khaclinh commited on
Commit
07cb239
·
1 Parent(s): ce0f2ab

Update testdata.py

Browse files
Files changed (1) hide show
  1. testdata.py +18 -18
testdata.py CHANGED
@@ -133,23 +133,23 @@ class TestData(datasets.GeneratorBasedBuilder):
133
 
134
  #annotation = parse_annotation(gt_pah)
135
 
136
- annotation = defaultdict(list)
137
- with open(gt_pah, 'r') as f:
138
- line = f.readline().strip()
139
- while line:
140
- assert re.match(r'^\d( [\d\.]+){4,5}$', line), 'Incorrect line: %s' % line
141
- cls, cx, cy, w, h = line.split()[:5]
142
- cls, cx, cy, w, h = int(cls), float(cx), float(cy), float(w), float(h)
143
- x1, y1, x2, y2 = cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2
144
- annotation[cls].append([x1, y1, x2, y2])
145
- line = f.readline().strip()
146
- datasets.logging.INFO(annotation)
147
- abcd =acd
148
- for cls, bboxes in annotation.items():
149
- for x1, y1, x2, y2 in bboxes:
150
- if cls == 0:
151
- faces.append({"bbox": [x1, y1, x2, y2]})
152
- else:
153
- plates({"bbox": [x1, y1, x2, y2]})
154
 
155
  yield idx, {"image": image_path, "faces": faces, "plates": plates}
 
133
 
134
  #annotation = parse_annotation(gt_pah)
135
 
136
+ # annotation = defaultdict(list)
137
+ # with open(gt_pah, 'r') as f:
138
+ # line = f.readline().strip()
139
+ # while line:
140
+ # assert re.match(r'^\d( [\d\.]+){4,5}$', line), 'Incorrect line: %s' % line
141
+ # cls, cx, cy, w, h = line.split()[:5]
142
+ # cls, cx, cy, w, h = int(cls), float(cx), float(cy), float(w), float(h)
143
+ # x1, y1, x2, y2 = cx - w / 2, cy - h / 2, cx + w / 2, cy + h / 2
144
+ # annotation[cls].append([x1, y1, x2, y2])
145
+ # line = f.readline().strip()
146
+ # datasets.logging.INFO(annotation)
147
+ # abcd =acd
148
+ # for cls, bboxes in annotation.items():
149
+ # for x1, y1, x2, y2 in bboxes:
150
+ # if cls == 0:
151
+ # faces.append({"bbox": [x1, y1, x2, y2]})
152
+ # else:
153
+ # plates({"bbox": [x1, y1, x2, y2]})
154
 
155
  yield idx, {"image": image_path, "faces": faces, "plates": plates}