当前位置:网站首页>[channel attention mechanism] senet
[channel attention mechanism] senet
2022-07-28 15:46:00 【Coke Daniel】
summary
Author's speech : link
SENet The core of this paper is the application of channel attention mechanism SE Block, Explicitly model the interdependencies between feature channels , Let the network automatically learn the importance of each channel , Then, according to this importance, improve the useful features , Useless inhibition ( Feature recalibration strategy ). Similar to what I learned before attention-unet Medium attention-gate, It is also a plug and play structure .
details
SE Block
CNN The core of is convolution , It will be spatially (spatial) In terms of information and characteristics (channel-wise) Aggregate information , Previous studies have tried to improve the performance of the network from the spatial dimension , This paper attempts to consider from the feature dimension , Put forward SE Block, As shown in the figure below :
First of all Squeeze operation , Along channel Dimension for feature compression , Compress each two-dimensional feature image into a real number , This real number has a global receptive field to some extent , And the dimension of output matches the number of characteristic channels of input .
The second is Excitation operation , Generate a weight for each two-dimensional feature graph , This weight is used to show the importance of declaring the current channel .
And finally a Reweight The operation of , We will Excitation The weight of the output of is weighted to the previous feature channel by channel through multiplication , Complete the recalibration of the original feature on the channel dimension .
In order to SE Block The embedded ResNet For example :
actual Squeeze Operation is global average pooling ,Excitation Operation is two full connection layers , Reduce the number of channels on the first floor , The other layer is responsible for restoring the original state , The last activation function uses sigmod, Get the weight coefficient , Then multiply the coefficient by the input , Get the new characteristic graph after considering the importance .
Use two layers of full connection instead of one :
1) It has more nonlinearity , It can better fit the complex correlation between channels ;
2) It greatly reduces the amount of parameters and calculation .
Code implementation
Realization 1
import paddle
import paddle.nn as nn
# Use full connection layer , because Linear It deals with the last dimension , So we need to tensor Additional processing of dimensions
class SELayer1(nn.Layer):
def __init__(self,in_channels,reduction=16):
super(SELayer1, self).__init__()
self.avg_pool=nn.AdaptiveAvgPool2D(1)
self.fc=nn.Sequential(
nn.Linear(in_channels,in_channels // reduction),
nn.ReLU(),
nn.Linear(in_channels // reduction, in_channels),
nn.Sigmoid()
)
def forward(self,x):
# x:[n,c,h,w]
# We don't need to w,h Because after the pooling operation 1*1 了
n, c, _, _=x.shape
y=self.avg_pool(x).flatten(1) # y:[n,c*h*w]=[n,c]
y=self.fc(y).reshape([n,c,1,1]) # y:[n,c,1,1]
# It's OK not to do this step The framework will broadcast automatically
y=y.expand_as(x) # y:[n,c,h,q]
out=x*y
return out
Realization 2
# Use 1*1 Instead of the full connection layer Avoided tensor Additional processing of dimensions
class SELayer2(nn.Layer):
def __init__(self,in_channels,reduction=16):
super(SELayer2, self).__init__()
self.squeeze =nn.AdaptiveAvgPool2D(1)
self.excitation=nn.Sequential(
nn.Conv2D(in_channels, in_channels // reduction, 1, 1, 0),
nn.ReLU(),
nn.Conv2D(in_channels // reduction, in_channels, 1, 1, 0),
nn.Sigmoid()
)
def forward(self,x):
# x:[n,c,h,w]
y=self.squeeze(x)
y=self.excitation(x)
out=x*y
return out
Add to ResNet50 On
边栏推荐
- Software architecture and design (VII) -- interactive architecture
- ECCV 2022 | ssp: a new idea of small sample tasks with self-supporting matching
- Stateflow logic system modeling
- Framework定制系列(一)-----SystemUI NavigationBar导航栏上滑返回Launcher
- Daily news on July 28, 2022: Science: AI has made another breakthrough in protein design, and can design specific functional proteins
- Flutter中是使用RxDart代替Stateful
- Software architecture and design (VI) -- hierarchy
- 10. Implementation of related data accumulation task
- Software architecture and design (I) -- key principles
- Shell programming specifications and variables
猜你喜欢

Docker container implements MySQL master-slave replication

ECCV 2022 | ssp: a new idea of small sample tasks with self-supporting matching

生命的感悟

Docker容器实现MySQL主从复制

爆肝整理 JVM 十大模块知识点总结,不信你还不懂

Minimum heap improves the efficiency of each sort

语音社交系统——完善有声系统产业链

Shell programming specifications and variables

Among the three "difficult and miscellaneous diseases" of machine learning, causal learning is the breakthrough | Liu Li, Chongqing University

Editor in ArcGIS Pro
随机推荐
跟我学Rx编程——Concat
一次失败的破解经历
try...except异常处理语句(6)
H265 streaming on OBS
Heap operation
Preparing for listing in the United States? Arm announced that it would divest the Internet of things service business: the future will focus on the underlying chip design
Docker实现Redis Cluster(集群)模式 哈希槽分区进行亿级数据存储
10. Implementation of related data accumulation task
软件架构与设计(一)-----关键原则
How to obtain and embed go binary execution package information
The difference between character array and string
关于Simulink如何生成模型覆盖率报告
Framework定制系列(六)-----屏蔽FallbackHome手机启动中弹窗直接进入Launcher
华为全球员工总数创新高:19.4万人,研发人员占比近50%
Vs usage skills
软件架构与设计(五)-----以数据为中心的架构
AS如何不区分大小写去进行智能提示
PXE network installation
数据实时反馈技术
Leetcode bracket validity problem