| 23 | |
| 24 | import debugpy |
| 25 | def get_args_parser(): |
| 26 | parser = argparse.ArgumentParser('Set transformer detector', |
| 27 | add_help=False) |
| 28 | parser.add_argument('--config_file', '-c', type=str, required=True) |
| 29 | parser.add_argument( |
| 30 | '--options', |
| 31 | nargs='+', |
| 32 | action=DictAction, |
| 33 | help='override some settings in the used config, the key-value pair ' |
| 34 | 'in xxx=yyy format will be merged into config file.') |
| 35 | |
| 36 | # training parameters |
| 37 | parser.add_argument('--output_dir', |
| 38 | default='', |
| 39 | help='path where to save, empty for no saving') |
| 40 | parser.add_argument('--device', |
| 41 | default='cuda', |
| 42 | help='device to use for training / testing') |
| 43 | parser.add_argument('--seed', default=42, type=int) |
| 44 | parser.add_argument('--resume', default='', help='resume from checkpoint') |
| 45 | parser.add_argument('--pretrain_model_path', |
| 46 | help='load from other checkpoint') |
| 47 | parser.add_argument('--finetune_ignore', type=str, nargs='+') |
| 48 | parser.add_argument('--start_epoch', |
| 49 | default=0, |
| 50 | type=int, |
| 51 | metavar='N', |
| 52 | help='start epoch') |
| 53 | parser.add_argument('--eval', action='store_true') |
| 54 | parser.add_argument('--num_workers', default=0, type=int) |
| 55 | parser.add_argument('--test', action='store_true') |
| 56 | parser.add_argument('--debug', action='store_true') |
| 57 | parser.add_argument('--find_unused_params', action='store_true') |
| 58 | |
| 59 | parser.add_argument('--save_log', action='store_true') |
| 60 | parser.add_argument('--to_vid', action='store_true') |
| 61 | parser.add_argument('--inference', action='store_true') |
| 62 | # distributed training parameters |
| 63 | |
| 64 | parser.add_argument('--rank', |
| 65 | default=0, |
| 66 | type=int, |
| 67 | help='number of distributed processes') |
| 68 | parser.add_argument('--local_rank', |
| 69 | type=int, |
| 70 | help='local rank for DistributedDataParallel') |
| 71 | parser.add_argument('--amp', |
| 72 | action='store_true', |
| 73 | help='Train with mixed precision') |
| 74 | |
| 75 | parser.add_argument('--inference_input', default=None, type=str) |
| 76 | return parser |
| 77 | |
| 78 | |
| 79 | def build_model_main(args, cfg): |