From 62cff6ebb1d33f62f9afa0b5c4ffd92bd9e3808d Mon Sep 17 00:00:00 2001 From: Mingdeng <946891067@qq.com> Date: Thu, 2 Feb 2023 16:06:47 +0900 Subject: [PATCH] The user can specify the roots of experiments in the config.path (#595) * The user can specify the roots of experiments in the config.path * Update the path augmentation by adding the exp NAME --- basicsr/utils/options.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/basicsr/utils/options.py b/basicsr/utils/options.py index 3afd79c4f..5c7155ecc 100644 --- a/basicsr/utils/options.py +++ b/basicsr/utils/options.py @@ -171,7 +171,11 @@ def parse_options(root_path, is_train=True): opt['path'][key] = osp.expanduser(val) if is_train: - experiments_root = osp.join(root_path, 'experiments', opt['name']) + experiments_root = opt['path'].get('experiments_root') + if experiments_root is None: + experiments_root = osp.join(root_path, 'experiments') + experiments_root = osp.join(experiments_root, opt['name']) + opt['path']['experiments_root'] = experiments_root opt['path']['models'] = osp.join(experiments_root, 'models') opt['path']['training_states'] = osp.join(experiments_root, 'training_states') @@ -185,7 +189,11 @@ def parse_options(root_path, is_train=True): opt['logger']['print_freq'] = 1 opt['logger']['save_checkpoint_freq'] = 8 else: # test - results_root = osp.join(root_path, 'results', opt['name']) + results_root = opt['path'].get('results_root') + if results_root is None: + results_root = osp.join(root_path, 'results') + results_root = osp.join(results_root, opt['name']) + opt['path']['results_root'] = results_root opt['path']['log'] = results_root opt['path']['visualization'] = osp.join(results_root, 'visualization')