Trying to go through a tensorflow tutorial here; I build a tf record file with ~100 images, and now when I try the following, the kernel hangs; Why is this happening? The tf record file is not large only 30MB+ or so, it shouldn't take long to read them in:
import tensorflow as tf
import os
print(os.path.exists("../carmakesorter/train-00000-of-00001"))
filenameQ = tf.train.string_input_producer(["../carmakesorter/train-00000-of-00001"],num_epochs=None)
# object to read records
recordReader = tf.TFRecordReader()
# read the full set of features for a single example
key, fullExample = recordReader.read(filenameQ)
# parse the full example into its' component features.
features = tf.parse_single_example(
fullExample,
features={
'image/height': tf.FixedLenFeature([], tf.int64),
'image/width': tf.FixedLenFeature([], tf.int64),
'image/colorspace': tf.FixedLenFeature([], dtype=tf.string,default_value=''),
'image/channels': tf.FixedLenFeature([], tf.int64),
'image/class/label': tf.FixedLenFeature([],tf.int64),
'image/class/text': tf.FixedLenFeature([], dtype=tf.string,default_value=''),
'image/format': tf.FixedLenFeature([], dtype=tf.string,default_value=''),
'image/filename': tf.FixedLenFeature([], dtype=tf.string,default_value=''),
'image/encoded': tf.FixedLenFeature([], dtype=tf.string, default_value='')
})
label = features['image/class/label']
with tf.Session() as sess:
print('start ...')
print(sess.run(label)) # I want to check the label here
print('end ...')
It prints:
True
start ...
My notebook kernel hangs for 10 minutes already and I don't see there will be an ending. Can somebody point out what I am doing wrong?
You forget to run queue runners with 'tf.train.start_queue_runners(sess)'