Twins: Revisiting the Design of Spatial Attention in Vision Transformers
Preprint
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 .Keywords
All Related Versions
This publication has 12 references indexed in Scilit:
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows2021
- Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions2021
- CvT: Introducing Convolutions to Vision Transformers2021
- Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet2021
- Going deeper with Image Transformers2021
- Co-Scale Conv-Attentional Image Transformers2021
- Bottleneck Transformers for Visual Recognition2021
- Pre-Trained Image Processing Transformer2021
- UP-DETR: Unsupervised Pre-training for Object Detection with Transformers2021
- Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformers2021