Vision Transformer with Quadrangle Attention

Qiming Zhang, Jing Zhang, Yufei Xu, Dacheng Tao
3/27/2023
91 citations
cs.CV
transformer-attention

Official code: ViTAE-Transformer/QFormer (241 stars, Python, MIT, last commit 2025-09-25).

Abstract

Window-based attention has become a popular choice in vision transformers due to its superior performance, lower computational complexity, and less memory footprint. However, the design of hand-crafted windows, which is data-agnostic, constrains the flexibility of transformers to adapt to objects of varying sizes, shapes, and orientations.

Show full abstract

To address this issue, we propose a novel quadrangle attention (QA) method that extends the window-based attention to a general quadrangle formulation. Our method employs an end-to-end learnable quadrangle regression module that predicts a transformation matrix to transform default windows into target quadrangles for token sampling and attention calculation, enabling the network to model various targets with different shapes and orientations and capture rich context information. We integrate QA into plain and hierarchical vision transformers to create a new architecture named QFormer, which offers minor code modifications and negligible extra computational cost. Extensive experiments on public benchmarks demonstrate that QFormer outperforms existing representative vision transformers on various vision tasks, including classification, object detection, semantic segmentation, and pose estimation. The code will be made publicly available at \href{https://github.com/ViTAE-Transformer/QFormer}{QFormer}.

View on arXivView PDF

Code Implementations(1)

MIT

The official repo for [TPAMI'23] "Vision Transformer with Quadrangle Attention"

24110PythonMar 27, 20231 years agoMIT
attention-mechanismbackboneclassificationdeep-learningobject-detection+3 more

Similar Papers

Cite this paper

@article{zhang2023vision,
  title  = {Vision Transformer with Quadrangle Attention},
  author = {Qiming Zhang and Jing Zhang and Yufei Xu and Dacheng Tao},
  year   = {2023},
  eprint = {2303.15105},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2303.15105v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2303.15105.svg)](https://codeofpaper.com/paper/2303.15105)

Discussion