22
33from collections .abc import Iterator
44from dataclasses import dataclass , field
5- from enum import Enum
5+ import warnings
66from functools import reduce
77from typing import Any
88
99import numpy as np
10- from deprecate import deprecated
1110
1211from supervision .config import (
1312 CLASS_NAME_DATA_FIELD ,
@@ -818,11 +817,6 @@ def from_paddledet(cls, paddledet_result) -> Detections:
818817 )
819818
820819 @classmethod
821- @deprecated (
822- target = None ,
823- deprecated_in = "0.26.0" ,
824- remove_in = "0.30.0" ,
825- )
826820 def from_lmm (cls , lmm : LMM | str , result : str | dict , ** kwargs : Any ) -> Detections :
827821 """
828822 !!! deprecated "Deprecated"
@@ -1201,6 +1195,14 @@ def from_lmm(cls, lmm: LMM | str, result: str | dict, **kwargs: Any) -> Detectio
12011195 ```
12021196 """ # noqa: E501
12031197
1198+ warnings .warn (
1199+ "`Detections.from_lmm` is deprecated since `supervision-0.26.0` "
1200+ "and will be removed in `supervision-0.30.0`. "
1201+ "Use `Detections.from_vlm` instead." ,
1202+ FutureWarning ,
1203+ stacklevel = 2 ,
1204+ )
1205+
12041206 # filler logic mapping old from_lmm to new from_vlm
12051207 lmm_to_vlm = {
12061208 LMM .PALIGEMMA : VLM .PALIGEMMA ,
@@ -1211,8 +1213,7 @@ def from_lmm(cls, lmm: LMM | str, result: str | dict, **kwargs: Any) -> Detectio
12111213 LMM .GOOGLE_GEMINI_2_5 : VLM .GOOGLE_GEMINI_2_5 ,
12121214 }
12131215
1214- # (this works even if the LMM enum is wrapped by @deprecated)
1215- if isinstance (lmm , Enum ) and lmm .__class__ .__name__ == "LMM" :
1216+ if isinstance (lmm , LMM ):
12161217 vlm = lmm_to_vlm [lmm ]
12171218
12181219 elif isinstance (lmm , str ):
0 commit comments