[Feature] Segformer backbone re-implementation (#594)
* [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 * parameters init refactor * 1. Refactor segformer backbone parameters init; 2. Remove rebundant functions and unit tests; * Remove rebundant codes * 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. * resolve the shape convertion functions doc string. * Add pad_to_patch_size arg. * Modify default value of pad_to_patch_size arg.
Showing
- mmseg/models/backbones/__init__.py 2 additions, 1 deletionmmseg/models/backbones/__init__.py
- mmseg/models/backbones/mit.py 416 additions, 0 deletionsmmseg/models/backbones/mit.py
- mmseg/models/backbones/swin.py 1 addition, 0 deletionsmmseg/models/backbones/swin.py
- mmseg/models/backbones/vit.py 1 addition, 0 deletionsmmseg/models/backbones/vit.py
- mmseg/models/utils/__init__.py 3 additions, 2 deletionsmmseg/models/utils/__init__.py
- mmseg/models/utils/ckpt_convert.py 49 additions, 0 deletionsmmseg/models/utils/ckpt_convert.py
- mmseg/models/utils/embed.py 18 additions, 8 deletionsmmseg/models/utils/embed.py
- mmseg/models/utils/shape_convert.py 28 additions, 0 deletionsmmseg/models/utils/shape_convert.py
- tests/test_models/test_backbones/test_mit.py 60 additions, 0 deletionstests/test_models/test_backbones/test_mit.py
Loading
Please register or sign in to comment