CoChat

Swin Transformer: Hierarchical Vision Transformer using Shifted Windows

Open access
Liu, Ze, Lin, Yutong, Cao, Yue, Hu, Han, Wei, Yixuan, Zhang, Zheng, Lin, Stephen, Guo, Baining · 2021 · 2021 IEEE/CVF International Conference on Computer Vision (ICCV)

The DOI matches its Crossref record; 105 of the 139 references it cites were found in a registry or an index; 36 of the 41 sources its claims cite were checked for support.

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. The code and models are publicly available at https://github.com/microsoft/Swin-Transformer.

Overview

CoChat Summary

TL;DR

Swin Transformer is a hierarchical vision Transformer that computes self-attention within non-overlapping local windows and alternates regular and shifted window partitions to enable cross-window connections with linear complexity to image size. It achieves strong results as a general-purpose vision backbone on ImageNet-1K classification, COCO object detection/instance segmentation, and ADE20K semantic segmentation.

Key findings

  • Image classification: Swin-L reaches 87.3 top-1 accuracy on ImageNet-1K with ImageNet-22K pre-training; regular ImageNet-1K training gives Swin-T 81.3, Swin-S 83.0, and Swin-B 83.5 top-1 at 224² input.
  • COCO object detection/instance segmentation: Swin-L (HTC++) achieves 58.7 box AP and 51.1 mask AP on COCO test-dev, surpassing previous state-of-the-art by +2.7 box AP and +2.6 mask AP.
  • ADE20K semantic segmentation: Swin-L with ImageNet-22K pre-training achieves 53.5 mIoU on the val set, an improvement of +3.2 mIoU over the previous state-of-the-art (SETR).
  • Ablation: shifted windows improve Swin-T by +1.1% top-1 on ImageNet-1K, +2.8 box AP/+2.2 mask AP on COCO, and +2.8 mIoU on ADE20K over no shifting; relative position bias also improves results across the three tasks.

Methods

  • Architecture: input RGB image split into 4×4 non-overlapping patches, linearly embedded; four stages with patch merging to produce hierarchical feature maps. Swin Transformer blocks replace standard multi-head self-attention with window-based MSA using regular and shifted window partitioning; default window size M=7, query dimension d=32, MLP expansion α=4, and relative position bias.
  • Data and tasks: ImageNet-1K classification (1.28M training images, 50K validation images, 1,000 classes), ImageNet-22K pre-training (14.2M images, 22K classes), COCO 2017 detection/instance segmentation (118K train, 5K val, 20K test-dev), and ADE20K semantic segmentation (25K images: 20K train, 2K val, 3K test; 150 categories).
  • Analysis: reports top-1 accuracy, COCO box/mask AP, and ADE20K mIoU; compares against ViT/DeiT and ResNe(X)t backbones; ablates shifted windows, position embedding methods, and self-attention computation methods.

Limitations

  • The paper states that “a thorough kernel optimization is beyond the scope of this paper” and notes that Swin Transformer is implemented with built-in PyTorch functions that are not all well-optimized, which affects inference-speed comparisons against highly optimized Cudnn-based ResNe(X)t.
  • The paper states that SoftMax computation is omitted when determining computational complexity.
  • No dedicated limitations section is present; evident from the text, the main design ablations are conducted with Swin-T, and the COCO system-level comparison uses HTC++ with additional components (instaboost, stronger multi-scale training, soft-NMS, ImageNet-22K initialization), so those gains are not solely attributable to the backbone.

Model-written summary. Check it against the paper before relying on it.

Integrity signals

Registry

Crossref · 10.1109/iccv48922.2021.00986

Cites

105 of 105 references verified0 citation errors · 0 not checkable

Statistics

Nothing to recompute.

Figures

Figure 1 (a) The proposed Swin Transformer builds hierarchical feature maps by merging image patches (shown in gray) in deeper layers and has linear computation complexity to input image size due to computation of self-attention only within each local window (shown in red). It can thus serve as a general-purpose backbone for both image classification and dense recognition tasks. (b) In contrast, previous vision Transformers [20] produce feature maps of a single low resolution and have quadratic computation complexity to input image size due to computation of selfattention globally.
Figure 1 (a) The proposed Swin Transformer builds hierarchical feature maps by merging image patches (shown in gray) in deeper layers and has linear computation complexity to input image size due to computation of self-attention only within each local window (shown in red). It can thus serve as a general-purpose backbone for both image classification and dense recognition tasks. (b) In contrast, previous vision Transformers [20] produce feature maps of a single low resolution and have quadratic computation complexity to input image size due to computation of selfattention globally.From the PDF
Figure 2 An illustration of the shifted window approach for computing self-attention in the proposed Swin Transformer architecture. In layer l (left), a regular window partitioning scheme is adopted, and self-attention is computed within each window. In the next layer l +1 (right), the window partitioning is shifted, resulting in new windows. The self-attention computation in the new windows crosses the boundaries of the previous windows in layer l , providing connections among them.
Figure 2 An illustration of the shifted window approach for computing self-attention in the proposed Swin Transformer architecture. In layer l (left), a regular window partitioning scheme is adopted, and self-attention is computed within each window. In the next layer l +1 (right), the window partitioning is shifted, resulting in new windows. The self-attention computation in the new windows crosses the boundaries of the previous windows in layer l , providing connections among them.From the PDF
Figure 3 (a) The architecture of a Swin Transformer (Swin-T); (b) two successive Swin Transformer Blocks (notation presented with Eq. (3)). W-MSA and SW-MSA are multi-head self attention modules with regular and shifted windowing configurations, respectively.
Figure 3 (a) The architecture of a Swin Transformer (Swin-T); (b) two successive Swin Transformer Blocks (notation presented with Eq. (3)). W-MSA and SW-MSA are multi-head self attention modules with regular and shifted windowing configurations, respectively.From the PDF
Figure 4 Illustration of an efficient batch computation approach for self-attention in shifted window partitioning.
Figure 4 Illustration of an efficient batch computation approach for self-attention in shifted window partitioning.From the PDF

Verification

Claims the paper makes

17 Valid · 8 Not valid · 2 Not checked · 63 Own results and interpretations

47 more claims · 5 with their cited sources checked

Create a free account to see all 90 claims and to verify the 3 references still open.

See all claims — free account
  • Probably not a substantial claim. 11
  • It may state two separate claims as one. 28

Create a free account to see these claims.

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

19 more claims about this paper

Create a free account to see every claim other papers make about this one.

See all claims — free account

Self-check

Percentages, sums and reported differences re-computed from the paper’s own numbers.

Each contradiction between two passages listed here was confirmed by an independent check.

1 of 1

Citations

Cites

Show all 105 references

Research works printed but not linked: 2

  1. [50] Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jon Shlens. Stand-alone selfattention in vision models. In Advances in Neural Information Processing Systems , volume 32. Curran Associates, Inc., 2019. 2, 3 -
  2. [51] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. Unet: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention , pages 234-241. Springer, 2015. 2 -

Cited by

Items 101–200 of 33,018

Metadata

Authors
Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., & Guo, B.
Affiliations
  • University of Science and Technology of China (CN)
  • Microsoft Research Asia (China) (CN)
Venue
2021 IEEE/CVF International Conference on Computer Vision (ICCV)
Publisher
IEEE
Published
2021-10
Pages
9992-10002
OpenAlex
W3138516171
Cited by
35,534
References
139
Citations by year
2026: 6175 · 2025: 10280 · 2024: 9238 · 2023: 6683 · 2022: 2761 · 2021: 389
FWCI
1556.28
Type
conference paper
Language
en
Open access
Locations
  • IEEE/CVF International Conference on Computer Vision (ICCV) (publishedVersion)
  • arXiv (Cornell University) (submittedVersion, cc-by)
  • arXiv (Cornell University) (cc-by)
Topics
  • Physical Sciences › Computer Science › Computer Vision and Pattern Recognition › Advanced Neural Network Applications
  • Physical Sciences › Computer Science › Artificial Intelligence › Domain Adaptation and Few-Shot Learning
  • Physical Sciences › Computer Science › Computer Vision and Pattern Recognition › Visual Attention and Saliency Detection
Keywords
Swin Transformer, vision transformer, hierarchical vision transformer, self-attention, linear computational complexity, image classification, object detection, semantic segmentation, dense prediction

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

The claim verdicts this report counts are experimental: their accuracy is not yet measured.

A language model drew the claims from the paper on 2026-09-28, under version 3 of the claim definition (prompt extract-v3).

A second model labelled each claim on 2026-09-28 (model jev-1.13-20260917, definition revision gold-guideline-v0.2).

Cited sources are checked with a language model’s help (gpt-6-sol).

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review

Data sources

Bibliographic data: Semantic Scholar, OpenAlex, Crossref.

Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).

Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.