Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tensorflow as tf
- import numpy as np
- import glob
- from numpy import array
- fq=glob.glob("*.jpg")
- from PIL import Image
- filename_queue = tf.train.string_input_producer(fq)
- reader = tf.WholeFileReader()
- key, value = reader.read(filename_queue)
- my_img = tf.image.decode_jpeg(value,channels=3)
- my_img=tf.cast(my_img,tf.float32)
- resized_image = tf.image.resize_images(my_img, [50, 50])
- labels = tf.placeholder(tf.int32, [None])
- images=tf.placeholder(tf.float32,[None,50,50,3])
- la=[0,0,0,0,0,0,1,1,1,1]
- onehot =tf.one_hot(la, depth=2)
- 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