compute_metrics(gt_labels: ObjectDetectionLabels, pred_labels: ObjectDetectionLabels, num_classes: int, iou_thresh: float = 0.5) Tuple[ndarray, ndarray, ndarray][source]#

Compute per-class true positives, false positives, and false negatives.

Does the following:

  1. Spatially join ground truth (GT) boxes with predicted boxes.

  2. Compute intersection-overo-union (IoU) for each matched box-pair.

  3. Filter matches by iou_thresh.

  4. For each GT box >1 matches, keep only the max-IoU one.

  5. For each pred box >1 matches, keep only the max-IoU one.

  6. For each class, c, compute:

    1. True positives (TP) := #matches where GT class ID == c and pred class ID == c

    2. False positives := #preds where (class ID == c) minus TP

    3. False negatives := #GT where (class ID == c) minus TP

Return type

Tuple[ndarray, ndarray, ndarray]