DEAL#
- class deepinv.models.DEAL(sigma_denoiser=0.1, lambda_reg=10.0, max_iter=50, auto_scale=False, target_y_std=25.0, color=False, device=None, clamp_output=True, pretrained='pretrained')[source]#
Bases:
ReconstructorDeep Equilibrium Attention Least Squares (DEAL) reconstruction model.
This model solves linear inverse problems using a learned equilibrium-based regularizer combined with iterative conjugate gradient least-squares updates. It can be used for image restoration and reconstruction tasks such as denoising, deblurring, and computed tomography reconstruction.
This implementation is adapted from the official DEAL repository.
For the original method, see Pourya et al.[1].
A pretrained network can be loaded by setting
pretrained='download'.The reconstruction is obtained by solving a regularized least-squares problem
\[\hat{x} = \arg\min_x \frac{1}{2}\|Ax - y\|^2 + \lambda g_\theta(x)\]where \(A\) is the forward operator, \(y\) the measurements, and \(g_\theta\) is the learned adaptive regularizer.
In the implementation, the learned regularizer is induced by a masked linear operator of the form
\[L_{\theta,c}(u, x) = m_{\theta,c}(u) \odot K_{\theta,c} x,\]so that the regularization term can be written as
\[g_{\theta}(u, x) = \sum_{c=1}^{C} \frac{1}{2}\|L_{\theta,c}(u, x)\|_2^2 = \sum_{c=1}^{C} \frac{1}{2}\|m_{\theta,c}(u) \odot K_{\theta,c} x\|_2^2,\]where \(K_{\theta,c}\) are learned linear filters, \(m_{\theta,c}(u)\) are spatially varying masks predicted by the network, and \(\odot\) denotes element-wise multiplication.
The optimization is performed iteratively using a fixed-point scheme. At each outer iteration, the algorithm updates the reconstruction by solving a linearized least-squares subproblem using conjugate gradient:
\[x^{(k+1)} \approx \arg\min_x \frac{1}{2}\|Ax - y\|^2 + \frac{\lambda}{2} \sum_{c=1}^{C} \|m_{\theta,c}(x^{(k)}) \odot K_{\theta,c}x\|_2^2.\]- Parameters:
sigma_denoiser (float) – denoiser noise level parameter
lambda_reg (float) – regularization strength \(\lambda\) used by the DEAL solver
max_iter (int) – maximum number of outer fixed-point iterations
auto_scale (bool) – if
True, rescales measurements in reconstruction mode when their empirical standard deviation is between0and5. This option is useful when measurements are given in a normalized range but the pretrained DEAL inverse-problem solver expects a larger intensity scale. It is disabled by default.target_y_std (float) – target measurement standard deviation used by
auto_scalewhen enabledcolor (bool) – if
True, use the color DEAL variant; otherwise grayscaledevice (str | None) – compute device. If
None, use CUDA if availableclamp_output (bool) – if
True, clamp output to[0, 1]pretrained (str | None) – checkpoint path,
'download','pretrained', orNone. IfNone, no pretrained weights are loaded. If'download'or'pretrained', the official DEAL pretrained weights are downloaded and loaded.
- References:
- forward(y, physics=None, sigma=None)[source]#
Run DEAL as either a denoiser or a reconstructor.
- Parameters:
y (torch.Tensor) – input measurements
physics (LinearPhysics | None) – forward operator for reconstruction. If
None, DEAL is applied as a denoiser.sigma (float | None) – denoising noise level used when
physicsisNone
- Returns:
reconstructed or denoised image
- Return type: