From d75c95daf64f16ff2cf4d0842b225310f60991cb Mon Sep 17 00:00:00 2001 From: ethanlee928 Date: Sat, 29 Jun 2024 01:10:48 +0800 Subject: [PATCH 1/2] fix Supervision depreciation of BoxAnnotator --- groundingdino/util/inference.py | 6 ++++-- requirements.txt | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/groundingdino/util/inference.py b/groundingdino/util/inference.py index 58528ed..44f7325 100644 --- a/groundingdino/util/inference.py +++ b/groundingdino/util/inference.py @@ -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.BoundingBoxAnnotator(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 diff --git a/requirements.txt b/requirements.txt index 9282de3..a64b8a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,5 @@ yapf timm numpy opencv-python -supervision +supervision>=0.15.0 pycocotools From 8b6a55f612b3328c94a5e62ea6144aedde0c4302 Mon Sep 17 00:00:00 2001 From: ethanlee928 Date: Tue, 23 Jul 2024 23:19:52 +0800 Subject: [PATCH 2/2] replaced BoundingBoxAnnotator with BoxAnnotator, updated Supervision version --- groundingdino/util/inference.py | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/groundingdino/util/inference.py b/groundingdino/util/inference.py index 44f7325..84a962e 100644 --- a/groundingdino/util/inference.py +++ b/groundingdino/util/inference.py @@ -121,7 +121,7 @@ def annotate(image_source: np.ndarray, boxes: torch.Tensor, logits: torch.Tensor in zip(phrases, logits) ] - bbox_annotator = sv.BoundingBoxAnnotator(color_lookup=sv.ColorLookup.INDEX) + 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 = bbox_annotator.annotate(scene=annotated_frame, detections=detections) diff --git a/requirements.txt b/requirements.txt index a64b8a5..24aa11d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,5 @@ yapf timm numpy opencv-python -supervision>=0.15.0 +supervision>=0.22.0 pycocotools