
swin_s3_small_224
Image classification1,242 ops49.7M params
Swin Transformer: hierarchical vision transformer with self-attention in shifted local windows.
Image classification · 1,305 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
How this diagram was made
timm.create_model('swin_large_patch4_window12_384', pretrained=False) This is Swin-L at 384x384.
About this model's family
Swin Transformer is a hierarchical vision transformer that serves as a general-purpose backbone for computer vision. Moving the Transformer from language to vision runs into large variations in the scale of visual entities and the high resolution of pixels compared to words. Its answer is shifted windows: self-attention is limited to non-overlapping local windows for efficiency, while shifting the windows between layers allows cross-window connection. This gives linear computational complexity in image size and the flexibility to model at various scales.
The network first splits the image into non-overlapping 4x4 patches, so each token starts as a 48-dimensional vector of raw pixel values that a linear embedding projects to dimension C. Patch merging layers then concatenate each 2x2 group of neighboring patches and apply a linear layer to the 4C-dimensional result, building the hierarchy stage by stage. The shifted partition is computed by a cyclic shift that keeps the number of batched windows the same as regular window partitioning. The learnt relative position bias from pre-training can also initialize a model for fine-tuning at a different window size through bi-cubic interpolation.
Swin-B is sized like ViT-B/DeiT-B, and Swin-T, Swin-S and Swin-L are about 0.25x, 0.5x and 2x its model size and compute. The window size is set to M = 7 by default. Swin-T uses C = 96 with layer numbers {2, 2, 6, 2}, and Swin-S keeps C = 96 with {2, 2, 18, 2}. Swin-B raises C to 128 and Swin-L to 192, both with layer numbers {2, 2, 18, 2}.
The timm members use code and weights from Microsoft's Swin-Transformer repository. The three swin_s3 members instead load S3 (AutoFormerV2) Swin weights from Microsoft's Cream repository. S3 models come from neural architecture search that searches not only the architecture but also the search space, gradually evolving the search dimensions guided by an E-T Error computed with a weight-sharing supernet. In Transformers, Swin can pad inputs to any height and width divisible by 32 and can be used as a backbone. The paper reports 87.3 top-1 on ImageNet-1K, 58.7 box AP and 51.1 mask AP on COCO test-dev, and 53.5 mIoU on ADE20K val.
Key idea. Self-attention inside shifted local windows, giving a hierarchical vision transformer with linear complexity in image size that works as a general-purpose backbone.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@misc{chen2021searchingsearchspacevision,
title={Searching the Search Space of Vision Transformer},
author={Minghao Chen and Kan Wu and Bolin Ni and Houwen Peng and Bei Liu and Jianlong Fu and Hongyang Chao and Haibin Ling},
year={2021},
eprint={2111.14725},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2111.14725},
}