{"record":{"id":"fcc203a00e5a1866","repo":"roboflow/supervision","slug":"expected-oriented-box-coordinates-to-contain-le","errorCode":null,"errorMessage":"Expected {ORIENTED_BOX_COORDINATES} to contain {len(detections) * 8} elements (N={len(detections)} detections x 8 coordinates), but got {obb_arr.size}. Each OBB must be stored as [x1, y1, x2, y2, x3, y3, x4, y4].","messagePattern":"Expected (.+?) to contain (.+?) elements \\(N=(.+?) detections x 8 coordinates\\), but got (.+?)\\. Each OBB must be stored as \\[x1, y1, x2, y2, x3, y3, x4, y4\\]\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/metrics/detection.py","lineNumber":154,"sourceCode":"        )\n\n    box_data: npt.NDArray[np.float32]\n    if metric_target == MetricTarget.ORIENTED_BOUNDING_BOXES:\n        obb = detections.data.get(ORIENTED_BOX_COORDINATES)\n        if obb is None:\n            if len(detections) > 0:\n                raise ValueError(\n                    \"ORIENTED_BOUNDING_BOXES requested, but \"\n                    f\"{ORIENTED_BOX_COORDINATES} is missing from detections.data\"\n                )\n            box_data = np.empty((0, 8), dtype=np.float32)\n        else:\n            obb_arr = np.asarray(obb, dtype=np.float32)\n            # Normalize (N, 4, 2) → (N, 8) as produced by from_ultralytics.\n            if obb_arr.ndim == 3 and obb_arr.shape[1:] == (4, 2):\n                obb_arr = obb_arr.reshape(-1, 8)\n            if obb_arr.size != len(detections) * 8:\n                raise ValueError(\n                    f\"Expected {ORIENTED_BOX_COORDINATES} to contain \"\n                    f\"{len(detections) * 8} elements \"\n                    f\"(N={len(detections)} detections x 8 coordinates), \"\n                    f\"but got {obb_arr.size}. \"\n                    \"Each OBB must be stored as [x1, y1, x2, y2, x3, y3, x4, y4].\"\n                )\n            box_data = obb_arr.reshape(-1, 8)\n    else:\n        box_data = np.asarray(detections.xyxy, dtype=np.float32)\n\n    arrays_to_concat = [\n        box_data,\n        np.expand_dims(detections.class_id.astype(np.float32), 1),\n    ]\n\n    if with_confidence:\n        if detections.confidence is None:\n            raise ValueError(","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/metrics/detection.py#L136-L172","documentation":"Error \"Expected {ORIENTED_BOX_COORDINATES} to contain {len(detections) * 8} elements (N={len(detections)} detections x 8 coordinates), but got {obb_arr.size}. Each OBB must be stored as [x1, y1, x2, y2, x3, y3, x4, y4].\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/metrics/detection.py:154 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Store each OBB as [x1, y1, x2, y2, x3, y3, x4, y4] so the data has exactly N * 8 elements.","Reshape the OBB array to (N, 8) or (N, 4, 2) consistently before assigning it to detections.data."],"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"}