| 15 | |
| 16 | |
| 17 | def parse_args(): |
| 18 | parser = argparse.ArgumentParser(description='mogen evaluation') |
| 19 | parser.add_argument('config', help='test config file path') |
| 20 | parser.add_argument('--work-dir', |
| 21 | help='the dir to save evaluation results') |
| 22 | parser.add_argument('checkpoint', help='checkpoint file') |
| 23 | parser.add_argument('--out', help='output result file') |
| 24 | parser.add_argument('--gpu_collect', |
| 25 | action='store_true', |
| 26 | help='whether to use gpu to collect results') |
| 27 | parser.add_argument('--tmpdir', help='tmp dir for writing some results') |
| 28 | parser.add_argument( |
| 29 | '--cfg-options', |
| 30 | nargs='+', |
| 31 | action=DictAction, |
| 32 | help='override some settings in the used config, the key-value pair ' |
| 33 | 'in xxx=yyy format will be merged into config file.') |
| 34 | parser.add_argument('--launcher', |
| 35 | choices=['none', 'pytorch', 'slurm', 'mpi'], |
| 36 | default='none', |
| 37 | help='job launcher') |
| 38 | parser.add_argument('--local_rank', type=int, default=0) |
| 39 | parser.add_argument('--device', |
| 40 | choices=['cpu', 'cuda'], |
| 41 | default='cuda', |
| 42 | help='device used for testing') |
| 43 | args = parser.parse_args() |
| 44 | if 'LOCAL_RANK' not in os.environ: |
| 45 | os.environ['LOCAL_RANK'] = str(args.local_rank) |
| 46 | return args |
| 47 | |
| 48 | |
| 49 | def main(): |