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] Add swin-transformer model. #271

Merged
merged 30 commits into from
Jul 1, 2021
Merged

Conversation

mzr1996
Copy link
Member

@mzr1996 mzr1996 commented May 26, 2021

Reproduce swin-transformer model and training recipes.

mmcls/models/backbones/swin_transformer.py Outdated Show resolved Hide resolved
mmcls/models/backbones/swin_transformer.py Show resolved Hide resolved
mmcls/models/backbones/swin_transformer.py Outdated Show resolved Hide resolved
mmcls/models/backbones/swin_transformer.py Outdated Show resolved Hide resolved
mmcls/models/backbones/swin_transformer.py Outdated Show resolved Hide resolved
mmcls/models/backbones/swin_transformer.py Outdated Show resolved Hide resolved
mmcls/models/backbones/swin_transformer.py Outdated Show resolved Hide resolved
mmcls/models/backbones/swin_transformer.py Outdated Show resolved Hide resolved
@mzr1996 mzr1996 force-pushed the swin branch 2 times, most recently from e832b7d to e1dd054 Compare June 2, 2021 11:15
@mzr1996 mzr1996 requested a review from ycxioooong June 15, 2021 06:33
@codecov
Copy link

codecov bot commented Jun 22, 2021

Codecov Report

Merging #271 (9bf61bd) into master (4ebee15) will increase coverage by 1.21%.
The diff coverage is 94.16%.

❗ Current head 9bf61bd differs from pull request most recent head 74a7566. Consider uploading reports for the commit 74a7566 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #271      +/-   ##
==========================================
+ Coverage   73.63%   74.84%   +1.21%     
==========================================
  Files          94       96       +2     
  Lines        4820     5093     +273     
  Branches      816      847      +31     
==========================================
+ Hits         3549     3812     +263     
- Misses       1166     1171       +5     
- Partials      105      110       +5     
Flag Coverage Δ
unittests 74.84% <94.16%> (+1.21%) ⬆️

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

Impacted Files Coverage Δ
mmcls/models/backbones/swin_transformer.py 90.90% <90.90%> (ø)
mmcls/models/utils/embed.py 78.64% <93.75%> (+12.44%) ⬆️
mmcls/models/utils/attention.py 96.89% <96.89%> (ø)
mmcls/models/backbones/__init__.py 100.00% <100.00%> (ø)
mmcls/models/utils/__init__.py 100.00% <100.00%> (ø)
mmcls/models/utils/helpers.py 100.00% <0.00%> (+15.38%) ⬆️

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 4ebee15...74a7566. Read the comment docs.

@ycxioooong
Copy link
Contributor

Please resolve the conflicts, thanks.

@mzr1996 mzr1996 changed the title [WIP] Add swin-transformer model. [Feature] Add swin-transformer model. Jun 29, 2021
@mzr1996 mzr1996 removed the WIP label Jun 29, 2021
Copy link
Contributor

@ycxioooong ycxioooong left a comment

Choose a reason for hiding this comment

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

LGTM

Fix BGR bug, align scheduler config.

Fix label smoothing parameter difference.
2. Add docstrings of each module.
3. Fix some variables' names.
4. Other small improvement.
@ycxioooong ycxioooong merged commit 076ee10 into open-mmlab:master Jul 1, 2021
mzr1996 added a commit to mzr1996/mmpretrain that referenced this pull request Nov 24, 2022
* Add swin transformer archs S, B and L.

* Add SwinTransformer configs

* Add train config files of swin.

* Align init method with original code

* Use nn.Unfold to merge patch

* Change all ConfigDict to dict

* Add init_cfg for all subclasses of BaseModule.

* Use mmcv version init function

* Add Swin README

* Use safer cfg copy method

* Improve docstring and variable name.

* Fix some difference in randaug

Fix BGR bug, align scheduler config.

Fix label smoothing parameter difference.

* Fix missing droppath in attn

* Fix bug of relative posititon table if window width is not equal to
height.

* Make `PatchMerging` more general, support kernel, stride, padding and
dilation.

* Rename `residual` to `identity` in attention and FFN.

* Add `auto_pad` option to auto pad feature map

* Improve docstring.

* Fix bug in ShiftWMSA padding.

* Remove unused `key` and `value` in ShiftWMSA

* Move `PatchMerging` into utils and use common `PatchEmbed`.

* Use latest `LinearClsHead`, train augments and label smooth settings.
And remove original `SwinLinearClsHead`.

* Mark some configs as "Evalution Only".

* Remove useless comment in config

* 1. Move ShiftWindowMSA and WindowMSA to `utils/attention.py`
2. Add docstrings of each module.
3. Fix some variables' names.
4. Other small improvement.

* Add unit tests of swin-transformer and patchmerging.

* Fix some bugs in unit tests.

* Fix bug of rel_position_index if window is not square.

* Make WindowMSA implicit, and add unit tests.

* Add metafile.yml, update readme and model_zoo.
@mzr1996 mzr1996 deleted the swin branch December 7, 2022 02:11
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.

6 participants