Guest User

Untitled

a guest
Nov 20th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. import tensorflow as tf
  2. import numpy as np
  3. import glob
  4. from numpy import array
  5. fq=glob.glob("*.jpg")
  6. from PIL import Image
  7.  
  8. filename_queue = tf.train.string_input_producer(fq)
  9. reader = tf.WholeFileReader()
  10. key, value = reader.read(filename_queue)
  11. my_img = tf.image.decode_jpeg(value,channels=3)
  12. my_img=tf.cast(my_img,tf.float32)
  13. resized_image = tf.image.resize_images(my_img, [50, 50])
  14. labels = tf.placeholder(tf.int32, [None])
  15. images=tf.placeholder(tf.float32,[None,50,50,3])
  16. la=[0,0,0,0,0,0,1,1,1,1]
  17. onehot =tf.one_hot(la, depth=2)
  18. image_batch,label_batch=tf.train.batch([resized_image,onehot],enqueue_many=True,dynamic_pad=True,allow_smaller_final_batch=True,batch_size=2,num_threads=1)
Add Comment
Please, Sign In to add comment