| 14 | import models |
| 15 | |
| 16 | def parse_args(): |
| 17 | parser = argparse.ArgumentParser( |
| 18 | description='mmseg test (and eval) a model') |
| 19 | parser.add_argument('config', help='test config file path') |
| 20 | parser.add_argument('checkpoint', help='checkpoint file') |
| 21 | parser.add_argument( |
| 22 | '--aug-test', action='store_true', help='Use Flip and Multi scale aug') |
| 23 | parser.add_argument('--out', help='output result file in pickle format') |
| 24 | parser.add_argument( |
| 25 | '--format-only', |
| 26 | action='store_true', |
| 27 | help='Format the output results without perform evaluation. It is' |
| 28 | 'useful when you want to format the result to a specific format and ' |
| 29 | 'submit it to the test server') |
| 30 | parser.add_argument( |
| 31 | '--eval', |
| 32 | type=str, |
| 33 | nargs='+', |
| 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( |
| 60 | '--opacity', |
| 61 | type=float, |
| 62 | default=0.5, |
| 63 | help='Opacity of painted segmentation map. In (0, 1] range.') |
| 64 | parser.add_argument( |
| 65 | '--save_dir', |
| 66 | type=str, |
| 67 | default=None) |
| 68 | parser.add_argument('--local-rank', type=int, default=0) |
| 69 | parser.add_argument('--aug_ratio_start', type=float, default=-1) |
| 70 | parser.add_argument('--exp_tag', default=None) |
| 71 | args = parser.parse_args() |
| 72 | if 'LOCAL_RANK' not in os.environ: |
| 73 | os.environ['LOCAL_RANK'] = str(args.local_rank) |