From ddc96b555b0f8bdd40a76f1467a1b289ed21fd82 Mon Sep 17 00:00:00 2001 From: Stephane Chavin <stephane.chavin@lis-lab.fr> Date: Sun, 21 Jul 2024 20:12:22 +0200 Subject: [PATCH] change YOLOv5 plot --- yolov5/utils/plots.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yolov5/utils/plots.py b/yolov5/utils/plots.py index 24c618c..d14901b 100755 --- a/yolov5/utils/plots.py +++ b/yolov5/utils/plots.py @@ -88,8 +88,8 @@ class Annotator: if self.pil or not is_ascii(label): self.draw.rectangle(box, width=self.lw, outline=color) # box if label: - w, h = self.font.getsize(label) # text width, height (WARNING: deprecated) in 9.2.0 - # _, _, w, h = self.font.getbbox(label) # text width, height (New) + # w, h = self.font.getsize(label) # text width, height (WARNING: deprecated) in 9.2.0 + _, _, w, h = self.font.getbbox(label) # text width, height (New) outside = box[1] - h >= 0 # label fits outside box self.draw.rectangle( (box[0], box[1] - h if outside else box[1], box[0] + w + 1, -- GitLab