Downsampling module for CGNet.
| 169 | |
| 170 | |
| 171 | class InputInjection(nn.Module): |
| 172 | """Downsampling module for CGNet.""" |
| 173 | |
| 174 | def __init__(self, num_downsampling): |
| 175 | super(InputInjection, self).__init__() |
| 176 | self.pool = nn.ModuleList() |
| 177 | for i in range(num_downsampling): |
| 178 | self.pool.append(nn.AvgPool2d(3, stride=2, padding=1)) |
| 179 | |
| 180 | def forward(self, x): |
| 181 | for pool in self.pool: |
| 182 | x = pool(x) |
| 183 | return x |
| 184 | |
| 185 | |
| 186 | @BACKBONES.register_module() |