Add deprecation warnings for annotation utilities and update dependencies

(cherry picked from commit 219161f1f9)
This commit is contained in:
jirka 2026-01-27 16:00:47 +01:00 committed by Jirka Borovec
parent 845e47f472
commit 3997182ee7
2 changed files with 20 additions and 0 deletions

View File

@ -57,6 +57,7 @@ dependencies = [
"requests>=2.26",
"scipy>=1.10",
"tqdm>=4.62.3",
"pyDeprecate>=0.4.0,<0.5"
]
optional-dependencies.metrics = [
"pandas>=2",

View File

@ -5,6 +5,7 @@ import cv2
import numpy as np
import numpy.typing as npt
from PIL import Image
from deprecate import deprecated
from supervision.draw.base import ImageType
@ -36,6 +37,15 @@ def ensure_cv2_image_for_class_method(
return wrapper
@deprecated(
target=ensure_cv2_image_for_class_method,
deprecated_in="0.27.0",
remove_in="0.30.0",
)
def ensure_cv2_image_for_annotation(annotate_func):
pass
def ensure_cv2_image_for_standalone_function(
image_processing_fun: Callable[..., ImageType],
) -> Callable[..., ImageType]:
@ -87,6 +97,15 @@ def ensure_pil_image_for_class_method(
return wrapper
@deprecated(
target=ensure_pil_image_for_class_method,
deprecated_in="0.27.0",
remove_in="0.30.0",
)
def ensure_pil_image_for_annotation(annotate_func):
pass
def images_to_cv2(images: list[ImageType]) -> list[npt.NDArray[np.uint8]]:
"""
Converts images provided either as Pillow images or OpenCV