From 4c904ac7f91c3fa2a4aaf3c58cd2bca39cdf7195 Mon Sep 17 00:00:00 2001 From: zzzer <48149018+zhixuwei@users.noreply.github.com> Date: Sat, 23 Nov 2024 23:01:47 +0800 Subject: [PATCH] Fix possible image drawing issues (#13426) * Update plots.py Fixed non-meaningful labels in the top right (row 1, column 4) plots when batch size is larger than max_subplots. Signed-off-by: zzzer <48149018+zhixuwei@users.noreply.github.com> * Update plots.py Signed-off-by: Glenn Jocher * Auto-format by https://ultralytics.com/actions * Simple loop conditions Simple loop conditions Signed-off-by: zzzer <48149018+zhixuwei@users.noreply.github.com> --------- Signed-off-by: zzzer <48149018+zhixuwei@users.noreply.github.com> Signed-off-by: Glenn Jocher Co-authored-by: Glenn Jocher Co-authored-by: UltralyticsAssistant --- utils/plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index 3493fa9..44d1035 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -183,7 +183,7 @@ def plot_images(images, targets, paths=None, fname="images.jpg", names=None): # Annotate fs = int((h + w) * ns * 0.01) # font size annotator = Annotator(mosaic, line_width=round(fs / 10), font_size=fs, pil=True, example=names) - for i in range(min(bs, i + 1)): + for i in range(bs): x, y = int(w * (i // ns)), int(h * (i % ns)) # block origin annotator.rectangle([x, y, x + w, y + h], None, (255, 255, 255), width=2) # borders if paths: