Replicate the last convolution layer (head[4] in DPT) for multi layer depth.
(self, num_repeat: int)
| 242 | return self.monodepth_predictor.internal_resolution() |
| 243 | |
| 244 | def replicate_head(self, num_repeat: int): |
| 245 | """Replicate the last convolution layer (head[4] in DPT) for multi layer depth.""" |
| 246 | conv_last = copy.deepcopy(self.monodepth_predictor.head[4]) |
| 247 | self.monodepth_predictor.head[4].out_channels = num_repeat |
| 248 | self.monodepth_predictor.head[4].weight = nn.Parameter( |
| 249 | conv_last.weight.repeat(num_repeat, 1, 1, 1) |
| 250 | ) |
| 251 | self.monodepth_predictor.head[4].bias = nn.Parameter(conv_last.bias.repeat(num_repeat)) |
| 252 | |
| 253 | |
| 254 | def create_monodepth_adaptor( |