fruit_project.utils.metrics¶
Classes¶
Object Detection Confusion Matrix inspired by Ultralytics. |
Module Contents¶
- class fruit_project.utils.metrics.ConfusionMatrix(nc: int, conf: float = 0.25, iou_thres: float = 0.45)[source]¶
Object Detection Confusion Matrix inspired by Ultralytics.
- Parameters:
nc (int) – Number of classes.
conf (float) – Confidence threshold for detections.
iou_thres (float) – IoU threshold for matching.
- process_batch(detections: torch.Tensor, labels: torch.Tensor)[source]¶
Update the confusion matrix with a batch of detections and ground truths.
- Parameters:
detections (torch.Tensor) – Tensor of detections, shape [N, 6] (x1, y1, x2, y2, conf, class).
labels (torch.Tensor) – Tensor of ground truths, shape [M, 5] (class, x1, y1, x2, y2).