
Compute a confusion matrix from SAHI predictions + COCO ground truth
Source:R/prediction.R
confusion_matrix.RdFor each image, greedily match predicted boxes to ground-truth boxes by IoU
(highest-scoring prediction matches first). Predictions that match a GT box
with IoU >= iou_threshold contribute a (gt_class, pred_class) cell.
Unmatched predictions land in the "background" row (false positives);
unmatched GT boxes land in the "background" column (false negatives).
Arguments
- predictions
Tibble of predictions with
image_id,category_id,score,xmin,ymin,width,height(thepredictionselement ofevaluate_model_sahi()output works directly).- annotation_json
Path to the COCO annotation JSON the predictions were produced against.
- iou_threshold
Minimum IoU for a prediction to count as matching a GT box (default 0.5).
- score_threshold
Filter predictions below this score before matching (default 0; keep all).