Swin Transformer: Hierarchical Vision Transformer using Shifted Windows

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 \textbf{S}hifted \textbf{win}dows. 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. The code and models are publicly available at~\url{https://github.com/microsoft/Swin-Transformer}.

PDF Abstract ICCV 2021 PDF ICCV 2021 Abstract
Task Dataset Model Metric Name Metric Value Global Rank Uses Extra
Training Data
Result Benchmark
Semantic Segmentation ADE20K Swin-B (UperNet, ImageNet-1k pretrain) Validation mIoU 49.7 # 54
Semantic Segmentation ADE20K Swin-L (UperNet, ImageNet-22k pretrain) Validation mIoU 53.50 # 34
Test Score 62.8 # 1
Semantic Segmentation ADE20K val Swin-L (UperNet, ImageNet-22k pretrain) mIoU 53.5 # 24
Semantic Segmentation ADE20K val Swin-B (UperNet, ImageNet-1k pretrain) mIoU 49.7 # 38
Real-Time Object Detection COCO Swin-B (12 fps) FPS (V100, b=1) 11.6 # 25
box AP 51.9 # 18
Object Detection COCO minival Swin-L (HTC++, multi scale) box AP 58 # 18
Object Detection COCO minival Swin-L (HTC++) box AP 57.1 # 20
Instance Segmentation COCO minival Swin-L (HTC++) mask AP 49.5 # 15
Instance Segmentation COCO minival Swin-L (HTC++, multi scale) mask AP 50.4 # 13
Instance Segmentation COCO test-dev Swin-L (HTC++, single scale) mask AP 50.2% # 11
Object Detection COCO test-dev Swin-L (HTC++, single scale) box AP 57.7 # 16
Object Detection COCO test-dev Swin-L (HTC++, multi scale) box AP 58.7 # 13
Instance Segmentation COCO test-dev Swin-L (HTC++, multi scale) mask AP 51.1% # 9
Semantic Segmentation EventScape Swin (B) mIoU 53.31 # 7
Semantic Segmentation EventScape Swin (S) mIoU 52.49 # 8
Semantic Segmentation FoodSeg103 Swin-Transformer (Swin-Small) mIoU 41.6 # 3
Image Classification ImageNet Swin-B (384 res, ImageNet-22k pretrain) Top 1 Accuracy 86.4% # 79
Number of params 88M # 572
GFLOPs 47 # 309
Image Classification ImageNet Swin-L (384 res, ImageNet-22k pretrain) Top 1 Accuracy 87.3% # 48
Number of params 197M # 620