ghostnet
真实的和虚幻的叠加。
ghostnet网络结构
class GhostModule(nn.Module):
def __init__(self, inp, oup, kernel_size=1, ratio=2, dw_size=3, stride=1, relu=True):
super(GhostModule, self).__init__()
self.oup = oup
init_channels = math.ceil(oup / ratio)
new_channels = init_channels*(ratio-1)
self.primary_conv = nn.Sequential(
nn.Conv2d(inp, init_channels, kernel_size, stride, kernel_size//2, bias=False),
nn.BatchNorm2d(init_channels),
nn.ReLU(inplace=True) if relu else nn.Sequential(),
)
self.cheap_operation = nn.Sequential(
nn.Conv2d(init_channels, new_channels, dw_size, 1, dw_size//2, groups=init_channels, bias=False),
nn.BatchNorm2d(new_channels),
nn.ReLU(inplace=True) if relu else nn.Sequential(),
)
def forward(self, x):
x1 = self.primary_conv(x)
x2 = self.cheap_operation(x1)
out = torch.cat([x1,x2], dim=1)
return out[:,:self.oup,:,:]
efficientnet
同时探索分辨率、深度、宽度。
b图是普通的网络,b图是增加了channel之后的网络,c图是增加了网络的层数,d图是增加了图像的分辨率,也就是增加了高度和宽度,e图是增加了高度、宽度和分辨率还有网络的深度。
增加网络的宽度是指增加卷积核的个数,黄线是指增加增加宽度,绿线是指增加分辨率,蓝线是指增加深度,红线是指同时都增加。
efficientnet的初始结构,其中mbconv指的是Mobile convolution,每个stage的第一个conv的sride=2,其余的stride=1。
se模块是一个注意力机制。第一个1*1卷积是升维度,第二个1*1卷积是降维度的。mbconv6里的6指的是倍率因子n,就是第一行里的n。
se模块,
https://blog.youkuaiyun.com/qq_37541097/article/details/114434046