playground_metrics.metrics_helper

Usage

This module implements helpers used to compute metrics derived from the MeanAveragePrecisionMetric.

API doc

class playground_metrics.metrics_helper.mean_fbeta.MeanFBetaAtThresholds(beta, thresholds, **kwargs)[source]

Bases: object

Class to compute mean F-beta score (averaged and per class) at list of thresholds for detection task.

Notes

Special cases are resolved as following:

  • if no predictions neither ground truth, then f2 = 1 for all classes

  • if no predictions but there is a ground truth, f2 = 0 for all classes

  • if there are predictions, we compute f2 from precision and recall using MeanAveragePrecisionMetric

Parameters:
  • beta (int/float) – F-beta scoring parameter

  • thresholds (list/tuple of float) – List/tuple of similarity thresholds for which we consider a valid match between detection and ground truth. For example, [0.5, 0.7, 0.9].

  • **kwargs – kwargs to configure internal MeanAveragePrecisionMetric

Raises:

ValueError – If thresholds is not a list/tuple or if beta is not a positive float

score

Mean F-beta score computed by compute() from accumulated values

Type:

float

compute()[source]

Compute the F-beta score averaged over all classes and thresholds according to the accumulated values.

Returns:

mean F-beta at thresholds

Return type:

float

reset()[source]

Reset all intermediate and return values to their initial value.

If reset() is not called in-between two compute() call, the values returned by compute() will take into account the entire prediction stack, not just the predictions in-between the two compute() calls.

update(detections, ground_truths)[source]

Accumulate values necessary to compute mAP with detections and ground truths of a single image.

Arguments are same as in update()