{"record":{"id":"73aaed5cec11b7c9","repo":"roboflow/supervision","slug":"corners-must-have-shape-n-4-2-got-c-shape","errorCode":null,"errorMessage":"corners must have shape (N, 4, 2); got {c.shape}","messagePattern":"corners must have shape \\(N, 4, 2\\); got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/detection/core.py","lineNumber":3318,"sourceCode":"        if total_area > 0:\n            confidence = np.array(\n                [float(np.dot(areas, confidences) / total_area)],\n                dtype=np.float32,\n            )\n        else:\n            confidence = winner.confidence\n    else:\n        confidence = None\n\n    # OBB path: merge corners via winner-angle projection, then derive xyxy\n    # from the merged OBB so both stay consistent.\n    has_obb = ORIENTED_BOX_COORDINATES in winner.data\n    if has_obb:\n        corners_list = []\n        for det in detections:\n            c = np.asarray(det.data[ORIENTED_BOX_COORDINATES])\n            if c.ndim != 3 or c.shape[1:] != (4, 2):\n                raise ValueError(f\"corners must have shape (N, 4, 2); got {c.shape}\")\n            corners_list.append(c[0].reshape(4, 2))\n        merged_corners = _merge_obb_corners(corners_list)\n        xyxy = xyxyxyxy_to_xyxy(merged_corners[np.newaxis])\n        data = {**winner.data, ORIENTED_BOX_COORDINATES: merged_corners[np.newaxis]}\n    else:\n        # AABB path: union bounding box across all group members\n        xyxy = np.array(\n            [\n                [\n                    all_xyxy[:, 0].min(),\n                    all_xyxy[:, 1].min(),\n                    all_xyxy[:, 2].max(),\n                    all_xyxy[:, 3].max(),\n                ]\n            ],\n            dtype=np.float32,\n        )\n        data = winner.data","sourceCodeStart":3300,"sourceCodeEnd":3336,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/detection/core.py#L3300-L3336","documentation":"Error \"corners must have shape (N, 4, 2); got {c.shape}\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/detection/core.py:3318 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass corners as an array of shape (N, 4, 2): N boxes, each with 4 corner points of (x, y) coordinates.","If you have a flat (N, 8) array, reshape it with corners.reshape(-1, 4, 2) before calling."],"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"}