PhysicsMultiScaler#
- class deepinv.physics.PhysicsMultiScaler(physics, img_size, filter='sinc', factors=(2, 4, 8), device='cpu', dtype=None, **kwargs)[source]#
Bases:
PhysicsMulti-scale wrapper for physics operators.
This class applies a physics model at a given scale by upsampling the input signal before applying the base physics operator.
\[A(x) = A_{base}(U_{scale}(x))\]where \(U_{scale}\) is the upsampling operator for the given scale and \(A_{base}\) is the base physics operator.
By default, we assume that the factors for the different scales are [2, 4, 8]. The 1st scale corresponds to upsampling by a factor of 2, the 2nd scale corresponds to upsampling by a factor of 4, and so on. The 0th scale corresponds to the base physics operator without upsampling.
- Parameters:
physics (deepinv.physics.Physics) – base physics operator.
img_size (tuple[int]) – shape of the input image (C, H, W).
filter (torch.Tensor, str) – type of filter to use for upsampling, e.g., ‘sinc’, ‘nearest’, ‘bilinear’.
factors (tuple[int]) – list of factors to use for upsampling.
device (torch.device, str) – device to use for the upsampling operator, e.g., ‘cpu’, ‘mps’, ‘cuda’.
dtype (torch.dtype,) – type to be associated with the signal.
- downsample_measurement(y, scale=None)[source]#
Downsample the measurements to a coarser scale
Unlike input images and physics operators, downsampling measurements is tricky as it depends on the nullspace of the downsampled physics operator. It is nonetheless possible to compute it for certain physics operators (blur, inpainting).
By default, this function raises a
NotImplementedErrorand it can be reimplemented in subclasses.Note
See also specific implementations in
deepinv.physics.BlurMultiScaler,deepinv.physics.BlurFFTMultiScaler, anddeepinv.physics.InpaintingMultiScaler.- Parameters:
y (torch.Tensor) – fine scale measurement
scale (int, None) – target scale in which to express
y, if None, uses the value of the attributescale, default: None