Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Errors in save_coco_results #8930

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions deploy/python/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down