MCPcopy Index your code
hub / github.com/YXB-NKU/Strip-R-CNN / parse_args

Function parse_args

tools/train.py:24–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22
23
24def parse_args():
25 parser = argparse.ArgumentParser(description='Train a detector')
26 parser.add_argument('config', help='train config file path')
27 parser.add_argument('--work-dir', help='the dir to save logs and models')
28 parser.add_argument(
29 '--resume-from', help='the checkpoint file to resume from')
30 parser.add_argument(
31 '--auto-resume',
32 action='store_true',
33 help='resume from the latest checkpoint automatically')
34 parser.add_argument(
35 '--no-validate',
36 action='store_true',
37 help='whether not to evaluate the checkpoint during training')
38 group_gpus = parser.add_mutually_exclusive_group()
39 group_gpus.add_argument(
40 '--gpus',
41 type=int,
42 help='number of gpus to use '
43 '(only applicable to non-distributed training)')
44 group_gpus.add_argument(
45 '--gpu-ids',
46 type=int,
47 nargs='+',
48 help='ids of gpus to use '
49 '(only applicable to non-distributed training)')
50 parser.add_argument('--seed', type=int, default=None, help='random seed')
51 parser.add_argument(
52 '--diff-seed',
53 action='store_true',
54 help='Whether or not set different seeds for different ranks')
55 parser.add_argument(
56 '--deterministic',
57 action='store_true',
58 help='whether to set deterministic options for CUDNN backend.')
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 return args
80
81

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected