Fix plot_images for classify training (#21072)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Laughing-q <1185102784@qq.com> Co-authored-by: Laughing <61612323+Laughing-q@users.noreply.github.com>
This commit is contained in:
parent
c707bbdaf6
commit
54e63a8ff0
@ -181,6 +181,9 @@ makei05@outlook.de:
|
||||
matthewnoyce@icloud.com:
|
||||
avatar: https://avatars.githubusercontent.com/u/131261051?v=4
|
||||
username: MatthewNoyce
|
||||
muhammadravi251001@gmail.com:
|
||||
avatar: https://avatars.githubusercontent.com/u/78993021?v=4
|
||||
username: muhammadravi251001
|
||||
muhammadrizwanmunawar123@gmail.com:
|
||||
avatar: https://avatars.githubusercontent.com/u/62513924?v=4
|
||||
username: RizwanMunawar
|
||||
|
||||
@ -228,10 +228,9 @@ class ClassificationTrainer(BaseTrainer):
|
||||
batch (Dict[str, torch.Tensor]): Batch containing images and class labels.
|
||||
ni (int): Number of iterations.
|
||||
"""
|
||||
batch["batch_idx"] = torch.arange(len(batch["img"])) # add batch index for plotting
|
||||
plot_images(
|
||||
images=batch["img"],
|
||||
batch_idx=torch.arange(len(batch["img"])),
|
||||
cls=batch["cls"].view(-1), # warning: use .view(), not .squeeze() for Classify models
|
||||
labels=batch,
|
||||
fname=self.save_dir / f"train_batch{ni}.jpg",
|
||||
on_plot=self.on_plot,
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user