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] Support ConvNeXt #1216

Merged
merged 36 commits into from
Mar 4, 2022
Merged

Conversation

MengzhangLI
Copy link
Contributor

@MengzhangLI MengzhangLI commented Jan 18, 2022

Motivation

Support ConvNext.
Paper: https://arxiv.org/abs/2201.03545
Github: https://github.com/facebookresearch/ConvNeXt

Modification

Need some refactor. WIP.

  • Refactor backbone code.
  • Refactor mmcv_custome code and align inference metric.
  • Add unit test
  • Align training metric.

@MengzhangLI MengzhangLI added the WIP Work in process label Jan 18, 2022
@MengzhangLI MengzhangLI self-assigned this Jan 18, 2022
@MengzhangLI
Copy link
Contributor Author

In our refactor code, (NCHW -> permute to NHWC -> PyTorch LN -> linear layers -> layer scale -> permute back to NCHW) takes over (NCHW -> custom LN -> 1x1 convs -> layer scale), the former style may be faster.

Reference: facebookresearch/ConvNeXt#18.

Copy link
Collaborator

@xvjiarui xvjiarui left a comment

Choose a reason for hiding this comment

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

Please refer to ResNet for some details

mmseg/models/backbones/convnext.py Outdated Show resolved Hide resolved
mmseg/models/backbones/convnext.py Outdated Show resolved Hide resolved
mmseg/models/backbones/convnext.py Outdated Show resolved Hide resolved
mmseg/models/backbones/convnext.py Outdated Show resolved Hide resolved
mmseg/models/backbones/convnext.py Outdated Show resolved Hide resolved
mmseg/models/backbones/convnext.py Outdated Show resolved Hide resolved
mmseg/models/backbones/convnext.py Outdated Show resolved Hide resolved
mmseg/models/backbones/convnext.py Outdated Show resolved Hide resolved
mmseg/models/backbones/convnext.py Outdated Show resolved Hide resolved
mmseg/models/backbones/convnext.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jan 21, 2022

Codecov Report

Merging #1216 (b77b971) into master (2d66179) will increase coverage by 0.04%.
The diff coverage is 94.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1216      +/-   ##
==========================================
+ Coverage   90.27%   90.32%   +0.04%     
==========================================
  Files         131      132       +1     
  Lines        7621     7699      +78     
  Branches     1267     1290      +23     
==========================================
+ Hits         6880     6954      +74     
  Misses        531      531              
- Partials      210      214       +4     
Flag Coverage Δ
unittests 90.32% <94.93%> (+0.04%) ⬆️

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

Impacted Files Coverage Δ
...eg/core/utils/layer_decay_optimizer_constructor.py 94.80% <94.80%> (ø)
mmseg/core/utils/__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 369a2ee...b77b971. Read the comment docs.

@mzr1996
Copy link
Member

mzr1996 commented Jan 27, 2022

Please look at open-mmlab/mmpretrain#670

Copy link
Collaborator

@MeowZheng MeowZheng left a comment

Choose a reason for hiding this comment

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

might add metafile and readme

README_zh-CN.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@MeowZheng MeowZheng merged commit 7ddd2fe into open-mmlab:master Mar 4, 2022
@MengzhangLI MengzhangLI removed the WIP Work in process label Mar 4, 2022
@MengzhangLI MengzhangLI changed the title [Feature] Support ConvNext [Feature] Support ConvNeXt Mar 4, 2022
@MengzhangLI MengzhangLI deleted the ConvNext branch March 17, 2022 09:24
ZhimingNJ pushed a commit to AetrexTechnology/mmsegmentation that referenced this pull request Jun 29, 2022
* upload original backbone and configs

* ConvNext Refactor

* ConvNext Refactor

* convnext customization refactor with mmseg style

* convnext customization refactor with mmseg style

* add ade20k_640x640.py

* upload files for training

* delete dist_optimizer_hook and remove layer_decay_optimizer_constructor

* check max(out_indices) < num_stages

* add unittest

* fix lint error

* use MMClassification backbone

* fix bugs in base_1k

* add mmcls in requirements/mminstall.txt

* add mmcls in requirements/mminstall.txt

* fix drop_path_rate and layer_scale_init_value

* use logger.info instead of print

* add mmcls in runtime.txt

* fix f string && delete

* add doctring in LearningRateDecayOptimizerConstructor and fix mmcls version in requirements

* fix typo in LearningRateDecayOptimizerConstructor

* use ConvNext models in unit test for LearningRateDecayOptimizerConstructor

* add unit test

* fix typo

* fix typo

* add layer_wise and fix redundant backbone.downsample_norm in it

* fix unit test

* give a ground truth lr_scale and weight_decay

* upload models and readme

* delete 'backbone.stem_norm' and 'backbone.downsample_norm' in get_num_layer()

* fix unit test and use mmcls url

* update md2yml.py and metafile

* fix typo
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
* make sure fp16 runs well

* add fp16 test for superes

* Update src/diffusers/models/unet_2d.py

Co-authored-by: Pedro Cuenca <[email protected]>

* gen on cuda

* always run fast inferecne test on cpu

* run on cpu

Co-authored-by: Pedro Cuenca <[email protected]>
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.

4 participants