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

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.

PDF Abstract ICLR 2021 PDF ICLR 2021 Abstract

Results from the Paper


Task Dataset Model Metric Name Metric Value Global Rank Uses Extra
Training Data
Result Benchmark
Image Classification CIFAR-10 ViT-L/16 Percentage correct 99.42 # 4
Image Classification CIFAR-10 ViT-H/14 Percentage correct 99.5 # 1
PARAMS 632M # 239
Top-1 Accuracy 99.5 # 1
Image Classification ImageNet ViT-L/16 Top 1 Accuracy 87.76% # 81
Image Classification ImageNet ViT-H/14 Top 1 Accuracy 88.55% # 47
Out-of-Distribution Generalization ImageNet-W ViT-B/32 Carton Gap +34 # 1
Out-of-Distribution Generalization ImageNet-W ViT-B/16 Carton Gap +26 # 1
Out-of-Distribution Generalization ImageNet-W ViT-L/16 Carton Gap +34 # 1
Dynamic Facial Expression Recognition MAFW ViT WAR 45.04 # 10
Image Classification ObjectNet ViT-H/14 Top-5 Accuracy 82.1 # 1
Fine-Grained Image Classification Oxford-IIIT Pets ViT-B/16 Top-1 Error Rate 6.2% # 5
Domain Generalization VizWiz-Classification ViT-16/L-224 Accuracy - All Images 49 # 8
Domain Generalization VizWiz-Classification ViT-8/B-224 Accuracy - Clean Images 48.9 # 15

Methods