0
点赞
收藏
分享

微信扫一扫

深度学习论文: Attentional Feature Fusion及其PyTorch实现


深度学习论文: Attentional Feature Fusion及其PyTorch实现
Attentional Feature Fusion
PDF: ​​​https://arxiv.org/pdf/2009.14082.pdf​​​ PyTorch代码: ​​https://github.com/shanglianlm0525/CvPytorch​​ PyTorch代码: ​​https://github.com/shanglianlm0525/PyTorch-Networks​​

1 概述

特征融合是指来自不同层或分支的特征的组合,是现代网络体系结构中很常见的一种操作。它通常通过简单的操作(例如求和或串联)来实现,但这可能不是最佳选择。在本论文中提出了一个统一而通用的方案,即注意力特征融合,该方案适用于大多数常见场景,包括由short and long skip connections以及在Inception层内的特征融合。

  • 提出的多尺度通道注意力模块用于更好地融合语义和尺度不一致的特征;
  • 通过添加另一个注意力级别(称为迭代关注特征融合)来缓解特征图的初始集成可能带来的问题;

2 Multi-Scale Channel Attention Module(MS-CAM)

MS-CAM多尺度通道注意力模块,结构比较简单,使用尺度不同的两个分支来提取通道注意力权重。其中一个分支使用Global Avg Pooling来提取全局特征的注意力,另一个分支直接使用point-wise卷积提取局部特征的通道注意力。

深度学习论文: Attentional Feature Fusion及其PyTorch实现_人工智能


PyTorch代码:

class MS_CAM(nn.Module):
def __init__(self, channel, ratio = 16):
super(MS_CAM, self).__init__()
mid_channel = channel // ratio
self.global_att = nn.Sequential(
nn.AdaptiveAvgPool2d(1),
nn.Conv2d(in_channels=channel, out_channels=mid_channel, kernel_size=1, stride=1, padding=0),
nn.BatchNorm2d(mid_channel),
nn.ReLU(inplace=True),
nn.Conv2d(in_channels=mid_channel, out_channels=channel, kernel_size=1, stride=1, padding=0),
nn.BatchNorm2d(channel),
)

self.local_att = nn.Sequential(
nn.Conv2d(in_channels=channel, out_channels=mid_channel, kernel_size=1, stride=1, padding=0),
nn.BatchNorm2d(mid_channel),
nn.ReLU(inplace=True),
nn.Conv2d(in_channels=mid_channel, out_channels=channel, kernel_size=1, stride=1, padding=0),
nn.BatchNorm2d(channel),
)

self.sigmoid = nn.Sigmoid()

def forward(self, x):
b, c, _, _ = x.size()
g_x = self.global_att(x)
l_x = self.local_att(x)
w = self.sigmoid(l_x * g_x.expand_as(l_x))
return w *

3 Attentional Feature Fusion

3-1 AFF

深度学习论文: Attentional Feature Fusion及其PyTorch实现_人工智能_02

基于多尺度信道的注意模块M,Attentional Feature Fusion (AFF) 可以被表达为:

深度学习论文: Attentional Feature Fusion及其PyTorch实现_pytorch_03


深度学习论文: Attentional Feature Fusion及其PyTorch实现_人工智能_04

3-2 iAFF

完全上下文感知方法有一个不可避免的问题,即如何初始地集成输入特性。初始融合质量作为注意力模块的输入会对最终融合权重产生影响。iAFF针对初始特征集成对于注意力特征融合影响比较大的问题,使用额外一层AFF生成更好的初始特征,即iterative Attentional Feature Fusion (iAFF):

深度学习论文: Attentional Feature Fusion及其PyTorch实现_深度学习_05


深度学习论文: Attentional Feature Fusion及其PyTorch实现_计算机视觉_06

3-3 Examples: InceptionNet, ResNet, and FPN

深度学习论文: Attentional Feature Fusion及其PyTorch实现_神经网络_07


举报

相关推荐

0 条评论