diff --git a/docs/metrics/detection.md b/docs/metrics/detection.md new file mode 100644 index 00000000..d0fa4615 --- /dev/null +++ b/docs/metrics/detection.md @@ -0,0 +1,3 @@ +## ConfusionMatrix + +:::supervision.metrics.detection.ConfusionMatrix diff --git a/supervision/metrics/detection.py b/supervision/metrics/detection.py index 218f3d5f..ce75ff1d 100644 --- a/supervision/metrics/detection.py +++ b/supervision/metrics/detection.py @@ -11,6 +11,15 @@ from supervision.detection.utils import box_iou_batch @dataclass class ConfusionMatrix: + """ + Data class containing information about classification results in form of a confusion matrix. + Attributes: + matrix: An array of shape (len(classes) + 1, len(classes) + 1) containing the number of TP, FP, FN and TN for each class. + classes: all known class names. + conf_threshold: detection confidence threshold between 0 and 1. Detections with lower confidence will be excluded from the matrix. + iou_threshold: detection iou threshold between 0 and 1. Detections with lower iou will be classified as FP. + """ + matrix: np.ndarray classes: List[str] conf_threshold: float