mmpose icon indicating copy to clipboard operation
mmpose copied to clipboard

[Feature] Keypoint partition metric

Open zwfcrazy opened this issue 2 years ago • 1 comments

Motivation

Sometimes one may be interested in the performance of a pose model on certain body parts rather than on all the keypoints. For example, CocoWholeBodyMetric evaluates coco metric on body, foot, face, lefthand and righthand. However, CocoWholeBodyMetric is not flexible enough to be applied to arbitrary custom datasets. Therefore, we provide this wrapper metric.

Modification

A new wrapper metric class is added.

BC-breaking (Optional)

No.

Use cases (Optional)

In my dataset, there are 40 keypoints. Some belongs to the body (coco 17 points), some belongs to foot and hands, etc. In the config file, we can do the following

val_evaluator = dict(
        type='KeypointPartitionMetric',
        metric=dict(
            type='CocoMetric',
        ),
        partitions=dict(
            body=range(17),
            foot=range(17, 23),
            jaw_lip=range(23, 28),
            left_hand=range(28, 34),
            right_hand=range(34, 40),
            all=range(40)
        )
)
where the numbers of each partition are keypoint indices. Note, the indices can be discontinuous.

Checklist

Before PR:

  • [x] I have read and followed the workflow indicated in the CONTRIBUTING.md to create this PR.
  • [x] Pre-commit or linting tools indicated in CONTRIBUTING.md are used to fix the potential lint issues.
  • [ ] Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
  • [ ] New functionalities are covered by complete unit tests. If not, please add more unit tests to ensure correctness.
  • [ ] The documentation has been modified accordingly, including docstring or example tutorials.

After PR:

  • [ ] CLA has been signed and all committers have signed the CLA in this PR.

zwfcrazy avatar Jan 28 '23 09:01 zwfcrazy

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 28 '23 09:01 CLAassistant

Codecov Report

Base: 80.22% // Head: 80.08% // Decreases project coverage by -0.15% :warning:

Coverage data is based on head (de07678) compared to base (cec0a04). Patch coverage: 39.34% of modified lines in pull request are covered.

:exclamation: Current head de07678 differs from pull request most recent head 0984a41. Consider uploading reports for the commit 0984a41 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           dev-1.x    #1944      +/-   ##
===========================================
- Coverage    80.22%   80.08%   -0.15%     
===========================================
  Files          209      210       +1     
  Lines        12417    12495      +78     
  Branches      2100     2110      +10     
===========================================
+ Hits          9962    10006      +44     
- Misses        2004     2040      +36     
+ Partials       451      449       -2     
Flag Coverage Δ
unittests 80.08% <39.34%> (-0.15%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...se/evaluation/metrics/keypoint_partition_metric.py 30.18% <30.18%> (ø)
mmpose/datasets/__init__.py 100.00% <100.00%> (ø)
mmpose/datasets/dataset_wrappers.py 93.61% <100.00%> (+8.16%) :arrow_up:
mmpose/evaluation/metrics/__init__.py 100.00% <100.00%> (ø)
mmpose/datasets/transforms/common_transforms.py 85.50% <0.00%> (-0.42%) :arrow_down:
mmpose/apis/webcam/nodes/base_visualizer_node.py 100.00% <0.00%> (ø)
mmpose/apis/webcam/utils/buffer.py 91.66% <0.00%> (+0.14%) :arrow_up:
.../datasets/datasets/base/base_coco_style_dataset.py 88.67% <0.00%> (+0.14%) :arrow_up:
mmpose/apis/webcam/utils/misc.py 75.97% <0.00%> (+0.15%) :arrow_up:
mmpose/datasets/transforms/topdown_transforms.py 91.30% <0.00%> (+0.19%) :arrow_up:
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Feb 06 '23 14:02 codecov[bot]