score = uNet5Stackb.evaluate(interpolated_tf, groundtruth_img, verbose=0) probs = uNet5Stackb.predict(interpolated_tf, verbose=0) # Computing and plotting mse and nmse mse = [mean_squared_error(groundtruth_img[idx][:, :, 0], probs[idx][:, :, 0]) for idx in range(len(groundtruth))] mse_den = [mean_squared_error(groundtruth_img[idx][:, :, 0], np.zeros(groundtruth_img[idx][:, :, 0].shape)) for idx in range(len(groundtruth))] nmse = [mse[idx] / mse_den[idx] for idx in range(len(groundtruth))] mse_int = [mean_squared_error(groundtruth_img[idx][:, :, 0], interpolated_tf[idx][:, :, 0]) for idx in range(len(groundtruth))] nmse_int = [mse_int[idx] / mse_den[idx] for idx in range(len(groundtruth))] pR.plot_mse(mse, mse_int) plt.title("Mse of uNetStackb") # Plot a random image pR.plot_hr(probs[0][:, :, 0], groundtruth_img[0][:, :, 0], interpolated_tf[0][:, :, 0], downsampled_img[0][:, :, 0]) plt.title("Random reconstruction by uNetStackb") pR.plot_mse(nmse, nmse_int) plt.title('Normalized mean squared error uNetStackb') # Plotting worst reconstructed image max_mse = max(mse) idx_bad = mse.index(max_mse) pR.plot_hr(probs[idx_bad][:, :, 0], groundtruth_img[idx_bad][:, :, 0], interpolated_tf[idx_bad][:, :, 0], downsampled_img[idx_bad][:, :, 0])
mean_squared_error(groundtruth_test_img[idx][:, :, 0], np.zeros(groundtruth_test_img[idx][:, :, 0].shape)) for idx in range(len(groundtruth_test_img)) ] nmseb = [mseb[idx] / mse_denb[idx] for idx in range(len(groundtruth_test_img))] mse_intb = [ mean_squared_error(groundtruth_test_img[idx][:, :, 0], interpolated_test_tf[idx][:, :, 0]) for idx in range(len(groundtruth_test_img)) ] nmse_intb = [ mse_intb[idx] / mse_denb[idx] for idx in range(len(groundtruth_test_img)) ] pR.plot_mse(mseb, mse_intb) plt.title("Mse uNetStackb") pR.plot_hr(probsb[0][:, :, 0], groundtruth_test_img[0][:, :, 0], interpolated_test_tf[0][:, :, 0], downsampled_test_img[0][:, :, 0]) plt.title("Rec by uNetStackb") pR.plot_mse(nmseb, nmse_intb) plt.title('Normalized mean squared error uNetStackb') # Plotting worst reconstructed image max_mseb = max(mseb) idx_badb = mseb.index(max_mseb) pR.plot_hr(probsb[idx_badb][:, :, 0], groundtruth_test_img[idx_badb][:, :, 0], interpolated_test_tf[idx_badb][:, :, 0], downsampled_test_img[idx_badb][:, :, 0]) idx_hmsebisb = [