skimage2.restoration.denoise_invariant#
- skimage2.restoration.denoise_invariant(image, denoise_function, *, stride=4, masks=None, denoiser_kwargs=None)[source]#
Apply a J-invariant version of a denoising function.
- Parameters:
- imagendarray (M[, N[, …]][, C]) of ints, uints or floats
Input data to be denoised.
imagecan be of any numeric type, but it is cast into a ndarray of floats (usingimg_as_float) for the computation of the denoised image.- denoise_functionfunction
Original denoising function.
- strideint, optional
Stride used in masking procedure that converts
denoise_functionto J-invariance.- maskslist of ndarray, optional
Set of masks to use for computing J-invariant output. If
None, a full set of masks covering the image will be used.- denoiser_kwargs
Keyword arguments passed to
denoise_function.
- Returns:
- outputndarray
Denoised image, of same shape as
image.
Notes
A denoising function is J-invariant if the prediction it makes for each pixel does not depend on the value of that pixel in the original image. The prediction for each pixel may instead use all the relevant information contained in the rest of the image, which is typically quite significant. Any function can be converted into a J-invariant one using a simple masking procedure, as described in [1].
The pixel-wise error of a J-invariant denoiser is uncorrelated to the noise, so long as the noise in each pixel is independent. Consequently, the average difference between the denoised image and the oisy image, the self-supervised loss, is the same as the difference between the denoised image and the original clean image, the ground-truth loss (up to a constant).
This means that the best J-invariant denoiser for a given image can be found using the noisy data alone, by selecting the denoiser minimizing the self- supervised loss.
References
[1]J. Batson & L. Royer. Noise2Self: Blind Denoising by Self-Supervision, International Conference on Machine Learning, p. 524-533 (2019).
Examples
>>> import _skimage2 as ski2 >>> from _skimage2.restoration import denoise_invariant, denoise_tv_chambolle >>> image = ski2.util.img_as_float(ski2.data.chelsea()) >>> noisy = ski2.util.random_noise(image, var=0.2 ** 2) >>> denoised = denoise_invariant(noisy, denoise_function=denoise_tv_chambolle)