NoiseModel#

class deepinv.physics.NoiseModel(noise_model=None, rng=None)[source]#

Bases: Module

Base class for noise model.

Noise models can be combined via deepinv.physics.NoiseModel.__mul__().

Parameters:
  • noise_model (Callable) – noise model function \(N(y)\).

  • rng (torch.Generator) – (optional) a pseudorandom random number generator for the parameter generation. If provided, it should be on the same device as the input.

__mul__(other)[source]#

Concatenates two noise \(N = N_1 \circ N_2\) via the mul operation

The resulting operator will add the noise from both noise models and keep the rng of \(N_1\).

Parameters:

other (deepinv.physics.NoiseModel) – Physics operator \(A_2\)

Returns:

(deepinv.physics.NoiseModel) concatenated operator

forward(input, seed=None)[source]#

Add noise to the input

Parameters:
  • input (torch.Tensor) – input tensor

  • seed (int) – the seed for the random number generator.

rand_like(input, seed=None)[source]#

Equivalent to torch.rand_like but supports a pseudorandom number generator argument.

Parameters:

seed (int) – the seed for the random number generator, if rng is provided.

randn_like(input, seed=None)[source]#

Equivalent to torch.randn_like but supports a pseudorandom number generator argument.

Parameters:

seed (int) – the seed for the random number generator, if rng is provided.

reset_rng()[source]#

Reset the random number generator to its initial state.

rng_manual_seed(seed=None)[source]#

Sets the seed for the random number generator.

Parameters:

seed (int) – the seed to set for the random number generator. If not provided, the current state of the random number generator is used. .. note:: The seed will be ignored if the random number generator is not initialized.

Examples using NoiseModel:#

Image deblurring with custom deep explicit prior.

Image deblurring with custom deep explicit prior.

Creating your own dataset

Creating your own dataset

Reconstructing an image using the deep image prior.

Reconstructing an image using the deep image prior.

Creating a forward operator.

Creating a forward operator.

A tour of forward sensing operators

A tour of forward sensing operators

Image transforms for equivariance & augmentations

Image transforms for equivariance & augmentations

3D wavelet denoising

3D wavelet denoising

Image deblurring with Total-Variation (TV) prior

Image deblurring with Total-Variation (TV) prior

Image inpainting with wavelet prior

Image inpainting with wavelet prior

Expected Patch Log Likelihood (EPLL) for Denoising and Inpainting

Expected Patch Log Likelihood (EPLL) for Denoising and Inpainting

Patch priors for limited-angle computed tomography

Patch priors for limited-angle computed tomography

DPIR method for PnP image deblurring.

DPIR method for PnP image deblurring.

PnP with custom optimization algorithm (Condat-Vu Primal-Dual)

PnP with custom optimization algorithm (Condat-Vu Primal-Dual)

Plug-and-Play algorithm with Mirror Descent for Poisson noise inverse problems.

Plug-and-Play algorithm with Mirror Descent for Poisson noise inverse problems.

Regularization by Denoising (RED) for Super-Resolution.

Regularization by Denoising (RED) for Super-Resolution.

Vanilla PnP for computed tomography (CT).

Vanilla PnP for computed tomography (CT).

Building your custom sampling algorithm.

Building your custom sampling algorithm.

Image reconstruction with a diffusion model

Image reconstruction with a diffusion model

Implementing DiffPIR

Implementing DiffPIR

Uncertainty quantification with PnP-ULA.

Uncertainty quantification with PnP-ULA.

Self-supervised denoising with the Neighbor2Neighbor loss.

Self-supervised denoising with the Neighbor2Neighbor loss.

Self-supervised denoising with the Generalized R2R loss.

Self-supervised denoising with the Generalized R2R loss.

Self-supervised learning with measurement splitting

Self-supervised learning with measurement splitting

Self-supervised denoising with the SURE loss.

Self-supervised denoising with the SURE loss.

Self-supervised denoising with the UNSURE loss.

Self-supervised denoising with the UNSURE loss.

Deep Equilibrium (DEQ) algorithms for image deblurring

Deep Equilibrium (DEQ) algorithms for image deblurring

Learned Primal-Dual algorithm for CT scan.

Learned Primal-Dual algorithm for CT scan.

Vanilla Unfolded algorithm for super-resolution

Vanilla Unfolded algorithm for super-resolution