I am creating a standard image classification model with Tensorflow. To do this, I have input images, each of which is assigned a label (a number in {0,1}). Therefore, the data can be saved in a list in the following format:
/path/to/image_0 label_0 /path/to/image_1 label_1 /path/to/image_2 label_2 ...
I want to use the TensorFlow queuing system to read my data and transfer it to my model. By ignoring tags, this can easily be achieved using string_input_producer and wholeFileReader . Here is the code:
def read_my_file_format(filename_queue): reader = tf.WholeFileReader() key, value = reader.read(filename_queue) example = tf.image.decode_png(value) return example #removing label, obtaining list containing /path/to/image_x image_list = [line[:-2] for line in image_label_list] input_queue = tf.train.string_input_producer(image_list) input_images = read_my_file_format(input_queue)
However, labels are lost in this process because image data is intentionally shuffled as part of the input pipeline. What is the easiest way to click tags along with image data through input queues?
python tensorflow
MarvMind Dec 17 '15 at 17:14 2015-12-17 17:14
source share