Skip to content

Commit 3648acc

Browse files
authored
Merge pull request #256 from mrava87/feat-red
Feat: added RED operator and solver
2 parents e2becfd + ab9c41b commit 3648acc

9 files changed

Lines changed: 730 additions & 20 deletions

File tree

docs/source/api/index.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Non-Convex
100100
Log1
101101
QuadraticEnvelopeCard
102102
QuadraticEnvelopeCardIndicator
103+
RED
103104
RelaxedMumfordShah
104105
SCAD
105106

@@ -148,7 +149,6 @@ Utility functions
148149
gradtest_bilinear
149150

150151

151-
152152
Solvers
153153
-------
154154

@@ -189,6 +189,13 @@ Primal
189189

190190
PlugAndPlay
191191

192+
.. currentmodule:: pyproximal.optimization.red
193+
194+
.. autosummary::
195+
:toctree: generated/
196+
197+
RED
198+
192199
.. currentmodule:: pyproximal.optimization.sr3
193200

194201
.. autosummary::

pyproximal/optimization/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
ADMML2 ADMM with L2 misfit term
1919
LinearizedADMM Linearized ADMM
2020
TwIST Two-step Iterative Shrinkage/Threshold
21-
PlugAndPlay Plug-and-Play Prior with ADMM
2221
DouglasRachfordSplitting Douglas-Rachford algorithm
23-
PPXA Parallel Proximal Algorithm
22+
PPXA Parallel Proximal algorithm
2423
ConsensusADMM Consensus problem with ADMM
2524
2625
A list of solvers in ``pyproximal.optimization.proximaldual`` using both proximal
@@ -34,7 +33,13 @@
3433
3534
Bregman Bregman iterations
3635
37-
Additional solvers are in ``pyproximal.optimization.sr3`` amd
36+
Similarly, solvers leveraging denoisers are in ``pyproximal.optimization.pnp`` and
37+
``pyproximal.optimization.red``:
38+
39+
PlugAndPlay Plug-and-Play Prior algorithm
40+
RED Regularization by Denoising algorithm
41+
42+
Additional solvers are in ``pyproximal.optimization.sr3`` and
3843
``pyproximal.optimization.palm``:
3944
4045
SR3 Sparse Relaxed Regularized algorithm
@@ -48,4 +53,4 @@
4853
4954
"""
5055

51-
from . import primal, primaldual, bregman, segmentation, sr3, palm, pnp
56+
from . import primal, primaldual, bregman, segmentation, sr3, palm, pnp, red

pyproximal/optimization/pnp.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class _Denoise(ProxOperator):
1515
denoiser : :obj:`func`
1616
Denoiser (must be a function with two inputs, the first is the signal
1717
to be denoised, the second is the `tau` constant of the y-update in
18-
the PnP optimization)
18+
the PnP optimization, which should be interpreted as the strenght of
19+
the denoiser)
1920
dims : :obj:`tuple`
2021
Dimensions used to reshape the vector ``x`` in the ``prox`` method
2122
prior to calling the ``denoiser``
@@ -52,18 +53,19 @@ def PlugAndPlay(
5253
) -> NDArray | tuple[NDArray, ...]:
5354
r"""Plug-and-Play Priors with any proximal algorithm of choice
5455
55-
Solves the following minimization problem using any proximal a
56-
lgorithm of choice:
56+
Solves the following minimization problem using any proximal
57+
algorithm of choice:
5758
5859
.. math::
5960
60-
\mathbf{x},\mathbf{z} = \argmin_{\mathbf{x}}
61-
f(\mathbf{x}) + \lambda g(\mathbf{x})
61+
\mathbf{x} = \argmin_{\mathbf{x}}
62+
f(\mathbf{x}) + \sigma g(\mathbf{x})
6263
6364
where :math:`f(\mathbf{x})` is a function that has a known gradient or
64-
proximal operator and :math:`g(\mathbf{x})` is a function acting as implicit
65-
prior. Implicit means that no explicit function should be defined: instead,
66-
a denoising algorithm of choice is used. See Notes for details.
65+
proximal operator and :math:`g(\mathbf{x})` is a function acting as an
66+
implicit prior. Implicit means that no explicit function should be
67+
defined: instead, a denoising algorithm of choice is used. See Notes
68+
for details.
6769
6870
Parameters
6971
----------
@@ -96,25 +98,28 @@ def PlugAndPlay(
9698
.. math::
9799
98100
\mathbf{x}^{k+1} = \prox_{\tau f}(\mathbf{z}^{k} - \mathbf{u}^{k})\\
99-
\mathbf{z}^{k+1} = \operatorname{Denoise}(\mathbf{x}^{k+1} + \mathbf{u}^{k}, \tau \lambda)\\
101+
\mathbf{z}^{k+1} = \operatorname{Denoise}(\mathbf{x}^{k+1} + \mathbf{u}^{k}, \tau \sigma)\\
100102
\mathbf{u}^{k+1} = \mathbf{u}^{k} + \mathbf{x}^{k+1} - \mathbf{z}^{k+1}
101103
102104
where :math:`\operatorname{Denoise}` is a denoising algorithm of choice. This rather peculiar step originates
103105
from the intuition that the optimization process associated with the z-update can be interpreted as a denoising
104106
inverse problem, or more specifically a MAP denoiser where the noise is gaussian with zero mean and variance
105-
equal to :math:`\tau \lambda`. For this reason any denoising of choice can be used instead of a function with
107+
equal to :math:`\tau \sigma`. For this reason any denoising of choice can be used instead of a function with
106108
known proximal operator.
107109
108-
Finally, whilst the :math:`\tau \lambda` denoising parameter should be chosen to
110+
Finally, whilst the :math:`\tau \sigma` denoising parameter should be chosen to
109111
represent an estimate of the noise variance (of the denoiser, not the data of the problem we wish to solve!),
110112
special care must be taken when setting up the denoiser and calling this optimizer. More specifically,
111-
:math:`\lambda` should not be passed to the optimizer, rather set directly in the denoiser.
113+
:math:`\sigma` should not be passed to the optimizer, rather set directly in the denoiser.
112114
On the other hand :math:`\tau` must be passed to the optimizer as it is also affecting the x-update;
113-
when defining the denoiser, ensure that :math:`\tau` is multiplied to :math:`\lambda` as shown in the tutorial.
115+
when defining the denoiser, ensure that :math:`\tau` is multiplied to :math:`\sigma` as shown in the tutorial.
114116
115-
Alternative, as suggested in [2]_, the :math:`\tau` could be set to 1. The parameter :math:`\lambda` can then be set
117+
Alternative, as suggested in [2]_, the :math:`\tau` could be set to 1. The parameter :math:`\sigma` can then be set
116118
to maximize the value of the denoiser and a second tuning parameter can be added directly to :math:`f`.
117119
120+
References
121+
----------
122+
118123
.. [1] Venkatakrishnan, S. V., Bouman, C. A. and Wohlberg, B.
119124
"Plug-and-Play priors for model based reconstruction",
120125
IEEE. 2013.

0 commit comments

Comments
 (0)