Skip to content

Commit f2ce08c

Browse files
author
Widget_An
committed
update
1 parent 70217ce commit f2ce08c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

object_detection/export_inference_graph.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@
103103
} \
104104
}"
105105
"""
106+
import sys
107+
import os
108+
sys.path.append(os.path.abspath(os.getcwd()))
106109
import tensorflow as tf
107110
from google.protobuf import text_format
108111
from object_detection import exporter

tf_datatools/create_pascal_tf_record.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ def dict_to_tf_example(data,
9999

100100
if 'object' in data:
101101
for obj in data['object']:
102-
xmin.append(float(obj['bndbox']['xmin']))
103-
ymin.append(float(obj['bndbox']['ymin']))
104-
xmax.append(float(obj['bndbox']['xmax']))
105-
ymax.append(float(obj['bndbox']['ymax']))
102+
width = float(obj['bndbox']['xmax']) - float(obj['bndbox']['xmin'])
103+
height = float(obj['bndbox']['ymax']) - float(obj['bndbox']['ymin'])
104+
xmin.append(float(obj['bndbox']['xmin']) / width)
105+
ymin.append(float(obj['bndbox']['ymin']) / height)
106+
xmax.append(float(obj['bndbox']['xmax']) / width)
107+
ymax.append(float(obj['bndbox']['ymax']) / height)
106108
classes_text.append(obj['name'].encode('utf8'))
107109
classes.append(label_map_dict[obj['name']])
108110

0 commit comments

Comments
 (0)