Compare commits

..
3 changed files with 22 additions and 16 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
name = "supervision"
description = "A set of easy-to-use utils that will come in handy in any Computer Vision project"
license = { text = "MIT" }
version = "0.27.0.post0"
version = "0.27.0.post1"
readme = "README.md"
requires-python = ">=3.9"
authors = [
+10 -9
View File
@@ -2,12 +2,11 @@ from __future__ import annotations
from collections.abc import Iterator
from dataclasses import dataclass, field
from enum import Enum
import warnings
from functools import reduce
from typing import Any
import numpy as np
from deprecate import deprecated
from supervision.config import (
CLASS_NAME_DATA_FIELD,
@@ -818,11 +817,6 @@ class Detections:
)
@classmethod
@deprecated(
target=None,
deprecated_in="0.26.0",
remove_in="0.30.0",
)
def from_lmm(cls, lmm: LMM | str, result: str | dict, **kwargs: Any) -> Detections:
"""
!!! deprecated "Deprecated"
@@ -1201,6 +1195,14 @@ class Detections:
```
""" # noqa: E501
warnings.warn(
"`Detections.from_lmm` is deprecated since `supervision-0.26.0` "
"and will be removed in `supervision-0.30.0`. "
"Use `Detections.from_vlm` instead.",
FutureWarning,
stacklevel=2,
)
# filler logic mapping old from_lmm to new from_vlm
lmm_to_vlm = {
LMM.PALIGEMMA: VLM.PALIGEMMA,
@@ -1211,8 +1213,7 @@ class Detections:
LMM.GOOGLE_GEMINI_2_5: VLM.GOOGLE_GEMINI_2_5,
}
# (this works even if the LMM enum is wrapped by @deprecated)
if isinstance(lmm, Enum) and lmm.__class__.__name__ == "LMM":
if isinstance(lmm, LMM):
vlm = lmm_to_vlm[lmm]
elif isinstance(lmm, str):
+11 -6
View File
@@ -5,11 +5,11 @@ import base64
import io
import json
import re
import warnings
from enum import Enum
from typing import Any
import numpy as np
from deprecate import deprecated
from PIL import Image
from supervision.detection.utils.boxes import denormalize_boxes
@@ -17,15 +17,14 @@ from supervision.detection.utils.converters import polygon_to_mask, polygon_to_x
from supervision.validators import validate_resolution
@deprecated(
target=None,
deprecated_in="0.27.0",
remove_in="0.31.0",
)
class LMM(Enum):
"""
Enum specifying supported Large Multimodal Models (LMMs).
.. deprecated:: 0.27.0
`LMM` is deprecated and will be removed in `supervision-0.31.0`.
Use `VLM` instead.
Attributes:
PALIGEMMA: Google's PaliGemma vision-language model.
FLORENCE_2: Microsoft's Florence-2 vision-language model.
@@ -51,6 +50,12 @@ class LMM(Enum):
@classmethod
def from_value(cls, value: LMM | str) -> LMM:
warnings.warn(
"`LMM` is deprecated since `supervision-0.27.0` and will be removed in "
"`supervision-0.31.0`. Use `VLM` instead.",
FutureWarning,
stacklevel=2,
)
if isinstance(value, cls):
return value
if isinstance(value, str):