-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtf_convert_coco.py
More file actions
33 lines (26 loc) · 1.37 KB
/
tf_convert_coco.py
File metadata and controls
33 lines (26 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import tensorflow as tf
import coco_to_tfrecords
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string(
'dataset_name', 'mscoco',
'The name of the dataset to convert.')
tf.app.flags.DEFINE_string(
'dataset_dir', 'data/mscoco/',
'Directory where the original dataset is stored.')
tf.app.flags.DEFINE_string(
'output_name', 'coco_train',
'Basename used for TFRecords output files.')
tf.app.flags.DEFINE_string(
'output_dir', 'data/tfrecords',
'Output directory where to store TFRecords files.')
def main(_):
if not FLAGS.dataset_dir:
raise ValueError('You must supply the dataset directory with --dataset_dir')
print('Dataset directory:', FLAGS.dataset_dir)
print('Output directory:', FLAGS.output_dir)
if FLAGS.dataset_name == 'mscoco':
coco_to_tfrecords.run(FLAGS.dataset_dir, FLAGS.output_dir, FLAGS.output_name)
else:
raise ValueError('Dataset [%s] was not recognized.' % FLAGS.dataset_name)
if __name__ == '__main__':
tf.app.run()