autodistill / autodistill-grounded-sam

GroundedSAM Base Model plugin for Autodistill
https://docs.autodistill.com
Apache License 2.0
44 stars 8 forks source link

Add overriding of GroundingDINO bboxes with calculated masks bboxes #10

Open Youho99 opened 5 months ago

Youho99 commented 5 months ago

According to the pull request https://github.com/roboflow/supervision/pull/1086

This modification makes it possible to recalculate the bboxes of the masks in order to have a bbox relating to the mask.

Basically, the bbox is the one predicted by autodistill_grounding_dino. Then autodistill_grounded_sam uses this bbox to predict a mask. But the bbox does not correspond directly to the mask.

I therefore use mask_to_xyxy() of supervision to recalculate the bboxes relating to the masks.