{"record":{"id":"9b30a5c975013235","repo":"roboflow/supervision","slug":"targets-must-have-shape-n-expected-target-cols","errorCode":null,"errorMessage":"Targets must have shape (N, {expected_target_cols}). Got {targets[0].shape} instead.","messagePattern":"Targets must have shape \\(N, (.+?)\\)\\. Got (.+?) instead\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/metrics/detection.py","lineNumber":216,"sourceCode":"            raise ValueError(\n                \"Predictions and targets must be lists of numpy arrays. \"\n                f\"Got {type(predictions[0])} and {type(targets[0])} instead.\"\n            )\n\n        expected_pred_cols = (\n            10 if metric_target == MetricTarget.ORIENTED_BOUNDING_BOXES else 6\n        )\n        expected_target_cols = (\n            9 if metric_target == MetricTarget.ORIENTED_BOUNDING_BOXES else 5\n        )\n\n        if predictions[0].shape[1] != expected_pred_cols:\n            raise ValueError(\n                f\"Predictions must have shape (N, {expected_pred_cols}). \"\n                f\"Got {predictions[0].shape} instead.\"\n            )\n        if targets[0].shape[1] != expected_target_cols:\n            raise ValueError(\n                f\"Targets must have shape (N, {expected_target_cols}). \"\n                f\"Got {targets[0].shape} instead.\"\n            )\n\n\ndef _split_detections_by_outcome(\n    predictions: Detections,\n    targets: Detections,\n    conf_threshold: float,\n    iou_threshold: float,\n    metric_target: MetricTarget = MetricTarget.BOXES,\n) -> tuple[Detections, Detections, Detections]:\n    \"\"\"\n    Split detections into true positives, false positives, and false negatives.\n\n    Matching follows the same attribution logic as\n    ``ConfusionMatrix.evaluate_detection_batch``:\n    - matches are computed globally across classes","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/metrics/detection.py#L198-L234","documentation":"Error \"Targets must have shape (N, {expected_target_cols}). Got {targets[0].shape} instead.\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/metrics/detection.py:216 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"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"}