TFRecordWriter
透過 TFRecordWriter 產生 train.record / eval.record
產生的方式可以參考
def create_tf_example(ex):
height = ex['height']
width = ex['width']
filename = ex['filename']
image_format = ex['image_format']
xmins = ex['xmins']
xmaxs = ex['xmaxs']
ymins = ex['ymins']
ymaxs = ex['ymaxs']
classes_text = ex['classes_text']
classes = ex['classes']
print(classes_text)
print(classes)
tf_example = tf.train.Example(features=tf.train.Features(feature={
'image/height': dataset_util.int64_feature(height),
'image/width': dataset_util.int64_feature(width),
'image/filename': dataset_util.bytes_feature(filename),
'image/source_id': dataset_util.bytes_feature(filename),
'image/format': dataset_util.bytes_feature(image_format),
'image/object/bbox/xmin': dataset_util.float_list_feature(xmins),
'image/object/bbox/xmax': dataset_util.float_list_feature(xmaxs),
'image/object/bbox/ymin': dataset_util.float_list_feature(ymins),
'image/object/bbox/ymax': dataset_util.float_list_feature(ymaxs),
'image/object/class/text': dataset_util.bytes_list_feature(str(classes_text)),
'image/object/class/label': dataset_util.int64_list_feature(classes),
}))
return tf_example