首先我们找到models文件夹中的commmon.py文件,加入
RepVGG和RCSOSA模############################RCS###################### class SR(nn.Module): # Shuffle RepVGG def __init__(self, c1, c2): super().__init__() c1_ = int(c1 // 2) c2_ = int(c2 // 2) self.repconv = RepVGG(c1_, c2_) def forward(self, x): x1, x2 = x.chunk(2, dim=1) out = torch.cat((x1, self.repconv(x2)), dim=1) out = self.channel_shuffle(out, 2) return out def channel_shuffle(self, x, groups): batchsize, num_channels, height, width = x.data.size() channels_per_group = num_channels // groups x = x.view(batchsize, groups, channels_per_group, height, width) x = torch.transpose(x, 1, 2).contiguous() x = x.view(batchsize, -1, height, width) return x class SEBlock(nn.Module): def __init__(self, input_c
YOLOV5加入RCS-OSA模块,提升检测速度,助力涨点!
于 2024-05-09 17:10:26 首次发布