def test_invariant_denoise(): # denoised_img = _invariant_denoise(noisy_img, _denoise_wavelet) denoised_img = _invariant_denoise(noisy_img, denoise_tv_chambolle) denoised_mse = mse(denoised_img, test_img) original_mse = mse(noisy_img, test_img) assert denoised_mse < original_mse
def test_invariant_denoise_color(): denoised_img_color = _invariant_denoise( noisy_img_color, _denoise_wavelet, denoiser_kwargs=dict(multichannel=True), ) denoised_mse = mse(denoised_img_color, test_img_color) original_mse = mse(noisy_img_color, test_img_color) assert denoised_mse < original_mse
def test_calibrate_denoiser_extra_output(): parameter_ranges = {"sigma": np.linspace(0.1, 1, 5) / 2} _, (parameters_tested, losses) = calibrate_denoiser( noisy_img, _denoise_wavelet, denoise_parameters=parameter_ranges, extra_output=True, ) all_denoised = [ _invariant_denoise(noisy_img, _denoise_wavelet, denoiser_kwargs=denoiser_kwargs) for denoiser_kwargs in parameters_tested ] ground_truth_losses = [mse(img, test_img) for img in all_denoised] assert np.argmin(losses) == np.argmin(ground_truth_losses)
def test_invariant_denoise_3d(): denoised_img_3d = _invariant_denoise(noisy_img_3d, _denoise_wavelet) denoised_mse = mse(denoised_img_3d, test_img_3d) original_mse = mse(noisy_img_3d, test_img_3d) assert denoised_mse < original_mse