roboflow/supervision · error · ValueError
from_inference() operates on a single result at a time.You c
Error message
from_inference() operates on a single result at a time.You can retrieve it like so: inference_result = model.infer(image)[0]
What it means
Inside Precision.compute()'s main matching branch, the code selects the IoU function by metric target: box_iou_batch for BOXES, mask_iou_batch for MASKS, oriented_box_iou_batch for ORIENTED_BOUNDING_BOXES. Any other MetricTarget value reaches the else-raise. With the current enum this is defensive dead code; it fires only on version skew or injected enum values.
Source
Thrown at src/supervision/key_points/core.py:428
```
```python
from supervision import _cv2 as cv2
import supervision as sv
from inference_sdk import InferenceHTTPClient
image = cv2.imread("<SOURCE_IMAGE_PATH>")
client = InferenceHTTPClient(
api_url="https://detect.roboflow.com",
api_key="<ROBOFLOW_API_KEY>"
)
result = client.infer(image, model_id="<POSE_MODEL_ID>")
key_points = sv.KeyPoints.from_inference(result)
```
"""
if isinstance(inference_result, list):
raise ValueError(
"from_inference() operates on a single result at a time."
"You can retrieve it like so: inference_result = model.infer(image)[0]"
)
if hasattr(inference_result, "dict"):
inference_result = inference_result.dict(exclude_none=True, by_alias=True)
elif hasattr(inference_result, "json"):
inference_result = inference_result.json()
if not inference_result.get("predictions"):
return cls.empty()
xy = []
confidence = []
class_id = []
class_names = []
for prediction in inference_result["predictions"]:
prediction_xy = []View on GitHub (pinned to 7f254d9784)
Solutions
- Reinstall/upgrade supervision so the enum and metric modules come from one version (pip install --force-reinstall supervision)
- Restrict metric_target to the three supported members
- Remove enum monkey-patches before computing metrics
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_IOU_TARGETS = {sv.MetricTarget.BOXES, sv.MetricTarget.MASKS, sv.MetricTarget.ORIENTED_BOUNDING_BOXES}
assert metric_target in SUPPORTED_IOU_TARGETS, f'{metric_target} has no IoU kernel here' Type guard
def has_iou_kernel(target: sv.MetricTarget) -> bool:
return target in {sv.MetricTarget.BOXES, sv.MetricTarget.MASKS, sv.MetricTarget.ORIENTED_BOUNDING_BOXES} Prevention
- Pin one supervision version per environment to avoid enum/kernel mismatch
- Smoke-test metric construction + a tiny update()/compute() before launching full evaluations
When it happens
Trigger: Running a supervision version where MetricTarget gained a member (e.g. a future target) that this Precision build does not handle — typically a mixed/partial install or a monkey-patched enum — while evaluating images with both predictions and targets.
Common situations: Partial upgrades, vendored/copied metric modules paired with a newer installed package, or custom enum extension experiments.
Related errors
- 2D boolean mask row count {mask.shape[0]} does not match obj
- 2D boolean mask column count {mask.shape[1]} does not match
- edges is a dict but class_id is None; KeyPoints must have cl
- No edges defined for class_id={class_id}.
- Cannot filter keypoints with a 2D boolean mask where rows ha
AI-assisted analysis of roboflow/supervision@7f254d9784 (2026-08-15).
Data as JSON: /api/errors/39c8cac2de0e6b03.
Report an issue: GitHub.