参数量计算:
(输入通道*w)*(输出通道*w)*k^2+(输出通道*w)*2
w是模型缩放里面的width
- [-1, 1, Conv, [64, 3, 2]] # 0-P1/2
输出通道c2=64,k=3,s=2
P1/2 特征图变小一半
先定义算子层
再搭一个forward前向传播
class Conv(nn.Module):
"""Standard convolution with args(ch_in, ch_out, kernel, stride, padding, groups, dilation, activation)."""
default_act = nn.SiLU() # default activation
def __init__(self, c1, c2, k=1, s=1, p=None, g=1, d=1, act=True):
"""Initialize Conv layer with given arguments including ac