-
Notifications
You must be signed in to change notification settings - Fork 5
/
config_template.yml
305 lines (302 loc) · 7.97 KB
/
config_template.yml
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
---
#############################################################################################
# This is a template for new configuration files.
# It contains sample values and explainations for every variable.
#
# "Mandatory" denotes that the key must exist.
# "Default: XY" denotes that if no key-value pair is provided, the default value will be used
#############################################################################################
# Mandatory - General settings needed in multiple settings
General:
# Default: False - Whether to train with automated mixed precision https://pytorch.org/tutorials/recipes/recipes/amp_recipe.html
amp: true
# Default: 'cpu' - Device to use. Either "cpu", "cuda", or "cuda:X", where X is the index of the gpu
device: cuda:0
# Mandatory - Task to perform. See class Task in './utils/metrics.py'
task: ves-seg
# Mandatory - Model / Network to use.
model:
# Name of the model. See MODEL_DICT in ./models/networks.py
name: DynUNet
# List all parameters for the model...
spatial_dims: 2
in_channels: 1
out_channels: 1
kernel_size: [3,3,3,3,3]
strides: [1,2,2,2,1]
upsample_kernel_size: [1,2,2,2,1]
# Mandatory for Training - Training settings
Train:
# Mandatory - Dataset settings
data:
# List the keys that are required by the model...
# Image files
image:
# Mandatory - Dataset files. Use absolute paths.
files: /ABSOLUTE/PATH/TO/SYNTHETIC/CSV/FOLDER/**/*.csv
# Default: Use all files - Path of a file listing all indices of the files that should be loaded
split: null
# Label files
label:
files: /ABSOLUTE/PATH/TO/SYNTHETIC/CSV/FOLDER/**/*.csv
split: null
background:
files: /ABSOLUTE/PATH/TO/SYNTHETIC/BACKGROUND/FOLDER/**/*.png
# Mandatory - Number of epochs to train
epochs: 30
# Default: 0 - Number of epochs to linearly decay learning rate
epochs_decay: 10
# Default: 1 - Epoch interval to perform valdiation
val_interval: 1
# Default: 1 - Epoch interval to store checkpoints
save_interval: 5
# Default: 1 - Batch size
batch_size: 4
# Mandatory - (Start) learning rate
lr: 0.0001
# Mandatory - Loss function. See get_loss_function_by_name() in ./utils/losses.py
loss: DiceBCELoss
# Default: false - Adversarial training. Only effective when NoiseModeld data transformation is used
AT: false
# Mandatory - Data augmentation. We use custom data transforms from ./data/data_transfroms.py and from https://docs.monai.io/en/stable/transforms.html
data_augmentation:
# List all data transforms in the order they should be run.
# Make sure to use the same key names as used in the data block.
# Mandatory - Name of the data transform.
- name: LoadImaged
# Mandatory - List of all items the transform should be applied to.
keys:
- background
# Other parameters...
image_only: true
- name: LoadGraphAndFilterByRandomRadiusd
keys:
- image
- label
image_resolutions:
- [304,304] # for 304x304 images
- [1216,1216]
# - [512,512] # for 512x512 images
# - [1216,1216]
min_radius: [0,0]
max_dropout_prob: 0.02
- name: ScaleIntensityd
keys:
- image
- label
- background
minv: 0
maxv: 1
- name: EnsureChannelFirstd
keys:
- image
- label
- background
strict_check: false
channel_dim: no_channel
- name: Resized
keys:
- image
- label
spatial_size:
- 1216
- 1216
mode: bilinear
- name: Resized
keys:
- background
spatial_size:
- 304
- 304
mode: bilinear
- name: NoiseModeld
keys:
- image
prob: 0.5
lambda_delta: 0.7
lambda_speckle: 0.5
lambda_gamma: 0.1
downsample_factor: 1
- name: RandomDecreaseResolutiond
keys:
- image
- name: RandFlipd
keys:
- image
- label
prob: 0.5
spatial_axis:
- 0
- 1
- name: RandRotate90d
keys:
- image
- label
prob: 0.75
- name: RandRotated
keys:
- image
- label
prob: 1
range_x: 0.17453292519943295
padding_mode: zeros
- name: AsDiscreted
keys:
- label
threshold: 0.5
- name: CastToTyped
keys:
- image
- label
dtype: dtype
# Mandatory - Post processing transforms that should be applied before computing the metric / the final output.
# We use custom data transforms from ./data/data_transfroms.py and from https://docs.monai.io/en/stable/transforms.html
post_processing:
# Default: None - Post processing for the models prediction.
prediction:
# Mandatory - Name of the transform
- name: Activations
sigmoid: true
- name: AsDiscrete
threshold: 0.5
- name: RemoveSmallObjects
min_size: 160
# Default: None - Post processing for the label.
label:
- name: CastToType
dtype: uint8
# Mandatory for Validation - Validation settings
Validation:
batch_size: 4
data:
image:
files: /ABSOLUTE/PATH/TO/OCTA-500/images/**/*.png
split: /ABSOLUTE/PATH/TO/OCTA-500/val_0.txt
label:
files: /ABSOLUTE/PATH/TO/OCTA-500/segmentations/**/*.png
split: /ABSOLUTE/PATH/TO/OCTA-500/val_0.txt
data_augmentation:
- name: LoadImaged
keys:
- image
- label
image_only: true
- name: ScaleIntensityd
keys:
- image
- label
minv: 0
maxv: 1
- name: EnsureChannelFirstd
keys:
- image
- label
strict_check: false
channel_dim: no_channel
- name: Resized
keys:
- image
- label
spatial_size:
- 1216
- 1216
mode: bilinear
- name: Rotate90d
keys:
- image
- label
k: 1
- name: Flipd
keys:
- image
- label
spatial_axis: 0
- name: AsDiscreted
keys:
- label
threshold: 0.5
- name: CastToTyped
keys:
- image
- label
dtype: dtype
post_processing:
prediction:
- name: Activations
sigmoid: true
- name: AsDiscrete
threshold: 0.5
- name: RemoveSmallObjects
min_size: 160
label:
- name: CastToType
dtype: uint8
# Mandatory for Testing - Test settings
Test:
batch_size: 1
data:
image:
files: /ABSOLUTE/PATH/TO/OCTA-500/images/**/*.png
split: /ABSOLUTE/PATH/TO/OCTA-500/val_0.txt
# Default: Infinity - Maximum number of samples used for inference
num_samples: 10
# Default: false - Create a side by side comparison of the source and prediction
save_comparisons: false
data_augmentation:
- name: LoadImaged
keys:
- image
image_only: true
- name: ToGrayScaled
keys:
- image
- name: ScaleIntensityd
keys:
- image
minv: 0
maxv: 1
- name: EnsureChannelFirstd
keys:
- image
strict_check: false
channel_dim: no_channel
- name: Resized
keys:
- image
spatial_size:
- 1216
- 1216
mode: bilinear
- name: Rotate90d
keys:
- image
k: 1
- name: Flipd
keys:
- image
spatial_axis: 0
- name: CastToTyped
keys:
- image
dtype: dtype
post_processing:
prediction:
- name: Activations
sigmoid: true
- name: AsDiscrete
threshold: 0.5
- name: RemoveSmallObjects
min_size: 160
label:
- name: CastToType
dtype: uint8
# Default: Output.save_dir + /test - Save directory to store test results
save_dir: /ABSOLUTE/PATH/TO/results/template/
# Mandatory - Output settings
Output:
# Mandatory - Save directory to store checkpoints, training details, etc.
save_dir: /ABSOLUTE/PATH/TO/results/template/
# Mandatory - If true, store example images during training as images in the save files.
save_to_disk: true
# Mandatory - If true, store example images during training in tensorboard
save_to_tensorboard: false