From 420303f285cf73a0feac778d091f653c20de5661 Mon Sep 17 00:00:00 2001 From: STILINSKI-ANAS <101132341+STILINSKI-ANAS@users.noreply.github.com> Date: Thu, 13 Jun 2024 04:38:05 +0100 Subject: [PATCH] replace the getsize method with the getbbox method --- utils/plots.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index fa49dc19d..f5c53cae5 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -83,7 +83,8 @@ def box_label(self, box, label='', color=(128, 128, 128), txt_color=(255, 255, 2 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 + bbox = self.font.getbbox(label) + w, h = bbox[2] - bbox[0], bbox[3] - bbox[1] # text width, height 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,