On the Integration of Self-Attention and Convolution

被引:244
|
作者
Pan, Xuran [1 ]
Ge, Chunjiang [1 ]
Lu, Rui [1 ]
Song, Shiji [1 ]
Chen, Guanfu [2 ]
Huang, Zeyi [2 ]
Huang, Gao [1 ,3 ]
机构
[1] Tsinghua Univ, Dept Automat, BNRist, Beijing, Peoples R China
[2] Huawei Technol Ltd, Shenzhen, Peoples R China
[3] Beijing Acad Artificial Intelligence, Beijing, Peoples R China
基金
中国国家自然科学基金;
关键词
D O I
10.1109/CVPR52688.2022.00089
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
Convolution and self-attention are two powerful techniques for representation learning, and they are usually considered as two peer approaches that are distinct from each other. In this paper, we show that there exists a strong underlying relation between them, in the sense that the bulk of computations of these two paradigms are in fact done with the same operation. Specifically, we first show that a traditional convolution with kernel size k x k can be decomposed into k(2) individual 1 x 1 convolutions, followed by shift and summation operations. Then, we interpret the projections of queries, keys, and values in self-attention module as multiple 1 x 1 convolutions, followed by the computation of attention weights and aggregation of the values. Therefore, the first stage of both two modules comprises the similar operation. More importantly, the first stage contributes a dominant computation complexity (square of the channel size) comparing to the second stage. This observation naturally leads to an elegant integration of these two seemingly distinct paradigms, i.e., a mixed model that enjoys the benefit of both self-Attention and Convolution (ACmix), while having minimum computational overhead compared to the pure convolution or self-attention counterpart. Extensive experiments show that our model achieves consistently improved results over competitive baselines on image recognition and downstream tasks. Code and pre-trained models will be released at https ://github.com/LeapLabTHU/ACmix and https://gitee.com/mindspore/models.
引用
收藏
页码:805 / 815
页数:11
相关论文
共 50 条
  • [21] Cloudformer: A Cloud-Removal Network Combining Self-Attention Mechanism and Convolution
    Wu, Peiyang
    Pan, Zongxu
    Tang, Hairong
    Hu, Yuxin
    REMOTE SENSING, 2022, 14 (23)
  • [22] Dunhuang murals contour generation network based on convolution and self-attention fusion
    Liu, Baokai
    He, Fengjie
    Du, Shiqiang
    Zhang, Kaiwu
    Wang, Jianhua
    APPLIED INTELLIGENCE, 2023, 53 (19) : 22073 - 22085
  • [23] A Self-attention Agent of Reinforcement Learning in Continuous Integration Testing
    Liu, Bangfu
    Li, Zheng
    Zhao, Ruilian
    Shang, Ying
    2023 IEEE 47TH ANNUAL COMPUTERS, SOFTWARE, AND APPLICATIONS CONFERENCE, COMPSAC, 2023, : 886 - 891
  • [24] A self-attention dynamic graph convolution network model for traffic flow prediction
    Liao, Kaili
    Zhou, Wuneng
    Wu, Wanpeng
    INTERNATIONAL JOURNAL OF MACHINE LEARNING AND CYBERNETICS, 2024,
  • [25] Combining self-attention and depth-wise convolution for human pose estimation
    Zhang, Fan
    Shi, Qingxuan
    Ma, Yanli
    SIGNAL IMAGE AND VIDEO PROCESSING, 2024, 18 (8-9) : 5647 - 5661
  • [26] Dunhuang murals contour generation network based on convolution and self-attention fusion
    Baokai Liu
    Fengjie He
    Shiqiang Du
    Kaiwu Zhang
    Jianhua Wang
    Applied Intelligence, 2023, 53 : 22073 - 22085
  • [27] Point Cloud Classification Segmentation Model Based on Self-Attention and Edge Convolution
    Shen, Lu
    Yang, Jiazhi
    Zhou, Guoqing
    Huo, Jiaxin
    Chen, Mengqiang
    Yu, Guangwang
    Zhang, Yuyang
    Computer Engineering and Applications, 2023, 59 (19) : 106 - 113
  • [28] SHYNESS AND SELF-ATTENTION
    CROZIER, WR
    BULLETIN OF THE BRITISH PSYCHOLOGICAL SOCIETY, 1983, 36 (FEB): : A5 - A5
  • [29] SelfGCN: Graph Convolution Network With Self-Attention for Skeleton-Based Action Recognition
    Wu, Zhize
    Sun, Pengpeng
    Chen, Xin
    Tang, Keke
    Xu, Tong
    Zou, Le
    Wang, Xiaofeng
    Tan, Ming
    Cheng, Fan
    Weise, Thomas
    IEEE TRANSACTIONS ON IMAGE PROCESSING, 2024, 33 : 4391 - 4403
  • [30] Research on Combining Self-Attention and Convolution for Chest X-Ray Disease Classification
    Guan Xin
    Geng Jingjing
    Li Qiang
    LASER & OPTOELECTRONICS PROGRESS, 2024, 61 (04)