IDEA-Research / GroundingDINO

[ECCV 2024] Official implementation of the paper "Grounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detection"
https://arxiv.org/abs/2303.05499
Apache License 2.0
6.83k stars 693 forks source link

fix Supervision depreciation of BoxAnnotator #342

Closed ethanlee928 closed 4 months ago

ethanlee928 commented 5 months ago

Saw a warning when calling annotate: SupervisionWarnings: annotate is deprecated: BoxAnnotator is deprecated and will be removed in supervision-0.22.0. Use BoundingBoxAnnotator and LabelAnnotator instead

Fixed by removing BoxAnnotator and use BoundingBoxAnnotator and LabelAnnotator as instructed by the warning. And based on supervision release note, BoundingBoxAnnotator is added in version 0.15.0 .

Please review. Thank you!

ethanlee928 commented 4 months ago

@ethanlee928

It seems there's been some confusion with version updates and the renaming of classes. Based latest information, BoundingBoxAnnotator has been renamed to BoxAnnotator and will be removed in future versions. Therefore, you should use BoxAnnotator instead of BoundingBoxAnnotator. Here is the corrected code:

bbox_annotator = sv.BoxAnnotator(color_lookup=sv.ColorLookup.INDEX)

With this update, your code will comply with the latest library standards, ensuring backward compatibility.

image

This PR can fix the following error:

TypeError: BoxAnnotator.annotate() got an unexpected keyword argument 'labels'

Thank you for your PR.

@pg56714 Thanks for providing the latest information, I've updated the PR based on your suggestion.

ethanlee928 commented 4 months ago

@SkalskiP Friendly ping to see if you had a chance to look at this PR related to Supervision. Appreciate any feedback when you get a moment. Thanks!

SkalskiP commented 4 months ago

Hi @ethanlee928 👋🏻, I did not know this PR existed. Looks good. Thanks a lot for the help in migrating from the old to the new supervision API.