Dual Vision Transformer

Ting Yao, Yehao Li, Yingwei Pan, Yu Wang, Xiao-Ping Zhang, Tao Mei · DOI

Abstract

Vision Transformers (ViTs) are powerful but suffer from quadratic computational complexity relative to input resolution. We present Dual Vision Transformer (Dual-ViT), a novel architecture that employs a two-pathway system to balance global context and local detail efficiently. By utilizing a "semantic pathway" to generate global priors and a "pixel pathway" for fine-grained feature extraction, Dual-ViT achieves state-of-the-art performance, reaching 85.7% top-1 accuracy on ImageNet while significantly reducing FLOPs and parameter counts compared to previous heavyweights.

Introduction

The primary challenge in standard Vision Transformers is the self-attention mechanism, which scales quadratically ($O(n^2)$) with the number of tokens. While this enables the capture of long-range dependencies, it imposes significant memory and computational burdens on high-resolution tasks. Existing mitigations, such as down-sampling (e.g., PVT) or local windowing (e.g., Swin), often sacrifice either fine-grained details or global context. Dual-ViT seeks to reconcile these trade-offs by maintaining both global semantics and local precision through a parallelized dual-pathway approach.

Comparison of various attention blocks, highlighting the Dual block's unique parallel structure.

Methodology

The core of the architecture is the Dual Block, designed for high-resolution early stages. It operates via two interacting components:

  1. Semantic Pathway: This pathway compresses input features into a compact set of learned "semantic queries." These queries undergo self-attention to distill a global summary of the image. Because the number of queries is small, this pathway remains computationally efficient.
  2. Pixel Pathway: This pathway processes full-resolution feature maps. Instead of standard self-attention, it performs cross-attention between the pixels and the semantic tokens from the global pathway. This allows every pixel to integrate global context without the prohibitive $O(n^2)$ cost.

In later stages, a Merge Block is employed to fuse the information. It concatenates tokens from both pathways, applying standard self-attention to ensure full integration of local and global features before final classification.

Detailed schematics of the standard Transformer block, the Dual block, and the Merge block.

Key Insights

  • Global-to-Local Dependency: Dual-ViT treats global semantics as a prior. By guiding the pixel pathway with global information, the model effectively reduces the search space for local features, making the learning process more efficient.
  • Parallel Processing: Running pathways in parallel allows for simultaneous gradient flow, helping the model compensate for information lost during the compression of semantic queries.
  • Parametric Queries: Unlike simple down-sampling, learned queries allow the model to adaptively determine which semantic information is most critical to preserve.

Experimental Results

Dual-ViT was evaluated on ImageNet-1K, MS COCO, and ADE20K, demonstrating a superior accuracy-to-latency profile:

  • ImageNet-1K: Dual-ViT-L reached 85.7% top-1 accuracy, outperforming VOLO-D4 while using 37.8% fewer parameters and 41.1% fewer FLOPs.
  • Object Detection: On MS COCO, Dual-ViT-S surpassed PVTv2 by 1.2% mAP with nearly half the parameters.
  • Saliency: Score-CAM visualizations indicate that Dual-ViT produces more focused attention maps that better align with actual object boundaries compared to previous architectures.

Conclusion

Dual-ViT offers a compelling solution to the efficiency bottlenecks of Vision Transformers. By decoupling global and local processing into parallel pathways, it achieves high accuracy across diverse vision tasks with significantly reduced computational overhead. Future work may explore dynamic scaling of semantic queries to further optimize performance based on image complexity.

Summary updated

BibTeX
@article{yao2023dual,
  author = {Ting Yao and Yehao Li and Yingwei Pan and Yu Wang and Xiao-Ping Zhang and Tao Mei},
  title = {{Dual Vision Transformer}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2023},
  doi = {10.1109/tpami.2023.3268446},
}
Figure