| 368 | |
| 369 | @staticmethod |
| 370 | def visualize_img_with_bbox(img_path, img, dt_instances: Instances, ref_pts=None, gt_boxes=None): |
| 371 | img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR) |
| 372 | if dt_instances.has('scores'): |
| 373 | img_show = draw_bboxes(img, np.concatenate([dt_instances.boxes, dt_instances.scores.reshape(-1, 1)], axis=-1), dt_instances.obj_idxes) |
| 374 | else: |
| 375 | img_show = draw_bboxes(img, dt_instances.boxes, dt_instances.obj_idxes) |
| 376 | # if ref_pts is not None: |
| 377 | # img_show = draw_points(img_show, ref_pts) |
| 378 | # if gt_boxes is not None: |
| 379 | # img_show = draw_bboxes(img_show, gt_boxes, identities=np.ones((len(gt_boxes), )) * -1) |
| 380 | cv2.imwrite(img_path, img_show) |
| 381 | |
| 382 | def detect(self, prob_threshold=0.2, area_threshold=100, vis=False): |
| 383 | total_dts = 0 |