Joel1810 commited on
Commit
ac0c1fe
·
verified ·
1 Parent(s): 9c72ba3

Upload configs/base_config.yaml

Browse files
Files changed (1) hide show
  1. configs/base_config.yaml +215 -0
configs/base_config.yaml ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MSLesSeg Framework Base Configuration
2
+ # Multiple Sclerosis Lesion Segmentation Framework
3
+
4
+ project:
5
+ name: "MSLesSeg_Segmentation"
6
+ seed: 42
7
+ experiment_dir: "./experiments"
8
+ checkpoint_dir: "./checkpoints"
9
+
10
+ dataset:
11
+ name: "MSLesSeg"
12
+ data_dir: "./data/MSLesSeg"
13
+ modalities: ["FLAIR", "T1", "T2"] # Channel order
14
+ num_modalities: 3
15
+ num_classes: 2 # background + lesion
16
+ in_channels: 3
17
+ out_channels: 2
18
+
19
+ # Preprocessing
20
+ spacing: [1.0, 1.0, 1.0] # Target isotropic spacing in mm
21
+ orientation: "RAS"
22
+ normalize: "zscore_nonzero" # zscore_nonzero, zscore, minmax
23
+ crop_foreground: true
24
+
25
+ # Patch-based training
26
+ patch_size: [128, 128, 128]
27
+ patch_overlap: 0.5
28
+
29
+ # Splits
30
+ split_strategy: "patient_wise" # patient_wise, stratified, random
31
+ val_ratio: 0.15
32
+ test_ratio: 0.0 # Official test set held out
33
+ num_folds: 5
34
+ fold_id: 0
35
+
36
+ # Class imbalance handling
37
+ pos_neg_ratio: 1.0 # For RandCropByPosNegLabeld
38
+ num_samples_per_volume: 4
39
+
40
+ data_augmentation:
41
+ enabled: true
42
+
43
+ spatial:
44
+ prob_flip: 0.5
45
+ prob_rotate90: 0.5
46
+ prob_scale: 0.1
47
+ scale_range: [0.9, 1.1]
48
+ prob_shift: 0.5
49
+ shift_range: [-0.1, 0.1]
50
+ prob_rotate: 0.2
51
+ rotate_range: [-0.0524, 0.0524] # +/- 3 degrees
52
+
53
+ intensity:
54
+ prob_scale_intensity: 0.1
55
+ scale_factors: 0.1
56
+ prob_shift_intensity: 0.5
57
+ shift_offsets: 0.1
58
+ prob_gamma: 0.3
59
+ gamma_range: [0.7, 1.5]
60
+ prob_gaussian_noise: 0.1
61
+ noise_std: 0.01
62
+
63
+ elastic:
64
+ enabled: false # Memory intensive for 3D
65
+ prob: 0.2
66
+ sigma_range: [5, 8]
67
+ magnitude_range: [1, 2]
68
+
69
+ model:
70
+ # Architecture selection
71
+ name: "SwinUNETR" # UNet, AttentionUNet, UNetPlusPlus, SwinUNETR, UNETR, SegResNet, VNet, nnUNet
72
+
73
+ # UNet / AttentionUNet / UNetPlusPlus
74
+ channels: [32, 64, 128, 256, 512]
75
+ strides: [2, 2, 2, 2]
76
+ num_res_units: 2
77
+
78
+ # SwinUNETR
79
+ feature_size: 48
80
+ use_checkpoint: true # Gradient checkpointing for memory
81
+
82
+ # UNETR
83
+ hidden_size: 768
84
+ mlp_dim: 3072
85
+ num_heads: 12
86
+ pos_embed: "conv"
87
+
88
+ # SegResNet
89
+ init_filters: 32
90
+ blocks_down: [1, 2, 2, 4]
91
+ blocks_up: [1, 1, 1]
92
+
93
+ # VNet
94
+ vnet_channels: [16, 32, 64, 128, 256]
95
+
96
+ training:
97
+ batch_size: 2
98
+ num_epochs: 800
99
+ num_workers: 4
100
+
101
+ optimizer:
102
+ name: "AdamW" # AdamW, SGD, Lion, SAM
103
+ lr: 0.0001
104
+ weight_decay: 0.0001
105
+
106
+ scheduler:
107
+ name: "cosine_warmup" # cosine_warmup, cosine, onecycle, polynomial, plateau
108
+ warmup_epochs: 10
109
+ T_0: 50
110
+ T_mult: 1
111
+ min_lr: 1.0e-7
112
+
113
+ loss:
114
+ name: "DiceCELoss" # DiceLoss, DiceCELoss, DiceFocalLoss, TverskyLoss, FocalLoss, BoundaryLoss
115
+ class_weights: null
116
+ focal_gamma: 2.0
117
+ tversky_alpha: 0.3
118
+ tversky_beta: 0.7
119
+
120
+ # Training techniques
121
+ mixed_precision: true
122
+ gradient_clip_val: 1.0
123
+ gradient_accumulation_steps: 1
124
+
125
+ # Validation
126
+ val_interval: 5
127
+ save_top_k: 3
128
+
129
+ # Early stopping
130
+ early_stopping:
131
+ enabled: true
132
+ patience: 100
133
+ monitor: "val_dice"
134
+ mode: "max"
135
+
136
+ inference:
137
+ sliding_window:
138
+ enabled: true
139
+ roi_size: [128, 128, 128]
140
+ sw_batch_size: 4
141
+ overlap: 0.5
142
+ mode: "gaussian"
143
+
144
+ test_time_augmentation:
145
+ enabled: false
146
+ flips: [[0], [1], [2], [0, 1], [0, 2], [1, 2]]
147
+
148
+ post_processing:
149
+ apply_sigmoid: false
150
+ threshold: 0.5
151
+ remove_small_objects: true
152
+ min_lesion_size: 3 # mm^3
153
+ fill_holes: false
154
+
155
+ metrics:
156
+ primary: "dice"
157
+ compute:
158
+ - dice
159
+ - iou
160
+ - precision
161
+ - recall
162
+ - sensitivity
163
+ - specificity
164
+ - f1
165
+ - hausdorff_distance
166
+ - hausdorff_95
167
+ - volume_similarity
168
+ - boundary_f1
169
+ - small_lesion_f1
170
+ - false_positive_rate
171
+ - false_discovery_rate
172
+
173
+ explainability:
174
+ enabled: true
175
+ methods:
176
+ - grad_cam
177
+ - attention_maps
178
+ - saliency_maps
179
+ - uncertainty_monte_carlo
180
+ mc_samples: 10
181
+
182
+ ensemble:
183
+ enabled: false
184
+ models:
185
+ - "fold_0_swinunetr"
186
+ - "fold_1_swinunetr"
187
+ - "fold_2_swinunetr"
188
+ method: "average" # average, weighted, stacking
189
+ weights: null
190
+
191
+ tracking:
192
+ enabled: true
193
+ backend: "trackio" # trackio, wandb, tensorboard
194
+ project_name: "mslesseg-segmentation"
195
+ experiment_name: "baseline_swinunetr"
196
+ log_every_n_steps: 10
197
+
198
+ hyperparameter_optimization:
199
+ enabled: false
200
+ backend: "optuna"
201
+ n_trials: 50
202
+ search_space:
203
+ lr: [1.0e-5, 1.0e-3]
204
+ batch_size: [1, 4]
205
+ patch_size: [[96, 96, 96], [128, 128, 128]]
206
+ feature_size: [24, 48, 96]
207
+ loss: ["DiceCELoss", "DiceFocalLoss"]
208
+ optimizer: ["AdamW", "SGD"]
209
+
210
+ # System configuration
211
+ system:
212
+ gpu_ids: [0]
213
+ precision: "16-mixed" # 16-mixed, 32, bf16-mixed
214
+ deterministic: false
215
+ benchmark: true