MCPcopy
hub / github.com/DingXiaoH/RepVGG / PPM

Class PPM

example_pspnet.py:9–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7# https://github.com/hszhao/semseg
8
9class PPM(nn.Module):
10 def __init__(self, in_dim, reduction_dim, bins, BatchNorm):
11 super(PPM, self).__init__()
12 self.features = []
13 for bin in bins:
14 self.features.append(nn.Sequential(
15 nn.AdaptiveAvgPool2d(bin),
16 nn.Conv2d(in_dim, reduction_dim, kernel_size=1, bias=False),
17 BatchNorm(reduction_dim),
18 nn.ReLU(inplace=True)
19 ))
20 self.features = nn.ModuleList(self.features)
21
22 def forward(self, x):
23 x_size = x.size()
24 out = [x]
25 for f in self.features:
26 out.append(F.interpolate(f(x), x_size[2:], mode='bilinear', align_corners=True))
27 return torch.cat(out, 1)
28
29
30class PSPNet(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected