Shortcuts

An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale

Abstract

While the Transformer architecture has become the de-facto standard for natural language processing tasks, its applications to computer vision remain limited. In vision, attention is either applied in conjunction with convolutional networks, or used to replace certain components of convolutional networks while keeping their overall structure in place. We show that this reliance on CNNs is not necessary and a pure transformer applied directly to sequences of image patches can perform very well on image classification tasks. When pre-trained on large amounts of data and transferred to multiple mid-sized or small image recognition benchmarks (ImageNet, CIFAR-100, VTAB, etc.), Vision Transformer (ViT) attains excellent results compared to state-of-the-art convolutional networks while requiring substantially fewer computational resources to train.

Citation

@inproceedings{
  dosovitskiy2021an,
  title={An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale},
  author={Alexey Dosovitskiy and Lucas Beyer and Alexander Kolesnikov and Dirk Weissenborn and Xiaohua Zhai and Thomas Unterthiner and Mostafa Dehghani and Matthias Minderer and Georg Heigold and Sylvain Gelly and Jakob Uszkoreit and Neil Houlsby},
  booktitle={International Conference on Learning Representations},
  year={2021},
  url={https://openreview.net/forum?id=YicbFdNTTy}
}

The training step of Vision Transformers is divided into two steps. The first step is training the model on a large dataset, like ImageNet-21k, and get the pretrain model. And the second step is training the model on the target dataset, like ImageNet-1k, and get the finetune model. Here, we provide both pretrain models and finetune models.

Pretrain model

The pre-trained models are converted from model zoo of Google Research.

ImageNet 21k

Model Params(M) Flops(G) Download
ViT-B16* 86.86 33.03 model
ViT-B32* 88.30 8.56 model
ViT-L16* 304.72 116.68 model

Models with * are converted from other repos.

Finetune model

The finetune models are converted from model zoo of Google Research.

ImageNet 1k

Model

Pretrain

resolution

Params(M)

Flops(G)

Top-1 (%)

Top-5 (%)

Config

Download

ViT-B16*

ImageNet-21k

384x384

86.86

33.03

85.43

97.77

config

model

ViT-B32*

ImageNet-21k

384x384

88.30

8.56

84.01

97.08

config

model

ViT-L16*

ImageNet-21k

384x384

304.72

116.68

85.63

97.63

config

model

Models with * are converted from other repos.

Read the Docs v: latest
Versions
master
latest
stable
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.