-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.yaml
297 lines (270 loc) · 7.81 KB
/
config.yaml
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
hydra:
run:
dir: ./results/${hydra.runtime.choices.experiment}/${now:%Y-%m-%d}/${now:%H-%M-%S}
sweep:
dir: ./results/${hydra.runtime.choices.experiment}/${now:%Y-%m-%d}/${now:%H-%M-%S}
subdir: ${hydra.job.num}_${hydra.job.override_dirname}
verbose:
- pelphix
- perphix
# - deepdrr
defaults:
- _self_ # makes it so the subconfigs override the primary
- experiment: train
- scheduler: step
- backbone: unet
- optimizer: adam
# Use the configured logging.
- override hydra/job_logging: rich
# Universal variables across experiments
experiment:
seed: 1234
onedrive_dir: ${onedrive_dir}
nmdid_dir: ${nmdid_dir}
skip_download: ${skip_download}
onedrive_dir: ~/datasets/OneDrive
nmdid_dir: sambhav/NMDID-ARCADE
pelvis_annotations_dir: 2023-03-12_pelvis-annotations_ssm
skip_download: True
num_workers: 0
num_procedures: 10000
# vis
fps: 2
show: True
# SSM parameters
n_points: 5000
pelvis_n_points: 10000
n_components: 40
_device_translation_min: 5
_device_translation_max: 100
_device_angulation_max: 45
_wire_translation_min: 2
_wire_translation_max: 15
_wire_angulation_max: 45
# Generating the Pelphix dataset.
sim:
root: ${onedrive_dir}/datasets/Pelphix
nmdid_root: ${onedrive_dir}/${nmdid_dir}
pelvis_annotations_dir: ${onedrive_dir}/${nmdid_dir}/${pelvis_annotations_dir}
num_val: 10
scan_name: THIN_BONE_TORSO
image_size:
- ${image_size}
- ${image_size}
max_procedure_length: 1000
num_procedures: ${num_procedures}
overwrite: ${overwrite}
cache_dir: ${hydra:runtime.cwd}/cache/pelphix
num_workers: ${num_workers}
uniform_wire_movement: False
skill_factor: [0.1, 0.3]
view_skill_factor: [0.6, 0.8]
view_tolerance:
# in degrees.
# ap: 3
# lateral: 5
# inlet: 3
# outlet: 5
# oblique_left: 3
# oblique_right: 3
# teardrop_left: 2
# teardrop_right: 2
ap: 2
lateral: 2
inlet: 2
outlet: 2
oblique_left: 2
oblique_right: 2
teardrop_left: 1
teardrop_right: 1
corridor_radii:
s1_left: 5
s1_right: 5
s1: 5
s2: 5
ramus_left: 3
ramus_right: 3
teardrop_left: 8
teardrop_right: 8
random_translation_bounds:
min:
device:
ap: ${_device_translation_min}
lateral: ${_device_translation_min}
inlet: ${_device_translation_min}
outlet: ${_device_translation_min}
oblique_left: ${_device_translation_min}
oblique_right: ${_device_translation_min}
teardrop_left: ${_device_translation_min}
teardrop_right: ${_device_translation_min}
wire:
ap: ${_wire_translation_min}
lateral: ${_wire_translation_min}
inlet: ${_wire_translation_min}
outlet: ${_wire_translation_min}
oblique_left: ${_wire_translation_min}
oblique_right: ${_wire_translation_min}
teardrop_left: ${_wire_translation_min}
teardrop_right: ${_wire_translation_min}
max:
device:
ap: ${_device_translation_max}
lateral: ${_device_translation_max}
inlet: ${_device_translation_max}
outlet: ${_device_translation_max}
oblique_left: ${_device_translation_max}
oblique_right: ${_device_translation_max}
teardrop_left: ${_device_translation_max}
teardrop_right: ${_device_translation_max}
wire:
ap: ${_wire_translation_max}
lateral: ${_wire_translation_max}
inlet: ${_wire_translation_max}
outlet: ${_wire_translation_max}
oblique_left: ${_wire_translation_max}
oblique_right: ${_wire_translation_max}
teardrop_left: ${_wire_translation_max}
teardrop_right: ${_wire_translation_max}
random_angulation_bounds:
min:
device:
ap: 2
lateral: 2
inlet: 2
outlet: 2
oblique_left: 2
oblique_right: 2
teardrop_left: 2
teardrop_right: 2
wire:
ap: 5
lateral: 5
inlet: 5
outlet: 5
oblique_left: 5
oblique_right: 5
teardrop_left: 5
teardrop_right: 5
max:
device:
ap: ${_device_angulation_max}
lateral: ${_device_angulation_max}
inlet: ${_device_angulation_max}
outlet: ${_device_angulation_max}
oblique_left: ${_device_angulation_max}
oblique_right: ${_device_angulation_max}
teardrop_left: ${_device_angulation_max}
teardrop_right: ${_device_angulation_max}
wire:
ap: ${_wire_angulation_max}
lateral: ${_wire_angulation_max}
inlet: ${_wire_angulation_max}
outlet: ${_wire_angulation_max}
oblique_left: ${_wire_angulation_max}
oblique_right: ${_wire_angulation_max}
teardrop_left: ${_wire_angulation_max}
teardrop_right: ${_wire_angulation_max}
# Other experimental variables
overwrite: False
gpus: 1
eval_only: False
image_size: 224 # 384
onedrive:
syncdir: ${onedrive_dir}
# Set to the output dir for a previous run to continue.
output_dir: output
batch_size: 2
base_lr: 0.00025
# path to transformer checkpoint, for resuming training or for testing
ckpt: null
transformer:
d_model: 512
nhead: 8
dim_feedforward: 2048
num_layers: 6
dropout: 0.5
data_num_workers: 2
dataloader:
batch_size: ${batch_size}
num_workers: ${data_num_workers}
drop_last: False
trainer:
devices: ${gpus}
accelerator: gpu
strategy: auto
deterministic: True
precision: 16 # 32 # 32 might be needed because embedded features are large (usually in range (-25, 25)).
max_epochs: 200
gradient_clip_val: 5 # 0.5
log_every_n_steps: 10
# find_unused_parameters: False
### Testing on Cadaver/patient Data ###
# Path to results directory (e.g. where checkpoint can be found) and results/visualizations will be save.
# If provided, and ckpt is not provided, will load the latest checkpoint from the results directory.
results_dir: "."
liverpool:
root_in_onedrive: datasets/2023-02-09_cadaver_liverpool/2023-02-16_percutaneous-fixation_conventional # in onedrive
root: ${onedrive_dir}/${liverpool.root_in_onedrive}
annotations_dir: ${liverpool.root}/annotations
csv_path: ${liverpool.root}/sequences.csv
image_dir: ${liverpool.root}/OrthoTrauma (20130116)
# Training the U-Net
weights_only: False
unet_seq_len: 48
unet_module:
supercategories: ["task", "activity", "acquisition", "frame"]
supercategory_num_classes: [8,3,8,2]
num_seg_classes: 17
num_keypoints: 16
unet: ${backbone}
transformer: ${transformer}
optimizer: ${optimizer}
scheduler: ${scheduler}
use_keypoints: True
use_segmentations: True
filter_preds: False
unet_image_size: 224
triplets: True
sequences_train:
seq_len: ${unet_seq_len}
train: true
image_size: ${unet_image_size}
triplets: ${triplets}
configs:
- loader: load
config:
annotation_path: ${sim.root}/annotations/pelphix_000338_train.json
image_dir: ${sim.root}/pelphix_000338_train
- loader: load
config:
annotation_path: ${sim.root}/annotations/pelphix_000339_train.json
image_dir: ${sim.root}/pelphix_000339_train
sequences_val:
seq_len: ${unet_seq_len}
train: false
image_size: ${unet_image_size}
triplets: ${triplets}
configs:
- loader: load
config:
annotation_path: ${sim.root}/annotations/pelphix_000338_val.json
image_dir: ${sim.root}/pelphix_000338_val
- loader: load
config:
annotation_path: ${sim.root}/annotations/pelphix_000339_val.json
image_dir: ${sim.root}/pelphix_000339_val
sequences_test:
seq_len: ${unet_seq_len} # 300 rather than 100?
train: false
image_size: ${unet_image_size}
fliph: true
triplets: ${triplets}
overlap: 0.5
configs:
- loader: from_csv
config:
image_dir: ${liverpool.image_dir}
annotations_dir: ${liverpool.annotations_dir}
csv_path: ${liverpool.csv_path}
name: liverpool
use_previous: false