From 09eb696ecdfb4b987f52e87abfa8fe8fed76d1cd Mon Sep 17 00:00:00 2001 From: lupeng Date: Tue, 6 Jun 2023 18:08:39 +0800 Subject: [PATCH 1/3] fix merge_args in tools/test.py --- tools/test.py | 31 ++++++++++++++++++------------- tools/train.py | 2 +- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/tools/test.py b/tools/test.py index 3a22ae78c5..e0cd10ca44 100644 --- a/tools/test.py +++ b/tools/test.py @@ -60,6 +60,19 @@ def parse_args(): def merge_args(cfg, args): """Merge CLI arguments to config.""" + + cfg.launcher = args.launcher + + # -------------------- work directory -------------------- + # work_dir is determined in this priority: CLI > segment in file > filename + if args.work_dir is not None: + # update configs according to CLI args if args.work_dir is not None + cfg.work_dir = args.work_dir + elif cfg.get('work_dir', None) is None: + # use config filename as default work_dir if cfg.work_dir is None + cfg.work_dir = osp.join('./work_dirs', + osp.splitext(osp.basename(args.config))[0]) + # -------------------- visualization -------------------- if args.show or (args.show_dir is not None): assert 'visualization' in cfg.default_hooks, \ @@ -80,10 +93,14 @@ def merge_args(cfg, args): 'The dump file must be a pkl file.' dump_metric = dict(type='DumpResults', out_file_path=args.dump) if isinstance(cfg.test_evaluator, (list, tuple)): - cfg.test_evaluator = list(cfg.test_evaluator).append(dump_metric) + cfg.test_evaluator = [*cfg.test_evaluator, dump_metric] else: cfg.test_evaluator = [cfg.test_evaluator, dump_metric] + # -------------------- Other arguments -------------------- + if args.cfg_options is not None: + cfg.merge_from_dict(args.cfg_options) + return cfg @@ -93,18 +110,6 @@ def main(): # load config cfg = Config.fromfile(args.config) cfg = merge_args(cfg, args) - cfg.launcher = args.launcher - if args.cfg_options is not None: - cfg.merge_from_dict(args.cfg_options) - - # work_dir is determined in this priority: CLI > segment in file > filename - if args.work_dir is not None: - # update configs according to CLI args if args.work_dir is not None - cfg.work_dir = args.work_dir - elif cfg.get('work_dir', None) is None: - # use config filename as default work_dir if cfg.work_dir is None - cfg.work_dir = osp.join('./work_dirs', - osp.splitext(osp.basename(args.config))[0]) cfg.load_from = args.checkpoint diff --git a/tools/train.py b/tools/train.py index e086d95d73..e1930c20c7 100644 --- a/tools/train.py +++ b/tools/train.py @@ -115,7 +115,7 @@ def merge_args(cfg, args): if args.auto_scale_lr: cfg.auto_scale_lr.enable = True - # visualization- + # visualization if args.show or (args.show_dir is not None): assert 'visualization' in cfg.default_hooks, \ 'PoseVisualizationHook is not set in the ' \ From 263cfc8739f48d980ce9fe71b9548b8f5fe201ac Mon Sep 17 00:00:00 2001 From: lupeng Date: Tue, 6 Jun 2023 18:12:55 +0800 Subject: [PATCH 2/3] move load_from into merge_args --- tools/test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/test.py b/tools/test.py index e0cd10ca44..5dc0110260 100644 --- a/tools/test.py +++ b/tools/test.py @@ -62,6 +62,7 @@ def merge_args(cfg, args): """Merge CLI arguments to config.""" cfg.launcher = args.launcher + cfg.load_from = args.checkpoint # -------------------- work directory -------------------- # work_dir is determined in this priority: CLI > segment in file > filename @@ -111,8 +112,6 @@ def main(): cfg = Config.fromfile(args.config) cfg = merge_args(cfg, args) - cfg.load_from = args.checkpoint - # build the runner from config runner = Runner.from_cfg(cfg) From badcfea6977dc8ca0fdcd26029e4f33a400c4442 Mon Sep 17 00:00:00 2001 From: lupeng Date: Tue, 6 Jun 2023 18:40:59 +0800 Subject: [PATCH 3/3] update mmcls version --- configs/body_2d_keypoint/topdown_heatmap/coco/vitpose_coco.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/body_2d_keypoint/topdown_heatmap/coco/vitpose_coco.md b/configs/body_2d_keypoint/topdown_heatmap/coco/vitpose_coco.md index f9266001d5..67e2a9cb3b 100644 --- a/configs/body_2d_keypoint/topdown_heatmap/coco/vitpose_coco.md +++ b/configs/body_2d_keypoint/topdown_heatmap/coco/vitpose_coco.md @@ -1,7 +1,7 @@ To utilize ViTPose, you'll need to have [MMClassification](https://github.com/open-mmlab/mmclassification). To install the required version, run the following command: ```shell -mim install 'mmcls>=1.0.0rc5' +mim install 'mmcls>=1.0.0rc6' ```