| 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( |
| 15 | in_channels, |
| 16 | planes, |
| 17 | kernel_size=kernel_size, |
| 18 | stride=1, |
| 19 | padding=padding, |
| 20 | dilation=dilation, |
| 21 | bias=False, |
| 22 | ) |
| 23 | self.bn = nn.BatchNorm2d(planes) if config.batch_size > 1 else nn.Identity() |
| 24 | self.relu = nn.ReLU(inplace=True) |
| 25 | |
| 26 | def forward(self, x): |
| 27 | x = self.atrous_conv(x) |
| 28 | x = self.bn(x) |
| 29 | |
| 30 | return self.relu(x) |
| 31 | |
| 32 | |
| 33 | class ASPP(nn.Module): |