From d3db15fcd0c08e33b87d89644f5e3ed8d67fd03b Mon Sep 17 00:00:00 2001 From: LinasKo Date: Fri, 5 Jul 2024 13:14:27 +0300 Subject: [PATCH] Fix bug where florence2 returns normalized xyxy regions --- supervision/detection/lmm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/supervision/detection/lmm.py b/supervision/detection/lmm.py index e39e434f..61b06ee1 100644 --- a/supervision/detection/lmm.py +++ b/supervision/detection/lmm.py @@ -174,7 +174,9 @@ def from_florence_2( match is not None ), f"Expected string to end in location tags, but got {result}" + w, h = resolution_wh xyxy = np.array([match.groups()], dtype=np.float32) + xyxy *= np.array([w, h, w, h]) / 1000 result_string = result[: match.start()] labels = np.array([result_string]) return xyxy, labels, None, None