Add deprecation warnings for keypoint validation utilities in supervision

This commit is contained in:
jirka 2026-01-27 16:38:39 +01:00 committed by Jirka Borovec
parent 224c7569a1
commit e36fbe061d
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
def validate_xyxy(xyxy: Any) -> None:
@ -66,6 +67,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))
@ -140,6 +150,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(