Fix #489: use public supervision API for annotation (works on 0.18-0.29) - #614
prawnsgupta wants to merge 3 commits into
Conversation
|
Hi @prawnsgupta , I have just tested your PR and it works nicely! However, the GUI has been refactored and therefore your changes conflict. Could you resolve those conflicts? Basically, your changes from |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks for testing it, @dpascualhe, and sorry for the slow turnaround. The conflicts are resolved. The branch is merged with current The change is down to two files:
Verified locally on Python 3.10 against the locked I think it's ready to be merged. Let me know for any other changes. |
Fixes #489.
Problem.
tabs/dataset_viewer.pyimportedBoxAnnotatorfrom the internal pathsupervision.detection.annotate, which was removed in supervision ≥ 0.22, causingModuleNotFoundErrorfor anyone whose environment resolves a supervision newer than the pinned 0.18.0. While investigating I also found that the sharedutils/image.py::draw_detections()helper (used bytabs/inference.py) crashes on modern supervision because its palette fallback callssv.Color.DEFAULT/sv.ColorPalette.default(), both of which raiseAttributeErroron recent versions (and are not caught by itsexcept TypeError).Fix.
utils/image.py: usesv.ColorPalette.DEFAULT(available on old and new supervision) and keep the existing old-API/new-APItry/except, so bothBoxAnnotator-combined (≤0.21) andBoxAnnotator+LabelAnnotator(≥0.22) paths work.tabs/dataset_viewer.py: remove the broken inline annotation and delegate todraw_detections(), matching howtabs/inference.pyalready renders detections.Verification. Tested end-to-end against supervision 0.18.0 (current pin) and 0.29.1 (latest); both render boxes/labels and return a valid
uint8ndarray. No dependency changes required — confirmednumpy 1.26.4(project pin) coexists with modern supervision.