fix Supervision depreciation of BoxAnnotator

pull/342/head
ethanlee928 2024-06-29 01:10:48 +08:00
parent df5b48a3ef
commit d75c95daf6
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -6,5 +6,5 @@ yapf
timm
numpy
opencv-python
supervision
supervision>=0.15.0
pycocotools