From b714fa8bae18c262d12b16c783b643a5238b4f61 Mon Sep 17 00:00:00 2001 From: wa22 Date: Fri, 24 May 2024 05:40:00 +0000 Subject: [PATCH] update --- ultralytics/cfg/default.yaml | 1 + ultralytics/engine/trainer.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ultralytics/cfg/default.yaml b/ultralytics/cfg/default.yaml index 2e165845..f57cc691 100644 --- a/ultralytics/cfg/default.yaml +++ b/ultralytics/cfg/default.yaml @@ -14,6 +14,7 @@ batch: 16 # (int) number of images per batch (-1 for AutoBatch) imgsz: 640 # (int | list) input images size as int for train and val modes, or list[w,h] for predict and export modes save: True # (bool) save train checkpoints and predict results save_period: -1 # (int) Save checkpoint every x epochs (disabled if < 1) +val_period: 10 # (int) Validation every x epochs cache: False # (bool) True/ram, disk or False. Use cache for data loading device: # (int | str | list, optional) device to run on, i.e. cuda device=0 or device=0,1,2,3 or device=cpu workers: 8 # (int) number of worker threads for data loading (per RANK if DDP) diff --git a/ultralytics/engine/trainer.py b/ultralytics/engine/trainer.py index 841ec120..3d16afea 100644 --- a/ultralytics/engine/trainer.py +++ b/ultralytics/engine/trainer.py @@ -425,7 +425,7 @@ class BaseTrainer: self.ema.update_attr(self.model, include=["yaml", "nc", "args", "names", "stride", "class_weights"]) # Validation - if (self.args.val and (((epoch+1) % 10 == 0) or (self.epochs - epoch) <= 10)) \ + if (self.args.val and (((epoch+1) % self.args.val_period == 0) or (self.epochs - epoch) <= 10)) \ or final_epoch or self.stopper.possible_stop or self.stop: self.metrics, self.fitness = self.validate() self.save_metrics(metrics={**self.label_loss_items(self.tloss), **self.metrics, **self.lr})