vis4d.eval.common.flow

Optical flow evaluator.

Classes

OpticalFlowEvaluator([max_flow, ...])

Optical flow evaluator.

class OpticalFlowEvaluator(max_flow=400.0, use_degrees=False, scale=1.0, epsilon=1e-06)[source]

Optical flow evaluator.

Initialize the optical flow evaluator.

Parameters:
  • max_flow (float, optional) – Maximum flow value. Defaults to 400.0.

  • use_degrees (bool, optional) – Whether to use degrees for angular error. Defaults to False.

  • scale (float, optional) – Scale factor for the optical flow. Defaults to 1.0.

  • epsilon (float, optional) – Epsilon value for numerical stability.

evaluate(metric)[source]

Evaluate predictions.

Returns a dict containing the raw data and a short description string containing a readable result.

Parameters:

metric (str) – Metric to use. See @property metric

Return type:

tuple[Dict[str, Union[float, int, Tensor]], str]

Returns:

metric_data, description tuple containing the metric data (dict with metric name and value) as well as a short string with shortened information.

Raises:
  • RuntimeError – if no data has been registered to be evaluated.

  • ValueError – if metric is not supported.

gather(gather_func)[source]

Accumulate predictions across processes.

Return type:

None

process_batch(prediction, groundtruth)[source]

Process a batch of data.

Parameters:
  • prediction (NDArrayNumber) – Prediction optical flow, in shape (N, H, W, 2).

  • groundtruth (NDArrayNumber) – Target optical flow, in shape (N, H, W, 2).

Return type:

None

reset()[source]

Reset evaluator for new round of evaluation.

Return type:

None

property metrics: list[str]

Supported metrics.