All models

davit_small

A vision transformer that alternates window attention over patches with attention over channels.

Image classification · 1,147 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 (34 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
DaViT
Parameters
49.7M
Operations
1,147
Framework
PyTorch
Recurrent
No
Published
Lecture Notes in Computer Science (arXiv 2022)
Cited by
424 (as of 29 October 2026)
Authors
Mingyu Ding, Bin Xiao, Noel Codella and others
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
m4100
Graph hash
c8f7bdf1373ae77f54f71b3b4aff4c77001afb78a72f86b25c52d649564cfa27
Skeleton hash
7e830caf9de67ecf2a5b3a62d19ed21f609be1716af7bc973cbcd1ef8cdae8ff
Architecture hash
1cefe790ee9ff423b202114e228932ead511a2168dc5a0c8e8b5e5d3ad831da3
Diagram SHA-256
37c752277e435f6a9aab5d5584497ea9dab1be1f04f6a58b693c12819d4eeb17
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

How this diagram was made

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

What it is

About this model's family

DaViT, the Dual Attention Vision Transformer, is a vision backbone that captures global context while keeping computation efficient. Its trick is to run self-attention two ways: over spatial tokens, where the spatial dimension defines the token scope and channels are the features, and over channel tokens, where the channel dimension defines the token scope and the spatial dimension is the feature. Each channel token is an abstract representation of the entire image, so channel attention captures global interactions by taking all spatial positions into account. Spatial attention refines the local representations with fine-grained interactions across locations.

To keep the whole model linear in cost, tokens are grouped along the sequence direction for both kinds of attention: spatial window attention partitions the image into non-overlapping windows, and channel group attention divides the channels into groups. A dual attention block pairs one spatial window attention block with one channel group attention block, and the model alternates the two.

The network has four stages, each opened by a patch embedding layer implemented as a strided convolution, with dual attention blocks stacked inside each stage at fixed resolution. The captured timm members cover the tiny, small, base, large, huge and giant sizes; Tiny and Small both use base width C = 96 and differ in the third stage, with 3 or 9 blocks. Without extra data, DaViT-Tiny, DaViT-Small and DaViT-Base reach 82.8%, 84.2% and 84.6% top-1 on ImageNet-1K with 28.3M, 49.7M and 87.9M parameters. Scaled up with 1.5B weakly supervised image and text pairs, the giant model reaches 90.4% top-1 on ImageNet-1K.

Key idea. Channel group self-attention, which treats each channel as an image-level token, alternated with spatial window attention so a vision transformer gets global context at linear cost.

  • davit
  • dual attention vision transformer
  • channel group attention
  • spatial window attention
  • vision transformer
  • image classification
  • backbone
  • imagenet

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

Cite the paper

@article{davit2022,
  title = {DaViT: Dual Attention Vision Transformers},
  author = {Mingyu Ding and Bin Xiao and Noel Codella and Ping Luo and Jingdong Wang and Lu Yuan},
  year = {2022},
  journal = {Lecture notes in computer science},
  eprint = {2204.03645}
}