[Refactor] Using mmcv transformer bricks to refactor vit. (#571)
* [Refactor] Using mmcv bricks to refactor vit * Follow the vit code structure from mmclassification * Add MMCV install into CI system. * Add to 'Install MMCV' CI item * Add 'Install MMCV_CPU' and 'Install MMCV_GPU CI' items * Fix & Add 1. Fix low code coverage of vit.py; 2. Remove HybirdEmbed; 3. Fix doc string of VisionTransformer; * Add helpers unit test. * Add converter to convert vit pretrain weights from timm style to mmcls style. * Clean some rebundant code and refactor init 1. Use timm style init_weights; 2. Remove to_xtuple and trunc_norm_; * Add comments for VisionTransformer.init_weights() * Add arg: pretrain_style to choose timm or mmcls vit pretrain weights.
Showing
- mmseg/models/backbones/vit.py 229 additions, 255 deletionsmmseg/models/backbones/vit.py
- mmseg/models/utils/__init__.py 2 additions, 2 deletionsmmseg/models/utils/__init__.py
- mmseg/models/utils/timm_convert.py 33 additions, 0 deletionsmmseg/models/utils/timm_convert.py
- mmseg/models/utils/weight_init.py 0 additions, 62 deletionsmmseg/models/utils/weight_init.py
- tests/test_models/test_backbones/test_vit.py 12 additions, 8 deletionstests/test_models/test_backbones/test_vit.py
Loading
Please register or sign in to comment