DownsamplingMatlab#
- class deepinv.physics.DownsamplingMatlab(factor=2, kernel='cubic', padding='reflect', antialiasing=True, device='cpu', **kwargs)[source]#
Bases:
DownsamplingDownsampling with MATLAB imresize
Downsamples with default MATLAB
imresize, using a bicubic kernel, antialiasing and reflect padding.Wraps
imresizefrom a modified version of the original implementation.The adjoint is computed using autograd via
deepinv.physics.adjoint_function(). This is becauseimresizewith reciprocal of scale is not a correct adjoint. Note however the adjoint is quite slow.- Parameters:
kernel (str) β MATLAB kernel, supports only
cubicfor bicubic downsampling.padding (str) β MATLAB padding type, supports only
reflectfor reflect padding.antialiasing (bool) β whether to perform antialiasing in MATLAB downsampling. Recommended to set to
Trueto 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 usephysics.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.