Skip to content

Commit

Permalink
Merge pull request #1 from liangxiao05/liangxiao05-patch-1
Browse files Browse the repository at this point in the history
Update create_pascal_tf_record.py
  • Loading branch information
liangxiao05 authored Mar 26, 2018
2 parents aeb8cfc + 1cf0a85 commit e658d64
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions research/object_detection/dataset_tools/create_pascal_tf_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,23 @@ def dict_to_tf_example(data,
truncated = []
poses = []
difficult_obj = []
for obj in data['object']:
difficult = bool(int(obj['difficult']))
if ignore_difficult_instances and difficult:
continue

difficult_obj.append(int(difficult))

xmin.append(float(obj['bndbox']['xmin']) / width)
ymin.append(float(obj['bndbox']['ymin']) / height)
xmax.append(float(obj['bndbox']['xmax']) / width)
ymax.append(float(obj['bndbox']['ymax']) / height)
classes_text.append(obj['name'].encode('utf8'))
classes.append(label_map_dict[obj['name']])
truncated.append(int(obj['truncated']))
poses.append(obj['pose'].encode('utf8'))

if data.has_key('object'):
for obj in data['object']:
difficult = bool(int(obj['difficult']))
if ignore_difficult_instances and difficult:
continue

difficult_obj.append(int(difficult))

xmin.append(float(obj['bndbox']['xmin']) / width)
ymin.append(float(obj['bndbox']['ymin']) / height)
xmax.append(float(obj['bndbox']['xmax']) / width)
ymax.append(float(obj['bndbox']['ymax']) / height)
classes_text.append(obj['name'].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={
'image/height': dataset_util.int64_feature(height),
Expand Down

0 comments on commit e658d64

Please sign in to comment.