
vit_large_patch14_reg4_dinov2
Image classification688 ops304.4M params
Vision Transformer: a Transformer encoder that classifies an image from a sequence of patch embeddings.
Image classification · 874 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
How this diagram was made
torchvision.models.get_model('vit_l_32', weights=None) This model is built by torchvision's vit_l_32 builder. In the paper's notation, that name denotes the Large size with 32 × 32 input patches.
About this model's family
The Vision Transformer (ViT) is a pure transformer applied directly to sequences of image patches for image classification. The paper's argument is that vision models do not need to rely on CNNs. An image is split into patches, and the patches are treated the same way as word tokens in a language model.
The design follows the original Transformer as closely as possible. A learnable embedding is prepended to the sequence of embedded patches, and a classification head is attached to its state at the encoder's output. Learnable 1D position embeddings are added to the patch embeddings to retain positional information. Inside the encoder, layer normalization is applied before every block and residual connections after every block. The paper notes that Transformers lack inductive biases inherent to CNNs, such as translation equivariance and locality, and do not generalize well when trained on insufficient data.
The paper defines Base, Large and Huge sizes with 12, 24 and 32 layers. Models with a smaller patch size see a longer sequence and are computationally more expensive. The paper reports that its best model reaches 88.55% accuracy on ImageNet and 94.55% on CIFAR-100. In torchvision, all the model builders rely on one VisionTransformer base class, and by default no pre-trained weights are used.
Key idea. The paper shows that a pure transformer applied directly to sequences of image patches can classify images without relying on CNNs.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.