Add deprecation warnings for keypoint validation utilities in supervision

(cherry picked from commit e36fbe061d)
This commit is contained in:
jirka 2026-01-27 16:38:39 +01:00 committed by Jirka Borovec
parent e275a239ad
commit eddcf3d09f
1 changed files with 21 additions and 0 deletions

View File

@ -1,6 +1,7 @@
from typing import Any
import numpy as np
from deprecate import deprecated
from supervision.detection.compact_mask import CompactMask
from supervision.utils.internal import warn_deprecated
@ -101,6 +102,15 @@ def validate_key_point_confidence(confidence: Any, n: int, m: int) -> None:
)
@deprecated(
target=validate_key_point_confidence,
deprecated_in="0.27.0",
remove_in="0.30.0",
)
def validate_keypoint_confidence(confidence: Any, n: int, m: int) -> None:
pass
def validate_tracker_id(tracker_id: Any, n: int) -> None:
expected_shape = f"({n},)"
actual_shape = str(getattr(tracker_id, "shape", None))
@ -175,6 +185,17 @@ def validate_key_points_fields(
validate_data(data, n)
@deprecated(
target=validate_key_points_fields,
deprecated_in="0.27.0",
remove_in="0.30.0",
)
def validate_keypoints_fields(
xy: Any, class_id: Any, confidence: Any, data: dict[str, Any]
) -> None:
pass
def validate_resolution(resolution: Any) -> tuple[int, int]:
if not (isinstance(resolution, tuple) and len(resolution) == 2):
raise ValueError(