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] Visualize openpose skeleton style on the image #2115

Merged
merged 4 commits into from Mar 26, 2023
Merged

[Feature] Visualize openpose skeleton style on the image #2115

merged 4 commits into from Mar 26, 2023

Conversation

Zheng-LinXiao
Copy link
Contributor

Motivation

Modification

BC-breaking (Optional)

Use cases (Optional)

add --skeleton-style to image_demo.py and topdown_demo_with_mmdet.py
For Example:

python demo/topdown_demo_with_mmdet.py \
    ${MMDET_CONFIG_FILE} ${MMDET_CHECKPOINT_FILE} \
    ${MMPOSE_CONFIG_FILE} ${MMPOSE_CHECKPOINT_FILE} \
    --input ${INPUT_PATH} \
    --skeleton-style openpose \
    --show

The result is as follow:
5

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.

@Zheng-LinXiao
Copy link
Contributor Author

Use 'mim install "mmpose>=1.0.0rc1"' to install mmpose, and an error will be reported when running the code. But using "pip install -v -e ." to install mmpose, running the code doesn't throw any error.

@codecov
Copy link

codecov bot commented Mar 23, 2023

Codecov Report

Patch coverage: 51.66% and project coverage change: -0.12 ⚠️

Comparison is base (c3e3cb1) 82.42% compared to head (283ca48) 82.30%.

❗ Current head 283ca48 differs from pull request most recent head e60b836. Consider uploading reports for the commit e60b836 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           dev-1.x    #2115      +/-   ##
===========================================
- Coverage    82.42%   82.30%   -0.12%     
===========================================
  Files          227      227              
  Lines        13324    13340      +16     
  Branches      2257     2261       +4     
===========================================
- Hits         10982    10980       -2     
- Misses        1834     1845      +11     
- Partials       508      515       +7     
Flag Coverage Δ
unittests 82.30% <51.66%> (-0.12%) ⬇️

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

Impacted Files Coverage Δ
mmpose/apis/inferencers/base_mmpose_inferencer.py 72.56% <ø> (ø)
mmpose/visualization/local_visualizer.py 62.81% <50.84%> (-8.23%) ⬇️
mmpose/engine/hooks/visualization_hook.py 89.65% <100.00%> (ø)

... and 1 file with indirect coverage changes

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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Ben-Louis
Copy link
Collaborator

Use 'mim install "mmpose>=1.0.0rc1"' to install mmpose, and an error will be reported when running the code. But using "pip install -v -e ." to install mmpose, running the code doesn't throw any error.

Thank you for your contribution! There's no need to fret about this issue. The recently introduced features won't be incorporated into mmpose when installed via pip or mim until a new release is available. However, these features are indeed present in the source code, so they will be accessible if mmpose is installed directly from the source.

@Zheng-LinXiao
Copy link
Contributor Author

Use 'mim install "mmpose>=1.0.0rc1"' to install mmpose, and an error will be reported when running the code. But using "pip install -v -e ." to install mmpose, running the code doesn't throw any error.

Thank you for your contribution! There's no need to fret about this issue. The recently introduced features won't be incorporated into mmpose when installed via pip or mim until a new release is available. However, these features are indeed present in the source code, so they will be accessible if mmpose is installed directly from the source.

OK,thank you

@@ -243,6 +248,20 @@ def _draw_instances_kpts(self,
else:
keypoints_visible = [np.ones(len(kpts)) for kpts in keypoints]

if skeleton_style == 'openpose':
neck = (keypoints[:, 5] + keypoints[:, 6]) / 2
neck_score = (scores[:, 5] + scores[:, 6]) / 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the confidence score for the neck, I think it should be considered based on different situations:

  1. When both left_shoulder and right_shoulder are present (score >= args.kpt_thr), the average score of the two can be used as the score for the neck.
  2. When one shoulder is missing, the score for the neck should be 0

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, can you also fix this in projects/mmpose4aigc/openpose_visualization.py this line?

new_cols = [1, 2, 3, 4, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17]
keypoints[:, new_cols] = keypoints[:, original_cols]
scores[:, new_cols] = scores[:, original_cols]
keypoints_visible = [np.ones(len(kpts)) for kpts in keypoints]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When visualizing images from GT in openpose-style, keypoints_visible should not be np.ones() for all keypoints

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does keypoints_visible to the joint_weights in coco_openpose.py?Here I refer to https://github.com/open-mmlab/mmpose/pull/2115/files/9630c10a895bec012cd44b2a882f8c1c143d9318#diff-070475f91f5ca244130def9db60fe354566df801e1a23aa33d3b2060c9c8515cL244,I don't understand keypoints_visible

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just refer to L246-L249:

if 'keypoints_visible' in instances:
    keypoints_visible = instances.keypoints_visible
else:
    keypoints_visible = [np.ones(len(kpts)) for kpts in keypoints]

joint_weights is used in loss calculation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When visualizing images from GT in openpose-style, keypoints_visible should not be np.ones() for all keypoints

Thank you very much for your explanation, I understand now!

Comment on lines 76 to 79
if dataset_meta.get(
'dataset_name') == 'coco' and args.skeleton_style == 'openpose':
dataset_meta = parse_pose_metainfo(
dict(from_file='configs/_base_/datasets/coco_openpose.py'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this piece of code into the visualizer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,Let me try

@Tau-J Tau-J merged commit b1876b8 into open-mmlab:dev-1.x Mar 26, 2023
6 of 7 checks passed
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.

None yet

3 participants