From c5ac5548aeac8ed1554ef6224bd3d839974abc5b Mon Sep 17 00:00:00 2001 From: Muhammad Rizwan Munawar Date: Wed, 5 Feb 2025 03:38:10 +0500 Subject: [PATCH] Optimize `seg_bbox` calculations (#19056) --- ultralytics/utils/plotting.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ultralytics/utils/plotting.py b/ultralytics/utils/plotting.py index c308e8d2..a88ea1a5 100644 --- a/ultralytics/utils/plotting.py +++ b/ultralytics/utils/plotting.py @@ -801,9 +801,8 @@ class Annotator: return cv2.polylines(self.im, [np.int32([mask])], isClosed=True, color=mask_color, thickness=2) - text_size, _ = cv2.getTextSize(label, 0, self.sf, self.tf) - if label: + text_size, _ = cv2.getTextSize(label, 0, self.sf, self.tf) cv2.rectangle( self.im, (int(mask[0][0]) - text_size[0] // 2 - 10, int(mask[0][1]) - text_size[1] - 10),