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

Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner and 6 more

Published
Lab
Google
Code
GitHub
Citations
75,784

TL;DR

Vision Transformer (ViT) applies a standard Transformer directly to a sequence of image patches, with no convolutional backbone, and does well on image classification when pre-trained on large data.

Read this as a

Why builders care

Editor's note

You do not need a CNN in the loop to get strong vision models. After large-scale pre-training, ViT attained excellent results against then state-of-the-art conv nets on ImageNet, CIFAR-100 and VTAB, and needed substantially fewer computational resources to train.

How to apply it

Editor's note
  1. 1For image classification, try a patch-token Transformer pre-trained on a large set, then transfer it to your mid-sized or small benchmark.
  2. 2Don't expect this from training on a small set alone. The paper's results depend on large-scale pre-training first.

Practical notes

AI-generated
  • Apply a standard transformer directly to sequences of image patches without convolutional networks.
  • Pre-train the model on large amounts of data before transferring it to your target benchmarks.

Key results

From the abstract
  1. 1

    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.

  2. 2

    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.

  • 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.

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.

Everything on this page is written from this abstract. For methods and full results, read the paper PDF.

Ask the paper

Answers come from the paper summary and abstract.

Ask anything about “An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale”, or start with one of these:

Closest matches across the feed and every collection, by shared words in titles, topics and abstracts.