mmdeploy
mmdeploy copied to clipboard
When object detection returns a large number of detection boxes, drawing boxes is very time-consuming. Is there any method[Feature]
Motivation
as title, i use cdk to infer and draw boxes using
def draw_bbox(frame, bboxes, labels, score_thr):
frame_copy = frame.copy()
for bbox, label_id in zip(bboxes, labels):
[left, top, right, bottom], score = bbox[0:4].astype(int), bbox[4]
if score < score_thr:
continue
english_label = label_mapping[label_id]
cv2.rectangle(frame_copy, (left, top), (right, bottom), (0, 255, 0), 2)
cv2.putText(frame_copy, f'{english_label}: {score:.2f}', (int(bbox[0]), int(bbox[1])), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2, cv2.LINE_AA)
return frame_copy`
Related resources
No response
Additional context
No response