Fix possible image drawing issues (#13423)

* 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 <glenn.jocher@ultralytics.com>

* Auto-format by https://ultralytics.com/actions

---------

Signed-off-by: zzzer <48149018+zhixuwei@users.noreply.github.com>
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
pull/13426/head^2
zzzer 2024-11-21 23:33:14 +08:00 committed by GitHub
parent b968b2d70c
commit 81ac034a86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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(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: