From c8a155635ec255f70e28eb51b61a392af39590d7 Mon Sep 17 00:00:00 2001 From: littletomatodonkey <2120160898@bit.edu.cn> Date: Mon, 1 Feb 2021 22:24:25 +0800 Subject: [PATCH] fix train and save (#594) --- tools/train.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/train.py b/tools/train.py index 3cd9d459..45ac37f9 100644 --- a/tools/train.py +++ b/tools/train.py @@ -98,13 +98,12 @@ def main(args): if top1_acc > best_top1_acc: best_top1_acc = top1_acc best_top1_epoch = epoch_id - if epoch_id % config.save_interval == 0: - model_path = os.path.join(config.model_save_dir, - config.ARCHITECTURE["name"]) - save_model(net, optimizer, model_path, "best_model") + model_path = os.path.join(config.model_save_dir, + config.ARCHITECTURE["name"]) + save_model(net, optimizer, model_path, "best_model") message = "The best top1 acc {:.5f}, in epoch: {:d}".format( best_top1_acc, best_top1_epoch) - logger.info("{:s}".format(logger.coloring(message, "RED"))) + logger.info(message) # 3. save the persistable model if epoch_id % config.save_interval == 0: -- GitLab