DownsamplingMatlab#

class deepinv.physics.DownsamplingMatlab(factor=2, kernel='cubic', padding='reflect', antialiasing=True, device='cpu', **kwargs)[source]#

Bases: Downsampling

Downsampling with MATLAB imresize

Downsamples with default MATLAB imresize, using a bicubic kernel, antialiasing and reflect padding.

Wraps imresize from a modified version of the original implementation.

The adjoint is computed using autograd via deepinv.physics.adjoint_function(). This is because imresize with reciprocal of scale is not a correct adjoint. Note however the adjoint is quite slow.

Parameters:
  • factor (int, float) – downsampling factor

  • kernel (str) – MATLAB kernel, supports only cubic for bicubic downsampling.

  • padding (str) – MATLAB padding type, supports only reflect for reflect padding.

  • antialiasing (bool) – whether to perform antialiasing in MATLAB downsampling. Recommended to set to True to match MATLAB.

  • device (torch.device, str) – Device on which the physics’ buffers will be created. If a buffer is updated via physics.update_parameters(), if not None, it will be automatically casted to the device of the replaced buffer, else, use the device of the provided value. To change the device of all buffers, please use physics.to(device).

A(x, factor=None, **kwargs)[source]#

Downsample forward operator

Parameters:
  • x (torch.Tensor) – input image

  • factor (int, float) – downsampling factor. If not None, use this factor and store it as current factor.

A_adjoint(y, factor=None, **kwargs)[source]#

Downsample adjoint operator via autograd.

Parameters:
  • y (torch.Tensor) – input measurement

  • factor (int, float) – downsampling factor. If not None, use this factor and store it as current factor.