From f255c7ae065554c7bf5f84382adf06a6f86be840 Mon Sep 17 00:00:00 2001 From: zzzer <48149018+zhixuwei@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:30:02 +0800 Subject: [PATCH 1/4] 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> --- utils/plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index e899ea4c15e7..44d1035104a9 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(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: From 2101bcf12c4a4862531d8cc018d01198f545428b Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 21 Nov 2024 15:57:51 +0100 Subject: [PATCH 2/4] Update plots.py Signed-off-by: Glenn Jocher --- utils/plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index 44d1035104a9..f0e51458e691 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(bs): + for i in range(min(bs, i+1)): 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: From 9a3ce35db15e8744ae27d522555e490bfbb2bb4d Mon Sep 17 00:00:00 2001 From: UltralyticsAssistant Date: Thu, 21 Nov 2024 14:58:12 +0000 Subject: [PATCH 3/4] Auto-format by https://ultralytics.com/actions --- utils/plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index f0e51458e691..3493fa95d133 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(min(bs, i + 1)): 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: From 5eeff056cca52ed62f4291e3f1e2a449aedbf28c Mon Sep 17 00:00:00 2001 From: zzzer <48149018+zhixuwei@users.noreply.github.com> Date: Thu, 21 Nov 2024 23:57:10 +0800 Subject: [PATCH 4/4] Simple loop conditions Simple loop conditions Signed-off-by: zzzer <48149018+zhixuwei@users.noreply.github.com> --- utils/plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index 3493fa95d133..44d1035104a9 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: