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 segformer decode head and related train config #599

Merged
merged 121 commits into from
Aug 13, 2021

Conversation

clownrat6
Copy link
Contributor

@clownrat6 clownrat6 commented Jun 11, 2021

  • Add head SegFormerHead;

  • Add some config for segformer;

@codecov
Copy link

codecov bot commented Jun 11, 2021

Codecov Report

Merging #599 (920feba) into master (9155d9e) will increase coverage by 0.78%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #599      +/-   ##
==========================================
+ Coverage   85.37%   86.16%   +0.78%     
==========================================
  Files         107      108       +1     
  Lines        5847     5860      +13     
  Branches      960      953       -7     
==========================================
+ Hits         4992     5049      +57     
+ Misses        673      628      -45     
- Partials      182      183       +1     
Flag Coverage Δ
unittests 86.14% <94.11%> (+0.78%) ⬆️

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

Impacted Files Coverage Δ
mmseg/models/utils/ckpt_convert.py 4.28% <ø> (-0.14%) ⬇️
mmseg/datasets/pipelines/transforms.py 97.28% <85.00%> (-0.71%) ⬇️
mmseg/models/backbones/mit.py 91.53% <100.00%> (+2.73%) ⬆️
mmseg/models/decode_heads/__init__.py 100.00% <100.00%> (ø)
mmseg/models/decode_heads/segformer_head.py 100.00% <100.00%> (ø)
mmseg/models/utils/__init__.py 100.00% <100.00%> (ø)
mmseg/__init__.py 90.32% <0.00%> (+16.63%) ⬆️

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 9155d9e...920feba. Read the comment docs.

@AncientRemember
Copy link

are the imgsize parameter of MixVisionTransformer is necessary? segformer drop the position encoding and make the model inductive when test resolution is diff with train

sennnnn added 2 commits June 12, 2021 01:19
1. Add related train and val configs;

2. Add AlignedResize;
@Junjun2016 Junjun2016 self-requested a review June 18, 2021 16:41
@Junjun2016
Copy link
Collaborator

are the imgsize parameter of MixVisionTransformer is necessary? segformer drop the position encoding and make the model inductive when test resolution is diff with train

In my opinion, the image size is not necessary, we will refactor it.

configs/segformer/segformer_mit-b1_512x512_160k_ade20k.py Outdated Show resolved Hide resolved
configs/segformer/segformer_mit-b1_512x512_160k_ade20k.py Outdated Show resolved Hide resolved
configs/segformer/segformer_mit-b1_512x512_160k_ade20k.py Outdated Show resolved Hide resolved
configs/segformer/segformer_mit-b2_512x512_160k_ade20k.py Outdated Show resolved Hide resolved
configs/segformer/segformer_mit-b0_512x512_160k_ade20k.py Outdated Show resolved Hide resolved
configs/segformer/segformer_mit-b4_512x512_160k_ade20k.py Outdated Show resolved Hide resolved
configs/segformer/segformer_mit-b5_512x512_160k_ade20k.py Outdated Show resolved Hide resolved
configs/segformer/segformer_mit-b5_640x640_160k_ade20k.py Outdated Show resolved Hide resolved
mmseg/models/decode_heads/segformer_head.py Outdated Show resolved Hide resolved
tools/model_converters/mit_convert.py Outdated Show resolved Hide resolved
@Junjun2016 Junjun2016 merged commit bcafcdd into open-mmlab:master Aug 13, 2021
bowenroom pushed a commit to bowenroom/mmsegmentation that referenced this pull request Feb 25, 2022
…lab#599)

* [Feature]Segformer re-implementation

* Using act_cfg and norm_cfg to control activation and normalization

* Split this PR into several little PRs

* Fix lint error

* Remove SegFormerHead

* [Feature] Add segformer decode head and related train config

* Add ade20K trainval support for segformer

1. Add related train and val configs;

2. Add AlignedResize;

* Set arg: find_unused_parameters = True

* parameters init refactor

* 1. Refactor segformer backbone parameters init;

2. Remove rebundant functions and unit tests;

* Remove rebundant codes

* Replace Linear Layer to 1X1 Conv

* Use nn.ModuleList to refactor segformer head.

* Remove local to_xtuple

* 1. Remove rebundant codes;

2. Modify module name;

* Refactor the backbone of segformer using mmcv.cnn.bricks.transformer.py

* Fix some code logic bugs.

* Add mit_convert.py to match pretrain keys of segformer.

* Resolve some comments.

* 1. Add some assert to ensure right params;

2. Support flexible peconv position;

* Add pe_index assert and fix unit test.

* 1. Add doc string for MixVisionTransformer;

2. Add some unit tests for MixVisionTransformer;

* Use hw_shape to pass shape of feature map.

* 1. Fix doc string of MixVisionTransformer;

2. Simplify MixFFN;

3. Modify H, W to hw_shape;

* Add more unit tests.

* Add doc string for shape convertion functions.

* Add some unit tests to improve code coverage.

* Fix Segformer backbone pretrain weights match bug.

* Modify configs of segformer.

* resolve the shape convertion functions doc string.

* Add pad_to_patch_size arg.

* Support progressive test with fewer memory cost.

* Modify default value of pad_to_patch_size arg.

* Temp code

* Using processor to refactor evaluation workflow.

* refactor eval hook.

* Fix process bar.

* Fix middle save argument.

* Modify some variable name of dataset evaluate api.

* Modify some viriable name of eval hook.

* Fix some priority bugs of eval hook.

* Fix some bugs about model loading and eval hook.

* Add ade20k 640x640 dataset.

* Fix related segformer configs.

* Depreciated efficient_test.

* Fix training progress blocked by eval hook.

* Depreciated old test api.

* Modify error patch size.

* Fix pretrain of mit_b0

* Fix the test api error.

* Modify dataset base config.

* Fix test api error.

* Modify outer api.

* Build a sampler test api.

* TODO: Refactor format_results.

* Modify variable names.

* Fix num_classes bug.

* Fix sampler index bug.

* Fix grammaly bug.

* Add part of benchmark results.

* Support batch sampler.

* More readable test api.

* Remove some command arg and fix eval hook bug.

* Support format-only arg.

* Modify format_results of datasets.

* Modify tool which use test apis.

* Update readme.

* Update readme of segformer.

* Updata readme of segformer.

* Update segformer readme and fix segformer mit_b4.

* Update readme of segformer.

* Clean AlignedResize related config.

* Clean code from pr open-mmlab#709

* Clean code from pr open-mmlab#709

* Add 512x512 segformer_mit-b5.

* Fix lint.

* Fix some segformer head bugs.

* Add segformer unit tests.

* Replace AlignedResize to ResizeToMultiple.

* Modify readme of segformer.

* Fix bug of ResizeToMultiple.

* Add ResizeToMultiple unit tests.

* Resolve conflict.

* Simplify the implementation of ResizeToMultiple.

* Update test results.

* Fix multi-scale test error when resize_ratio=1.75 and input size=640x640.

* Update segformer results.

* Update Segformer results.

* Fix some url bugs and pipelines bug.

* Move ckpt convertion to tools.

* Add segformer official pretrain weights usage.

* Clean redundant codes.

* Remove redundant codes.

* Unfied format.

* Add description for segformer converter.

* Update workers.
wjkim81 pushed a commit to wjkim81/mmsegmentation that referenced this pull request Dec 3, 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.

4 participants