Introduction
Vision Transformers (ViTs) have set new benchmarks in computer vision, yet they are hindered by the quadratic computational complexity ($O(N^2)$) of standard self-attention relative to the number of input tokens. While high-resolution images are critical for dense prediction tasks like object detection and semantic segmentation, the resulting token explosion makes standard ViTs computationally prohibitive. Existing solutions, such as the Swin Transformer, utilize local windows to reduce complexity but often struggle to capture global context effectively without complex shifting mechanisms. DaViT (Dual Attention Vision Transformer) addresses this challenge by introducing a dual attention mechanism that achieves global receptive fields with linear complexity.
The Dual Attention Mechanism
The core innovation of DaViT is its alternating attention structure, which decomposes the global attention problem into two complementary operations:
- Spatial Window Attention: This operation performs multi-head self-attention within local windows, capturing fine-grained local textures and spatial structures.
- Channel Group Attention: By transposing the feature matrix, DaViT treats channels as tokens and spatial positions as feature dimensions. Since each channel represents an abstract feature across the entire image, performing attention in the channel dimension naturally facilitates global information exchange.
This "transpose trick" allows the model to alternate between local refinement and global fusion. By grouping channels, the complexity of this operation remains linear ($O(P)$) with respect to the number of pixels, enabling efficient processing of high-resolution inputs without the memory explosion typical of standard transformers.
Experimental Results
DaViT was evaluated across a wide range of benchmarks, including ImageNet-1K for classification, MS COCO for detection, and ADE20K for segmentation. The model consistently outperforms existing state-of-the-art architectures like Swin and Focal Transformers across various scales.
Image Classification
On ImageNet-1K, DaViT-Tiny achieves 82.8% top-1 accuracy with 28.3M parameters, outperforming Swin-Tiny (81.2%). The architecture demonstrates exceptional scaling power; when the DaViT-Giant variant is pre-trained on a massive weakly-supervised dataset of 1.5 billion image-text pairs, it reaches a state-of-the-art 90.4% top-1 accuracy.
Downstream Tasks
The benefits of global context are particularly evident in downstream tasks. For object detection on MS COCO, DaViT-Tiny (using RetinaNet) achieves 44.0 AP, significantly surpassing both ResNet-50 (36.3) and Swin-Tiny (42.0). In semantic segmentation on ADE20K, DaViT-Base reaches 49.4% mIoU, outperforming Swin-Base (48.1%).
Discussion and Future Work
While DaViT achieves state-of-the-art results, the authors identify several avenues for further optimization. Currently, Feed-Forward Network (FFN) layers account for a significant portion of the model's parameter and FLOP count, suggesting that "pure-attention" structures could yield further efficiency gains. Additionally, while the current relative position encoding is effective, more advanced spatial reasoning modules might enhance performance on tasks requiring precise geometric understanding. Finally, the most significant scaling results were achieved using a massive private dataset, highlighting the ongoing importance of data scale in training frontier vision models.
Summary updated