Skip to main content
QUICK REVIEW

[Paper Review] QuadTree Attention for Vision Transformers

Shitao Tang, Jiahui Zhang|arXiv (Cornell University)|Jan 8, 2022
Advanced Neural Network ApplicationsComputer Science70 citations
TL;DR

QuadTree Attention reduces vision-transformer complexity from quadratic to linear by building token pyramids and performing coarse-to-fine attention, achieving state-of-the-art results across feature matching, stereo, image classification, and object detection with lower computation.

ABSTRACT

Transformers have been successful in many vision tasks, thanks to their capability of capturing long-range dependency. However, their quadratic computational complexity poses a major obstacle for applying them to vision tasks requiring dense predictions, such as object detection, feature matching, stereo, etc. We introduce QuadTree Attention, which reduces the computational complexity from quadratic to linear. Our quadtree transformer builds token pyramids and computes attention in a coarse-to-fine manner. At each level, the top K patches with the highest attention scores are selected, such that at the next level, attention is only evaluated within the relevant regions corresponding to these top K patches. We demonstrate that quadtree attention achieves state-of-the-art performance in various vision tasks, e.g. with 4.0% improvement in feature matching on ScanNet, about 50% flops reduction in stereo matching, 0.4-1.5% improvement in top-1 accuracy on ImageNet classification, 1.2-1.8% improvement on COCO object detection, and 0.7-2.4% improvement on semantic segmentation over previous state-of-the-art transformers. The codes are available at https://github.com/Tangshitao/QuadtreeAttention.

Motivation & Objective

  • Motivate and address the quadratic computational cost of standard vision transformers for dense prediction tasks.
  • Propose a coarse-to-fine quadtree attention mechanism to skip irrelevant regions and reduce computations.
  • Enable both cross-attention and self-attention within a single efficient framework.
  • Demonstrate state-of-the-art performance gains across feature matching, stereo, image classification, and object detection.

Proposed method

  • Construct token pyramids by downsampling queries, keys, and values to L levels.
  • At each level, select the top K patches with highest attention scores to restrict fine-level attention to corresponding regions.
  • Aggregate messages across levels via two architectures: QuadTree-A (sum of level-wise messages) and QuadTree-B (learned-weighted combination of level-wise messages).
  • Compute attention scores recursively with s_ij^l = s_ij^{l-1} t_ij^l and t_ij^l from 2x2 local patches, enabling linear complexity in N.
  • Incorporate multiscale position encoding (LePE) using unshared depth-wise convolutions to preserve positional information across levels.

Experimental results

Research questions

  • RQ1Can QuadTree Attention reduce the quadratic complexity of vision transformers to linear without sacrificing performance on dense vision tasks?
  • RQ2Does the coarse-to-fine selective attention approach retain long-range dependencies while maintaining efficiency in cross- and self-attention scenarios?
  • RQ3How do the two aggregation schemes (QuadTree-A and QuadTree-B) compare in terms of accuracy and efficiency?
  • RQ4Can QuadTree Attention achieve state-of-the-art results across feature matching, stereo, classification, and detection tasks compared to existing efficient transformers?

Key findings

  • QuadTree Attention achieves comparable or superior performance to linear transformers with significantly reduced FLOPs and memory in feature matching and stereo.
  • On feature matching (ScanNet), QuadTree-B improves AUC@20 by 1.8–4.0 points over linear and SR attention variants depending on setup.
  • In stereo, QuadTree-B attains similar EPE to vanilla STTR while using about 52% FLOPs and 63% memory.
  • For ImageNet classification, QuadTree-B-b2 reaches 84.0% top-1, outperforming PVTv2 and Swin Transformer baselines.
  • In COCO object detection, QuadTree Attention + RetinaNet achieves 47.9 AP, about 1.8 higher than PVTv2 with fewer FLOPs.
  • Semantic segmentation shows improvements of 0.7–2.4% over prior transformers.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.