def basic_argument_parser(distributed=True, requires_config_file=True, requires_output_dir=True):
    ' Basic cli tool parser for Detectron2Go binaries '
    parser = argparse.ArgumentParser(description='PyTorch Object Detection Training')
    parser.add_argument('--runner', type=str, default='d2go.runner.GeneralizedRCNNRunner', help='Full class name, i.e. (package.)module.class')
    parser.add_argument('--config-file', help='path to config file', default='', required=requires_config_file, metavar='FILE')
    parser.add_argument('--output-dir', help='When given, this will override the OUTPUT_DIR in the config-file', required=requires_output_dir, default=None, type=str)
    parser.add_argument('opts', help='Modify config options using the command-line', default=None, nargs=argparse.REMAINDER)
    if distributed:
        parser.add_argument('--num-processes', type=int, default=1, help='number of gpus per machine')
        parser.add_argument('--num-machines', type=int, default=1)
        parser.add_argument('--machine-rank', type=int, default=0, help='the rank of this machine (unique per machine)')
        parser.add_argument('--dist-url', default='file:///tmp/d2go_dist_file_{}'.format(time.time()))
        parser.add_argument('--dist-backend', type=str, default='NCCL')
    if (not requires_config_file):
        parser.add_argument('--datasets', type=str, nargs='+', required=True, help='cfg.DATASETS.TEST')
        parser.add_argument('--min_size', type=int, required=True, help='cfg.INPUT.MIN_SIZE_TEST')
        parser.add_argument('--max_size', type=int, required=True, help='cfg.INPUT.MAX_SIZE_TEST')
        return parser
    return parser
Basic cli tool parser for Detectron2Go binaries
def basic_argument_parser(distributed=True, requires_config_file=True, requires_output_dir=True):
    '  '
    parser = argparse.ArgumentParser(description='PyTorch Object Detection Training')
    parser.add_argument('--runner', type=str, default='d2go.runner.GeneralizedRCNNRunner', help='Full class name, i.e. (package.)module.class')
    parser.add_argument('--config-file', help='path to config file', default=, required=requires_config_file, metavar='FILE')
    parser.add_argument('--output-dir', help='When given, this will override the OUTPUT_DIR in the config-file', required=requires_output_dir, default=None, type=str)
    parser.add_argument('opts', help='Modify config options using the command-line', default=None, nargs=argparse.REMAINDER)
    if distributed:
        parser.add_argument('--num-processes', type=int, default=1, help='number of gpus per machine')
        parser.add_argument('--num-machines', type=int, default=1)
        parser.add_argument('--machine-rank', type=int, default=0, help='the rank of this machine (unique per machine)')
        parser.add_argument('--dist-url', default='file:///tmp/d2go_dist_file_{}'.format(time.time()))
        parser.add_argument('--dist-backend', type=str, default='NCCL')
    if (not requires_config_file):
        parser.add_argument('--datasets', type=str, nargs='+', required=True, help='cfg.DATASETS.TEST')
        parser.add_argument('--min_size', type=int, required=True, help='cfg.INPUT.MIN_SIZE_TEST')
        parser.add_argument('--max_size', type=int, required=True, help='cfg.INPUT.MAX_SIZE_TEST')
        return parser
    return parser