Skip to content

Commit

Permalink
Merge pull request IDEA-Research#342 from ethanlee928/main
Browse files Browse the repository at this point in the history
fix Supervision depreciation of BoxAnnotator
  • Loading branch information
SkalskiP authored Jul 24, 2024
2 parents e27a646 + e49e881 commit 5a890bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions groundingdino/util/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ def annotate(image_source: np.ndarray, boxes: torch.Tensor, logits: torch.Tensor
in zip(phrases, logits)
]

box_annotator = sv.BoxAnnotator()
bbox_annotator = sv.BoxAnnotator(color_lookup=sv.ColorLookup.INDEX)
label_annotator = sv.LabelAnnotator(color_lookup=sv.ColorLookup.INDEX)
annotated_frame = cv2.cvtColor(image_source, cv2.COLOR_RGB2BGR)
annotated_frame = box_annotator.annotate(scene=annotated_frame, detections=detections, labels=labels)
annotated_frame = bbox_annotator.annotate(scene=annotated_frame, detections=detections)
annotated_frame = label_annotator.annotate(scene=annotated_frame, detections=detections, labels=labels)
return annotated_frame


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ yapf
timm
numpy
opencv-python
supervision==0.21.0
supervision>=0.22.0
pycocotools

0 comments on commit 5a890bd

Please sign in to comment.