python - Read TF Record file takes very long -
trying go through tensorflow tutorial here; build tf record file ~100 images, , when try following, kernel hangs; why happening? tf record file not large 30mb+ or so, shouldn't take long read them in:
import tensorflow 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 read records recordreader = tf.tfrecordreader() # read full set of features single example key, fullexample = recordreader.read(filenameq) # parse full example 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'] tf.session() sess: print('start ...') print(sess.run(label)) # want check label here print('end ...')
it prints:
true start ...
my notebook kernel hangs 10 minutes , don't see there ending. can point out doing wrong?
you forget run queue runners 'tf.train.start_queue_runners(sess)'
Comments
Post a Comment