From a5d1cdcbf9a798bb44faf6eca9bd6104d7b41978 Mon Sep 17 00:00:00 2001 From: xjf Date: Mon, 10 Feb 2025 14:16:17 +0800 Subject: [PATCH] Fixes tinyvision/DAMO-YOLO#138 --- damo/utils/visualize.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/damo/utils/visualize.py b/damo/utils/visualize.py index cfba883..40a493c 100644 --- a/damo/utils/visualize.py +++ b/damo/utils/visualize.py @@ -27,6 +27,8 @@ def vis(img, boxes, scores, cls_ids, conf=0.5, class_names=None): font = cv2.FONT_HERSHEY_SIMPLEX txt_size = cv2.getTextSize(text, font, 0.4, 1)[0] + + img = img.copy() # Ensure img is writable cv2.rectangle(img, (x0, y0), (x1, y1), color, 2) txt_bk_color = (_COLORS[cls_id] * 255 * 0.7).astype(np.uint8).tolist()