BlurFFT#

class deepinv.physics.BlurFFT(img_size, filter=None, device='cpu', **kwargs)[source]#

Bases: DecomposablePhysics

FFT-based blur operator.

It performs the operation

\[y = w*x\]

where \(*\) denotes convolution and \(w\) is a filter.

Blur operator based on torch.fft operations, which assumes a circular padding of the input, and allows for the singular value decomposition via deepinv.Physics.DecomposablePhysics and has fast pseudo-inverse and prox operators.

Parameters:


Examples:

BlurFFT operator with a basic averaging filter applied to a 16x16 black image with a single white pixel in the center:

>>> from deepinv.physics import BlurFFT
>>> x = torch.zeros((1, 1, 16, 16)) # Define black image of size 16x16
>>> x[:, :, 8, 8] = 1 # Define one white pixel in the middle
>>> filter = torch.ones((1, 1, 2, 2)) / 4 # Basic 2x2 filter
>>> physics = BlurFFT(filter=filter, img_size=(1, 16, 16))
>>> y = physics(x)
>>> y[y<1e-5] = 0.
>>> y[:, :, 7:10, 7:10] # Display the center of the blurred image
tensor([[[[0.2500, 0.2500, 0.0000],
          [0.2500, 0.2500, 0.0000],
          [0.0000, 0.0000, 0.0000]]]])
A(x, filter=None, **kwargs)[source]#

Applies the forward operator \(y = A(x)\).

If a mask/singular values is provided, it is used to apply the forward operator, and also stored as the current mask/singular values.

Parameters:
Returns:

output tensor

A_adjoint(x, filter=None, **kwargs)[source]#

Computes the adjoint of the forward operator \(\tilde{x} = A^{\top}y\).

If a mask/singular values is provided, it is used to apply the adjoint operator, and also stored as the current mask/singular values.

Parameters:
Returns:

output tensor

U(x)[source]#

Applies the \(U\) operator of the SVD decomposition.

Note

This method should be overwritten by the user to define its custom DecomposablePhysics operator.

Parameters:

x (torch.Tensor) – input tensor

U_adjoint(x)[source]#

Applies the \(U^{\top}\) operator of the SVD decomposition.

Note

This method should be overwritten by the user to define its custom DecomposablePhysics operator.

Parameters:

x (torch.Tensor) – input tensor

V(x)[source]#

Applies the \(V\) operator of the SVD decomposition.

Note

This method should be overwritten by the user to define its custom DecomposablePhysics operator.

Parameters:

x (torch.Tensor) – input tensor

V_adjoint(x)[source]#

Applies the \(V^{\top}\) operator of the SVD decomposition.

Note

This method should be overwritten by the user to define its custom DecomposablePhysics operator.

Parameters:

x (torch.Tensor) – input tensor

update_parameters(filter=None, **kwargs)[source]#

Updates the current filter.

Parameters:

filter (torch.Tensor) – New filter to be applied to the input image.

Examples using BlurFFT:#

A tour of blur operators

A tour of blur operators

Image deblurring with custom deep explicit prior.

Image deblurring with custom deep explicit prior.

Image deblurring with Total-Variation (TV) prior

Image deblurring with Total-Variation (TV) prior

DPIR method for PnP image deblurring.

DPIR method for PnP image deblurring.

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

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

Building your custom sampling algorithm.

Building your custom sampling algorithm.

Deep Equilibrium (DEQ) algorithms for image deblurring

Deep Equilibrium (DEQ) algorithms for image deblurring