Optionally align monodepth to ground truth with a local scale map. Args: monodepth: The monodepth model with intermediate features to use. depth: Ground truth depth to align predicted depth to. depth_decoder_features: The (optional) monodepth decoder feat
(
self,
monodepth: torch.Tensor,
depth: torch.Tensor,
depth_decoder_features: torch.Tensor | None = None,
)
| 37 | self.scale_map_estimator = scale_map_estimator |
| 38 | |
| 39 | def forward( |
| 40 | self, |
| 41 | monodepth: torch.Tensor, |
| 42 | depth: torch.Tensor, |
| 43 | depth_decoder_features: torch.Tensor | None = None, |
| 44 | ): |
| 45 | """Optionally align monodepth to ground truth with a local scale map. |
| 46 | |
| 47 | Args: |
| 48 | monodepth: The monodepth model with intermediate features to use. |
| 49 | depth: Ground truth depth to align predicted depth to. |
| 50 | depth_decoder_features: The (optional) monodepth decoder features. |
| 51 | """ |
| 52 | if depth is not None and self.scale_map_estimator is not None: |
| 53 | depth_alignment_map = self.scale_map_estimator( |
| 54 | monodepth[:, 0:1], depth, depth_decoder_features |
| 55 | ) |
| 56 | monodepth = depth_alignment_map * monodepth |
| 57 | else: |
| 58 | # Some losses rely on the presence of an alignment map. |
| 59 | # We ensure that they can be computed by creating a fake alignment map. |
| 60 | depth_alignment_map = torch.ones_like(monodepth) |
| 61 | return monodepth, depth_alignment_map |
| 62 | |
| 63 | |
| 64 | class RGBGaussianPredictor(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected