{"record":{"id":"8da6498f7eeb16ca","repo":"roboflow/supervision","slug":"unsupported-metric-target-for-iou-calculation-8da649","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/recall.py","lineNumber":283,"sourceCode":"                    prediction_confidence = np.asarray(\n                        predictions.confidence, dtype=np.float32\n                    )\n                    if self._metric_target == MetricTarget.BOXES:\n                        # BOXES target never yields CompactMask; narrow for mypy.\n                        iou = box_iou_batch(\n                            cast(npt.NDArray[np.number], target_contents),\n                            cast(npt.NDArray[np.number], prediction_contents),\n                        )\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                        # OBB target never yields CompactMask; narrow for mypy.\n                        iou = oriented_box_iou_batch(\n                            cast(npt.NDArray[np.number], target_contents),\n                            cast(npt.NDArray[np.number], 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":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/metrics/recall.py#L265-L301","documentation":"Error \"Unsupported metric target for IoU calculation\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/metrics/recall.py:283 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported MetricTarget for IoU computation (e.g. BOXES or MASKS where implemented).","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"}