roboflow/supervision · error · ValueError

ORIENTED_BOUNDING_BOXES requested, but {ORIENTED_BOX_COORDIN

Error message

ORIENTED_BOUNDING_BOXES requested, but {ORIENTED_BOX_COORDINATES} is missing from detections.data

What it means

Error "ORIENTED_BOUNDING_BOXES requested, but {ORIENTED_BOX_COORDINATES} is missing from detections.data" thrown in roboflow/supervision.

Source

Thrown at src/supervision/metrics/detection.py:143

        ... )
        >>> tensor_obb.shape
        (1, 9)

        ```
    """
    _assert_supported_target(metric_target)

    if detections.class_id is None:
        raise ValueError(
            "ConfusionMatrix can only be calculated for Detections with class_id"
        )

    box_data: npt.NDArray[np.float32]
    if metric_target == MetricTarget.ORIENTED_BOUNDING_BOXES:
        obb = detections.data.get(ORIENTED_BOX_COORDINATES)
        if obb is None:
            if len(detections) > 0:
                raise ValueError(
                    "ORIENTED_BOUNDING_BOXES requested, but "
                    f"{ORIENTED_BOX_COORDINATES} is missing from detections.data"
                )
            box_data = np.empty((0, 8), dtype=np.float32)
        else:
            obb_arr = np.asarray(obb, dtype=np.float32)
            # Normalize (N, 4, 2) → (N, 8) as produced by from_ultralytics.
            if obb_arr.ndim == 3 and obb_arr.shape[1:] == (4, 2):
                obb_arr = obb_arr.reshape(-1, 8)
            if obb_arr.size != len(detections) * 8:
                raise ValueError(
                    f"Expected {ORIENTED_BOX_COORDINATES} to contain "
                    f"{len(detections) * 8} elements "
                    f"(N={len(detections)} detections x 8 coordinates), "
                    f"but got {obb_arr.size}. "
                    "Each OBB must be stored as [x1, y1, x2, y2, x3, y3, x4, y4]."
                )
            box_data = obb_arr.reshape(-1, 8)

View on GitHub (pinned to 7f254d9784)

Solutions

  1. Add ORIENTED_BOX_COORDINATES to detections.data with shape (N, 4, 2) before evaluating with MetricTarget.ORIENTED_BOUNDING_BOXES.
  2. Load the dataset with is_obb=True or populate the OBB data manually.

When it happens

Trigger: Thrown at src/supervision/metrics/detection.py:143 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/3216e5b8609e23e0. Report an issue: GitHub.