Skip to content

Instantly share code, notes, and snippets.

@WuStangDan
Created October 6, 2017 20:40
Show Gist options
  • Save WuStangDan/3dc404ebabf5b7ef4721baa475ebd49c to your computer and use it in GitHub Desktop.
Save WuStangDan/3dc404ebabf5b7ef4721baa475ebd49c to your computer and use it in GitHub Desktop.
import tensorflow as tf
from object_detection.utils import dataset_util
flags = tf.app.flags
flags.DEFINE_string('output_path', '', 'Path to output TFRecord')
FLAGS = flags.FLAGS
def create_tf_example(data_and_label_info):
...
...
return tf_data_and_label
def main(_):
writer = tf.python_io.TFRecordWriter(FLAGS.output_path)
# TODO START: Write code to read in your dataset to examples variable
file_loc = None
all_data_and_label_info = LOAD(file_loc)
# TODO END
for data_and_label_info in all_data_and_label_info:
tf_example = create_tf_example(data_and_label_info)
writer.write(tf_example.SerializeToString())
writer.close()
if __name__ == '__main__':
tf.app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment