{"record":{"id":"7bf3c78314fa2d6f","repo":"roboflow/supervision","slug":"metrictarget-masks-is-not-currently-supported-for","errorCode":null,"errorMessage":"MetricTarget.MASKS is not currently supported for ConfusionMatrix.","messagePattern":"MetricTarget\\.MASKS is not currently supported for ConfusionMatrix\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/metrics/detection.py","lineNumber":34,"sourceCode":")\n\nfrom supervision.config import ORIENTED_BOX_COORDINATES\nfrom supervision.dataset.core import DetectionDataset\nfrom supervision.detection.core import Detections\nfrom supervision.detection.utils.iou_and_nms import (\n    box_iou_batch,\n    oriented_box_iou_batch,\n)\nfrom supervision.metrics.core import MetricTarget\nfrom supervision.metrics.utils.matching import _greedy_match\n\nif TYPE_CHECKING:\n    from matplotlib.figure import Figure\n\n\ndef _assert_supported_target(metric_target: MetricTarget) -> None:\n    if metric_target == MetricTarget.MASKS:\n        raise ValueError(\n            \"MetricTarget.MASKS is not currently supported for ConfusionMatrix.\"\n        )\n\n\ndef _validated_class_ids(\n    values: npt.NDArray[np.float32],\n    num_classes: int,\n    role: str,\n) -> npt.NDArray[np.int64]:\n    \"\"\"Return class ids that are safe to use as confusion-matrix indexes.\"\"\"\n    if values.size == 0:\n        return np.asarray(values, dtype=np.int64)\n\n    finite = np.isfinite(values)\n    integral = values == np.floor(values)\n    if not np.all(finite & integral):\n        raise ValueError(f\"{role} class ids must be finite integers.\")\n","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/metrics/detection.py#L16-L52","documentation":"Error \"MetricTarget.MASKS is not currently supported for ConfusionMatrix.\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/metrics/detection.py:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["ConfusionMatrix does not support MetricTarget.MASKS; use MetricTarget.BOXES or ORIENTED_BOUNDING_BOXES.","To evaluate masks, use MeanAveragePrecision/MeanAverageRecall with MetricTarget.MASKS instead."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}