LinearPhysicsMultiScaler#
- class deepinv.physics.LinearPhysicsMultiScaler(physics, img_shape, filter='sinc', factors=(2, 4, 8), device='cpu', **kwargs)[source]#
Bases:
PhysicsMultiScaler,LinearPhysicsMulti-scale wrapper for linear physics operators.
See
PhysicsMultiScalerfor details.- Examples:
A multiscale BlurFFT operator can be created as follows:
>>> import torch >>> import deepinv as dinv >>> physics = dinv.physics.BlurFFT(img_size=(1, 32, 32), filter=dinv.physics.blur.gaussian_blur(.2)) >>> x = torch.rand((1, 1, 8, 8)) # define an image 4 times smaller than the physics input size (scale = 2) >>> new_physics = dinv.physics.LinearPhysicsMultiScaler(physics, (1, 32, 32), factors=[2, 4, 8]) # define a multiscale physics with base img size (1, 32, 32) >>> y = new_physics(x, scale=2) # applying physics at scale 2 >>> print(y.shape) torch.Size([1, 1, 32, 32])
- Parameters:
physics (deepinv.physics.Physics) – base physics operator.
img_shape (tuple) – shape of the input image (C, H, W).
filter (str) – type of filter to use for upsampling, e.g., ‘sinc’, ‘nearest’, ‘bilinear’.
factors (list[int]) – list of factors to use for upsampling.
device (str, torch.device, str) – device to use for the upsampling operator, e.g., ‘cpu’, ‘cuda’.
- A_dagger(y, scale=None, **kwargs)[source]#
Computes the pseudo-inverse of the linear operator \(A\).
If the scale is set to 0, it uses the base physics pseudo-inverse, which might have a more efficient implementation.
- Parameters:
y (torch.Tensor) – measurements tensor
- Returns:
(
torch.Tensor) estimated signal tensor
- prox_l2(z, y, gamma, solver='CG', max_iter=None, tol=None, verbose=False, scale=None, **kwargs)[source]#
Computes proximal operator of \(f(x) = \frac{1}{2}\|Ax-y\|^2\), i.e.,
\[\underset{x}{\arg\min} \; \frac{\gamma}{2}\|Ax-y\|^2 + \frac{1}{2}\|x-z\|^2\]If the scale is set to 0, it uses the base physics proximal operator, which might have a more efficient implementation.
- Parameters:
y (torch.Tensor) – measurements tensor
z (torch.Tensor) – signal tensor
gamma (float) – hyperparameter of the proximal operator
solver (str) – solver to use for the proximal operator, see
deepinv.optim.utils.least_squares()for detailsmax_iter (int) – maximum number of iterations for iterative solvers
tol (float) – tolerance for iterative solvers
verbose (bool) – whether to print information during the solver execution
scale (int) – scale at which to apply the physics operator
- Returns:
(
torch.Tensor) estimated signal tensor