Created
September 12, 2018 21:16
-
-
Save evanlouie/214dc436a76e79213c130788a3f573ef to your computer and use it in GitHub Desktop.
Print a target TFRecord file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import tensorflow as tf | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--example", help="target TFRecord Example file") | |
parser.add_argument("--sequence_example", | |
help="target TFRecord SequenceExample file") | |
args = parser.parse_args() | |
if args.sequence_example: | |
for record in tf.python_io.tf_record_iterator(args.sequence_example): | |
result = tf.train.SequenceExample.FromString(record) | |
print(result) | |
elif args.example: | |
for record in tf.python_io.tf_record_iterator(args.example): | |
result = tf.train.Example.FromString(record) | |
print(result) | |
else: | |
print('No valid options provided') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment