Vision Transformers

Table of contents

  1. ▪ Image Patches and Tokens
  2. ▪ Self-Attention
  3. ▪ Architecture and Training
  4. ▪ References

▪ Image Patches and Tokens

A Vision Transformer (ViT) divides an image into patches and maps each patch to a feature vector, or token. Positional embeddings preserve information about where patches occur. The original ViT also introduces a class token whose final representation supports image classification.

▪ Self-Attention

Self-attention lets each token combine information from other tokens. Transformer blocks alternate attention and feed-forward processing to refine the representations. Patch size and image resolution determine the number of tokens and influence computation and spatial detail.

▪ Architecture and Training

ViT describes a network architecture, rather than a single training objective or vision task. A classifier can use a global representation, while other methods use the patch features. DINOv2 provides an example of training ViT backbones through self-supervision. A useful first exercise is to trace the tensor shapes from image patches to final features.

▪ References


This site uses Just the Docs, a documentation theme for Jekyll.