forked from Tencent/MedicalNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setting.py
116 lines (113 loc) · 3.28 KB
/
setting.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
'''
Configs for training & testing
Written by Whalechen
'''
import argparse
def parse_opts():
parser = argparse.ArgumentParser()
parser.add_argument(
'--data_root',
default='./data',
type=str,
help='Root directory path of data')
parser.add_argument(
'--img_list',
default='./data/train.txt',
type=str,
help='Path for image list file')
parser.add_argument(
'--n_seg_classes',
default=2,
type=int,
help="Number of segmentation classes"
)
parser.add_argument(
'--learning_rate', # set to 0.001 when finetune
default=0.001,
type=float,
help=
'Initial learning rate (divided by 10 while training by lr scheduler)')
parser.add_argument(
'--num_workers',
default=4,
type=int,
help='Number of jobs')
parser.add_argument(
'--batch_size', default=1, type=int, help='Batch Size')
parser.add_argument(
'--phase', default='train', type=str, help='Phase of train or test')
parser.add_argument(
'--save_intervals',
default=10,
type=int,
help='Interation for saving model')
parser.add_argument(
'--n_epochs',
default=200,
type=int,
help='Number of total epochs to run')
parser.add_argument(
'--input_D',
default=56,
type=int,
help='Input size of depth')
parser.add_argument(
'--input_H',
default=448,
type=int,
help='Input size of height')
parser.add_argument(
'--input_W',
default=448,
type=int,
help='Input size of width')
parser.add_argument(
'--resume_path',
default='',
type=str,
help=
'Path for resume model.'
)
parser.add_argument(
'--pretrain_path',
default='pretrain/resnet_50.pth',
type=str,
help=
'Path for pretrained model.'
)
parser.add_argument(
'--new_layer_names',
#default=['upsample1', 'cmp_layer3', 'upsample2', 'cmp_layer2', 'upsample3', 'cmp_layer1', 'upsample4', 'cmp_conv1', 'conv_seg'],
default=['conv_seg'],
type=list,
help='New layer except for backbone')
parser.add_argument(
'--no_cuda', action='store_true', help='If true, cuda is not used.')
parser.set_defaults(no_cuda=False)
parser.add_argument(
'--gpu_id',
nargs='+',
type=int,
help='Gpu id lists')
parser.add_argument(
'--model',
default='resnet',
type=str,
help='(resnet | preresnet | wideresnet | resnext | densenet | ')
parser.add_argument(
'--model_depth',
default=50,
type=int,
help='Depth of resnet (10 | 18 | 34 | 50 | 101)')
parser.add_argument(
'--resnet_shortcut',
default='B',
type=str,
help='Shortcut type of resnet (A | B)')
parser.add_argument(
'--manual_seed', default=1, type=int, help='Manually set random seed')
parser.add_argument(
'--ci_test', action='store_true', help='If true, ci testing is used.')
args = parser.parse_args()
args.save_folder = "./trails/models/{}_{}".format(args.model, args.model_depth)
return args