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

Alexander Kolesnikov
Alexey Dosovitskiy
Dirk Weissenborn
Jakob Uszkoreit
Lucas Beyer
Neil Houlsby
Sylvain Gelly
Thomas Unterthiner
Xiaohua Zhai
ICLR (2021)
Google Scholar

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 tasks, attention is usually 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 ConvNets is not necessary and a pure transformer can perform very well on image classification tasks when applied directly to sequences of image patches. When pre-trained on large amounts of data and transferred to multiple recognition benchmarks (ImageNet, CIFAR-10, etc), these transformers attain excellent accuracy, matching or outperforming the best convolutional networks while requiring substantially less computational resources to train.