fruit_project.utils.metrics¶
Classes¶
Object Detection Confusion Matrix inspired by Ultralytics. |
|
Mean Average Precision evaluator for RT-DETRv2 - adapted for fruit_project. |
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) None [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).
- class fruit_project.utils.metrics.MAPEvaluator(image_processor, device, threshold: float = 0.0, id2label: Dict[int, str] | None = None)[source]¶
Mean Average Precision evaluator for RT-DETRv2 - adapted for fruit_project.
- collect_targets(targets, image_sizes)[source]¶
Process ground truth targets - now handles HF-processed format.