Skip to content

Commit

Permalink
Clean unnecessary custom_imports in entrypoints (#6546)
Browse files Browse the repository at this point in the history
  • Loading branch information
FloydHsiu committed Nov 19, 2021
1 parent c76ab0e commit a7a16af
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 36 deletions.
4 changes: 0 additions & 4 deletions mmdet/core/export/pytorch2onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions tools/analysis_tools/analyze_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions tools/analysis_tools/eval_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions tools/analysis_tools/get_flops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions tools/analysis_tools/test_robustness.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions tools/misc/browse_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ def skip_pipeline_steps(config):
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':
Expand Down
4 changes: 0 additions & 4 deletions tools/misc/print_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')


Expand Down
4 changes: 0 additions & 4 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions tools/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a7a16af

Please sign in to comment.