()
| 82 | |
| 83 | |
| 84 | def main(): |
| 85 | args = parse_args() |
| 86 | |
| 87 | # load config |
| 88 | cfg = Config.fromfile(args.config) |
| 89 | |
| 90 | # TODO: We will unify the ceph support approach with other OpenMMLab repos |
| 91 | if args.ceph: |
| 92 | cfg = replace_ceph_backend(cfg) |
| 93 | |
| 94 | cfg.launcher = args.launcher |
| 95 | if args.cfg_options is not None: |
| 96 | cfg.merge_from_dict(args.cfg_options) |
| 97 | |
| 98 | # work_dir is determined in this priority: CLI > segment in file > filename |
| 99 | if args.work_dir is not None: |
| 100 | # update configs according to CLI args if args.work_dir is not None |
| 101 | cfg.work_dir = args.work_dir |
| 102 | elif cfg.get('work_dir', None) is None: |
| 103 | # use config filename as default work_dir if cfg.work_dir is None |
| 104 | cfg.work_dir = osp.join('./work_dirs', |
| 105 | osp.splitext(osp.basename(args.config))[0]) |
| 106 | |
| 107 | cfg.load_from = args.checkpoint |
| 108 | |
| 109 | if args.show or args.show_dir: |
| 110 | cfg = trigger_visualization_hook(cfg, args) |
| 111 | |
| 112 | # build the runner from config |
| 113 | if 'runner_type' not in cfg: |
| 114 | # build the default runner |
| 115 | runner = Runner.from_cfg(cfg) |
| 116 | else: |
| 117 | # build customized runner from the registry |
| 118 | # if 'runner_type' is set in the cfg |
| 119 | runner = RUNNERS.build(cfg) |
| 120 | |
| 121 | # start testing |
| 122 | runner.test() |
| 123 | |
| 124 | |
| 125 | if __name__ == '__main__': |
no test coverage detected