From 183bfc4d8c64a8e007c7c3491c7d54a0f6a23bf7 Mon Sep 17 00:00:00 2001 From: lupeng Date: Tue, 4 Apr 2023 09:58:02 +0800 Subject: [PATCH] fix CocoMetric and update yolo-pose results --- mmpose/evaluation/metrics/coco_metric.py | 12 +++++++++--- projects/yolox-pose/README.md | 8 ++++---- .../configs/yolox-pose_s_8xb32-300e_coco.py | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/mmpose/evaluation/metrics/coco_metric.py b/mmpose/evaluation/metrics/coco_metric.py index 9b8bb706f2..dd059bf8fb 100644 --- a/mmpose/evaluation/metrics/coco_metric.py +++ b/mmpose/evaluation/metrics/coco_metric.py @@ -178,13 +178,19 @@ def process(self, data_batch: Sequence[dict], pred['keypoint_scores'] = keypoint_scores pred['category_id'] = data_sample.get('category_id', 1) - if ('bbox_scores' not in data_sample['gt_instances'] - or len(data_sample['gt_instances']['bbox_scores']) != - len(keypoints)): + if 'bbox_scores' in data_sample['pred_instances']: + # some one-stage models will predict bboxes and scores + # together with keypoints + bbox_scores = data_sample['pred_instances']['bbox_scores'] + elif ('bbox_scores' not in data_sample['gt_instances'] + or len(data_sample['gt_instances']['bbox_scores']) != + len(keypoints)): # bottom-up models might output different number of # instances from annotation bbox_scores = np.ones(len(keypoints)) else: + # top-down models use detected bboxes, the scores of which + # are contained in the gt_instances bbox_scores = data_sample['gt_instances']['bbox_scores'] pred['bbox_scores'] = bbox_scores diff --git a/projects/yolox-pose/README.md b/projects/yolox-pose/README.md index 828ea8af91..6b632c00ff 100644 --- a/projects/yolox-pose/README.md +++ b/projects/yolox-pose/README.md @@ -91,10 +91,10 @@ Results on COCO val2017 | Model | Input Size | AP | AP50 | AP75 | AR | AR50 | Download | | :-------------------------------------------------------------: | :--------: | :---: | :-------------: | :-------------: | :---: | :-------------: | :----------------------------------------------------------------------: | -| [YOLOX-tiny-Pose](./configs/yolox-pose_tiny_4xb64-300e_coco.py) | 640 | 0.477 | 0.756 | 0.506 | 0.547 | 0.802 | [model](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_tiny_4xb64-300e_coco-c47dd83b_20230321.pth) \| [log](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_tiny_4xb64-300e_coco_20230321.json) | -| [YOLOX-s-Pose](./configs/yolox-pose_s_8xb32-300e_coco.py) | 640 | 0.595 | 0.836 | 0.653 | 0.658 | 0.878 | [model](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_s_8xb32-300e_coco-9f5e3924_20230321.pth) \| [log](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_s_8xb32-300e_coco_20230321.json) | -| [YOLOX-m-Pose](./configs/yolox-pose_m_4xb64-300e_coco.py) | 640 | 0.659 | 0.870 | 0.729 | 0.713 | 0.903 | [model](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_m_4xb64-300e_coco-cbd11d30_20230321.pth) \| [log](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_m_4xb64-300e_coco_20230321.json) | -| [YOLOX-l-Pose](./configs/yolox-pose_l_4xb64-300e_coco.py) | 640 | 0.679 | 0.882 | 0.749 | 0.733 | 0.911 | [model](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_l_4xb64-300e_coco-122e4cf8_20230321.pth) \| [log](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_l_4xb64-300e_coco_20230321.json) | +| [YOLOX-tiny-Pose](./configs/yolox-pose_tiny_4xb64-300e_coco.py) | 640 | 0.518 | 0.799 | 0.545 | 0.566 | 0.841 | [model](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_tiny_4xb64-300e_coco-c47dd83b_20230321.pth) \| [log](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_tiny_4xb64-300e_coco_20230321.json) | +| [YOLOX-s-Pose](./configs/yolox-pose_s_8xb32-300e_coco.py) | 640 | 0.632 | 0.875 | 0.692 | 0.676 | 0.907 | [model](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_s_8xb32-300e_coco-9f5e3924_20230321.pth) \| [log](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_s_8xb32-300e_coco_20230321.json) | +| [YOLOX-m-Pose](./configs/yolox-pose_m_4xb64-300e_coco.py) | 640 | 0.685 | 0.897 | 0.753 | 0.727 | 0.925 | [model](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_m_4xb64-300e_coco-cbd11d30_20230321.pth) \| [log](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_m_4xb64-300e_coco_20230321.json) | +| [YOLOX-l-Pose](./configs/yolox-pose_l_4xb64-300e_coco.py) | 640 | 0.706 | 0.907 | 0.775 | 0.747 | 0.934 | [model](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_l_4xb64-300e_coco-122e4cf8_20230321.pth) \| [log](https://download.openmmlab.com/mmpose/v1/projects/yolox-pose/yolox-pose_l_4xb64-300e_coco_20230321.json) | We have only trained models with an input size of 640, as we couldn't replicate the performance enhancement mentioned in the paper when increasing the input size from 640 to 960. We warmly welcome any contributions if you can successfully reproduce the results from the paper! diff --git a/projects/yolox-pose/configs/yolox-pose_s_8xb32-300e_coco.py b/projects/yolox-pose/configs/yolox-pose_s_8xb32-300e_coco.py index d5ca77bc6c..f0cda72544 100644 --- a/projects/yolox-pose/configs/yolox-pose_s_8xb32-300e_coco.py +++ b/projects/yolox-pose/configs/yolox-pose_s_8xb32-300e_coco.py @@ -83,7 +83,7 @@ test_cfg=dict( yolox_style=True, multi_label=False, - score_thr=0.2, + score_thr=0.001, max_per_img=300, nms=dict(type='nms', iou_threshold=0.65))) @@ -189,7 +189,7 @@ val_evaluator = dict( type='mmpose.CocoMetric', ann_file=data_root + 'annotations/person_keypoints_val2017.json', -) + score_mode='bbox') test_evaluator = val_evaluator default_hooks = dict(checkpoint=dict(save_best='coco/AP', rule='greater'))