-
Notifications
You must be signed in to change notification settings - Fork 1
/
write_preds_save_dice.py
317 lines (266 loc) · 25.2 KB
/
write_preds_save_dice.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
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
306
307
308
309
310
311
312
313
314
315
316
317
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 12 10:20:10 2020
@author: jjia
"""
import tensorflow as tf
from tensorflow.keras import backend as K
from futils import segmentor as v_seg
from futils.compute_distance_metrics_and_save import write_all_metrics
from futils.find_connect_parts import write_connected_lobes
from futils.generate_fissure_from_masks import gntFissure
from futils.mypath import Mypath
from futils.write_batch_preds import write_preds_to_disk
config = tf.ConfigProto()
config.gpu_options.allow_growth = True # dynamically grow the memory used on the GPU
sess = tf.Session(config=config)
K.set_session(sess) # set this TensorFlow session as the default session for Keras
'''
'1585000573.7211952_0.00011a_o_0ds2dr1bn1fs16ptsz144ptzsz64',
'1584924602.9965076_0.00010a_o_0ds2dr1bn1fs16ptsz144ptzsz64',
'1584925363.1298258_0.00010a_o_0ds2dr1bn1fs16ptsz96ptzsz64'
1587041504.5222292_0.00010a_o_0ds2dr1bn1fs16ptsz144ptzsz64
1587846165.2829812_0.00010a_o_0ds2dr1bn1fs16ptsz144ptzsz64
1587858645.924413_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz96
1587858294.826981_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz96
1587857822.602289_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz96
1587852304.1056986_0.00010a_o_0ds2dr1bn1fs4ptsz144ptzsz96
1587852304.1056986_0.00010a_o_0ds2dr1bn1fs4ptsz144ptzsz96
1587848974.2342067_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz96
1587848927.819794_0.00010a_o_0ds2dr1bn1fs16ptsz144ptzsz96
1587846165.2829812_0.00010a_o_0ds2dr1bn1fs16ptsz144ptzsz64
'1588287353.8400497_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz96'
'1588287759.0237665_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz96'
'1588287839.3979223_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz96'
'1588288125.8417192_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz144'
'1588288409.620666_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz64'
'1588288526.236716_0.00010a_o_0ds2dr1bn1fs4ptsz144ptzsz64'
'1588288618.4858303_0.00010a_o_0ds2dr1bn1fs2ptsz144ptzsz64'
'1588289073.84265_0.00010a_o_0ds2dr1bn1fs4ptsz144ptzsz96'
'1588289144.719585_0.00010a_o_0ds2dr1bn1fs16ptsz144ptzsz96'
'1588287353.8400497_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz96',
'1588287759.0237665_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz96',
'1588287839.3979223_0.00010a_o_0ds2dr1bn1fs8ptsz144ptzsz96',
'1588717256_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb5ptsz96ptzsz96',
'1588718049_lr0.001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb50ptsz64ptzsz64',
'1588717836_lr0.001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb50ptsz96ptzsz64',
'1588717764_lr0.001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb50ptsz96ptzsz144',
'1588717689_lr0.001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb50ptsz144ptzsz96',
'1588717666_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb20ptsz144ptzsz96',
'1588717641_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb10ptsz144ptzsz96',
'1588717429_lr0.0001ld0ao0ds2dr1bn1fn2trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb5ptsz144ptzsz96',
'1588717407_lr0.0001ld0ao0ds2dr1bn1fn12trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb5ptsz144ptzsz96',
'1588717381_lr0.0001ld0ao0ds2dr1bn1fn8trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb5ptsz144ptzsz96',
'1588717334_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb5ptsz144ptzsz32',
'1588717312_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb5ptsz144ptzsz64',
'1588717256_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb5ptsz96ptzsz96',
'1588717176_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb5ptsz128ptzsz96',
'1588716830_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb5ptsz144ptzsz96',
'1588710600_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb5ptsz144ptzsz96'
'1588717256_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb5ptsz96ptzsz96',
'1588887205_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb50ptsz96ptzsz144',
'1588886816_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb50ptsz64ptzsz64',
'1588886682_lr0.0001ld0ao0ds2dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb50ptsz144ptzsz96'
''
'1585000103.6170883_0.00011a_o_0ds2dr1bn1fs16ptsz96ptzsz64',
'1584925363.1298258_0.00010a_o_0ds2dr1bn1fs16ptsz96ptzsz64'
following 6 models contain lobe task:
'1592676170_448_lr0.0001ld0m6l0m7l0pm0.5no_label_dirNoneao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb18ptsz144ptzsz96', # lobe+vessel 18 cts
'1592685339_438_lr0.0001ld0m6l0m7l0pm0.5no_label_dirGLUCOLDao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb18ptsz144ptzsz96', # lobe+recon 18 cts
'1592685598_920_lr0.0001ld0m6l0m7l0pm0.5no_label_dirSScao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb18ptsz144ptzsz96', # lobe+vessel+recon 18 cts
'1592689121_655_lr0.0001ld0mtscale1m6l0m7l0pm0.5no_label_dirNoneao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb5ptsz144ptzsz96', # lobe 5 cts
'1592689233_654_lr0.0001ld0mtscale1m6l0m7l0pm0.5no_label_dirGLUCOLDao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb5ptsz144ptzsz96',
'1592689179_995_lr0.0001ld0mtscale1m6l0m7l0pm0.5no_label_dirNoneao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb5ptsz144ptzsz96'
following 6 models contain vessel task:
'1592689179_711_lr0.0001ld0mtscale1m6l0m7l0pm0.5no_label_dirNoneao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb5ptsz144ptzsz96', # lobe+vessel 5 cts
'1592689254_580_lr0.0001ld0mtscale1m6l0m7l0pm0.5no_label_dirSScao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb5ptsz144ptzsz96', # vessel+recon 5 cts
'1592689158_187_lr0.0001ld0mtscale1m6l0m7l0pm0.5no_label_dirNoneao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb5ptsz144ptzsz96', #vessel_only 5 cts
'1592685598_203_lr0.0001ld0m6l0m7l0pm0.5no_label_dirSScao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb18ptsz144ptzsz96', #lobe+vessel+recon 18 cts
'1592676170_464_lr0.0001ld0m6l0m7l0pm0.5no_label_dirNoneao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb18ptsz144ptzsz96', #lobe+vessel 18 cts
'1592685256_247_lr0.0001ld0m6l0m7l0pm0.5no_label_dirSScao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb18ptsz144ptzsz96', # vessel + recon 18 cts
'1592676155_848_lr0.0001ld0m6l0m7l0pm0.5no_label_dirNoneao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb18ptsz144ptzsz96' #vessel_only, 18 cts
follow 4 models are the continuely trained models:
for lobe:
'1592867691_416_lr1e-05ld1mtscale1m6l0m7l0pm0.0no_label_dirNoneao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb18ptsz144ptzsz96', # mtscale, 18 cts
'1592867085_582_lr1e-05ld1mtscale1m6l0m7l0pm0.0no_label_dirNoneao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb5ptsz144ptzsz96', # mtscale, 5 cts
for vessel:
'1592867294_862_lr1e-05ld1mtscale1m6l0m7l0pm0.5no_label_dirNoneao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb18ptsz144ptzsz96', # mtscale, 18 cts
'1592867477_914_lr1e-05ld1mtscale1m6l0m7l0pm0.5no_label_dirNoneao0ds0dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan100tr_nb5ptsz144ptzsz96', # mtscale, 5 cts
for lobe:
'1589547509_lr0.0001ld0ao1ds2dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan10tr_nb5ptsz144ptzsz96',
'1589547535_lr0.0001ld0ao1ds2dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan10tr_nb19ptsz144ptzsz96',
'1589547545_lr0.0001ld0ao1ds2dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan10tr_nb19ptsz144ptzsz96',
'1589550315_lr0.0001ld0ao1ds2dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan10tr_nb19ptsz144ptzsz96',
'1589550811_lr0.0001ld0ao1ds2dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan10tr_nb5ptsz144ptzsz96',
'1589550817_lr0.0001ld0ao1ds2dr1bn1fn16trszNonetrzszNonetrsp1.4trzsp2.5ptch_per_scan10tr_nb5ptsz144ptzsz96'
for vessel:
['1590413648_783_lr0.0001ld0m6l0m7l0pm0.5no_label_dirSScao0ds0dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb3ptsz144ptzsz96',
'1590414183_839_lr0.0001ld0m6l0m7l0pm0.5no_label_dirSScao0ds0dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb1ptsz144ptzsz96',
'1590413385_685_lr0.0001ld0m6l0m7l0pm0.5no_label_dirSScao0ds0dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb3ptsz144ptzsz96',
'1590413385_284_lr0.0001ld0m6l0m7l0pm0.5no_label_dirSScao0ds0dr1bn1fn16trszNonetrzszNonetrsp0.6trzsp0.3ptch_per_scan500tr_nb1ptsz144ptzsz96'
]
'1595875612_613_lr0.0001ld0mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1595878407_302_lr0.0001ld0mtscale1netnol-nnlpm0.5nldGLUCOLDao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb5ptsz144ptzsz96',
'1595875648_331_lr0.0001ld0mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1595878305_786_lr0.0001ld0mtscale1netnol-nnlpm0.5nldGLUCOLDao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb18ptsz144ptzsz96',
'1595877571_251_lr0.0001ld0mtscale0netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1595878666_42_lr0.0001ld0mtscale0netnol-nnlpm0.5nldGLUCOLDao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb5ptsz144ptzsz96',
'1595876197_377_lr0.0001ld0mtscale0netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1595888909_592_lr0.0001ld0mtscale0netnol-nnlpm0.5nldGLUCOLDao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb18ptsz144ptzsz96',
'1595934933_835_lr0.0001ld0mtscale1netnol-novpm0.5nldGLUCOLDao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb5ptsz144ptzsz96',
'1595934933_727_lr0.0001ld0mtscale1netnol-nov-nnlpm0.5nldGLUCOLDao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb5ptsz144ptzsz96',
'1595934933_562_lr0.0001ld0mtscale1netnol-novpm0.5nldGLUCOLDao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb18ptsz144ptzsz96',
'1595934933_588_lr0.0001ld0mtscale1netnol-nov-nnlpm0.5nldGLUCOLDao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb18ptsz144ptzsz96'
'1596148486_486_lr0.0001ld1mtscale0netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1596148055_918_lr0.0001ld1mtscale0netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1596282280_398_lr0.0001ld1mtscale0netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1596282736_533_lr0.0001ld1mtscale0netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1596282782_472_lr0.0001ld1mtscale0netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1596282864_156_lr0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1596282909_196_lr0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1596282954_794_lr0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1596282987_709_lr0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1596492575_641_lr0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96'.
'1596492575_57_lr0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96'.
'1596492575_540_lr0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96'.
'1596492575_956_lr0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96'.
'1596750032_237_lr0.0001ld0mtscale0netnovpm0.5nldSScao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb5ptsz144ptzsz96',
'1596750032_417_lr0.0001ld0mtscale0netnov-nnlpm0.5nldSScao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb5ptsz144ptzsz96',
'1596750032_566_lr0.0001ld0mtscale0netnovpm0.5nldSScao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb18ptsz144ptzsz96',
'1596750032_130_lr0.0001ld0mtscale0netnov-nnlpm0.5nldSScao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb18ptsz144ptzsz96',
'1596926882_451_lr0.0001lrvs0.0001ld1mtscale1netnovpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1596926882_96_lr0.0001lrvs0.0001ld1mtscale1netnovpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1596926882_784_lr0.0001lrvs0.0001ld1mtscale1netnovpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1596926882_209_lr0.0001lrvs0.0001ld1mtscale1netnovpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1597066656_855_lr0.0001lrvs0.0001ld1mtscale0netnovpm0.5nldNoneao0ds0bn1fn16tsp0.0z0.0pps100trnb5nlnb0ptsz144ptzsz96',
'1597066656_482_lr0.0001lrvs0.0001ld1mtscale0netnovpm0.5nldNoneao0ds0bn1fn16tsp0.0z0.0pps100trnb5nlnb0ptsz144ptzsz96',
'1597066656_632_lr0.0001lrvs0.0001ld1mtscale0netnovpm0.5nldNoneao0ds0bn1fn16tsp0.0z0.0pps100trnb18nlnb0ptsz144ptzsz96',
'1597066656_951_lr0.0001lrvs0.0001ld1mtscale0netnovpm0.5nldNoneao0ds0bn1fn16tsp0.0z0.0pps100trnb18nlnb0ptsz144ptzsz96',
'1597013371_607_lr0.0001lrvs0.0001ld1mtscale1netnovpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1597013371_561_lr0.0001lrvs0.0001ld1mtscale1netnovpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1597013371_569_lr0.0001lrvs0.0001ld1mtscale1netnovpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1597013371_780_lr0.0001lrvs0.0001ld1mtscale1netnovpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1597011428_532_lr0.0001lrvs0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1597011428_999_lr0.0001lrvs0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1597011428_927_lr0.0001lrvs0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1597011428_590_lr0.0001lrvs0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1597011627_773_lr0.0001lrvs0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1597011627_868_lr0.0001lrvs0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb5nlnb0ptsz144ptzsz96',
'1597011627_520_lr0.0001lrvs0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1597011627_353_lr0.0001lrvs0.0001ld1mtscale1netnolpm0.5nldNoneao0ds0bn1fn16tsp1.4z2.5pps100trnb18nlnb0ptsz144ptzsz96',
'1599428838_623_lrlb0.0001lrvs1e-05mtscale0netnolpm0.5nldLUNA16ao0ds0tsp1.4z2.5pps100lbnb17vsnb50nlnb400ptsz144ptzsz96',
'1599475109_771_lrlb0.0001lrvs1e-05mtscale1netnol-novpm0.5nldLUNA16ao1ds2tsp1.4z2.5pps100lbnb17vsnb50nlnb400ptsz144ptzsz96',
'1599475109_302_lrlb0.0001lrvs1e-05mtscale1netnol-nnlpm0.5nldLUNA16ao1ds2tsp1.4z2.5pps100lbnb17vsnb50nlnb400ptsz144ptzsz96',
'''
"""
"1600642845_843_lrlb0.0001lrvs1e-05mtscale0netnolpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1599948441_65_lrlb0.0001lrvs1e-05mtscale1netnolpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1599948441_432_lrlb0.0001lrvs1e-05mtscale1netnol-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1599948441_216_lrlb0.0001lrvs1e-05mtscale1netnol-nnlpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600476675_493_lrlb0.0001lrvs1e-05mtscale0netnol-nnlpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600476675_894_lrlb0.0001lrvs1e-05mtscale0netnol-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600476675_636_lrlb0.0001lrvs1e-05mtscale0netnol-nnl-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600642845_949_lrlb0.0001lrvs1e-05mtscale0netnol-nnlpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600642845_85_lrlb0.0001lrvs1e-05mtscale0netnol-nnl-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600643885_62_lrlb0.0001lrvs1e-05mtscale1netnolpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600643885_972_lrlb0.0001lrvs1e-05mtscale1netnol-nnlpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600643885_770_lrlb0.0001lrvs1e-05mtscale1netnol-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600643885_753_lrlb0.0001lrvs1e-05mtscale1netnol-nnl-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600645190_366_lrlb0.0001lrvs1e-05mtscale0netnolpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600645190_465_lrlb0.0001lrvs1e-05mtscale0netnol-nnlpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600645190_458_lrlb0.0001lrvs1e-05mtscale0netnol-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600645190_537_lrlb0.0001lrvs1e-05mtscale0netnol-nnl-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600645872_556_lrlb0.0001lrvs1e-05mtscale0netnolpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600645872_657_lrlb0.0001lrvs1e-05mtscale0netnol-nnlpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600645872_801_lrlb0.0001lrvs1e-05mtscale0netnol-nnl-novpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600478665_637_lrlb0.0001lrvs1e-05mtscale0netnol-nnl-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600478665_204_lrlb0.0001lrvs1e-05mtscale0netnol-nnlpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600478665_586_lrlb0.0001lrvs1e-05mtscale0netnolpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600479252_877_lrlb0.0001lrvs1e-05mtscale1netnol-nnl-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600479252_612_lrlb0.0001lrvs1e-05mtscale1netnol-nnlpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
"1600479252_70_lrlb0.0001lrvs1e-05mtscale1netnolpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
"""
""","""
task = 'lobe'
biggest_5_lobe = True
for sub_dir in ["LOLA11"]:
str_names = [
"1600645190_537_lrlb0.0001lrvs1e-05mtscale0netnol-nnl-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
# "1602632551_850_lrlb0.0001lrvs1e-05lbio2_in_1_out_lownetnol-nnl-novpm0.5nldLUNA16ao1ds2pps100lbnb17vsnb50nlnb400ptsz144fat1ptzsz96"
# "1602431109_114_lrlb0.0001lrvs1e-05lbio2_in_1_out_lownetnol-nnl-novpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144fat0ptzsz96"
# "1602431109_639_lrlb0.0001lrvs1e-05lbio2_in_1_out_lownetnol-nnl-novpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144fat0ptzsz96"
# "1599948441_216_lrlb0.0001lrvs1e-05mtscale1netnol-nnlpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1599948441_432_lrlb0.0001lrvs1e-05mtscale1netnol-novpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1599948441_65_lrlb0.0001lrvs1e-05mtscale1netnolpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1602429191_780_lrlb0.0001lrvs1e-05lbio2_in_1_out_lownetnol-nnl-novpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144fat1ptzsz96"
# "1602427814_828_lrlb0.0001lrvs1e-05lbio2_in_1_out_lownetnol-nnl-novpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144fat1ptzsz96"
# "1600643885_972_lrlb0.0001lrvs1e-05mtscale1netnol-nnlpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1599169291_810_lrlb0.0001lrvs1e-05mtscale1netnolpm0.5nldLUNA16ao1ds2tsp1.4z2.5pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1600913687_652_lrlb0.0001lrvs1e-05mtscale1netnol-nnl-novpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1599948441_216_lrlb0.0001lrvs1e-05mtscale1netnol-nnlpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1600479252_70_lrlb0.0001lrvs1e-05mtscale1netnolpm0.0nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1602030143_266_lrlb0.0001lrvs1e-05lbio2_in_1_out_lownetnol-nnlpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1602030143_575_lrlb0.0001lrvs1e-05lbio2_in_1_out_lownetnol-novpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1602030143_123_lrlb0.0001lrvs1e-05lbio2_in_1_out_lownetnolpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1602030666_560_lrlb0.0001lrvs1e-05lbio1_in_low_1_out_lownetnol-nnl-novpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1602030219_49_lrlb0.0001lrvs1e-05lbio1_in_low_1_out_lownetnolpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1602030143_123_lrlb0.0001lrvs1e-05lbio2_in_1_out_lownetnolpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1602030666_6_lrlb0.0001lrvs1e-05lbio1_in_low_1_out_lownetnol-nnl-novpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1602030219_49_lrlb0.0001lrvs1e-05lbio1_in_low_1_out_lownetnolpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1602030143_123_lrlb0.0001lrvs1e-05lbio2_in_1_out_lownetnolpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96",
# "1602030454_701_lrlb0.0001lrvs1e-05lbio1_in_low_1_out_lownetnol-novpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
# "1602030454_568_lrlb0.0001lrvs1e-05lbio1_in_low_1_out_lownetnol-nnlpm0.5nldLUNA16ao0ds0pps100lbnb17vsnb50nlnb400ptsz144ptzsz96"
]
print(str_names)
for str_name in str_names:
mypath = Mypath(task=task, current_time=str_name) # set task=vessel to predict the lobe masks of SSc
# model_name = '/data/jjia/new/models/' + task + '/' + str_name + '_valid.hdf5'
model_name = mypath.model_fpath_best_whole("valid", str_name)
tr_sp, tr_z_sp = 1.4, 2.5
tr_sz, tr_z_sz = None, None
pt_sz, pt_z_sz = 144, 96
if sub_dir is "GLUCOLD": # write metrics for lobe and fissure (GLUCOLD), for lung and fissure (LOLA11)
goals = ['lobe', 'fissure']
stride = 0.25
radiusValue = 3
elif sub_dir is "LOLA11":
goals = ['lung', 'fissure']
stride = 0.25
radiusValue = 1
else:
raise Exception("sub_dir is not correct")
for goal in goals:
if goal is "lobe":
labels = [4, 5, 6, 7, 8]
fissure, lung = False, False
elif goal is "fissure":
fissure, lung = True, False
labels = [1]
else:
labels = [1]
fissure, lung = False, True
if fissure:
gntFissure(mypath.pred_path("valid", sub_dir=sub_dir, biggest_5_lobe=biggest_5_lobe), radiusValue=radiusValue, workers=10)
else:
segment = v_seg.v_segmentor(batch_size=1,
model=model_name,
ptch_sz=pt_sz, ptch_z_sz=pt_z_sz,
trgt_sz=tr_sz, trgt_z_sz=tr_z_sz,
trgt_space_list=[tr_z_sp, tr_sp, tr_sp],
task=task, attention=False)
print('stride is', stride)
workers = 5 if sub_dir == "GLUCOLD" else 5
write_preds_to_disk(segment=segment,
data_dir=mypath.ori_ct_path("valid", sub_dir=sub_dir),
preds_dir=mypath.pred_path("valid", sub_dir=sub_dir),
number=100,
stride=stride, workers=workers, qsize=20)
write_connected_lobes(mypath.pred_path("valid", sub_dir=sub_dir), workers=5,
target_dir=mypath.pred_path("valid", sub_dir=sub_dir, biggest_5_lobe=biggest_5_lobe))
workers = 3 if sub_dir == "GLUCOLD" else 5 # save memory for GLUCOLD metrics
write_all_metrics(labels=labels, # exclude background
gdth_path=mypath.gdth_path("valid", sub_dir=sub_dir),
pred_path=mypath.pred_path("valid", sub_dir=sub_dir, biggest_5_lobe=biggest_5_lobe),
csv_file=mypath.all_metrics_fpath("valid", fissure=fissure, sub_dir=sub_dir),
fissure=fissure, fissureradius=radiusValue,
lung=lung, workers=workers)