MCPcopy Create free account
hub / github.com/InternRobotics/EmbodiedScan / main

Function main

tools/test.py:105–153  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

103
104
105def main():
106 args = parse_args()
107
108 # load config
109 cfg = Config.fromfile(args.config)
110
111 # TODO: We will unify the ceph support approach with other OpenMMLab repos
112 # if args.ceph:
113 # cfg = replace_ceph_backend(cfg)
114
115 cfg.launcher = args.launcher
116 if args.cfg_options is not None:
117 cfg.merge_from_dict(args.cfg_options)
118
119 # work_dir is determined in this priority: CLI > segment in file > filename
120 if args.work_dir is not None:
121 # update configs according to CLI args if args.work_dir is not None
122 cfg.work_dir = args.work_dir
123 elif args.task_name is not None:
124 cfg.work_dir = osp.join('./work_dirs', args.task_name)
125 elif cfg.get('work_dir', None) is None:
126 # use config filename as default work_dir if cfg.work_dir is None
127 cfg.work_dir = osp.join('./work_dirs',
128 osp.splitext(osp.basename(args.config))[0])
129
130 cfg.load_from = args.checkpoint
131
132 if args.show or args.show_dir:
133 cfg = trigger_visualization_hook(cfg, args)
134
135 if args.tta:
136 # Currently, we only support tta for 3D segmentation
137 # TODO: Support tta for 3D detection
138 assert 'tta_model' in cfg, 'Cannot find ``tta_model`` in config.'
139 assert 'tta_pipeline' in cfg, 'Cannot find ``tta_pipeline`` in config.'
140 cfg.test_dataloader.dataset.pipeline = cfg.tta_pipeline
141 cfg.model = ConfigDict(**cfg.tta_model, module=cfg.model)
142
143 # build the runner from config
144 if 'runner_type' not in cfg:
145 # build the default runner
146 runner = Runner.from_cfg(cfg)
147 else:
148 # build customized runner from the registry
149 # if 'runner_type' is set in the cfg
150 runner = RUNNERS.build(cfg)
151
152 # start testing
153 runner.test()
154
155
156if __name__ == '__main__':

Callers 1

test.pyFile · 0.70

Calls 2

parse_argsFunction · 0.70

Tested by

no test coverage detected