Skip to content

Instantly share code, notes, and snippets.

@tomrunia
Created August 16, 2017 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomrunia/700585a0d44dff4606f26b7b50856932 to your computer and use it in GitHub Desktop.
Save tomrunia/700585a0d44dff4606f26b7b50856932 to your computer and use it in GitHub Desktop.
filename_queue = tf.FIFOQueue(100000, [tf.string], shapes=[[]])
# ...
reader = tf.WholeFileReader()
image_filename, image_raw = reader.read(self._filename_queue)
image = tf.image.decode_jpeg(image_raw, channels=3)
# Image preprocessing
image_preproc = ...
# Read a batch of preprocessing images from queue
batch_images, batch_filenames = tf.train.batch(
[image_preproc, image_filename], batch_size, num_threads=num_threads,
allow_smaller_final_batch=True)
# ...
np_images, filenames = sess.run([batch_images, batch_filenames])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment