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