All models

crossvit_18_dagger_408

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

Image classification · 837 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
44.6M
Operations
837
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
m3962
Graph hash
8914d447f2ea40fd788f74fb989ce8bb5456074d18f8037439024d2f03899f46
Skeleton hash
3486d4ad7c873ac562a90da7ba8797871a051cd2c31c1a5e58ae4ca4e9650b5f
Architecture hash
46748a235092256835159be658eb73df31e051a77722348611544bf102986c6f
Diagram SHA-256
7217e2c6caec141e23fbe027096a04d3287f339a5bfac628c1569631de2c0f29
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_18_dagger_408', pretrained=False)

What it is

This model corresponds to the paper's CrossViT-18 with the dagger suffix, which replaces the linear patch embedding with three convolutional layers as the patch tokenizer. The 408 in the name of the CrossViT-18 dagger model is the actual input resolution of a model originally named for 384.

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}, 
}