RMT: Retentive Networks Meet Vision Transformers

Qihang Fan, Huaibo Huang, Mingrui Chen, Hongmin Liu, Ran He
9/1/2023

No official code found. Best implementation: qhfan/RMT (391 stars, last commit 2024-07-29).

Abstract

Vision Transformer (ViT) has gained increasing attention in the computer vision community in recent years. How-ever, the core component of ViT, Self-Attention, lacks ex-plicit spatial priors and bears a quadratic computational complexity, thereby constraining the applicability of ViT. To alleviate these issues, we draw inspiration from the re-cent Retentive Network (RetNet) in the field of NLP, and propose RMT, a strong vision backbone with explicit spa-tial prior for general purposes. Specifically, we extend the RetNet's temporal decay mechanism to the spatial do-main, and propose a spatial decay matrix based on the Manhattan distance to introduce the explicit spatial prior to Self-Attention. Additionally, an attention decomposition form that adeptly adapts to explicit spatial prior is proposed, aiming to reduce the computational burden of modeling global information without disrupting the spa-tial decay matrix. Based on the spatial decay matrix and the attention decomposition form, we can flexibly integrate explicit spatial prior into the vision backbone with lin-ear complexity. Extensive experiments demonstrate that RMT exhibits exceptional performance across various vision tasks. Specifically, without extra training data, RMT achieves 84.8% and 86.1% top-l acc on ImageNet-lk with 27MI4.5GFLOPs and 96M/18.2GFLOPs. For downstream tasks, RMT achieves 54.5 box AP and 47.2 mask AP on the COCO detection task, and 52.8 mloU on the ADE20K se-mantic segmentation task.

View on arXivView PDF

Code Implementations(1)

qhfan/RMTCommunity100%

(CVPR2024)RMT: Retentive Networks Meet Vision Transformer

39127C++, CudaOct 27, 20232 years ago

Similar Papers

Cite this paper

@article{fan2023rmt,
  title  = {RMT: Retentive Networks Meet Vision Transformers},
  author = {Qihang Fan and Huaibo Huang and Mingrui Chen and Hongmin Liu and Ran He},
  year   = {2023},
  eprint = {2309.11523},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/pdf/2309.11523},
  journal = {CVPR 2023 2023}
}

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

Discussion