vis4d.eval.common.cls

Image classification evaluator.

Classes

ClassificationEvaluator()

Multi-class classification evaluator.

class ClassificationEvaluator[source]

Multi-class classification evaluator.

Initialize the classification evaluator.

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 the metric is not supported.

gather(gather_func)[source]

Accumulate predictions across processes.

Return type:

None

process_batch(prediction, groundtruth)[source]

Process a batch of predictions and groundtruths.

Parameters:
  • prediction (ArrayLike) – Prediction, in shape (N, C).

  • groundtruth (ArrayLike) – Groundtruth, in shape (N, ).

reset()[source]

Reset evaluator for new round of evaluation.

Return type:

None

property metrics: list[str]

Supported metrics.