admin管理员组文章数量:1530292
原文:https://arxiv/pdf/1911.06667.pdf
ESE(Effective Squeeze and Extraction) layer是模型中的一个block,基于SE(Squeeze and Extraction)而来。与SE的区别在于,ESE block只有一个fc层,《CenterMask : Real-Time Anchor-Free Instance Segmentation》的作者注意到SE模块有一个缺点:由于维度的减少导致的通道信息损失。为了避免这种大模型的计算负担,se的2个fc层需要减少通道维度。特别的,当第一个fc层使用r减少输入特征通道,将通道数从c变为c/r的时候,第二个fc层又需要扩张减少的通道数到原始的通道c.在这个过程中,通道维度的减少导致了通道信息的损失。因而,effective SE(eSE)仅仅使用一个通道数为c的fc层代替了两个fc层,避免了通道信息DE丢失;
代码:
def get_act_fn(act=None, trt=False):
assert act is None or isinstance(act, (
str, dict)), 'name of activation should be str, dict or None'
if not act:
return identity
if isinstance(act, dict):
name = act['name']
act.pop('name')
kwargs = act
else:
name = act
kwargs = dict()
if trt and name in TRT_ACT_SPEC:
fn = TRT_ACT_SPEC[name]
elif name in ACT_SPEC:
fn = ACT_SPEC[name]
else:
fn = getattr(F, name)
return lambda x: fn(x, **kwargs)
class EffectiveSELayer(nn.Layer):
""" Effective Squeeze-Excitation
From `CenterMask : Real-Time Anchor-Free Instance Segmentation` - https://arxiv/abs/1911.06667
"""
def __init__(self, channels, act='hardsigmoid'):
super(EffectiveSELayer, self).__init__()
self.fc = nn.Conv2D(channels, channels, kernel_size=1, padding=0)
self.act = get_act_fn(act) if act is None or isinstance(act, (
str, dict)) else act
def forward(self, x):
x_se = x.mean((2, 3), keepdim=True)
x_se = self.fc(x_se)
return x * self.act(x_se)
代码摘自pp-yoloe(https://github/PaddlePaddle/PaddleDetection)
本文标签: 注意力ESEEffectiveBlockExcitation
版权声明:本文标题:【注意力】ESE:Effective Squeeze-and-Excitation Block 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1726480848a1072549.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论