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

Refactor heads to support multiple heads #382

Merged
merged 19 commits into from
Jan 13, 2021
Merged

Refactor heads to support multiple heads #382

merged 19 commits into from
Jan 13, 2021

Conversation

jin-s13
Copy link
Collaborator

@jin-s13 jin-s13 commented Dec 26, 2020

fix #219

Migration note :

Config files need to be changed.

  1. rename loss_pose to loss_keypoint.

  2. move loss_keypoint from model settings to keypoint_head settings.

For example, in configs/top_down/hrnet/coco/hrnet_w32_coco_256x192.py.

from

keypoint_head=dict(
        type='TopDownSimpleHead',
        in_channels=32,
        out_channels=channel_cfg['num_output_channels'],
        num_deconv_layers=0,
        extra=dict(final_conv_kernel=1, ),
    ),
    train_cfg=dict(),
    test_cfg=dict(
        flip_test=True,
        post_process='default',
        shift_heatmap=True,
        modulate_kernel=11),
    loss_pose=dict(type='JointsMSELoss', use_target_weight=True))

to

keypoint_head=dict(
        type='TopDownSimpleHead',
        in_channels=32,
        out_channels=channel_cfg['num_output_channels'],
        num_deconv_layers=0,
        extra=dict(final_conv_kernel=1, ),
        loss_keypoint=dict(type='JointsMSELoss', use_target_weight=True)),
    train_cfg=dict(),
    test_cfg=dict(
        flip_test=True,
        post_process='default',
        shift_heatmap=True,
        modulate_kernel=11))

@jin-s13 jin-s13 added the status/WIP work in progress label Dec 26, 2020
@codecov
Copy link

codecov bot commented Dec 26, 2020

Codecov Report

Merging #382 (c45a387) into master (9f077d8) will decrease coverage by 0.48%.
The diff coverage is 77.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #382      +/-   ##
==========================================
- Coverage   82.44%   81.96%   -0.49%     
==========================================
  Files         121      124       +3     
  Lines        8028     8235     +207     
  Branches     1298     1330      +32     
==========================================
+ Hits         6619     6750     +131     
- Misses       1145     1203      +58     
- Partials      264      282      +18     
Flag Coverage Δ
unittests 81.96% <77.65%> (-0.49%) ⬇️

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

Impacted Files Coverage Δ
...datasets/datasets/top_down/topdown_mpii_dataset.py 40.16% <0.00%> (-0.67%) ⬇️
...sets/datasets/top_down/topdown_mpii_trb_dataset.py 46.87% <0.00%> (-1.52%) ⬇️
...s/datasets/top_down/topdown_posetrack18_dataset.py 32.87% <0.00%> (-2.34%) ⬇️
...keypoint_heads/bottom_up_higher_resolution_head.py 83.76% <13.63%> (-16.24%) ⬇️
...pose/datasets/datasets/hand/interhand2d_dataset.py 77.08% <28.57%> (-4.94%) ⬇️
...ose/models/keypoint_heads/bottom_up_simple_head.py 72.91% <59.09%> (-4.12%) ⬇️
mmpose/apis/inference.py 65.26% <60.00%> (ø)
mmpose/models/detectors/top_down.py 65.28% <63.63%> (-14.16%) ⬇️
mmpose/datasets/datasets/hand/hand_base_dataset.py 93.63% <71.42%> (-1.51%) ⬇️
mmpose/models/detectors/bottom_up.py 62.40% <76.19%> (-1.57%) ⬇️
... and 22 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f077d8...c45a387. Read the comment docs.

@jin-s13 jin-s13 removed the status/WIP work in progress label Jan 5, 2021
@jin-s13 jin-s13 requested review from innerlee and removed request for Canwang-sjtu January 5, 2021 08:25
@jin-s13 jin-s13 changed the title support multiple heads Refactor heads to support multiple heads Jan 6, 2021
@jin-s13 jin-s13 mentioned this pull request Jan 6, 2021
9 tasks
@innerlee
Copy link
Contributor

Give a clear migration note on the first post. e.g., #288

"""

def __init__(self,
backbone,
keypoint_head=None,
train_cfg=None,
test_cfg=None,
pretrained=None,
loss_pose=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

For better migration experience, we can keep loss_pose here, and raise an error if it is not None, and give the link to this pr in the error message.

@innerlee
Copy link
Contributor

Two comments.

@innerlee innerlee merged commit 1a7c238 into master Jan 13, 2021
@innerlee innerlee deleted the multihead branch January 13, 2021 12:28
rollingman1 pushed a commit to rollingman1/mmpose that referenced this pull request Nov 5, 2021
@imsotable imsotable mentioned this pull request Jan 13, 2022
shuheilocale pushed a commit to shuheilocale/mmpose that referenced this pull request May 6, 2023
* support multiple heads

* name to loss_keypoint

* update config

* move loss_weight to losses

* fix typo

* fix comments

* check

* mv preds to heads

* check

* update init

* multibatch for hands

* support multibatch hand

* rm unnecessary use_bbox_id

* update bottomup inference

* rm bbox_ids=None

* if bbox_id not in img_metas then return None

* keep loss_pose in detectors, and add some warnings.

* keep loss_pose in detectors, and add some warnings.

* keep loss_pose in detectors, and add some warnings.
HAOCHENYE pushed a commit to HAOCHENYE/mmpose that referenced this pull request Jun 27, 2023
ajgrafton pushed a commit to ajgrafton/mmpose that referenced this pull request Mar 6, 2024
* support multiple heads

* name to loss_keypoint

* update config

* move loss_weight to losses

* fix typo

* fix comments

* check

* mv preds to heads

* check

* update init

* multibatch for hands

* support multibatch hand

* rm unnecessary use_bbox_id

* update bottomup inference

* rm bbox_ids=None

* if bbox_id not in img_metas then return None

* keep loss_pose in detectors, and add some warnings.

* keep loss_pose in detectors, and add some warnings.

* keep loss_pose in detectors, and add some warnings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

multi-head design
3 participants