MCPcopy
hub / github.com/amdegroot/ssd.pytorch / parse_rec

Function parse_rec

eval.py:104–121  ·  view source on GitHub ↗

Parse a PASCAL VOC xml file

(filename)

Source from the content-addressed store, hash-verified

102
103
104def parse_rec(filename):
105 """ Parse a PASCAL VOC xml file """
106 tree = ET.parse(filename)
107 objects = []
108 for obj in tree.findall('object'):
109 obj_struct = {}
110 obj_struct['name'] = obj.find('name').text
111 obj_struct['pose'] = obj.find('pose').text
112 obj_struct['truncated'] = int(obj.find('truncated').text)
113 obj_struct['difficult'] = int(obj.find('difficult').text)
114 bbox = obj.find('bndbox')
115 obj_struct['bbox'] = [int(bbox.find('xmin').text) - 1,
116 int(bbox.find('ymin').text) - 1,
117 int(bbox.find('xmax').text) - 1,
118 int(bbox.find('ymax').text) - 1]
119 objects.append(obj_struct)
120
121 return objects
122
123
124def get_output_dir(name, phase):

Callers 1

voc_evalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected