(self, in_channels, out_channels, config, D)
| 25 | self.weight_initialization() |
| 26 | |
| 27 | def network_initialization(self, in_channels, out_channels, config, D): |
| 28 | def space_n_time_m(n, m): |
| 29 | return n if D == 3 else [n, n, n, m] |
| 30 | |
| 31 | if D == 4: |
| 32 | self.OUT_PIXEL_DIST = space_n_time_m(self.OUT_PIXEL_DIST, 1) |
| 33 | |
| 34 | dilations = config.dilations |
| 35 | bn_momentum = bn_momentum = config.bn_momentum |
| 36 | self.inplanes = self.INIT_DIM |
| 37 | self.conv1 = conv( |
| 38 | in_channels, |
| 39 | self.inplanes, |
| 40 | kernel_size=space_n_time_m(config.conv1_kernel_size, 1), |
| 41 | stride=1, |
| 42 | D=D, |
| 43 | ) |
| 44 | |
| 45 | self.bn1 = get_norm( |
| 46 | NormType.BATCH_NORM, self.inplanes, D=self.D, bn_momentum=bn_momentum |
| 47 | ) |
| 48 | self.relu = ME.MinkowskiReLU(inplace=True) |
| 49 | self.pool = sum_pool( |
| 50 | kernel_size=space_n_time_m(2, 1), stride=space_n_time_m(2, 1), D=D |
| 51 | ) |
| 52 | |
| 53 | self.layer1 = self._make_layer( |
| 54 | self.BLOCK, |
| 55 | self.PLANES[0], |
| 56 | self.LAYERS[0], |
| 57 | stride=space_n_time_m(2, 1), |
| 58 | dilation=space_n_time_m(dilations[0], 1), |
| 59 | ) |
| 60 | self.layer2 = self._make_layer( |
| 61 | self.BLOCK, |
| 62 | self.PLANES[1], |
| 63 | self.LAYERS[1], |
| 64 | stride=space_n_time_m(2, 1), |
| 65 | dilation=space_n_time_m(dilations[1], 1), |
| 66 | ) |
| 67 | self.layer3 = self._make_layer( |
| 68 | self.BLOCK, |
| 69 | self.PLANES[2], |
| 70 | self.LAYERS[2], |
| 71 | stride=space_n_time_m(2, 1), |
| 72 | dilation=space_n_time_m(dilations[2], 1), |
| 73 | ) |
| 74 | self.layer4 = self._make_layer( |
| 75 | self.BLOCK, |
| 76 | self.PLANES[3], |
| 77 | self.LAYERS[3], |
| 78 | stride=space_n_time_m(2, 1), |
| 79 | dilation=space_n_time_m(dilations[3], 1), |
| 80 | ) |
| 81 | |
| 82 | self.final = conv( |
| 83 | self.PLANES[3] * self.BLOCK.expansion, |
| 84 | out_channels, |
no test coverage detected