
mobilevitv2 (image classification)
Image classification276 ops4.4M params
MobileViTV2 swaps MobileViT's multi-headed attention for linear-cost separable self-attention.
Image classification · 298 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.
About this model's family
MobileViTV2 is the second version of MobileViT, built by replacing MobileViT's multi-headed self-attention with separable self-attention. The main efficiency bottleneck in MobileViT is multi-headed self-attention, which costs O(k2) time in the number of tokens k. Separable self-attention has linear complexity, O(k), and uses element-wise operations rather than costly batch-wise matrix multiplications, which suits resource-constrained devices. With about three million parameters, MobileViTV2 reaches 75.6% top-1 on ImageNet, about 1% above MobileViT while running 3.2× faster on a mobile device.
In practice it behaves more like a CNN than a transformer: it works on batches of images rather than sequences, has no embeddings, and the backbone outputs a feature map. One quirk: the pretrained checkpoints expect images in BGR pixel order, not RGB.
Key idea. Separable self-attention with linear O(k) complexity, computed with element-wise operations, replacing multi-headed self-attention in MobileViT.
AI-written summary, based on the model's documentation and checked automatically against it; not reviewed by a person. Corrections welcome.