All models

crossvit_9_240

Dual-branch vision transformer that mixes small-patch and large-patch tokens through cross-attention.

Image classification · 577 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (16 KB)

Open in a new tab

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

Family
CrossViT
Parameters
8.6M
Operations
577
Framework
PyTorch
Recurrent
No
Published
ICCV (arXiv 2021)
Cited by
23 (as of 5 October 2026)
Authors
Chun-Fu Chen, Quanfu Fan, Rameswar Panda
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 diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m3963
Graph hash
2e7de418507da672ead32e90c05796f2f099026ab8eb7dea33fa8aa279cd407c
Skeleton hash
adc4b4b79799f3979a74b4f5a1b82f0a14cb70049750ab41f0d7b66d1cef5e89
Architecture hash
716d8b8e28f7fbba58e9a988f0a5740f52e1f62658aa78baa44be34bf25e300a
Diagram SHA-256
ba93cf73af37912f1f6acd1e4ed3a7a17d92e69ad0a96315f78e36907d39ed36
TorchLens version
2.35.3
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

timm.create_model('crossvit_9_240', pretrained=False)

What it is

This model corresponds to the paper's CrossViT-9, where the final number is the total count of transformer encoders in the large branch.

About this model's family

CrossViT is a vision transformer for image classification that processes an image at two patch sizes in parallel. The motivation is a trade-off in ViT: with a finer patch size the model can perform better, but FLOPs and memory consumption rise.

Each multi-scale encoder has two branches: a large, primary branch that uses coarse patches with more transformer encoders and wider embeddings, and a small, complementary branch that uses fine patches with fewer encoders and smaller embeddings. The branches exchange information through cross-attention, in which the CLS token of one branch serves as a query over the patch tokens of the other. Because only the CLS token is used in the query, the computation and memory needed to build the attention map are linear rather than quadratic.

In the paper, CrossViT-Ti, CrossViT-S and CrossViT-B set their large branches identical to the tiny, small and base models of DeiT. In the other names the final number is the total count of transformer encoders in the large branch. The models marked with a dagger replace the linear patch embedding with three convolutional layers. The paper reports that CrossViT improves DeiT-Ti, DeiT-S and DeiT-B by 1.2%, 1.2% and 0.4% points on ImageNet1K when those models are used as its primary branch. In timm the model names were changed to show the actual input resolution, so the 224 models are named 240 and the 384 models are named 408.

Key idea. CrossViT is a dual-branch vision transformer that fuses small-patch and large-patch tokens with a cross-attention module whose cost is linear instead of quadratic.

  • crossvit
  • cross vit
  • cross-attention multi-scale vision transformer
  • dual-branch transformer
  • multi-scale vision transformer
  • cross-attention token fusion
  • image classification
  • imagenet1k

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{chen2021crossvitcrossattentionmultiscalevision,
      title={CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification}, 
      author={Chun-Fu Chen and Quanfu Fan and Rameswar Panda},
      year={2021},
      eprint={2103.14899},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2103.14899}, 
}