-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathgene_tfrecords.py
More file actions
33 lines (27 loc) · 1014 Bytes
/
Copy pathgene_tfrecords.py
File metadata and controls
33 lines (27 loc) · 1014 Bytes
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
33
# -*- coding: utf-8 -*-
import tensorflow as tf
from datasets import xml_to_tfrecords
import os
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string(
'output_name', 'annotated_data',
'Basename used for TFRecords output files.')
tf.app.flags.DEFINE_string(
'output_dir', 'tfrecords',
'Output directory where to store TFRecords files.')
tf.app.flags.DEFINE_string(
'xml_img_txt_path', None,
'the path means the txt'
)
tf.app.flags.DEFINE_integer(
'samples_per_files', 2000,
'the number means one tf_record save how many pictures'
)
def main(_):
if not FLAGS.xml_img_txt_path or not os.path.exists(FLAGS.xml_img_txt_path):
raise ValueError('You must supply the dataset directory with --xml_img_txt_path')
print('Dataset directory:', FLAGS.xml_img_txt_path)
print('Output directory:', FLAGS.output_dir)
xml_to_tfrecords.run(FLAGS.xml_img_txt_path, FLAGS.output_dir, FLAGS.output_name, FLAGS.samples_per_files)
if __name__ == '__main__':
tf.app.run()