| 147 | |
| 148 | |
| 149 | def parse_args() -> argparse.Namespace: |
| 150 | parser = argparse.ArgumentParser( |
| 151 | description='mmseg backend test (and eval)') |
| 152 | parser.add_argument('config', help='test config file path') |
| 153 | parser.add_argument('model', help='Input model file') |
| 154 | parser.add_argument( |
| 155 | '--backend', |
| 156 | help='Backend of the model.', |
| 157 | choices=['onnxruntime', 'tensorrt']) |
| 158 | parser.add_argument('--out', help='output result file in pickle format') |
| 159 | parser.add_argument( |
| 160 | '--format-only', |
| 161 | action='store_true', |
| 162 | help='Format the output results without perform evaluation. It is' |
| 163 | 'useful when you want to format the result to a specific format and ' |
| 164 | 'submit it to the test server') |
| 165 | parser.add_argument( |
| 166 | '--eval', |
| 167 | type=str, |
| 168 | nargs='+', |
| 169 | help='evaluation metrics, which depends on the dataset, e.g., "mIoU"' |
| 170 | ' for generic datasets, and "cityscapes" for Cityscapes') |
| 171 | parser.add_argument('--show', action='store_true', help='show results') |
| 172 | parser.add_argument( |
| 173 | '--show-dir', help='directory where painted images will be saved') |
| 174 | parser.add_argument( |
| 175 | '--options', nargs='+', action=DictAction, help='custom options') |
| 176 | parser.add_argument( |
| 177 | '--eval-options', |
| 178 | nargs='+', |
| 179 | action=DictAction, |
| 180 | help='custom options for evaluation') |
| 181 | parser.add_argument( |
| 182 | '--opacity', |
| 183 | type=float, |
| 184 | default=0.5, |
| 185 | help='Opacity of painted segmentation map. In (0, 1] range.') |
| 186 | parser.add_argument('--local_rank', type=int, default=0) |
| 187 | args = parser.parse_args() |
| 188 | if 'LOCAL_RANK' not in os.environ: |
| 189 | os.environ['LOCAL_RANK'] = str(args.local_rank) |
| 190 | return args |
| 191 | |
| 192 | |
| 193 | def main(): |