compute_metrics#
- compute_metrics(gt_labels: ObjectDetectionLabels, pred_labels: ObjectDetectionLabels, num_classes: int, iou_thresh: float = 0.5) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray] [source]#
Compute per-class true positives, false positives, and false negatives.
Does the following:
Spatially join ground truth (GT) boxes with predicted boxes.
Compute intersection-overo-union (IoU) for each matched box-pair.
Filter matches by
iou_thresh
.For each GT box >1 matches, keep only the max-IoU one.
For each pred box >1 matches, keep only the max-IoU one.
For each class, c, compute:
True positives (TP) := #matches where GT class ID == c and pred class ID == c
False positives := #preds where (class ID == c) minus TP
False negatives := #GT where (class ID == c) minus TP
- Parameters:
gt_labels (ObjectDetectionLabels) –
pred_labels (ObjectDetectionLabels) –
num_classes (int) –
iou_thresh (float) –
- Return type: