diff --git a/mmdet/core/export/pytorch2onnx.py b/mmdet/core/export/pytorch2onnx.py index 53906f265..b8261eed9 100644 --- a/mmdet/core/export/pytorch2onnx.py +++ b/mmdet/core/export/pytorch2onnx.py @@ -78,10 +78,6 @@ def build_model_from_cfg(config_path, checkpoint_path, cfg_options=None): cfg = mmcv.Config.fromfile(config_path) if cfg_options is not None: cfg.merge_from_dict(cfg_options) - # import modules from string list. - if cfg.get('custom_imports', None): - from mmcv.utils import import_modules_from_strings - import_modules_from_strings(**cfg['custom_imports']) # set cudnn_benchmark if cfg.get('cudnn_benchmark', False): torch.backends.cudnn.benchmark = True diff --git a/tools/analysis_tools/analyze_results.py b/tools/analysis_tools/analyze_results.py index 60e20fea6..826526557 100644 --- a/tools/analysis_tools/analyze_results.py +++ b/tools/analysis_tools/analyze_results.py @@ -183,10 +183,6 @@ def main(): if args.cfg_options is not None: cfg.merge_from_dict(args.cfg_options) cfg.data.test.test_mode = True - # import modules from string list. - if cfg.get('custom_imports', None): - from mmcv.utils import import_modules_from_strings - import_modules_from_strings(**cfg['custom_imports']) cfg.data.test.pop('samples_per_gpu', 0) cfg.data.test.pipeline = get_loading_pipeline(cfg.data.train.pipeline) diff --git a/tools/analysis_tools/eval_metric.py b/tools/analysis_tools/eval_metric.py index c55bced3a..1fcdc1c1f 100644 --- a/tools/analysis_tools/eval_metric.py +++ b/tools/analysis_tools/eval_metric.py @@ -56,10 +56,6 @@ def main(): if args.cfg_options is not None: cfg.merge_from_dict(args.cfg_options) - # import modules from string list. - if cfg.get('custom_imports', None): - from mmcv.utils import import_modules_from_strings - import_modules_from_strings(**cfg['custom_imports']) cfg.data.test.test_mode = True dataset = build_dataset(cfg.data.test) diff --git a/tools/analysis_tools/get_flops.py b/tools/analysis_tools/get_flops.py index 7f1c3bfc5..0ac59a500 100644 --- a/tools/analysis_tools/get_flops.py +++ b/tools/analysis_tools/get_flops.py @@ -63,10 +63,6 @@ def main(): cfg = Config.fromfile(args.config) if args.cfg_options is not None: cfg.merge_from_dict(args.cfg_options) - # import modules from string list. - if cfg.get('custom_imports', None): - from mmcv.utils import import_modules_from_strings - import_modules_from_strings(**cfg['custom_imports']) model = build_detector( cfg.model, diff --git a/tools/analysis_tools/test_robustness.py b/tools/analysis_tools/test_robustness.py index ab09366d0..29cb41da6 100644 --- a/tools/analysis_tools/test_robustness.py +++ b/tools/analysis_tools/test_robustness.py @@ -191,10 +191,6 @@ def main(): cfg = mmcv.Config.fromfile(args.config) if args.cfg_options is not None: cfg.merge_from_dict(args.cfg_options) - # import modules from string list. - if cfg.get('custom_imports', None): - from mmcv.utils import import_modules_from_strings - import_modules_from_strings(**cfg['custom_imports']) # set cudnn_benchmark if cfg.get('cudnn_benchmark', False): torch.backends.cudnn.benchmark = True diff --git a/tools/misc/browse_dataset.py b/tools/misc/browse_dataset.py index 3b8b8d601..aebe9cf9b 100644 --- a/tools/misc/browse_dataset.py +++ b/tools/misc/browse_dataset.py @@ -56,10 +56,6 @@ def retrieve_data_cfg(config_path, skip_type, cfg_options): cfg = Config.fromfile(config_path) if cfg_options is not None: cfg.merge_from_dict(cfg_options) - # import modules from string list. - if cfg.get('custom_imports', None): - from mmcv.utils import import_modules_from_strings - import_modules_from_strings(**cfg['custom_imports']) train_data_cfg = cfg.data.train while 'dataset' in train_data_cfg and train_data_cfg[ 'type'] != 'MultiImageMixDataset': diff --git a/tools/misc/print_config.py b/tools/misc/print_config.py index e44cda062..1b2cb30c2 100644 --- a/tools/misc/print_config.py +++ b/tools/misc/print_config.py @@ -44,10 +44,6 @@ def main(): cfg = Config.fromfile(args.config) if args.cfg_options is not None: cfg.merge_from_dict(args.cfg_options) - # import modules from string list. - if cfg.get('custom_imports', None): - from mmcv.utils import import_modules_from_strings - import_modules_from_strings(**cfg['custom_imports']) print(f'Config:\n{cfg.pretty_text}') diff --git a/tools/test.py b/tools/test.py index f16ac635c..31bb3be34 100644 --- a/tools/test.py +++ b/tools/test.py @@ -122,10 +122,6 @@ def main(): cfg = Config.fromfile(args.config) if args.cfg_options is not None: cfg.merge_from_dict(args.cfg_options) - # import modules from string list. - if cfg.get('custom_imports', None): - from mmcv.utils import import_modules_from_strings - import_modules_from_strings(**cfg['custom_imports']) # set cudnn_benchmark if cfg.get('cudnn_benchmark', False): torch.backends.cudnn.benchmark = True diff --git a/tools/train.py b/tools/train.py index 45fa03bfa..95db9fbbc 100644 --- a/tools/train.py +++ b/tools/train.py @@ -90,10 +90,6 @@ def main(): cfg = Config.fromfile(args.config) if args.cfg_options is not None: cfg.merge_from_dict(args.cfg_options) - # import modules from string list. - if cfg.get('custom_imports', None): - from mmcv.utils import import_modules_from_strings - import_modules_from_strings(**cfg['custom_imports']) # set cudnn_benchmark if cfg.get('cudnn_benchmark', False): torch.backends.cudnn.benchmark = True