AN IMAGE IS WORTH 16X16 WORDS: TRANSFORMERS FOR IMAGE RECOGNITION AT SCALE - ICLR 2021
-
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.
-
Figure 1: Model overview. We split an image into fixed-size patches, linearly embed each of them,add position embeddings, and feed the resulting sequence of vectors to a standard Transformer encoder. In order to perform classification, we use the standard approach of adding an extra learnable “classification token” to the sequence.
We trained fpr CIFAR 10 and CIFAR 100 datasets
Model | Dataset | Accuracy | Epochs |
---|---|---|---|
ViT-B_16 | CIFAR 10 | 97.99% | 500 |
ViT-B_16 | CIFAR 100 | 87.28% | 500 |
Parameters | Values |
---|---|
Device | Tesla V100-SXM2-32GB |
Image size | 224x224 |
Patch size | 16x16 |