mmpretrain/configs/swin_transformer
Ma Zerun 159b38d276
[Reproduction] Reproduce training results of T2T-ViT (#610)
* Add cosine cool down lr updater

* Use ema hook

* Update decay mult

* Update configs.

* Update T2T-ViT readme and format all readme

* Update swin readme

* Update tnt readme

* Add docstring for `CosineAnnealingCooldownLrUpdaterHook`.

* Update t2t readme and metafile
2021-12-28 15:09:40 +08:00
..
README.md [Reproduction] Reproduce training results of T2T-ViT (#610) 2021-12-28 15:09:40 +08:00
metafile.yml [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin-base_16xb64_in1k-384px.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin-base_16xb64_in1k.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin-large_16xb64_in1k-384px.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin-large_16xb64_in1k.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin-small_16xb64_in1k.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin-tiny_16xb64_in1k.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin_base_224_b16x64_300e_imagenet.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin_base_384_evalonly_imagenet.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin_large_224_evalonly_imagenet.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin_large_384_evalonly_imagenet.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin_small_224_b16x64_300e_imagenet.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00
swin_tiny_224_b16x64_300e_imagenet.py [Improvement] Rename config files according to the config name standard. (#508) 2021-11-19 14:20:35 +08:00

README.md

Swin Transformer: Hierarchical Vision Transformer using Shifted Windows

Abstract

This paper presents a new vision Transformer, called Swin Transformer, that capably serves as a general-purpose backbone for computer vision. Challenges in adapting Transformer from language to vision arise from differences between the two domains, such as large variations in the scale of visual entities and the high resolution of pixels in images compared to words in text. To address these differences, we propose a hierarchical Transformer whose representation is computed with Shifted windows. The shifted windowing scheme brings greater efficiency by limiting self-attention computation to non-overlapping local windows while also allowing for cross-window connection. This hierarchical architecture has the flexibility to model at various scales and has linear computational complexity with respect to image size. These qualities of Swin Transformer make it compatible with a broad range of vision tasks, including image classification (87.3 top-1 accuracy on ImageNet-1K) and dense prediction tasks such as object detection (58.7 box AP and 51.1 mask AP on COCO test-dev) and semantic segmentation (53.5 mIoU on ADE20K val). Its performance surpasses the previous state-of-the-art by a large margin of +2.7 box AP and +2.6 mask AP on COCO, and +3.2 mIoU on ADE20K, demonstrating the potential of Transformer-based models as vision backbones. The hierarchical design and the shifted window approach also prove beneficial for all-MLP architectures.

Citation

@article{liu2021Swin,
  title={Swin Transformer: Hierarchical Vision Transformer using Shifted Windows},
  author={Liu, Ze and Lin, Yutong and Cao, Yue and Hu, Han and Wei, Yixuan and Zhang, Zheng and Lin, Stephen and Guo, Baining},
  journal={arXiv preprint arXiv:2103.14030},
  year={2021}
}

Results and models

ImageNet-21k

The pre-trained models on ImageNet-21k are used to fine-tune, and therefore don't have evaluation results.

Model resolution Params(M) Flops(G) Download
Swin-B 224x224 86.74 15.14 model
Swin-B 384x384 86.88 44.49 model
Swin-L 224x224 195.00 34.04 model
Swin-L 384x384 195.20 100.04 model

ImageNet-1k

Model Pretrain resolution Params(M) Flops(G) Top-1 (%) Top-5 (%) Config Download
Swin-T From scratch 224x224 28.29 4.36 81.18 95.61 config model | log
Swin-S From scratch 224x224 49.61 8.52 83.02 96.29 config model | log
Swin-B From scratch 224x224 87.77 15.14 83.36 96.44 config model | log
Swin-S* From scratch 224x224 49.61 8.52 83.21 96.25 config model
Swin-B* From scratch 224x224 87.77 15.14 83.42 96.44 config model
Swin-B* From scratch 384x384 87.90 44.49 84.49 96.95 config model
Swin-B* ImageNet-21k 224x224 87.77 15.14 85.16 97.50 config model
Swin-B* ImageNet-21k 384x384 87.90 44.49 86.44 98.05 config model
Swin-L* ImageNet-21k 224x224 196.53 34.04 86.24 97.88 config model
Swin-L* ImageNet-21k 384x384 196.74 100.04 87.25 98.25 config model

Models with * are converted from the official repo. The config files of these models are only for validation. We don't ensure these config files' training accuracy and welcome you to contribute your reproduction results.