tf.train.batch - Get items from dequeue_many operation

Viewed 270

For my TensorFlow training pipeline I am using a tf.FIFOQueue containing image files to read and a tf.train.batch to obtain a batch of pre-processed images. This works fine.

For debugging purposes, I am now looking for a way to get the filenames that were fetched from the dequeue_many operation in tf.train.batch.

Below the corresponding piece of my code. So I am trying to get the str or tf.string objects from the filename_queue that are dequeued inside the batch operation. If there any solution besides rewriting a tf.train.batch like operation and perform the dequeue_many operation myself?

filename_queue = tf.FIFOQueue(100000, [tf.string], shapes=[[]])

# ...

reader = tf.WholeFileReader()
_, image_raw = reader.read(filename_queue)
image = tf.image.decode_jpeg(image_raw, channels=3)

# Image preprocessing
image_preproc = ...

# Read a batch of preprocessing images from queue
image_batch = tf.train.batch([image_preproc], batch_size, num_threads=1)

# How to get the filenames corresponding to the images in 'image_batch'?
1 Answers
Related