| 13 | from IPython import embed |
| 14 | |
| 15 | def parse_args(): |
| 16 | parser = argparse.ArgumentParser( |
| 17 | description='mmseg test (and eval) a model') |
| 18 | parser.add_argument('config', help='test config file path') |
| 19 | parser.add_argument('checkpoint', help='checkpoint file') |
| 20 | parser.add_argument( |
| 21 | '--aug-test', action='store_true', help='Use Flip and Multi scale aug') |
| 22 | parser.add_argument('--out', default='work_dirs/res.pkl', help='output result file in pickle format') |
| 23 | parser.add_argument( |
| 24 | '--format-only', |
| 25 | action='store_true', |
| 26 | help='Format the output results without perform evaluation. It is' |
| 27 | 'useful when you want to format the result to a specific format and ' |
| 28 | 'submit it to the test server') |
| 29 | parser.add_argument( |
| 30 | '--eval', |
| 31 | type=str, |
| 32 | nargs='+', |
| 33 | default='mIoU', |
| 34 | help='evaluation metrics, which depends on the dataset, e.g., "mIoU"' |
| 35 | ' for generic datasets, and "cityscapes" for Cityscapes') |
| 36 | parser.add_argument('--show', action='store_true', help='show results') |
| 37 | parser.add_argument( |
| 38 | '--show-dir', help='directory where painted images will be saved') |
| 39 | parser.add_argument( |
| 40 | '--gpu-collect', |
| 41 | action='store_true', |
| 42 | help='whether to use gpu to collect results.') |
| 43 | parser.add_argument( |
| 44 | '--tmpdir', |
| 45 | help='tmp directory used for collecting results from multiple ' |
| 46 | 'workers, available when gpu_collect is not specified') |
| 47 | parser.add_argument( |
| 48 | '--options', nargs='+', action=DictAction, help='custom options') |
| 49 | parser.add_argument( |
| 50 | '--eval-options', |
| 51 | nargs='+', |
| 52 | action=DictAction, |
| 53 | help='custom options for evaluation') |
| 54 | parser.add_argument( |
| 55 | '--launcher', |
| 56 | choices=['none', 'pytorch', 'slurm', 'mpi'], |
| 57 | default='none', |
| 58 | help='job launcher') |
| 59 | parser.add_argument('--local_rank', type=int, default=0) |
| 60 | args = parser.parse_args() |
| 61 | if 'LOCAL_RANK' not in os.environ: |
| 62 | os.environ['LOCAL_RANK'] = str(args.local_rank) |
| 63 | return args |
| 64 | |
| 65 | |
| 66 | def main(): |