supervision
supervision copied to clipboard
from_vlm(VLM.DEEPSEEK_VL_2, ...) accepts non-positive resolution_wh and returns mirrored/zero boxes
Search before asking
- [x] I have searched the issues and discussions and found no similar bug report.
Bug
Every other VLM parser in supervision/detection/vlm.py rejects a non-positive resolution_wh with ValueError: Both dimensions in resolution must be positive. from_deepseek_vl_2 unpacks it directly (width, height = resolution_wh), so a bad value silently produces negative or all-zero boxes instead of an error.
Expected: same ValueError as PaliGemma / Qwen / Kosmos-2.
Actual: boxes like [[-192.19, 96.10, -64.06, 192.19]] for (-640, 480), and [[0, 0, 0, 0]] for (0, 0).
Probably just calling _validate_resolution(resolution_wh) at the top of from_deepseek_vl_2, like the other parsers.
Environment
- supervision 0.32.0.dev0 (develop @ 887a7ae9)
- Python 3.12, Windows 11
Minimal Reproducible Example
import supervision as sv
text = "<|ref|>cat<|/ref|><|det|>[[100, 200, 300, 400]]<|/det|>"
print(sv.Detections.from_vlm(sv.VLM.DEEPSEEK_VL_2, text, resolution_wh=(-640, 480)).xyxy)
# [[-192.1922 96.0961 -64.064064 192.1922 ]]
print(sv.Detections.from_vlm(sv.VLM.PALIGEMMA, "<loc0000><loc0000><loc0512><loc0512> cat", resolution_wh=(-640, 480)))
# ValueError: Both dimensions in resolution must be positive. Got (-640, 480).
Are you willing to submit a PR?
- [x] Yes I'd like to help by submitting a PR!