roboflow/supervision · error · ValueError

Predictions must have shape (N, {expected_pred_cols}). Got {

Error message

Predictions must have shape (N, {expected_pred_cols}). Got {predictions[0].shape} instead.

What it means

Error "Predictions must have shape (N, {expected_pred_cols}). Got {predictions[0].shape} instead." thrown in roboflow/supervision.

Source

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

        )
    if len(predictions) > 0:
        if not isinstance(predictions[0], np.ndarray) or not isinstance(
            targets[0], np.ndarray
        ):
            raise ValueError(
                "Predictions and targets must be lists of numpy arrays. "
                f"Got {type(predictions[0])} and {type(targets[0])} instead."
            )

        expected_pred_cols = (
            10 if metric_target == MetricTarget.ORIENTED_BOUNDING_BOXES else 6
        )
        expected_target_cols = (
            9 if metric_target == MetricTarget.ORIENTED_BOUNDING_BOXES else 5
        )

        if predictions[0].shape[1] != expected_pred_cols:
            raise ValueError(
                f"Predictions must have shape (N, {expected_pred_cols}). "
                f"Got {predictions[0].shape} instead."
            )
        if targets[0].shape[1] != expected_target_cols:
            raise ValueError(
                f"Targets must have shape (N, {expected_target_cols}). "
                f"Got {targets[0].shape} instead."
            )


def _split_detections_by_outcome(
    predictions: Detections,
    targets: Detections,
    conf_threshold: float,
    iou_threshold: float,
    metric_target: MetricTarget = MetricTarget.BOXES,
) -> tuple[Detections, Detections, Detections]:
    """

View on GitHub (pinned to 7f254d9784)

Solutions

  1. Shape each prediction array as (N, expected_pred_cols): box columns plus confidence/class as required.
  2. Verify you are passing predictions, not targets, and that each row contains all required columns.

When it happens

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