MCPcopy Create free account
hub / github.com/Lans1ng/OSSOD / parse_args

Function parse_args

train.py:22–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21
22def parse_args():
23 parser = argparse.ArgumentParser(description='Train a detector')
24 parser.add_argument('--config', default='',
25 help='train config file path')
26 parser.add_argument('--work-dir', help='the dir to save logs and models')
27 parser.add_argument(
28 '--base_stage', default='False', help='training stage')
29 parser.add_argument(
30 '--resume-from', help='the checkpoint file to resume from')
31 parser.add_argument(
32 '--no-validate',
33 action='store_true',
34 help='whether not to evaluate the checkpoint during training')
35 group_gpus = parser.add_mutually_exclusive_group()
36 group_gpus.add_argument(
37 '--gpus',
38 type=int,
39 help='number of gpus to use '
40 '(only applicable to non-distributed training)')
41 group_gpus.add_argument(
42 '--gpu-ids',
43 type=int,
44 nargs='+',
45 help='ids of gpus to use '
46 '(only applicable to non-distributed training)')
47 parser.add_argument('--seed', type=int, default=None, help='random seed')
48 parser.add_argument(
49 '--deterministic',
50 action='store_true',
51 help='whether to set deterministic options for CUDNN backend.')
52 parser.add_argument(
53 '--options',
54 nargs='+',
55 action=DictAction,
56 help='override some settings in the used config, the key-value pair '
57 'in xxx=yyy format will be merged into config file (deprecate), '
58 'change to --cfg-options instead.')
59 parser.add_argument(
60 '--cfg-options',
61 nargs='+',
62 action=DictAction,
63 help='override some settings in the used config, the key-value pair '
64 'in xxx=yyy format will be merged into config file. If the value to '
65 'be overwritten is a list, it should be like key="[a,b]" or key=a,b '
66 'It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]" '
67 'Note that the quotation marks are necessary and that no white space '
68 'is allowed.')
69 parser.add_argument(
70 '--launcher',
71 choices=['none', 'pytorch', 'slurm', 'mpi'],
72 default='none',
73 help='job launcher')
74 parser.add_argument('--local_rank', type=int, default=0)
75 args = parser.parse_args()
76 if 'LOCAL_RANK' not in os.environ:
77 os.environ['LOCAL_RANK'] = str(args.local_rank)
78
79 if args.options and args.cfg_options:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected