Bootstrap

YOLOv9中模块总结补充|SPPELAN

c10d4a2a12624777a3b3d34e83db6757.png


 专栏相关代码:目前售价售价69.9,改进点80+

专栏介绍:YOLOv9改进系列 | 包含深度学习最新创新,助力高效涨点!!!


1. SPPELAN

        SPPELAN是YOLOv9中与SPPF类似的模块,整体结构及代码如下,代码中SP模块即为最大池化。

96020b653c604a4a9b9024617fd2230a.png

class SP(nn.Module):
    def __init__(self, k=3, s=1):
        super(SP, self).__init__()
        self.m = nn.MaxPool2d(kernel_size=k, stride=s, padding=k // 2)

    def forward(self, x):
        return self.m(x)


class SPPELAN(nn.Module):
    # spp-elan
    def __init__(self, c1, c2, c3):  # ch_in, ch_out, number, shortcut, groups, expansion
        super().__init__()
        self.c = c3
        self.cv1 = Conv(c1, c3, 1, 1)
        self.cv2 = SP(5)
        self.cv3 = SP(5)
        self.cv4 = SP(5)
        self.cv5 = Conv(4*c3, c2, 1, 1)

    def forward(self, x):
        y = [self.cv1(x)]
        y.extend(m(y[-1]) for m in [self.cv2, self.cv3, self.cv4])
        return self.cv5(torch.cat(y, 1))

 

 

;