Skip to content

Instantly share code, notes, and snippets.

@rreece
Created April 11, 2019 17:42
Show Gist options
  • Save rreece/beb3be0605ef0d8a6ee8050b5cdb0179 to your computer and use it in GitHub Desktop.
Save rreece/beb3be0605ef0d8a6ee8050b5cdb0179 to your computer and use it in GitHub Desktop.
import tensorflow as tf
from google.protobuf.json_format import MessageToJson
filename = 'myfile.tfrecords'
for record_str in tf.python_io.tf_record_iterator(filename):
example = tf.train.Example.FromString(record_str)
json = MessageToJson(example)
print(json)
uin = input('Press Enter to contiue to next example [q to quit]: ').strip()
if uin.lower() == 'q':
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment