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

[Feature] Keypoint partition metric #1944

Merged
merged 5 commits into from
Feb 20, 2023

Conversation

zwfcrazy
Copy link
Contributor

@zwfcrazy zwfcrazy commented Jan 28, 2023

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.
Unit tests have been 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:

  • I have read and followed the workflow indicated in the CONTRIBUTING.md to create this PR.
  • 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.

@CLAassistant
Copy link

CLAassistant commented Jan 28, 2023

CLA assistant check
All committers have signed the CLA.

@Ben-Louis Ben-Louis changed the title Keypoint partition metric [Feature] Keypoint partition metric Jan 29, 2023
@codecov
Copy link

codecov bot commented Feb 6, 2023

Codecov Report

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

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

❗ 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%) ⬇️

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%) ⬆️
mmpose/evaluation/metrics/__init__.py 100.00% <100.00%> (ø)
mmpose/datasets/transforms/common_transforms.py 85.50% <0.00%> (-0.42%) ⬇️
mmpose/apis/webcam/nodes/base_visualizer_node.py 100.00% <0.00%> (ø)
mmpose/apis/webcam/utils/buffer.py 91.66% <0.00%> (+0.14%) ⬆️
.../datasets/datasets/base/base_coco_style_dataset.py 88.67% <0.00%> (+0.14%) ⬆️
mmpose/apis/webcam/utils/misc.py 75.97% <0.00%> (+0.15%) ⬆️
mmpose/datasets/transforms/topdown_transforms.py 91.30% <0.00%> (+0.19%) ⬆️
... 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.

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

@zwfcrazy zwfcrazy requested review from Tau-J and Ben-Louis and removed request for Tau-J and Ben-Louis February 11, 2023 08:38
@ly015 ly015 force-pushed the dev-1.x-zwf-partition-metric branch from 0984a41 to 6f43219 Compare February 13, 2023 05:51
@ly015 ly015 merged commit a2b2a31 into open-mmlab:dev-1.x Feb 20, 2023
ly015 pushed a commit to ly015/mmpose that referenced this pull request Feb 21, 2023
shuheilocale pushed a commit to shuheilocale/mmpose that referenced this pull request May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants