MCPcopy Index your code
hub / github.com/NVIDIA/semantic-segmentation / DPC

Class DPC

network/utils.py:263–298  ·  view source on GitHub ↗

From: Searching for Efficient Multi-scale architectures for dense prediction

Source from the content-addressed store, hash-verified

261
262
263class DPC(nn.Module):
264 '''
265 From: Searching for Efficient Multi-scale architectures for dense
266 prediction
267 '''
268 def __init__(self, in_dim, reduction_dim=256, output_stride=16,
269 rates=[(1, 6), (18, 15), (6, 21), (1, 1), (6, 3)],
270 dropout=False, separable=False):
271 super(DPC, self).__init__()
272
273 self.dropout = dropout
274 if output_stride == 8:
275 rates = [(2 * r[0], 2 * r[1]) for r in rates]
276 elif output_stride == 16:
277 pass
278 else:
279 raise 'output stride of {} not supported'.format(output_stride)
280
281 self.a = dpc_conv(in_dim, reduction_dim, rates[0], separable)
282 self.b = dpc_conv(reduction_dim, reduction_dim, rates[1], separable)
283 self.c = dpc_conv(reduction_dim, reduction_dim, rates[2], separable)
284 self.d = dpc_conv(reduction_dim, reduction_dim, rates[3], separable)
285 self.e = dpc_conv(reduction_dim, reduction_dim, rates[4], separable)
286
287 self.drop = nn.Dropout(p=0.1)
288
289 def forward(self, x):
290 a = self.a(x)
291 b = self.b(a)
292 c = self.c(a)
293 d = self.d(a)
294 e = self.e(b)
295 out = torch.cat((a, b, c, d, e), 1)
296 if self.dropout:
297 out = self.drop(out)
298 return out
299
300
301def get_aspp(high_level_ch, bottleneck_ch, output_stride, dpc=False):

Callers 1

get_asppFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected