Skip to content

Commit 5af13c0

Browse files
committed
add Qwen3-VL prompting example
1 parent e0edb28 commit 5af13c0

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

supervision/detection/core.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,36 @@ def from_lmm(cls, lmm: LMM | str, result: str | dict, **kwargs: Any) -> Detectio
951951
detections.class_id
952952
# array([0, 1])
953953
```
954+
955+
!!! example "Qwen3-VL"
956+
957+
```python
958+
import supervision as sv
959+
960+
qwen_3_vl_result = \"\"\"```json
961+
[
962+
{"bbox_2d": [139, 768, 315, 954], "label": "cat"},
963+
{"bbox_2d": [366, 679, 536, 849], "label": "dog"}
964+
]
965+
```\"\"\"
966+
detections = sv.Detections.from_lmm(
967+
sv.LMM.QWEN_3_VL,
968+
qwen_3_vl_result,
969+
resolution_wh=(1000, 1000),
970+
classes=['cat', 'dog'],
971+
)
972+
detections.xyxy
973+
# array([[139., 768., 315., 954.], [366., 679., 536., 849.]])
974+
975+
detections.class_id
976+
# array([0, 1])
977+
978+
detections.data
979+
# {'class_name': array(['cat', 'dog'], dtype='<U10')}
980+
981+
detections.class_id
982+
# array([0, 1])
983+
```
954984
955985
!!! example "Gemini 2.0"
956986
```python
@@ -1329,6 +1359,36 @@ def from_vlm(cls, vlm: VLM | str, result: str | dict, **kwargs: Any) -> Detectio
13291359
detections.class_id
13301360
# array([0, 1])
13311361
```
1362+
1363+
!!! example "Qwen3-VL"
1364+
1365+
```python
1366+
import supervision as sv
1367+
1368+
qwen_3_vl_result = \"\"\"```json
1369+
[
1370+
{"bbox_2d": [139, 768, 315, 954], "label": "cat"},
1371+
{"bbox_2d": [366, 679, 536, 849], "label": "dog"}
1372+
]
1373+
```\"\"\"
1374+
detections = sv.Detections.from_vlm(
1375+
sv.VLM.QWEN_3_VL,
1376+
qwen_3_vl_result,
1377+
resolution_wh=(1000, 1000),
1378+
classes=['cat', 'dog'],
1379+
)
1380+
detections.xyxy
1381+
# array([[139., 768., 315., 954.], [366., 679., 536., 849.]])
1382+
1383+
detections.class_id
1384+
# array([0, 1])
1385+
1386+
detections.data
1387+
# {'class_name': array(['cat', 'dog'], dtype='<U10')}
1388+
1389+
detections.class_id
1390+
# array([0, 1])
1391+
```
13321392
13331393
!!! example "Gemini 2.0"
13341394
```python

0 commit comments

Comments
 (0)