From 0ad01399cd81a7170a388c2af2e590f4e5034d5b Mon Sep 17 00:00:00 2001 From: Muhammad Rizwan Munawar Date: Fri, 19 Apr 2024 07:20:55 +0500 Subject: [PATCH] Fix per class counts display gap (#10148) Co-authored-by: Glenn Jocher --- ultralytics/utils/plotting.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ultralytics/utils/plotting.py b/ultralytics/utils/plotting.py index 1ffc27c2..cbdf7873 100644 --- a/ultralytics/utils/plotting.py +++ b/ultralytics/utils/plotting.py @@ -440,12 +440,9 @@ class Annotator: text_x = self.im.shape[1] - int(self.im.shape[1] * 0.025 + max_text_width) text_y = int(self.im.shape[0] * 0.025) - # Calculate dynamic gap between each count value based on the width of the image - dynamic_gap = max(1, self.im.shape[1] // 100) * tf - for i, count in enumerate(counts): text_x_pos = text_x - text_y_pos = text_y + i * dynamic_gap # Adjust vertical position with dynamic gap + text_y_pos = text_y + i * (max_text_height + 25 * tf) # Draw the border cv2.rectangle( @@ -468,8 +465,6 @@ class Annotator: lineType=cv2.LINE_AA, ) - text_y_pos += tf * max_text_height - @staticmethod def estimate_pose_angle(a, b, c): """