vit_hybrid (image classification)
A base-sized Vision Transformer that takes its input tokens from a BiT ResNet feature map, for image classification.
Image classification · 669 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.
At a glance
- Task
- Image classification
- Parameters
- 99M
- Operations
- 669
- Framework
- PyTorch
- Recurrent
- No
- Published
- ICLR 2021
- Cited by
- 21,334 (as of 22 October 2026)
- Authors
- Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov and others
- Source
- transformers 4.57.0
- Name in source
- vit_hybrid:image-classification
- License
- Apache-2.0
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
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.
Details
- Stable ID
- m11007
- Graph hash
- f732e060f2415dae314c682cbda125eb952f36a442880217ee658da5381e034f
- Skeleton hash
- 8be997b7bc58796caa01ba16e7e6873bf406f59f79424fa0ad1ab7145799fb41
- Architecture hash
- 8217b6961873f2b90a0e652bb7315b2ff7af2cc78c553cf361e116898e9b5278
- Diagram SHA-256
- 8f4e391786269df7aa45d6fa49e0b4fa18350e9487362c7f843944a770edb876
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
ViT hybrid is a variant of the Vision Transformer that does not build its input sequence from raw image patches. A convolutional backbone, specifically BiT, runs first, and its features are used as the initial tokens for the Transformer. This model is the base-sized hybrid for image classification, which its model card says was pretrained on ImageNet-21k and fine-tuned on ImageNet.
In the paper's description, the patch embedding projection is applied to patches extracted from a CNN feature map. The patches can have spatial size 1x1, in which case the input sequence is obtained by flattening the spatial dimensions of the feature map and projecting to the Transformer dimension. The authors' code release notes that the R50+ViT-B/16 hybrid uses a modified ResNet-50 with [3,4,9] blocks. In hybrid model names, the number at the end stands for the total downsampling ratio of the ResNet backbone, not for the patch size.
Comparing performance against pre-training compute, the paper finds that hybrids slightly outperform ViT at small computational budgets, but that the difference vanishes for larger models. The authors call this somewhat surprising, since one might expect convolutional local feature processing to assist ViT at any size.
Key idea. The hybrid Vision Transformer forms the Transformer's input sequence from the feature map of a CNN instead of from raw image patches.
- ViT-Hybrid
- ViT hybrid
- R50+ViT-B/16
- vit-hybrid-base-bit-384
- hybrid vision transformer
- image classification
- ImageNet
- ResNet-50 ViT hybrid
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{dosovitskiy2021imageworth16x16words,
title={An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale},
author={Alexey Dosovitskiy and Lucas Beyer and Alexander Kolesnikov and Dirk Weissenborn and Xiaohua Zhai and Thomas Unterthiner and Mostafa Dehghani and Matthias Minderer and Georg Heigold and Sylvain Gelly and Jakob Uszkoreit and Neil Houlsby},
year={2021},
eprint={2010.11929},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2010.11929},
}