Shortcuts

MeanGTRelativeSquaredError

class torch_uncertainty.metrics.MeanGTRelativeSquaredError(squared=True, num_outputs=1, **kwargs)[source]

Compute mean squared error relative to the Ground Truth (MSErel or SRE).

\[\text{MSErel} = \frac{1}{N}\sum_i^N \frac{(y_i - \hat{y_i})^2}{y_i}\]

Where \(y\) is a tensor of target values, and \(\hat{y}\) is a tensor of predictions.

As input to forward and update the metric accepts the following input:

  • preds (Tensor): Predictions from model

  • target (Tensor): Ground truth values

As output of forward and compute the metric returns the following output:

  • rel_mean_squared_error (Tensor): A tensor with the relative mean squared error

Parameters:
  • squared – If True returns MSErel value, if False returns RMSErel value.

  • num_outputs – Number of outputs in multioutput setting

  • kwargs – Additional keyword arguments, see Advanced metric settings.

Reference:

As in e.g. From big to small: Multi-scale local planar guidance for monocular depth estimation

update(pred, target)[source]

Update state with predictions and targets.