GSConv+VoVGSCSP(Slimneck报错修正)
参考有温度的AI提供的Slimneck代码进行的报错修改链接YOLOv5改进之YOLOv5GSConvSlim Neck_vovgscsp-CSDN博客报错TypeError: conv2d() received an invalid combination of arguments - got (Tensor, Parameter, NoneType, tuple, tuple, tuple, int), but expected one of:* (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, tuple of ints padding, tuple of ints dilation, int groups)didnt match because some of the arguments have invalid types: (Tensor, Parameter, NoneType, tuple, tuple, tuple, int)* (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, str padding, tuple of ints dilation, int groups)didnt match because some of the arguments have invalid types: (Tensor, Parameter, NoneType, tuple, tuple, tuple, int)修正将GSConv部分的代码替换如下其他保持不变。class GSConv(nn.Module):def __init__(self, c1, c2, k1, s1, g1, actTrue):super().__init__()c_ c2 // 2self.cv1 Conv(c1, c_, k, s, None, g, 1,act)self.cv2 Conv(c_, c_, 5, 1, None, c_,1, act)def forward(self, x):x1 self.cv1(x)x2 torch.cat((x1, self.cv2(x1)), 1)# shuffleb, n, h, w x2.data.size()b_n b * n // 2y x2.reshape(b_n, 2, h * w)y y.permute(1, 0, 2)y y.reshape(2, -1, n // 2, h, w)return torch.cat((y[0], y[1]), 1)