From fd1bb5b4b2c5fe505a32b7ba0612fa76c478e917 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Fri, 11 Jul 2025 16:49:58 +0300 Subject: [PATCH] Update supervision/detection/vlm.py Co-authored-by: Soumik Rakshit <19soumik.rakshit96@gmail.com> --- supervision/detection/vlm.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/supervision/detection/vlm.py b/supervision/detection/vlm.py index 6cfdb047..1267ca74 100644 --- a/supervision/detection/vlm.py +++ b/supervision/detection/vlm.py @@ -416,9 +416,19 @@ def from_google_gemini_2_5( resolution_wh: Tuple[int, int], ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, Optional[np.ndarray]]: """ - Parse and scale bounding boxes and masks from Google Gemini 2.5 style JSON output. - https://aistudio.google.com/ - https://ai.google.dev/gemini-api/docs/vision?lang=python + Parse and scale bounding boxes and masks from Google Gemini 2.5 style + [JSON output](https://ai.google.dev/gemini-api/docs/vision?lang=python). + + The JSON is expected to be enclosed in triple backticks with the format: + ```json + [ + { + "box_2d": [x1, y1, x2, y2], + "mask": "data:image/png;base64,...", + "label": "some class name"}, + ... + ] + ``` Args: result: String containing the JSON snippet enclosed by triple backticks.