discopat.metrics

Functions

compute_ap(groundtruths, predictions, ...)

Average Precision (AP) at a given IoU/IoMean/whatever threshold.

compute_iomean(box1, box2[, eps])

Compute IoMean between two boxes.

compute_iou(box1, box2[, eps])

Compute IoU between two boxes.

compute_iou_matrix(groundtruths, predictions)

Compute IoU matrix between groundtruths and predictions.

discopat.metrics.compute_ap(groundtruths, predictions, threshold, localization_criterion)[source]

Average Precision (AP) at a given IoU/IoMean/whatever threshold.

Parameters:
  • groundtruths (list)

  • predictions (list)

  • threshold (float)

  • localization_criterion (str)

Return type:

float

discopat.metrics.compute_iomean(box1, box2, eps=1e-10)[source]

Compute IoMean between two boxes.

Parameters:
  • box1 (list) – [x1, y1, x2, y2, (score)],

  • box2 (list) – [x1, y1, x2, y2, (score)],

  • eps (float) – Safety term for the denominator.

Returns:

The IoMean (float).

Return type:

float

discopat.metrics.compute_iou(box1, box2, eps=1e-10)[source]

Compute IoU between two boxes.

Parameters:
  • box1 (list) – [x1, y1, x2, y2, (score)],

  • box2 (list) – [x1, y1, x2, y2, (score)],

  • eps (float) – Safety term for the denominator.

Returns:

The IoU (float).

Return type:

float

discopat.metrics.compute_iou_matrix(groundtruths, predictions)[source]

Compute IoU matrix between groundtruths and predictions.

Parameters:
  • groundtruths (list) – list of boxes in the format [x1, y1, x2, y2],

  • predictions (list) – list of boxes in the format [x1, y1, x2, y2, score].

Returns:

A matrix where every columns corresponds to a groundtruth, every row to a prediction, and the coefficient at (i, j) is the iou between predictions[i] and groundtruth[j].

Return type:

list