Twins: Revisiting the Design of Spatial Attention in Vision Transformers

Xiangxiang Chu, Zhi Tian, Yuqing Wang, Bo Zhang, Haibing Ren +3 more
4/28/2021
cs.CVcs.AIcs.LG

Official code: Meituan-AutoML/Twins (610 stars, Apache-2.0, last commit 2023-02-14).

Abstract

Very recently, a variety of vision transformer architectures for dense prediction tasks have been proposed and they show that the design of spatial attention is critical to their success in these tasks. In this work, we revisit the design of the spatial attention and demonstrate that a carefully-devised yet simple spatial attention mechanism performs favourably against the state-of-the-art schemes. As a result, we propose two vision transformer architectures, namely, Twins-PCPVT and Twins-SVT. Our proposed architectures are highly-efficient and easy to implement, only involving matrix multiplications that are highly optimized in modern deep learning frameworks. More importantly, the proposed architectures achieve excellent performance on a wide range of visual tasks, including image level classification as well as dense detection and segmentation. The simplicity and strong performance suggest that our proposed architectures may serve as stronger backbones for many vision tasks. Our code is released at https://github.com/Meituan-AutoML/Twins .

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Two simple and effective designs of vision transformer, which is on par with the Swin transformer

61065Shell, PythonApr 28, 20213 years agoApache-2.0
image-classificationtwinsvision-transformer-architectures

Similar Papers

Cite this paper

@article{chu2021twins,
  title  = {Twins: Revisiting the Design of Spatial Attention in Vision Transformers},
  author = {Xiangxiang Chu and Zhi Tian and Yuqing Wang and Bo Zhang and Haibing Ren and Xiaolin Wei and Huaxia Xia and Chunhua Shen},
  year   = {2021},
  eprint = {2104.13840},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2104.13840}
}

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/2104.13840.svg)](https://codeofpaper.com/paper/2104.13840)

Discussion