roboflow/supervision · error · ValueError
corners must have shape (N, 4, 2); got {c.shape}
Error message
corners must have shape (N, 4, 2); got {c.shape} What it means
Error "corners must have shape (N, 4, 2); got {c.shape}" thrown in roboflow/supervision.
Source
Thrown at src/supervision/detection/core.py:3318
if total_area > 0:
confidence = np.array(
[float(np.dot(areas, confidences) / total_area)],
dtype=np.float32,
)
else:
confidence = winner.confidence
else:
confidence = None
# OBB path: merge corners via winner-angle projection, then derive xyxy
# from the merged OBB so both stay consistent.
has_obb = ORIENTED_BOX_COORDINATES in winner.data
if has_obb:
corners_list = []
for det in detections:
c = np.asarray(det.data[ORIENTED_BOX_COORDINATES])
if c.ndim != 3 or c.shape[1:] != (4, 2):
raise ValueError(f"corners must have shape (N, 4, 2); got {c.shape}")
corners_list.append(c[0].reshape(4, 2))
merged_corners = _merge_obb_corners(corners_list)
xyxy = xyxyxyxy_to_xyxy(merged_corners[np.newaxis])
data = {**winner.data, ORIENTED_BOX_COORDINATES: merged_corners[np.newaxis]}
else:
# AABB path: union bounding box across all group members
xyxy = np.array(
[
[
all_xyxy[:, 0].min(),
all_xyxy[:, 1].min(),
all_xyxy[:, 2].max(),
all_xyxy[:, 3].max(),
]
],
dtype=np.float32,
)
data = winner.dataView on GitHub (pinned to 7f254d9784)
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.
When it happens
Trigger: Thrown at src/supervision/detection/core.py:3318 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/73aaed5cec11b7c9.
Report an issue: GitHub.