17篇注意力机制PyTorch实现,包含MLP、Re-Parameter系列热门论文
注意力(Attention)机制最早在计算机视觉中应用,后来又在 NLP 领域发扬光大,该机制将有限的注意力集中在重点信息上,从而节省资源,快速获得最有效的信息。
2014 年,Google DeepMind 发表《Recurrent Models of Visual Attention》,使注意力机制流行起来;2015 年,Bahdanau 等人在论文《Neural Machi17ne Translation by Jointly Learning to Align and Translate》中,将注意力机制首次应用在 NLP 领域;2017 年,Google 机器翻译团队发表的《Attention is All You Need》中,完全抛弃了 RNN 和 CNN 等网络结构,而仅仅采用注意力机制来进行机器翻译任务,并且取得了很好的效果,注意力机制也因此成了研究热点。
经过几年的发篇注展,领域内产生了众多的注意力机制论文研究,这些工作在 CV、NLP 领域取得了较好的效果。近日,在 GitHub 上,有研究者介绍了 17 篇关于注意力机制论文的 PyTorch 的代码实现以及使用方法。
项目地址:https://github.com/xmu-xiaoma666/External-Attention-pytorch
项目介绍
项目作者对注意力机制进行了分类,分为三个系列:意力Attention 系列、MLP 系列、ReP(Re-Parameter)系列。其中 Attention 系列中包含有大名鼎鼎的《Attention is All You Need》等 11 篇论文;最近比较热门的 MLP 系列包括谷歌的 MLP-Mixer、gMLP ,Facebook 的 ResMLP,清华的 RepMLP ;此外,ReP(Re-Parameter)系列包括清华等提出的 RepVGG、机制 ACNet。
Attention 系列的 11 篇 Attention 论文 Pytorch 实现方式如下:
Pytorch 实现论文「Beyond Self-attention: External Attention using Two Linear Layers for Visual Tasks---arXiv 2020.05.05」 Pytorch 实现论文「Attention IsPy All You Need---NIPS2017」 Pytorch 实现论文「Simplified Self Attention Usage」 Pytorch 实现论文 「Squeeze-and-Excitation Networks---CVPR2018」 Pytorch 实现论文「Selective Kernel Networks---CVPR2019」 Pytorch 实现论文「CBAM: ConvoTolutional Block Attention Module---ECCV2018」 Pytorch 实现论文「BAM: Bottleneck Attention Module---BMCV2018」 Pytorch 实现论文「ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks---CVPR2020」 Pytorrcch 实现论文「Dual Attention Network for Scene Segmentation---CVPR2019」 Pytorch 实现论文「EPSANet: An Efficient Pyramid Split Attention Block on Convolutional Neural Network---arXiv 2020.05.30」 Pytorch 实现论文 「ResT: An Efh实ficient Transformer for Visual Recognition---arXiv 2020.05.28」
MLP(多层感知机)系列中,包含 4 篇论文 Pytorch 实现方式,论文如下:
Pytorch 实现论文「RepMLP: Re-parameterizing Convolutions into Fully-connected Layers for Ima现,ge Recognition---arXiv 2020.05.05」 Pytorch 实现论文「MLP-Mixer: An all-MLP Architecture for Vision---arXiv 2020.05.17」 Pytorch 实现论文「ResMLP: Feedforward networks for image classification with data-efficient training包含---arXiv 2020.05.07」 Pytorch 实现论文「Pay Attention to MLPs---arXiv 2020.05.17」
ReP(Re-Parameter)系列中,包含 2 篇论文 Pytorch 实现方式,论文如下:
Pytorch 实现论文「RepVGG: Making VGG-style ConvNets Great Again---CVPR2ML021」 Pytorch 实现论文「ACNet: Strengthening the Kernel Skeletons for Powerful CNN via Asymmetric Convolution Blocks---ICCV2019」
总结来说,该项目共用 Pytorch 实现了 17 篇注意力机制论文。每篇论文包括题目(可直接链接到论文)、网络架构、代码。示例如下:
论文:「Beyond Self-atP、tention: External Attention using Two Linear Layers for Visual Tasks」。
网络框架:
代码:
from attention.ExternalAttention *import* ExternalAttention import torch inReput=torch.randn(50,49,512) ea = ExternalAttention(d_model=512,S=8) output=ea(input) print(output.shape)
相关文章
描述 log() 方法返回x的自然对数,x > 0。 语法 以下是 log() 方法的语法: import math math.log( x ) 注意:log()是不能直接访问的,需要导入 math2026-11-16
2025年杭州云栖大会上传来重磅消息:阿里云与英伟达宣布达成深度合作,共同进军 Physical AI(物理AI) 领域。此次合作旨在将人工智能技术与物理世界深度融合,加速具身智能和辅助驾驶等前沿应用2026-11-16
KakaoTalk将集成ChatGPT功能 韩国聊天应用迎来AI升级
韩国最大的即时通讯应用KakaoTalk即将迎来重大功能更新。据韩国《首尔经济日报》援引业内人士消息,即时通讯巨头Kakao公司正计划在其核心产品中整合OpenAI的ChatGPT技术,为用户提供集成2026-11-16
标签: 长安启源A07 济广高速10·2事故 IACC辅助驾驶 L2级自动驾驶
云梦级6月1日云梦级消息,据新黄河报道,济广高速“10·2”交通事故调查报告公布后,涉事长安启源A07碰撞前的辅助驾驶运行细节引发关注。 5月30日下午,长安启源技术人员回电解答相关系统功能。工作人员2026-11-16
如今的应用程序都运行在加密技术之上,而在云平台中运行应用程序,需要SSH密钥来访问虚拟机,并采用API密钥来与外部服务交互,以及Web服务器的X.509v3证书。组织需要验证Web服务的安全客户端证书2026-11-16
Truffle是一个开发环境(提供用于编译,部署,测试和构建的命令行工具),框架(提供各种程序包以使其易于编写测试,部署代码,构建客户端等)和资产管道(发布软件包并使用其他人发布的软件包来构建基于以太2026-11-16

最新评论