diff --git a/supervision/keypoint/core.py b/supervision/keypoint/core.py index f4fd4d0c..facab5f8 100644 --- a/supervision/keypoint/core.py +++ b/supervision/keypoint/core.py @@ -443,13 +443,15 @@ class KeyPoints: predictor = DefaultPredictor(cfg) result = predictor(image) - keypoints = sv.Keypoints.from_detectron2(result) + keypoints = sv.KeyPoints.from_detectron2(result) ``` """ - + if hasattr(detectron2_results["instances"], "pred_keypoints"): return cls( - xy=detectron2_results["instances"].pred_keypoints.cpu().numpy()[:, :, :2], + xy=detectron2_results["instances"] + .pred_keypoints.cpu() + .numpy()[:, :, :2], confidence=detectron2_results["instances"] .pred_keypoints.cpu() .numpy()[:, :, 2:], diff --git a/supervision/validators/__init__.py b/supervision/validators/__init__.py index 9a9fca8c..44cfcb98 100644 --- a/supervision/validators/__init__.py +++ b/supervision/validators/__init__.py @@ -62,8 +62,7 @@ def validate_keypoint_confidence(confidence: Any, n: int, m: int) -> None: if not is_valid: raise ValueError( f"confidence must be a 1D np.ndarray with shape {expected_shape}, but " - "got" - f"shape {actual_shape}" + f"got shape {actual_shape}" )