| 9 | |
| 10 | |
| 11 | class _ASPPModule(nn.Module): |
| 12 | def __init__(self, in_channels, planes, kernel_size, padding, dilation): |
| 13 | super(_ASPPModule, self).__init__() |
| 14 | self.atrous_conv = nn.Conv2d(in_channels, planes, kernel_size=kernel_size, |
| 15 | stride=1, padding=padding, dilation=dilation, bias=False) |
| 16 | self.bn = nn.BatchNorm2d(planes) if config.batch_size > 1 else nn.Identity() |
| 17 | self.relu = nn.ReLU(inplace=True) |
| 18 | |
| 19 | def forward(self, x): |
| 20 | x = self.atrous_conv(x) |
| 21 | x = self.bn(x) |
| 22 | |
| 23 | return self.relu(x) |
| 24 | |
| 25 | |
| 26 | class ASPP(nn.Module): |