| 12 | |
| 13 | # TODO: support fuse_conv_bn and format_only |
| 14 | def parse_args(): |
| 15 | parser = argparse.ArgumentParser( |
| 16 | description='MMDet3D test (and eval) a model') |
| 17 | parser.add_argument('config', help='test config file path') |
| 18 | parser.add_argument('checkpoint', help='checkpoint file') |
| 19 | parser.add_argument( |
| 20 | '--work-dir', |
| 21 | help='the directory to save the file containing evaluation metrics') |
| 22 | parser.add_argument( |
| 23 | '--ceph', action='store_true', help='Use ceph as data storage backend') |
| 24 | parser.add_argument( |
| 25 | '--show', action='store_true', help='show prediction results') |
| 26 | parser.add_argument( |
| 27 | '--show-dir', |
| 28 | help='directory where painted images will be saved. ' |
| 29 | 'If specified, it will be automatically saved ' |
| 30 | 'to the work_dir/timestamp/show_dir') |
| 31 | parser.add_argument( |
| 32 | '--task', |
| 33 | type=str, |
| 34 | choices=[ |
| 35 | 'mono_det', 'multi-view_det', 'lidar_det', 'lidar_seg', |
| 36 | 'multi-modality_det' |
| 37 | ], |
| 38 | help='Determine the visualization method depending on the task.') |
| 39 | parser.add_argument( |
| 40 | '--wait-time', type=float, default=2, help='the interval of show (s)') |
| 41 | parser.add_argument( |
| 42 | '--cfg-options', |
| 43 | nargs='+', |
| 44 | action=DictAction, |
| 45 | help='override some settings in the used config, the key-value pair ' |
| 46 | 'in xxx=yyy format will be merged into config file. If the value to ' |
| 47 | 'be overwritten is a list, it should be like key="[a,b]" or key=a,b ' |
| 48 | 'It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]" ' |
| 49 | 'Note that the quotation marks are necessary and that no white space ' |
| 50 | 'is allowed.') |
| 51 | parser.add_argument( |
| 52 | '--launcher', |
| 53 | choices=['none', 'pytorch', 'slurm', 'mpi'], |
| 54 | default='none', |
| 55 | help='job launcher') |
| 56 | parser.add_argument('--local_rank', type=int, default=0) |
| 57 | args = parser.parse_args() |
| 58 | if 'LOCAL_RANK' not in os.environ: |
| 59 | os.environ['LOCAL_RANK'] = str(args.local_rank) |
| 60 | return args |
| 61 | |
| 62 | |
| 63 | def trigger_visualization_hook(cfg, args): |