{ } Raw JSON

bundles / skimage latest / skimage / restoration / j_invariant / denoise_invariant

function

skimage.restoration.j_invariant:denoise_invariant

source: /dev/scikit-image/src/skimage/restoration/j_invariant.py:90

Signature

def denoise_invariant(image, denoise_function, *, stride = 4, masks = None, denoiser_kwargs = None)

Summary

Apply a J-invariant version of a denoising function.

Parameters

image : ndarray (M[, N[, ...]][, C]) of ints, uints or floats

Input data to be denoised. image can be of any numeric type, but it is cast into a ndarray of floats (using img_as_float) for the computation of the denoised image.

denoise_function : function

Original denoising function.

stride : int, optional

Stride used in masking procedure that converts denoise_function to J-invariance.

masks : list 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

output : ndarray

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.

Examples

import skimage
from skimage.restoration import denoise_invariant, denoise_tv_chambolle
image = skimage.util.img_as_float(skimage.data.chelsea())
noisy = skimage.util.random_noise(image, var=0.2 ** 2)
✓

Aliases

  • skimage.restoration.denoise_invariant