-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompute_confusion_errors.py
More file actions
390 lines (346 loc) · 18.3 KB
/
compute_confusion_errors.py
File metadata and controls
390 lines (346 loc) · 18.3 KB
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
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
import numpy as np
import torch
import matplotlib.pyplot as plt
from skimage.metrics import structural_similarity as ssim
if __name__ == "__main__":
true_c = np.load("Phantoms/type_d_phantoms.npy")
true_c2 = np.load("Phantoms/other_phantoms.npy")
true_c = np.concatenate((true_c, true_c2), axis = 0)
del true_c2
true_c_norm = np.sum((true_c - 1.5)**2, axis = (1,2,3))**(1/2)
art_low_medium = np.load("Recons/type_d_ac_recon_low_medium.npy")
art_low_medium2 = np.load("Recons/other_ac_recon_low_medium.npy")
art_low_medium = np.concatenate((art_low_medium, art_low_medium2), axis = 0)
del art_low_medium2
art_low_medium_rrmse = np.sum((true_c - art_low_medium)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/art_low_medium_rrmse.npy", art_low_medium_rrmse)
del art_low_medium_rrmse
art_low_medium_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], art_low_medium[j,0,:,:], data_range= 0.2)
art_low_medium_ssim.append(plc_ssim)
np.save("Errors/art_low_medium_ssim.npy", np.array(art_low_medium_ssim))
del art_low_medium_ssim
del art_low_medium
art_low_high = np.load("Recons/type_d_ac_recon_low_high.npy")
art_low_high2 = np.load("Recons/other_ac_recon_low_high.npy")
art_low_high = np.concatenate((art_low_high, art_low_high2), axis = 0)
del art_low_high2
art_low_high_rrmse = np.sum((true_c - art_low_high)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/art_low_high_rrmse.npy", art_low_high_rrmse)
del art_low_high_rrmse
art_low_high_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], art_low_high[j,0,:,:], data_range= 0.2)
art_low_high_ssim.append(plc_ssim)
np.save("Errors/art_low_high_ssim.npy", np.array(art_low_high_ssim))
del art_low_high_ssim
del art_low_high
dc_low_medium = np.load("Recons/type_d_dc_recon_low_medium.npy")
dc_low_medium2 = np.load("Recons/other_dc_recon_low_medium.npy")
dc_low_medium = np.concatenate((dc_low_medium, dc_low_medium2), axis = 0)
del dc_low_medium2
dc_low_medium_rrmse = np.sum((true_c - dc_low_medium)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dc_low_medium_rrmse.npy", dc_low_medium_rrmse)
del dc_low_medium_rrmse
dc_low_medium_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dc_low_medium[j,0,:,:], data_range= 0.2)
dc_low_medium_ssim.append(plc_ssim)
np.save("Errors/dc_low_medium_ssim.npy", np.array(dc_low_medium_ssim))
del dc_low_medium_ssim
del dc_low_medium
dc_low_high = np.load("Recons/type_d_dc_recon_low_high.npy")
dc_low_high2 = np.load("Recons/other_dc_recon_low_high.npy")
dc_low_high = np.concatenate((dc_low_high, dc_low_high2), axis = 0)
del dc_low_high2
dc_low_high_rrmse = np.sum((true_c - dc_low_high)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dc_low_high_rrmse.npy", dc_low_high_rrmse)
del dc_low_high_rrmse
dc_low_high_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dc_low_high[j,0,:,:], data_range= 0.2)
dc_low_high_ssim.append(plc_ssim)
np.save("Errors/dc_low_high_ssim.npy", np.array(dc_low_high_ssim))
del dc_low_high_ssim
del dc_low_high
dual_low_medium = np.load("Recons/type_d_dual_recon_low_medium.npy")
dual_low_medium2 = np.load("Recons/other_dual_recon_low_medium.npy")
dual_low_medium = np.concatenate((dual_low_medium, dual_low_medium2), axis = 0)
del dual_low_medium2
dual_low_medium_rrmse = np.sum((true_c - dual_low_medium)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dual_low_medium_rrmse.npy", dual_low_medium_rrmse)
del dual_low_medium_rrmse
dual_low_medium_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dual_low_medium[j,0,:,:], data_range= 0.2)
dual_low_medium_ssim.append(plc_ssim)
np.save("Errors/dual_low_medium_ssim.npy", np.array(dual_low_medium_ssim))
del dual_low_medium_ssim
del dual_low_medium
dual_low_high = np.load("Recons/type_d_dual_recon_low_high.npy")
dual_low_high2 = np.load("Recons/other_dual_recon_low_high.npy")
dual_low_high = np.concatenate((dual_low_high, dual_low_high2), axis = 0)
del dual_low_high2
dual_low_high_rrmse = np.sum((true_c - dual_low_high)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dual_low_high_rrmse.npy", dual_low_high_rrmse)
del dual_low_high_rrmse
dual_low_high_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dual_low_high[j,0,:,:], data_range= 0.2)
dual_low_high_ssim.append(plc_ssim)
np.save("Errors/dual_low_high_ssim.npy", np.array(dual_low_high_ssim))
del dual_low_high_ssim
del dual_low_high
inet_low_medium = np.load("Recons/type_d_inet_recon_low_medium.npy")
inet_low_medium2 = np.load("Recons/other_inet_recon_low_medium.npy")
inet_low_medium = np.concatenate((inet_low_medium, inet_low_medium2), axis = 0)
del inet_low_medium2
inet_low_medium_rrmse = np.sum((true_c - inet_low_medium)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/inet_low_medium_rrmse.npy", inet_low_medium_rrmse)
del inet_low_medium_rrmse
inet_low_medium_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], inet_low_medium[j,0,:,:], data_range= 0.2)
inet_low_medium_ssim.append(plc_ssim)
np.save("Errors/inet_low_medium_ssim.npy", np.array(inet_low_medium_ssim))
del inet_low_medium_ssim
del inet_low_medium
inet_low_high = np.load("Recons/type_d_inet_recon_low_high.npy")
inet_low_high2 = np.load("Recons/other_inet_recon_low_high.npy")
inet_low_high = np.concatenate((inet_low_high, inet_low_high2), axis = 0)
del inet_low_high2
inet_low_high_rrmse = np.sum((true_c - inet_low_high)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/inet_low_high_rrmse.npy", inet_low_high_rrmse)
del inet_low_high_rrmse
inet_low_high_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], inet_low_high[j,0,:,:], data_range= 0.2)
inet_low_high_ssim.append(plc_ssim)
np.save("Errors/inet_low_high_ssim.npy", np.array(inet_low_high_ssim))
del inet_low_high_ssim
del inet_low_high
art_medium_low = np.load("Recons/type_d_ac_recon_medium_low.npy")
art_medium_low2 = np.load("Recons/other_ac_recon_medium_low.npy")
art_medium_low = np.concatenate((art_medium_low, art_medium_low2), axis = 0)
del art_medium_low2
art_medium_low_rrmse = np.sum((true_c - art_medium_low)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/art_medium_low_rrmse.npy", art_medium_low_rrmse)
del art_medium_low_rrmse
art_medium_low_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], art_medium_low[j,0,:,:], data_range= 0.2)
art_medium_low_ssim.append(plc_ssim)
np.save("Errors/art_medium_low_ssim.npy", np.array(art_medium_low_ssim))
del art_medium_low_ssim
del art_medium_low
art_medium_high = np.load("Recons/type_d_ac_recon_medium_high.npy")
art_medium_high2 = np.load("Recons/other_ac_recon_medium_high.npy")
art_medium_high = np.concatenate((art_medium_high, art_medium_high2), axis = 0)
del art_medium_high2
art_medium_high_rrmse = np.sum((true_c - art_medium_high)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/art_medium_high_rrmse.npy", art_medium_high_rrmse)
del art_medium_high_rrmse
art_medium_high_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], art_medium_high[j,0,:,:], data_range= 0.2)
art_medium_high_ssim.append(plc_ssim)
np.save("Errors/art_medium_high_ssim.npy", np.array(art_medium_high_ssim))
del art_medium_high_ssim
del art_medium_high
dc_medium_low = np.load("Recons/type_d_dc_recon_medium_low.npy")
dc_medium_low2 = np.load("Recons/other_dc_recon_medium_low.npy")
dc_medium_low = np.concatenate((dc_medium_low, dc_medium_low2), axis = 0)
del dc_medium_low2
dc_medium_low_rrmse = np.sum((true_c - dc_medium_low)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dc_medium_low_rrmse.npy", dc_medium_low_rrmse)
del dc_medium_low_rrmse
dc_medium_low_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dc_medium_low[j,0,:,:], data_range= 0.2)
dc_medium_low_ssim.append(plc_ssim)
np.save("Errors/dc_medium_low_ssim.npy", np.array(dc_medium_low_ssim))
del dc_medium_low_ssim
del dc_medium_low
dc_medium_high = np.load("Recons/type_d_dc_recon_medium_high.npy")
dc_medium_high2 = np.load("Recons/other_dc_recon_medium_high.npy")
dc_medium_high = np.concatenate((dc_medium_high, dc_medium_high2), axis = 0)
del dc_medium_high2
dc_medium_high_rrmse = np.sum((true_c - dc_medium_high)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dc_medium_high_rrmse.npy", dc_medium_high_rrmse)
del dc_medium_high_rrmse
dc_medium_high_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dc_medium_high[j,0,:,:], data_range= 0.2)
dc_medium_high_ssim.append(plc_ssim)
np.save("Errors/dc_medium_high_ssim.npy", np.array(dc_medium_high_ssim))
del dc_medium_high_ssim
del dc_medium_high
dual_medium_low = np.load("Recons/type_d_dual_recon_medium_low.npy")
dual_medium_low2 = np.load("Recons/other_dual_recon_medium_low.npy")
dual_medium_low = np.concatenate((dual_medium_low, dual_medium_low2), axis = 0)
del dual_medium_low2
dual_medium_low_rrmse = np.sum((true_c - dual_medium_low)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dual_medium_low_rrmse.npy", dual_medium_low_rrmse)
del dual_medium_low_rrmse
dual_medium_low_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dual_medium_low[j,0,:,:], data_range= 0.2)
dual_medium_low_ssim.append(plc_ssim)
np.save("Errors/dual_medium_low_ssim.npy", np.array(dual_medium_low_ssim))
del dual_medium_low_ssim
del dual_medium_low
dual_medium_high = np.load("Recons/type_d_dual_recon_medium_high.npy")
dual_medium_high2 = np.load("Recons/other_dual_recon_medium_high.npy")
dual_medium_high = np.concatenate((dual_medium_high, dual_medium_high2), axis = 0)
del dual_medium_high2
dual_medium_high_rrmse = np.sum((true_c - dual_medium_high)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dual_medium_high_rrmse.npy", dual_medium_high_rrmse)
del dual_medium_high_rrmse
dual_medium_high_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dual_medium_high[j,0,:,:], data_range= 0.2)
dual_medium_high_ssim.append(plc_ssim)
np.save("Errors/dual_medium_high_ssim.npy", np.array(dual_medium_high_ssim))
del dual_medium_high_ssim
del dual_medium_high
inet_medium_low = np.load("Recons/type_d_inet_recon_medium_low.npy")
inet_medium_low2 = np.load("Recons/other_inet_recon_medium_low.npy")
inet_medium_low = np.concatenate((inet_medium_low, inet_medium_low2), axis = 0)
del inet_medium_low2
inet_medium_low_rrmse = np.sum((true_c - inet_medium_low)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/inet_medium_low_rrmse.npy", inet_medium_low_rrmse)
del inet_medium_low_rrmse
inet_medium_low_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], inet_medium_low[j,0,:,:], data_range= 0.2)
inet_medium_low_ssim.append(plc_ssim)
np.save("Errors/inet_medium_low_ssim.npy", np.array(inet_medium_low_ssim))
del inet_medium_low_ssim
del inet_medium_low
inet_medium_high = np.load("Recons/type_d_inet_recon_medium_high.npy")
inet_medium_high2 = np.load("Recons/other_inet_recon_medium_high.npy")
inet_medium_high = np.concatenate((inet_medium_high, inet_medium_high2), axis = 0)
del inet_medium_high2
inet_medium_high_rrmse = np.sum((true_c - inet_medium_high)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/inet_medium_high_rrmse.npy", inet_medium_high_rrmse)
del inet_medium_high_rrmse
inet_medium_high_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], inet_medium_high[j,0,:,:], data_range= 0.2)
inet_medium_high_ssim.append(plc_ssim)
np.save("Errors/inet_medium_high_ssim.npy", np.array(inet_medium_high_ssim))
del inet_medium_high_ssim
del inet_medium_high
art_high_low = np.load("Recons/type_d_ac_recon_high_low.npy")
art_high_low2 = np.load("Recons/other_ac_recon_high_low.npy")
art_high_low = np.concatenate((art_high_low, art_high_low2), axis = 0)
del art_high_low2
art_high_low_rrmse = np.sum((true_c - art_high_low)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/art_high_low_rrmse.npy", art_high_low_rrmse)
del art_high_low_rrmse
art_high_low_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], art_high_low[j,0,:,:], data_range= 0.2)
art_high_low_ssim.append(plc_ssim)
np.save("Errors/art_high_low_ssim.npy", np.array(art_high_low_ssim))
del art_high_low_ssim
del art_high_low
art_high_medium = np.load("Recons/type_d_ac_recon_high_medium.npy")
art_high_medium2 = np.load("Recons/other_ac_recon_high_medium.npy")
art_high_medium = np.concatenate((art_high_medium, art_high_medium2), axis = 0)
del art_high_medium2
art_high_medium_rrmse = np.sum((true_c - art_high_medium)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/art_high_medium_rrmse.npy", art_high_medium_rrmse)
del art_high_medium_rrmse
art_high_medium_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], art_high_medium[j,0,:,:], data_range= 0.2)
art_high_medium_ssim.append(plc_ssim)
np.save("Errors/art_high_medium_ssim.npy", np.array(art_high_medium_ssim))
del art_high_medium_ssim
del art_high_medium
dc_high_low = np.load("Recons/type_d_dc_recon_high_low.npy")
dc_high_low2 = np.load("Recons/other_dc_recon_high_low.npy")
dc_high_low = np.concatenate((dc_high_low, dc_high_low2), axis = 0)
del dc_high_low2
dc_high_low_rrmse = np.sum((true_c - dc_high_low)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dc_high_low_rrmse.npy", dc_high_low_rrmse)
del dc_high_low_rrmse
dc_high_low_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dc_high_low[j,0,:,:], data_range= 0.2)
dc_high_low_ssim.append(plc_ssim)
np.save("Errors/dc_high_low_ssim.npy", np.array(dc_high_low_ssim))
del dc_high_low_ssim
del dc_high_low
dc_high_medium = np.load("Recons/type_d_dc_recon_high_medium.npy")
dc_high_medium2 = np.load("Recons/other_dc_recon_high_medium.npy")
dc_high_medium = np.concatenate((dc_high_medium, dc_high_medium2), axis = 0)
del dc_high_medium2
dc_high_medium_rrmse = np.sum((true_c - dc_high_medium)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dc_high_medium_rrmse.npy", dc_high_medium_rrmse)
del dc_high_medium_rrmse
dc_high_medium_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dc_high_medium[j,0,:,:], data_range= 0.2)
dc_high_medium_ssim.append(plc_ssim)
np.save("Errors/dc_high_medium_ssim.npy", np.array(dc_high_medium_ssim))
del dc_high_medium_ssim
del dc_high_medium
dual_high_low = np.load("Recons/type_d_dual_recon_high_low.npy")
dual_high_low2 = np.load("Recons/other_dual_recon_high_low.npy")
dual_high_low = np.concatenate((dual_high_low, dual_high_low2), axis = 0)
del dual_high_low2
dual_high_low_rrmse = np.sum((true_c - dual_high_low)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dual_high_low_rrmse.npy", dual_high_low_rrmse)
del dual_high_low_rrmse
dual_high_low_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dual_high_low[j,0,:,:], data_range= 0.2)
dual_high_low_ssim.append(plc_ssim)
np.save("Errors/dual_high_low_ssim.npy", np.array(dual_high_low_ssim))
del dual_high_low_ssim
del dual_high_low
dual_high_medium = np.load("Recons/type_d_dual_recon_high_medium.npy")
dual_high_medium2 = np.load("Recons/other_dual_recon_high_medium.npy")
dual_high_medium = np.concatenate((dual_high_medium, dual_high_medium2), axis = 0)
del dual_high_medium2
dual_high_medium_rrmse = np.sum((true_c - dual_high_medium)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/dual_high_medium_rrmse.npy", dual_high_medium_rrmse)
del dual_high_medium_rrmse
dual_high_medium_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], dual_high_medium[j,0,:,:], data_range= 0.2)
dual_high_medium_ssim.append(plc_ssim)
np.save("Errors/dual_high_medium_ssim.npy", np.array(dual_high_medium_ssim))
del dual_high_medium_ssim
del dual_high_medium
inet_high_low = np.load("Recons/type_d_inet_recon_high_low.npy")
inet_high_low2 = np.load("Recons/other_inet_recon_high_low.npy")
inet_high_low = np.concatenate((inet_high_low, inet_high_low2), axis = 0)
del inet_high_low2
inet_high_low_rrmse = np.sum((true_c - inet_high_low)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/inet_high_low_rrmse.npy", inet_high_low_rrmse)
del inet_high_low_rrmse
inet_high_low_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], inet_high_low[j,0,:,:], data_range= 0.2)
inet_high_low_ssim.append(plc_ssim)
np.save("Errors/inet_high_low_ssim.npy", np.array(inet_high_low_ssim))
del inet_high_low_ssim
del inet_high_low
inet_high_medium = np.load("Recons/type_d_inet_recon_high_medium.npy")
inet_high_medium2 = np.load("Recons/other_inet_recon_high_medium.npy")
inet_high_medium = np.concatenate((inet_high_medium, inet_high_medium2), axis = 0)
del inet_high_medium2
inet_high_medium_rrmse = np.sum((true_c - inet_high_medium)**2, axis = (1,2,3))**(1/2)/true_c_norm
np.save("Errors/inet_high_medium_rrmse.npy", inet_high_medium_rrmse)
del inet_high_medium_rrmse
inet_high_medium_ssim = []
for j in range(true_c.shape[0]):
plc_ssim = ssim(true_c[j,0,:,:], inet_high_medium[j,0,:,:], data_range= 0.2)
inet_high_medium_ssim.append(plc_ssim)
np.save("Errors/inet_high_medium_ssim.npy", np.array(inet_high_medium_ssim))
del inet_high_medium_ssim
del inet_high_medium