-
Notifications
You must be signed in to change notification settings - Fork 36
/
config.py
160 lines (97 loc) · 3.08 KB
/
config.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
"""
The required configurations for training phase ('prepare_Data.py', 'train.py').
"""
cfg = dict()
"""
The coordinates to crop brain volumes. For example, a brain volume with the
One can set the x0,x1,... by calculating none zero pixels through dataset.
Note that the final three shapes must be divisible by the network downscale rate.
"""
cfg['crop_coord'] = {'x0':42, 'x1':194,
'y0':29, 'y1':221,
'z0':2, 'z1':146}
"""
The path to all brain volumes (ex: suppose we have a folder 'MICCAI_BraTS_2019_Data_Training'
that contains two HGG and LGG folders so:
data_dir='./MICCAI_BraTS_2019_Data_Training/*/*')
"""
cfg['data_dir'] = '/path/to/data/'
"""
The final data shapes of saved table file.
"""
cfg['table_data_shape'] = (cfg["crop_coord"]['z1']-cfg["crop_coord"]['z0'],
cfg["crop_coord"]['y1']-cfg["crop_coord"]['y0'],
cfg["crop_coord"]['x1']-cfg["crop_coord"]['x0'])
"""
BraTS datasets contain 4 channels: (FLAIR, T1, T1ce, T2)
"""
cfg['data_channels'] = 4
"""
The path to save table file + k-fold files
"""
cfg['save_data_dir'] = './data/'
"""
The path to save models + log files + tensorboards
"""
cfg['save_dir'] = './save/'
"""
k-fold cross-validation
"""
cfg['k_fold'] = 5
"""
The defualt path of saved table.
"""
cfg['hdf5_dir'] = './data/data.hdf5'
"""
The path to brain indexes of specific fold (a numpy file that was saved in ./data/ by default)
"""
cfg['brains_idx_dir'] = './data/fold0_idx.npy'
"""
'axial', 'sagittal' or 'coronal'. The 'view' has no effect in "prepare_data.py".
All 2D slices and the model will be prepared with respect to 'view'.
"""
cfg['view'] = 'axial'
"""
The batch size for training and validating the model
"""
cfg['batch_size'] = 16
cfg['val_batch_size'] = 32
"""
The augmentation parameters.
"""
cfg['hor_flip'] = True
cfg['ver_flip'] = True
cfg['rotation_range'] = 0
cfg['zoom_range'] = 0.
"""
The leraning rate and the number of epochs for training the model
"""
cfg['epochs'] = 100
cfg['lr'] = 0.008
"""
If True, use process-based threading. "https://keras.io/models/model/"
"""
cfg['multiprocessing'] = False
"""
Maximum number of processes to spin up when using process-based threading.
If unspecified, workers will default to 1. If 0, will execute the generator
on the main thread. "https://keras.io/models/model/"
"""
cfg['workers'] = 1
"""
Whether to use the proposed modifid UNet or the original UNet
"""
cfg['modified_unet'] = True
"""
The depth of the U-structure
"""
cfg['levels'] = 3
"""
The number of channels of the first conv
"""
cfg['start_chs'] = 64
"""
If specified, before training, the model weights will be loaded from this path otherwise
the model will be trained from scratch.
"""
cfg['load_model_dir'] = None