r/TheMachineLearning • u/iWearCrocsAllTheTime • 1d 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
3
u/AlwaysPlayF3 1d ago •
This is spectacularly unhelpful
1
u/hellobutno 18h ago
how some* vision transformers read an image