All models

davit (MMPretrain)

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

Image classification · 86 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 (27 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
731.4K
Operations
86
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
Source
timm 1.0.30
Name in source
mmpretrain:davit
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
m6962
Graph hash
31ffa4169098107016b8eb81a50f26fc06ee20cde61072380ea0aff800b71890
Skeleton hash
abee40200c05bf40b3061d3c256f6339a1646784434403cf71773e4c95252c6d
Architecture hash
226319c3a1692ea1b461fa57c36db115821b2ae5b13adfaa2698c2c3c03d5984
Diagram SHA-256
49053f435409d6322bdaca0b517feda216c8ba53647b566307dd6b5f864953da
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

menagerie.classics.wave_b_openmmlab:build_mmpretrain: build({})

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