liveBook · Manning

Vision Transformer

As explained in Machine Learning Algorithms in Depth

A vision transformer is a transformer-based image model that processes an image as a sequence of embedded patches.

A Vision Transformer (ViT) applies a transformer-like architecture to images by converting an image into a sequence of embedded patches. Each fixed-size patch receives a linear embedding and a positional embedding before entering a transformer encoder. section 11.5

The image-classification pipeline consists of:

  • Divide the image into fixed-size patches. section 11.5
  • Linearly embed each patch and add positional information. section 11.5
  • Feed the resulting vector sequence to a standard transformer encoder. section 11.5
  • Pass the encoder output to an MLP head for classification. section 11.5

Image classification from patches

Given an image, represent every fixed-size region as a position-aware vector, process the ordered vectors with a transformer encoder, and use the resulting representation to classify the image. section 11.5

How Machine Learning Algorithms in Depth covers it

How deep it goes
Defines patch embedding, positional embedding, transformer encoding, and classification but does not derive their internal operations.
Examples
Uses fixed-size image patches, ImageNet classification, and comparisons with AlexNet, VGG, and ResNet.
What it assumes
Assumes familiarity with image models, embeddings, transformer encoders, and classification.
What you can do after
Evaluate/understand how an image becomes a patch-token sequence for transformer-based classification.
How it connects
Connects image patches and positional embeddings to transformer encoders, MLP heads, CNNs, ResNet, and self-attention-based transformers.

Also explained in

Compare how 7 books explain Vision Transformer →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Algorithms in Depth. The section links point to the parts of the book it draws on.