CAT: Cross Attention in Vision Transformer

Hezheng Lin, Xing Cheng, Xiangyu Wu, Fan Yang, Dong Shen +3 more
6/10/2021
cs.CVcs.AI
transformer-attention

Official code: linhezheng19/CAT (169 stars, Python, MIT, last commit 2022-06-25).

Abstract

Since Transformer has found widespread use in NLP, the potential of Transformer in CV has been realized and has inspired many new approaches. However, the computation required for replacing word tokens with image patches for Transformer after the tokenization of the image is vast(e.g., ViT), which bottlenecks model training and inference.

Show full abstract

In this paper, we propose a new attention mechanism in Transformer termed Cross Attention, which alternates attention inner the image patch instead of the whole image to capture local information and apply attention between image patches which are divided from single-channel feature maps capture global information. Both operations have less computation than standard self-attention in Transformer. By alternately applying attention inner patch and between patches, we implement cross attention to maintain the performance with lower computational cost and build a hierarchical network called Cross Attention Transformer(CAT) for other vision tasks. Our base model achieves state-of-the-arts on ImageNet-1K, and improves the performance of other methods on COCO and ADE20K, illustrating that our network has the potential to serve as general backbones. The code and models are available at \url{https://github.com/linhezheng19/CAT}.

View on arXivView PDF

Code Implementations(1)

linhezheng19/CATOfficial100%
MIT

Official implement of "CAT: Cross Attention in Vision Transformer".

16920Python, ShellMay 21, 20214 years agoMIT

Similar Papers

Cite this paper

@article{lin2021cat,
  title  = {CAT: Cross Attention in Vision Transformer},
  author = {Hezheng Lin and Xing Cheng and Xiangyu Wu and Fan Yang and Dong Shen and Zhongyuan Wang and Qing Song and Wei Yuan},
  year   = {2021},
  eprint = {2106.05786},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2106.05786}
}

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

Discussion