| 25 | |
| 26 | |
| 27 | def get_args_parser(): |
| 28 | parser = argparse.ArgumentParser('Set transformer detector', add_help=False) |
| 29 | parser.add_argument('--config_file', '-c', type=str, required=True) |
| 30 | parser.add_argument('--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 | # dataset parameters |
| 37 | parser.add_argument('--dataset_file', default='coco') |
| 38 | parser.add_argument('--coco_path', type=str, default='/comp_robot/cv_public_dataset/COCO2017/') |
| 39 | parser.add_argument('--coco_panoptic_path', type=str) |
| 40 | parser.add_argument('--remove_difficult', action='store_true') |
| 41 | parser.add_argument('--fix_size', action='store_true') |
| 42 | |
| 43 | # training parameters |
| 44 | parser.add_argument('--output_dir', default='', |
| 45 | help='path where to save, empty for no saving') |
| 46 | parser.add_argument('--note', default='', |
| 47 | help='add some notes to the experiment') |
| 48 | parser.add_argument('--device', default='cuda', |
| 49 | help='device to use for training / testing') |
| 50 | parser.add_argument('--seed', default=42, type=int) |
| 51 | parser.add_argument('--resume', default='', help='resume from checkpoint') |
| 52 | parser.add_argument('--pretrain_model_path', help='load from other checkpoint') |
| 53 | parser.add_argument('--finetune_ignore', type=str, nargs='+') |
| 54 | parser.add_argument('--start_epoch', default=0, type=int, metavar='N', |
| 55 | help='start epoch') |
| 56 | parser.add_argument('--eval', action='store_true') |
| 57 | parser.add_argument('--num_workers', default=10, type=int) |
| 58 | parser.add_argument('--test', action='store_true') |
| 59 | parser.add_argument('--debug', action='store_true') |
| 60 | parser.add_argument('--find_unused_params', action='store_true') |
| 61 | |
| 62 | parser.add_argument('--save_results', action='store_true') |
| 63 | parser.add_argument('--save_log', action='store_true') |
| 64 | |
| 65 | # distributed training parameters |
| 66 | parser.add_argument('--world_size', default=1, type=int, |
| 67 | help='number of distributed processes') |
| 68 | parser.add_argument('--dist_url', default='env://', help='url used to set up distributed training') |
| 69 | parser.add_argument('--rank', default=0, type=int, |
| 70 | help='number of distributed processes') |
| 71 | parser.add_argument("--local_rank", type=int, help='local rank for DistributedDataParallel') |
| 72 | parser.add_argument('--amp', action='store_true', |
| 73 | help="Train with mixed precision") |
| 74 | |
| 75 | return parser |
| 76 | |
| 77 | |
| 78 | def build_model_main(args): |