Created
December 9, 2022 14:22
-
-
Save AlessandroMondin/e8e83f5591c69cb9641b44f85f3b6a5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SPPF(nn.Module): | |
def __init__(self, in_channels, out_channels): | |
super(SPPF, self).__init__() | |
c_ = int(in_channels//2) | |
self.c1 = CBL(in_channels, c_, 1, 1, 0) | |
self.pool = nn.MaxPool2d(kernel_size=5, stride=1, padding=2) | |
self.c_out = CBL(c_ * 4, out_channels, 1, 1, 0) | |
def forward(self, x): | |
x = self.c1(x) | |
pool1 = self.pool(x) | |
pool2 = self.pool(pool1) | |
pool3 = self.pool(pool2) | |
return self.c_out(torch.cat([x, pool1, pool2, pool3], dim=1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment