-
Notifications
You must be signed in to change notification settings - Fork 6
/
ms_parser.py
42 lines (29 loc) · 1.12 KB
/
ms_parser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import argparse
def parse_args():
# function to parse boolean args
def str2bool(v):
if isinstance(v, bool):
return v
if v.lower() in ("yes", "true", "t", "y", "1"):
return True
elif v.lower() in ("no", "false", "f", "n", "0"):
return False
else:
raise argparse.ArgumentTypeError("Boolean value expected.")
# Command-line argument parser
parser = argparse.ArgumentParser(description="MS-Net properties.")
parser.add_argument("--net_name", default="test_4", type=str)
parser.add_argument("--scales", default=4, type=int)
parser.add_argument("--filters", default=2, type=int)
parser.add_argument("--LR", default=1e-4, type=float)
parser.add_argument("--data_aug", type=str2bool, default=0)
parser.add_argument("--train", type=str2bool, default=0)
parser.add_argument(
"-gpu",
default="0",
type=str,
help="GPU to train on 0-3 (if a cluster is available)",
)
args = parser.parse_args()
print(args)
return args