Pass `args` when creating validator for classification (#16025)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
pull/16058/head^2
Mohammed Yasin 3 months ago committed by GitHub
parent 93b80552fc
commit d0dd2b9313
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      ultralytics/models/yolo/classify/train.py

@ -1,5 +1,7 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
from copy import copy
import torch
from ultralytics.data import ClassificationDataset, build_dataloader
@ -107,7 +109,9 @@ class ClassificationTrainer(BaseTrainer):
def get_validator(self):
"""Returns an instance of ClassificationValidator for validation."""
self.loss_names = ["loss"]
return yolo.classify.ClassificationValidator(self.test_loader, self.save_dir, _callbacks=self.callbacks)
return yolo.classify.ClassificationValidator(
self.test_loader, self.save_dir, args=copy(self.args), _callbacks=self.callbacks
)
def label_loss_items(self, loss_items=None, prefix="train"):
"""

Loading…
Cancel
Save