{"record":{"id":"4b1ea50b269b881e","repo":"roboflow/supervision","slug":"unsupported-metric-target-for-iou-calculation-4b1ea5","errorCode":null,"errorMessage":"Unsupported metric target for IoU calculation","messagePattern":"Unsupported metric target for IoU calculation","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/metrics/precision.py","lineNumber":258,"sourceCode":"                            \"Precision metric requires `confidence` on predictions.\"\n                        )\n                    prediction_class_ids = np.asarray(\n                        predictions.class_id, dtype=np.int32\n                    )\n                    target_class_ids = np.asarray(targets.class_id, dtype=np.int32)\n                    prediction_confidence = np.asarray(\n                        predictions.confidence, dtype=np.float32\n                    )\n                    if self._metric_target == MetricTarget.BOXES:\n                        iou = box_iou_batch(target_contents, prediction_contents)\n                    elif self._metric_target == MetricTarget.MASKS:\n                        iou = mask_iou_batch(target_contents, prediction_contents)\n                    elif self._metric_target == MetricTarget.ORIENTED_BOUNDING_BOXES:\n                        iou = oriented_box_iou_batch(\n                            target_contents, prediction_contents\n                        )\n                    else:\n                        raise ValueError(\n                            \"Unsupported metric target for IoU calculation\"\n                        )\n\n                    # None keeps the matcher on its single-round fast path\n                    # when no size bucket is scored.\n                    target_scored_mask = (\n                        target_size_mask\n                        if size_category != ObjectSizeCategory.ANY\n                        else None\n                    )\n                    matches, matched_target_indices = (\n                        _match_detection_batch_with_target_indices(\n                            prediction_class_ids,\n                            target_class_ids,\n                            iou,\n                            iou_thresholds,\n                            target_scored_mask=target_scored_mask,\n                        )","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/metrics/precision.py#L240-L276","documentation":"Error \"Unsupported metric target for IoU calculation\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/metrics/precision.py:258 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported MetricTarget for IoU computation (e.g. BOXES).","For unsupported targets, compute IoU with box-based metrics 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"}