roboflow/supervision · error · ValueError
Targets must have shape (N, {expected_target_cols}). Got {ta
Error message
Targets must have shape (N, {expected_target_cols}). Got {targets[0].shape} instead. What it means
Error "Targets must have shape (N, {expected_target_cols}). Got {targets[0].shape} instead." thrown in roboflow/supervision.
Source
Thrown at src/supervision/metrics/detection.py:216
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]:
"""
Split detections into true positives, false positives, and false negatives.
Matching follows the same attribution logic as
``ConfusionMatrix.evaluate_detection_batch``:
- matches are computed globally across classesView on GitHub (pinned to 7f254d9784)
Solutions
- Shape each target array as (N, expected_target_cols): box columns plus class id.
- Verify you are passing targets, not predictions, and that each row contains all required columns.
When it happens
Trigger: Thrown at src/supervision/metrics/detection.py:216 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/9b30a5c975013235.
Report an issue: GitHub.