Reading an Example from Tensorflow Records File
Python
This will read a single example from a collection of tensorflow record files and print out the format of the first record. This will show the key and value for each feature.
1| FILENAMES = tf.io.gfile.glob(r'data\train_tfrecords\ld_train*.tfrec') 2| 3| for tf_rec in FILENAMES: 4| raw_dataset = tf.data.TFRecordDataset(tf_rec) 5| for raw_record in raw_dataset.take(1): 6| example = tf.train.Example() 7| example.ParseFromString(raw_record.numpy()) 8| print(example) 9|
149
132
127
119