From f40854b61b2b347e1ff03a6fc0a765f1210a4fdc Mon Sep 17 00:00:00 2001 From: Matthias Vadcard <48956156+MattVAD@users.noreply.github.com> Date: Tue, 8 Feb 2022 16:13:45 +0100 Subject: [PATCH] Allow custom` --evolve` project names (#6567) * Update train.py As see in #6463, modification on train in evolve process to allow custom save directory. * fix val * PEP8 whitespace around operator * Cleanup Co-authored-by: Glenn Jocher --- train.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/train.py b/train.py index 4a1f8958b874..24efefa98653 100644 --- a/train.py +++ b/train.py @@ -515,7 +515,8 @@ def main(opt, callbacks=Callbacks()): check_file(opt.data), check_yaml(opt.cfg), check_yaml(opt.hyp), str(opt.weights), str(opt.project) # checks assert len(opt.cfg) or len(opt.weights), 'either --cfg or --weights must be specified' if opt.evolve: - opt.project = str(ROOT / 'runs/evolve') + if opt.project == str(ROOT / 'runs/train'): # if default project name, rename to runs/evolve + opt.project = str(ROOT / 'runs/evolve') opt.exist_ok, opt.resume = opt.resume, False # pass resume to exist_ok and disable resume opt.save_dir = str(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok))