[docs]defapply_crop(depth:NDArrayNumber)->NDArrayNumber:"""Apply crop to depth map to match SHIFT evaluation."""returndepth[...,0:740,:]
[docs]classSHIFTDepthEvaluator(DepthEvaluator):"""SHIFT depth estimation evaluation class."""def__init__(self,use_eval_crop:bool=True)->None:"""Initialize the evaluator. Args: use_eval_crop (bool): Whether to use the evaluation crop. Default: True. """super().__init__(min_depth=0.01,max_depth=80.0)self.use_eval_crop=use_eval_crop
[docs]def__repr__(self)->str:"""Concise representation of the dataset evaluator."""return"SHIFT Depth Estimation Evaluator"
[docs]defprocess_batch(# type: ignore # pylint: disable=arguments-differself,prediction:NDArrayNumber,groundtruth:NDArrayNumber)->None:"""Process sample and update confusion matrix. Args: prediction: Predictions of shape (N, H, W). groundtruth: Groundtruth of shape (N, H, W). """ifself.use_eval_crop:prediction=apply_crop(prediction)groundtruth=apply_crop(groundtruth)print(prediction.shape,groundtruth.shape)super().process_batch(prediction,groundtruth)