@@ -1321,44 +1321,32 @@ def _get_results(self, bindings):
13211321 # mh, mw, _ = self.get_input_shape()
13221322 # detections = []
13231323 # for det in infer_results:
1324- # print(det)
13251324 # if det.score < self.score_threshold: break
13261325 # xmin, ymin, xmax, ymax = map_box_to_orig([det.x_min * mw, det.y_min * mh, det.x_max * mw, det.y_max * mh], (oh, ow), (mh, mw))
13271326 # detection = {'label': self.labels[det.class_id] if self.labels else str(det.class_id), 'score': float(det.score), 'box': [xmin, ymin, xmax - xmin, ymax - ymin], 'class_id': det.class_id}
13281327 # if self.task == 'segment':
13291328 # mask = resize_mask_to_unpadded_box(det.mask, [xmin, ymin, xmax, ymax], [det.x_min * mw, det.y_min * mh, det.x_max * mw, det.y_max * mh])
13301329 # if mask is not None: detection['mask'] = mask
13311330 # detections.append(detection)
1332- # print(detections)
13331331 # return detections
13341332
13351333 def _process_nms_results (self , result , image ):
13361334 infer_results = result if isinstance (result , list ) else [result ]
13371335 img_height , img_width = image .shape [:2 ]
13381336 size = max (img_height , img_width )
13391337 padding_length = int (abs (img_height - img_width ) / 2 )
1340-
13411338 detections = []
13421339 for det in infer_results :
1343- if det .score < self .score_threshold :
1344- break
1345-
1340+ if det .score < self .score_threshold : break
13461341 box_on_input_image , box_on_padded_image = convert_box_from_normalized (
13471342 [det .x_min , det .y_min , det .x_max , det .y_max ], size , padding_length , img_height , img_width )
1348-
13491343 xmin , ymin , xmax , ymax = box_on_input_image
1350- detection = {
1351- 'label' : self .labels [det .class_id ] if self .labels else str (det .class_id ),
1352- 'score' : float (det .score ),
1353- 'box' : [xmin , ymin , xmax - xmin , ymax - ymin ],
1354- 'class_id' : det .class_id
1355- }
1356-
1344+ detection = {'label' : self .labels [det .class_id ] if self .labels else str (det .class_id ),
1345+ 'score' : float (det .score ), 'box' : [xmin , ymin , xmax - xmin , ymax - ymin ], 'class_id' : det .class_id }
13571346 if self .task == 'segment' :
13581347 mask = resize_mask_to_unpadded_box (det .mask , box_on_input_image , box_on_padded_image )
13591348 if mask is not None :
13601349 detection ['mask' ] = mask
1361-
13621350 detections .append (detection )
13631351 return detections
13641352
0 commit comments