Skip to content

[Feature] Support HRFormer (NeurIPS'2021) - #1112

Open
LayneH wants to merge 35 commits into
open-mmlab:masterfrom
LayneH:hrformer
Open

LayneH wants to merge 35 commits into
open-mmlab:masterfrom
LayneH:hrformer

Conversation

@LayneH

@LayneH LayneH commented Dec 7, 2021 •

Copy link
Copy Markdown
Contributor

Motivation

Support the HRFormer backbone published at NeurIPS'2021.
ref: open-mmlab/mmpose#1203

Modification

mmseg/models/backbones/hrformer.py: Add the implementation of HRFormer.
configs/hrformer/*: Add configs for HRFormer

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMDet3D.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@MengzhangLI

Copy link
Copy Markdown
Contributor

Hi, @LayneH
Thanks for your nice PR!
We would review it ASAP.

@Junjun2016

Copy link
Copy Markdown
Collaborator

Hi @LayneH
Please fix the lint error.

@MengzhangLI

MengzhangLI commented Dec 7, 2021 •

Copy link
Copy Markdown
Contributor

Hi, @LayneH . Could you grant authorization on me about your forked MMSegmentation followed here? Thus I could push my modifications on your branch.

image

Right now there are too many errors / bugs detected by our CI in Github. I could use my local pre-commit command to swipe them.

Best,

Comment thread mmseg/models/backbones/hrformer.py Resolved
@codecov

codecov Bot commented Dec 7, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #1112 (4a2c83e) into master (520ec8e) will decrease coverage by 0.07%.
The diff coverage is 88.71%.

❗ Current head 4a2c83e differs from pull request most recent head 1e6334f. Consider uploading reports for the commit 1e6334f to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1112      +/-   ##
==========================================
- Coverage   90.11%   90.04%   -0.08%     
==========================================
  Files         125      126       +1     
  Lines        7262     7652     +390     
  Branches     1206     1268      +62     
==========================================
+ Hits         6544     6890     +346     
- Misses        515      547      +32     
- Partials      203      215      +12     
Flag Coverage Δ
unittests 90.04% <88.71%> (-0.08%) ⬇️

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

Impacted Files Coverage Δ
mmseg/models/backbones/hrformer.py 88.68% <88.68%> (ø)
mmseg/models/backbones/__init__.py 100.00% <100.00%> (ø)

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 520ec8e...1e6334f. Read the comment docs.

@MengzhangLI MengzhangLI added the WIP Work in process label Dec 8, 2021
Comment thread mmseg/models/backbones/hrformer.py Resolved
Comment thread mmseg/models/backbones/hrformer.py Resolved
Comment thread mmseg/models/backbones/hrformer.py Resolved
Comment thread mmseg/models/backbones/hrformer.py Resolved
Comment thread mmseg/models/backbones/hrformer.py Resolved
Comment thread mmseg/models/backbones/hrformer.py Resolved
Comment thread mmseg/models/backbones/hrformer.py Resolved
Comment thread mmseg/models/backbones/hrformer.py Resolved

@zengwang430521 zengwang430521 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How about setting HRFormer as a subclass of HRNet and reusing some functions?

)
layers = []

if isinstance(block, HRFormerBlock):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think there may be a bug in this line. Actually, block is not an instance of HRFormerBlock or Bottleneck, so this line will always return False. Maybe we should use block == HRFormerBlock.


inplanes = planes * block.expansion
for i in range(1, blocks):
layers.append(block(inplanes, planes))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Will this line cause an error whenblock is HRFormerBlock ?

Comment thread mmseg/models/backbones/hrformer.py Resolved
Comment thread mmseg/models/backbones/hrformer.py Resolved
Comment thread mmseg/models/backbones/hrformer.py Resolved
Comment thread mmseg/models/backbones/hrformer.py Resolved
@MengzhangLI MengzhangLI removed the WIP Work in process label Mar 29, 2022
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