roboflow/supervision · error · ValueError

Unsupported metric target for IoU calculation

Error message

Unsupported metric target for IoU calculation

What it means

Error "Unsupported metric target for IoU calculation" thrown in roboflow/supervision.

Source

Thrown at src/supervision/metrics/recall.py:283

                    prediction_confidence = np.asarray(
                        predictions.confidence, dtype=np.float32
                    )
                    if self._metric_target == MetricTarget.BOXES:
                        # BOXES target never yields CompactMask; narrow for mypy.
                        iou = box_iou_batch(
                            cast(npt.NDArray[np.number], target_contents),
                            cast(npt.NDArray[np.number], prediction_contents),
                        )
                    elif self._metric_target == MetricTarget.MASKS:
                        iou = mask_iou_batch(target_contents, prediction_contents)
                    elif self._metric_target == MetricTarget.ORIENTED_BOUNDING_BOXES:
                        # OBB target never yields CompactMask; narrow for mypy.
                        iou = oriented_box_iou_batch(
                            cast(npt.NDArray[np.number], target_contents),
                            cast(npt.NDArray[np.number], prediction_contents),
                        )
                    else:
                        raise ValueError(
                            "Unsupported metric target for IoU calculation"
                        )

                    # None keeps the matcher on its single-round fast path
                    # when no size bucket is scored.
                    target_scored_mask = (
                        target_size_mask
                        if size_category != ObjectSizeCategory.ANY
                        else None
                    )
                    matches, matched_target_indices = (
                        _match_detection_batch_with_target_indices(
                            prediction_class_ids,
                            target_class_ids,
                            iou,
                            iou_thresholds,
                            target_scored_mask=target_scored_mask,
                        )

View on GitHub (pinned to 7f254d9784)

Solutions

  1. Use a supported MetricTarget for IoU computation (e.g. BOXES or MASKS where implemented).
  2. For unsupported targets, compute IoU with box-based metrics instead.

When it happens

Trigger: Thrown at src/supervision/metrics/recall.py:283 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of roboflow/supervision@7f254d9784 (2026-08-15). Data as JSON: /api/errors/8da6498f7eeb16ca. Report an issue: GitHub.