I just stumbled over this question: TensorFlow - Read all examples from a TFRecords at once?
And the first answer suggest using tf.parse_example instead of parsing single examples because that seems to be faster. But the code provided is not complete and I don't know how I can use that. If I batch and then use parse_example I will get a batch of features. That means I need to unpack that batch in order to decode the jpegs? The code from the answer is:
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue)
features = tf.parse_single_example(serialized_example, features={
image/center': tf.VarLenFeature(tf.string),
})
image = features['image/center']
image_decoded = tf.image.decode_jpeg(image.values[0], channels=3)
return image_decoded
And suggest switching to:
batch = tf.train.batch([serialized_example], num_examples, capacity=num_examples)
parsed_examples = tf.parse_example(batch, feature_spec)
But how can I now decode those parsed_examples?