arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2105.02358cs.CV
收藏

超越自我注意力:视觉任务中使用两个线性层的外部注意力

Beyond Self-attention: External Attention using Two Linear Layers for Visual Tasks

BNRist(北京国家信息科学与技术研究中心);Tsinghua University(清华大学)

Meng-Hao Guo, Zheng-Ning Liu, Tai-Jiang Mu, Shi-Min Hu

摘要:

注意力机制,特别是自我注意,在视觉任务的深度特征表征中发挥着越来越重要的作用。自注意力通过使用跨所有位置的成对亲和力计算特征的加权和来更新每个位置处的特征,以捕获单个样本内的长程依赖性。然而,自我注意具有二次复杂性,并且忽略了不同样本之间的潜在相关性。本文提出了一种新型的注意力机制,我们称之为外部注意力,它基于两个外部的、小型的、可学习的、共享的存储器,只需使用两个级联的线性层和两个规范化层即可轻松实现;它可以方便地取代现有流行架构中的自我注意力。外部注意力具有线性复杂性,并隐含地考虑了所有数据样本之间的相关性。我们进一步将多头机制纳入外部注意力,提供一个全MLP架构,外部注意力MLP(EAMLP),图像分类。对图像分类、目标检测、语义分割、实例分割、图像生成和点云分析的大量实验表明,我们的方法提供的结果与自我注意力机制及其一些变体相当或更优,并且具有更低的计算和存储成本。

英文摘要:

Attention mechanisms, especially self-attention, have played an increasingly important role in deep feature representation for visual tasks. Self-attention updates the feature at each position by computing a weighted sum of features using pair-wise affinities across all positions to capture the long-range dependency within a single sample. However, self-attention has quadratic complexity and ignores potential correlation between different samples. This paper proposes a novel attention mechanism which we call external attention, based on two external, small, learnable, shared memories, which can be implemented easily by simply using two cascaded linear layers and two normalization layers; it conveniently replaces self-attention in existing popular architectures. External attention has linear complexity and implicitly considers the correlations between all data samples. We further incorporate the multi-head mechanism into external attention to provide an all-MLP architecture, external attention MLP (EAMLP), for image classification. Extensive experiments on image classification, object detection, semantic segmentation, instance segmentation, image generation, and point cloud analysis reveal that our method provides results comparable or superior to the self-attention mechanism and some of its variants, with much lower computational and memory costs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑