From 19bf41781018c7aaee65ad1b328be3cd4635d910 Mon Sep 17 00:00:00 2001 From: LinasKo Date: Fri, 21 Jun 2024 15:38:21 +0300 Subject: [PATCH] Special case for REGION_TO_DESCRIPTION when nothing is detected --- supervision/detection/lmm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/supervision/detection/lmm.py b/supervision/detection/lmm.py index 9cd9e99a..e39e434f 100644 --- a/supervision/detection/lmm.py +++ b/supervision/detection/lmm.py @@ -165,6 +165,9 @@ def from_florence_2( result, str ), f"Expected string as result, got {type(result)}" + if result == "No object detected.": + return np.empty((0, 4), dtype=np.float32), np.array([]), None, None + pattern = re.compile(r"") match = pattern.search(result) assert (