(
cfg_paths: List[Path] = Option(
...,
help='The path to the config file of the task',
exists=True,
),
work_dirs: List[Path] = Option(
...,
help='The work dirs for the task(named by timestamp), '
'need to ensure the order is the same as cfg_paths.',
exists=True,
),
group: str = Option(None,
help='If not None, show the accuracy in the group.'),
)
| 13 | |
| 14 | @app.command(help='Visualize the results of multiple models') |
| 15 | def main( |
| 16 | cfg_paths: List[Path] = Option( |
| 17 | ..., |
| 18 | help='The path to the config file of the task', |
| 19 | exists=True, |
| 20 | ), |
| 21 | work_dirs: List[Path] = Option( |
| 22 | ..., |
| 23 | help='The work dirs for the task(named by timestamp), ' |
| 24 | 'need to ensure the order is the same as cfg_paths.', |
| 25 | exists=True, |
| 26 | ), |
| 27 | group: str = Option(None, |
| 28 | help='If not None, show the accuracy in the group.'), |
| 29 | ): |
| 30 | assert len(cfg_paths) == len(work_dirs) |
| 31 | cfgs = [Config.fromfile(it, format_python_code=False) for it in cfg_paths] |
| 32 | |
| 33 | multi_models_summarizer = None |
| 34 | for cfg, work_dir in zip(cfgs, work_dirs): |
| 35 | cfg['work_dir'] = work_dir |
| 36 | summarizer_cfg = cfg.get('summarizer', {}) |
| 37 | summarizer_cfg['type'] = MultiModelSummarizer |
| 38 | summarizer_cfg['config'] = cfg |
| 39 | summarizer = build_from_cfg(summarizer_cfg) |
| 40 | if multi_models_summarizer is None: |
| 41 | multi_models_summarizer = summarizer |
| 42 | else: |
| 43 | multi_models_summarizer.merge(summarizer) |
| 44 | multi_models_summarizer.summarize() |
| 45 | if group: |
| 46 | multi_models_summarizer.show_group(group) |
| 47 | |
| 48 | |
| 49 | if __name__ == '__main__': |
nothing calls this directly
no test coverage detected