From 4cee0dc80f4c72dcfae414e20f3fd8cb8694227b Mon Sep 17 00:00:00 2001 From: Shaun Date: Tue, 16 Apr 2024 13:39:05 +0800 Subject: [PATCH] [BugFix] Errors in save_coco_results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #8929 修改了bbox表达式 --- deploy/python/infer.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/deploy/python/infer.py b/deploy/python/infer.py index eb548176e5d..0c90dc8b275 100644 --- a/deploy/python/infer.py +++ b/deploy/python/infer.py @@ -494,20 +494,14 @@ def save_coco_results(self, if 'boxes' in results: boxes = results['boxes'][idx:idx + box_num].tolist() - if task_type == 'Rotate': - bbox = [ - box[2], box[3], box[4], box[5], box[6], box[7], box[8], - box[9] - ] # x1, y1, x2, y2, x3, y3, x4, y4 - else: # default is 'Detection' - bbox: [box[2], box[3], box[4] - box[2], - box[5] - box[3]] # xyxy -> xywh bbox_results.extend([{ 'image_id': img_id, - 'category_id': coco_clsid2catid[int(box[0])] \ - if use_coco_category else int(box[0]), + 'category_id': coco_clsid2catid[int(box[0])] if use_coco_category else int(box[0]), 'file_name': file_name, - 'bbox': bbox, + # default is 'Detection' : xyxy -> xywh + # 'Rotate': x1, y1, x2, y2, x3, y3, x4, y4 + 'bbox': [box[2], box[3], box[4] - box[2], box[5] - box[3]] if task_type == 'Rotate' else + [box[2], box[3], box[4], box[5], box[6], box[7], box[8], box[9], box[9]], 'score': box[1]} for box in boxes]) if 'masks' in results: