Rethinking Bottleneck Structure for Efficient Mobile Network Design
Rethinking Bottleneck Structure for Efficient Mobile Network Design
一. 论文简介
减少模块提取特征时的丢失,增强模块提取特征的能力
采用类似hourglass的结构,先降采样后升采样(相对于通道)
![](https://img2020.cnblogs.com/blog/1033571/202009/1033571-20200904173012099-1188334255.png)
二. 模块详解
2.1 整体结构介绍
depth-wise(w/ Relu) + points-wise(W/O Relu) + point-wise(W/ Relu) + depth-wise(W/O Relu)
![](https://img2020.cnblogs.com/blog/1033571/202009/1033571-20200904173537704-2144865530.png)
![](https://img2020.cnblogs.com/blog/1033571/202009/1033571-20200904173840079-1868568896.png)
class SandGlassModule(nn.Module):
def __init__(self, inp, oup, stride, reduction_ratio):
super(SandGlass, self).__init__()
assert stride in [1, 2]
hidden_dim = round(inp // reduction_ratio)
self.identity = stride == 1 and inp == oup
self.conv = nn.Sequential(
# dw + relu
nn.Conv2d(inp, inp, 3, 1, 1, groups=inp, bias=False),
nn.BatchNorm2d(inp),
nn.ReLU6(inplace=True),
# pw + linear(non-relu)
nn.Conv2d(inp, hidden_dim, 1, 1, 0, bias=False),
nn.BatchNorm2d(hidden_dim),
# pw + relu
nn.Conv2d(hidden_dim, oup, 1, 1, 0, bias=False),
nn.BatchNorm2d(oup),
nn.ReLU6(inplace=True),
# dw + linear(non-relu)
nn.Conv2d(oup, oup, 3, stride, 1, groups=oup, bias=False),
nn.BatchNorm2d(oup),
)
def forward(self, x):
if self.identity:
return x + self.conv(x)
else:
return self.conv(x)
作者:影醉阏轩窗
-------------------------------------------
个性签名:衣带渐宽终不悔,为伊消得人憔悴!
如果觉得这篇文章对你有小小的帮助的话,记得关注再下的公众号,同时在右下角点个“推荐”哦,博主在此感谢!
![](https://images2018.cnblogs.com/blog/1033571/201807/1033571-20180705122122491-1885279937.jpg)