From c3899f47048f0cf8be5369fac1f5cceaa95deee6 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 18 Oct 2021 14:13:24 +0200 Subject: [PATCH 1/3] Add `on_fit_epoch_end` callback --- train.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/train.py b/train.py index 29ae43e3bd37..9a1bf3d29c0b 100644 --- a/train.py +++ b/train.py @@ -423,6 +423,8 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary plots=True, callbacks=callbacks, compute_loss=compute_loss) # val best model with plots + if is_coco: + callbacks.run('on_fit_epoch_end', list(mloss) + list(results) + lr, epoch, best_fitness, fi) callbacks.run('on_train_end', last, best, plots, epoch) LOGGER.info(f"Results saved to {colorstr('bold', save_dir)}") From 1db6b9d58ef6fc6d09c417849f764e8cdb47dc05 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 18 Oct 2021 14:18:37 +0200 Subject: [PATCH 2/3] Add results to train --- train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train.py b/train.py index 9a1bf3d29c0b..da7346be77ab 100644 --- a/train.py +++ b/train.py @@ -426,7 +426,7 @@ def train(hyp, # path/to/hyp.yaml or hyp dictionary if is_coco: callbacks.run('on_fit_epoch_end', list(mloss) + list(results) + lr, epoch, best_fitness, fi) - callbacks.run('on_train_end', last, best, plots, epoch) + callbacks.run('on_train_end', last, best, plots, epoch, results) LOGGER.info(f"Results saved to {colorstr('bold', save_dir)}") torch.cuda.empty_cache() From 01e1be86686060375f3f631c0d1c769be9d05a52 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 18 Oct 2021 14:25:57 +0200 Subject: [PATCH 3/3] Update __init__.py --- utils/loggers/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/loggers/__init__.py b/utils/loggers/__init__.py index b698c3d2db45..0b457df63c93 100644 --- a/utils/loggers/__init__.py +++ b/utils/loggers/__init__.py @@ -131,7 +131,7 @@ def on_model_save(self, last, epoch, final_epoch, best_fitness, fi): if ((epoch + 1) % self.opt.save_period == 0 and not final_epoch) and self.opt.save_period != -1: self.wandb.log_model(last.parent, self.opt, epoch, fi, best_model=best_fitness == fi) - def on_train_end(self, last, best, plots, epoch): + def on_train_end(self, last, best, plots, epoch, results): # Callback runs on training end if plots: plot_results(file=self.save_dir / 'results.csv') # save results.png