Denoiser#

class deepinv.models.Denoiser(device='cpu')[source]#

Bases: Module

Base class for denoiser models.

Provides a template for defining denoiser models.

While most denoisers \(\denoisername\) are designed to handle Gaussian noise with variance \(\sigma^2\), this is not mandatory.

Note

A Denoiser can be converted into a Reconstructor by using the deepinv.models.ArtifactRemoval class.

The base class inherits from torch.nn.Module.

forward(x, sigma, **kwargs)[source]#

Applies denoiser \(\denoiser{x}{\sigma}\). The input x is expected to be with pixel values in [0, 1] range, up to random noise. The output is also expected to be in [0, 1] range.

Parameters:
  • x (torch.Tensor) – noisy input, of shape [B, C, H, W].

  • sigma (torch.Tensor, float) – noise level. Can be a float or a torch.Tensor of shape [B]. If a single float is provided, the same noise level is used for all samples in the batch. Otherwise, batch-wise noise levels are used.

Returns:

(torch.Tensor) Denoised tensor.

Examples using Denoiser:#

Imaging inverse problems with adversarial networks

Imaging inverse problems with adversarial networks

Bring your own dataset

Bring your own dataset

Use iterative reconstruction algorithms

Use iterative reconstruction algorithms

Use a pretrained model

Use a pretrained model

5 minute quickstart tutorial

5 minute quickstart tutorial

Single-pixel imaging with Spyrit

Single-pixel imaging with Spyrit

Benchmarking pretrained denoisers

Benchmarking pretrained denoisers

Inference and fine-tune a foundation model

Inference and fine-tune a foundation model

Training a reconstruction model

Training a reconstruction model

3D denoising

3D denoising

Tour of MRI functionality in DeepInverse

Tour of MRI functionality in DeepInverse

Random phase retrieval and reconstruction methods.

Random phase retrieval and reconstruction methods.

Pattern Ordering in a Compressive Single Pixel Camera

Pattern Ordering in a Compressive Single Pixel Camera

DPIR method for PnP image deblurring.

DPIR method for PnP image deblurring.

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

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

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

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

Vanilla PnP for computed tomography (CT).

Vanilla PnP for computed tomography (CT).

Building your custom MCMC sampling algorithm.

Building your custom MCMC sampling algorithm.

Image reconstruction with a diffusion model

Image reconstruction with a diffusion model

Implementing DiffPIR

Implementing DiffPIR

Using state-of-the-art diffusion models from HuggingFace Diffusers with DeepInverse

Using state-of-the-art diffusion models from HuggingFace Diffusers with DeepInverse

Building your diffusion posterior sampling method using SDEs

Building your diffusion posterior sampling method using SDEs

Implementing DPS

Implementing DPS

Uncertainty quantification with PnP-ULA.

Uncertainty quantification with PnP-ULA.

Image transformations for Equivariant Imaging

Image transformations for Equivariant Imaging

Self-supervised learning from incomplete measurements of multiple operators.

Self-supervised learning from incomplete measurements of multiple operators.

Self-supervised denoising with the Neighbor2Neighbor loss.

Self-supervised denoising with the Neighbor2Neighbor loss.

Poisson denoising using Poisson2Sparse

Poisson denoising using Poisson2Sparse

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.

Image transforms for equivariance & augmentations

Image transforms for equivariance & augmentations

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

Reducing the memory and computational complexity of unfolded network training

Reducing the memory and computational complexity of unfolded network training

Unfolded Chambolle-Pock for constrained image inpainting

Unfolded Chambolle-Pock for constrained image inpainting

Vanilla Unfolded algorithm for super-resolution

Vanilla Unfolded algorithm for super-resolution