# Swin (2021)

> A Transformer that attends within small windows and merges patches as it goes deeper, so it can replace the ConvNet backbone in detection and segmentation.

Page: https://mralbu.github.io/ai-datasets/p/swin

## Key facts

- Title: Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Authors: Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo
- Venue: ICCV 2021
- Category: Vision
- Paper: https://www.alphaxiv.org/abs/2103.14030

## Why it matters

ViT matched ConvNets at classification but produced one coarse feature map and was too costly on large images. Swin made a Transformer a drop-in backbone for dense tasks, topped detection and segmentation leaderboards, and won the ICCV 2021 best paper award.

## The idea

Compute self-attention only inside fixed local windows, so cost grows linearly with image size, and shift the windows by half their width in every other layer so information crosses their borders. Merge neighboring patches between stages to get feature maps at several scales, as a convolutional network has.

## The result

87.3% top-1 on ImageNet-1K with ImageNet-22K pretraining, 58.7 box AP and 51.1 mask AP on COCO test-dev (+2.7 and +2.6 over the previous best), and 53.5 mIoU on ADE20K (+3.2).

## The data

- [ImageNet (ILSVRC) (2009)](https://mralbu.github.io/ai-datasets/d/imagenet.md): 1.28 million photos across 1,000 classes, the dataset behind the deep learning boom.
- [MS COCO (2014)](https://mralbu.github.io/ai-datasets/d/coco.md): 330k everyday scenes with 1.5M labeled objects in 80 categories.
- [ADE20K (2017)](https://mralbu.github.io/ai-datasets/d/ade20k.md): 27,000 scenes where every object, and often its parts, is outlined and named.

## Builds on

- [ViT (2020)](https://mralbu.github.io/ai-datasets/p/vit.md)

## Led to

- [ConvNeXt (2022)](https://mralbu.github.io/ai-datasets/p/convnext.md)

## Part of

- [Vision backbones](https://mralbu.github.io/ai-datasets/t/vision-backbones.md) (step 5 of 6)
