Unverified Commit e3bfb9b8 authored by pkulzc's avatar pkulzc Committed by GitHub
Browse files

Merge pull request #3744 from liangxiao05/master

Update create_pascal_tf_record.py
parents 2506c9a6 e658d645
...@@ -104,21 +104,23 @@ def dict_to_tf_example(data, ...@@ -104,21 +104,23 @@ def dict_to_tf_example(data,
truncated = [] truncated = []
poses = [] poses = []
difficult_obj = [] difficult_obj = []
for obj in data['object']:
difficult = bool(int(obj['difficult'])) if data.has_key('object'):
if ignore_difficult_instances and difficult: for obj in data['object']:
continue difficult = bool(int(obj['difficult']))
if ignore_difficult_instances and difficult:
difficult_obj.append(int(difficult)) continue
xmin.append(float(obj['bndbox']['xmin']) / width) difficult_obj.append(int(difficult))
ymin.append(float(obj['bndbox']['ymin']) / height)
xmax.append(float(obj['bndbox']['xmax']) / width) xmin.append(float(obj['bndbox']['xmin']) / width)
ymax.append(float(obj['bndbox']['ymax']) / height) ymin.append(float(obj['bndbox']['ymin']) / height)
classes_text.append(obj['name'].encode('utf8')) xmax.append(float(obj['bndbox']['xmax']) / width)
classes.append(label_map_dict[obj['name']]) ymax.append(float(obj['bndbox']['ymax']) / height)
truncated.append(int(obj['truncated'])) classes_text.append(obj['name'].encode('utf8'))
poses.append(obj['pose'].encode('utf8')) classes.append(label_map_dict[obj['name']])
truncated.append(int(obj['truncated']))
poses.append(obj['pose'].encode('utf8'))
example = tf.train.Example(features=tf.train.Features(feature={ example = tf.train.Example(features=tf.train.Features(feature={
'image/height': dataset_util.int64_feature(height), 'image/height': dataset_util.int64_feature(height),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment