{"record":{"id":"927429e2b54ec82e","repo":"roboflow/supervision","slug":"predictions-and-targets-must-be-lists-of-numpy-arr","errorCode":null,"errorMessage":"Predictions and targets must be lists of numpy arrays. Got {type(predictions[0])} and {type(targets[0])} instead.","messagePattern":"Predictions and targets must be lists of numpy arrays\\. Got (.+?) and (.+?) instead\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/metrics/detection.py","lineNumber":198,"sourceCode":"\ndef _validate_input_tensors(\n    predictions: list[npt.NDArray[np.float32]],\n    targets: list[npt.NDArray[np.float32]],\n    metric_target: MetricTarget = MetricTarget.BOXES,\n) -> None:\n    \"\"\"\n    Checks for shape consistency of input tensors.\n    \"\"\"\n    if len(predictions) != len(targets):\n        raise ValueError(\n            f\"Number of predictions ({len(predictions)}) and\"\n            f\"targets ({len(targets)}) must be equal.\"\n        )\n    if len(predictions) > 0:\n        if not isinstance(predictions[0], np.ndarray) or not isinstance(\n            targets[0], np.ndarray\n        ):\n            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(","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/metrics/detection.py#L180-L216","documentation":"Error \"Predictions and targets must be lists of numpy arrays. Got {type(predictions[0])} and {type(targets[0])} instead.\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/metrics/detection.py:198 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass predictions and targets as lists of numpy arrays (one array per image).","Convert Detections to arrays with the appropriate helper, or convert your data to np.ndarray lists first."],"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"}