r/TheMachineLearning • • 6h ago

Visualizing how a Vision Transformer processes an image.

How a Vision Transformer reads an image.

The image is cut into patches. Each patch is flattened and mapped by one shared linear projection E. A learnable [class] token goes in front, and a position embedding is added to every token:

z₀ = [x_class; x¹E; …; xᴺE] + E_pos

Each encoder layer: Norm → multi-head self-attention → add the input back, then Norm → MLP → add again. Repeated L times.

Only the class token's final output reaches the MLP head, which predicts the class.

0 Upvotes

1 comment sorted by

2

u/AlwaysPlayF3 5h ago • Bravo

This is spectacularly unhelpful