SPP (three maximum pooling + one direct connection + splicing) SPP (three maximum pooling + one direct connection + splicing) S P P ( three th most large pool of+A months straight even+Fight pick )
classSpatialPyramidPooling(nn.Module):def__init__(self, pool_sizes=[5,9,13]):super(SpatialPyramidPooling, self).__init__()
self.maxpools = nn.ModuleList([nn.MaxPool2d(pool_size,1, pool_size//2)for pool_size in pool_sizes])defforward(self, x):
features =[maxpool(x)for maxpool in self.maxpools[::-1]]
features = torch.cat(features +[x], dim=1)return features