sporco.pgm.cbpdn¶
Classes for PGM algorithm for the Convolutional BPDN problem
Classes
|
Base class for PGM algorithm for the Convolutional BPDN (CBPDN) [26] problem. |
|
PGM algorithm for Convolutional BPDN with a spatial mask. |
Class Descriptions¶
- class sporco.pgm.cbpdn.ConvBPDN(*args, **kwargs)[source]¶
Bases:
PGMDFT
Base class for PGM algorithm for the Convolutional BPDN (CBPDN) [26] problem.
The generic problem form is
\[\mathrm{argmin}_\mathbf{x} \; f( \{ \mathbf{x}_m \} ) + \lambda g( \{ \mathbf{x}_m \} )\]where \(f = (1/2) \left\| \sum_m \mathbf{d}_m * \mathbf{x}_m - \mathbf{s} \right\|_2^2\), and \(g(\cdot)\) is a penalty term or the indicator function of a constraint; with input image \(\mathbf{s}\), dictionary filters \(\mathbf{d}_m\), and coefficient maps \(\mathbf{x}_m\). It is solved via the PGM formulation
Proximal step
\[\mathbf{x}_k = \mathrm{prox}_{t_k}(g) (\mathbf{y}_k - 1/L \nabla f(\mathbf{y}_k) ) \;\;.\]Combination step
\[\mathbf{y}_{k+1} = \mathbf{x}_k + \left( \frac{t_k - 1}{t_{k+1}} \right) (\mathbf{x}_k - \mathbf{x}_{k-1}) \;\;,\]with \(t_{k+1} = \frac{1 + \sqrt{1 + 4 t_k^2}}{2}\).
After termination of the
solve
method, attributeitstat
is a list of tuples representing statistics of each iteration. The fields of the named tupleIterationStats
are:
Iter
: Iteration number
ObjFun
: Objective function value
DFid
: Value of data fidelity term \((1/2) \| \sum_m \mathbf{d}_m * \mathbf{x}_m - \mathbf{s} \|_2^2\)
RegL1
: Value of regularisation term \(\sum_m \| \mathbf{x}_m \|_1\)
Rsdl
: Residual
L
: Inverse of gradient step parameter
Time
: Cumulative run timeThis class supports an arbitrary number of spatial dimensions, dimN, with a default of 2. The input dictionary D is either dimN + 1 dimensional, in which case each spatial component (image in the default case) is assumed to consist of a single channel, or dimN + 2 dimensional, in which case the final dimension is assumed to contain the channels (e.g. colour channels in the case of images). The input signal set S is either dimN dimensional (no channels, only one signal), dimN + 1 dimensional (either multiple channels or multiple signals), or dimN + 2 dimensional (multiple channels and multiple signals). Determination of problem dimensions is handled by
cnvrep.CSC_ConvRepIndexing
.Call graph
- Parameters:
- Darray_like
Dictionary array
- Sarray_like
Signal array
- lmbdafloat
Regularisation parameter
- opt
ConvBPDN.Options
objectAlgorithm options
- dimK0, 1, or None, optional (default None)
Number of dimensions in input signal corresponding to multiple independent signals
- dimNint, optional (default 2)
Number of spatial/temporal dimensions
- class Options(opt=None)[source]¶
Bases:
Options
ConvBPDN algorithm options
Options include all of those defined in
pgm.PGMDFT.Options
, together with additional options:
NonNegCoef
: Flag indicating whether to force solution to be non-negative.
NoBndryCross
: Flag indicating whether all solution coefficients corresponding to filters crossing the image boundary should be forced to zero.
L1Weight
: An array of weights for the \(\ell_1\) norm. The array shape must be such that the array is compatible for multiplication with the X/Y variables. If this option is defined, the regularization term is \(\lambda \sum_m \| \mathbf{w}_m \odot \mathbf{x}_m \|_1\) where \(\mathbf{w}_m\) denotes slices of the weighting array on the filter index axis.
- Parameters:
- optdict or None, optional (default None)
ConvBPDN algorithm options
- defaults = {'AutoStop': {'Enabled': False, 'Tau0': 0.01}, 'Backtrack': None, 'Callback': None, 'DataType': None, 'FastSolve': False, 'IterTimer': 'solve', 'L': 500.0, 'L1Weight': 1.0, 'MaxMainIter': 1000, 'Momentum': <sporco.pgm.momentum.MomentumNesterov object>, 'Monotone': False, 'NoBndryCross': False, 'NonNegCoef': False, 'RelStopTol': 0.001, 'StatusHeader': True, 'StepSizePolicy': None, 'Verbose': False, 'X0': None}¶
Default content and allowed dict keys
- itstat_fields_objfn = ('ObjFun', 'DFid', 'RegL1')¶
Fields in IterationStats associated with the objective function; see
eval_objfun
- hdrtxt_objfn = ('Fnc', 'DFid', 'Regℓ1')¶
Display column headers associated with the objective function; see
eval_objfun
- hdrval_objfun = {'DFid': 'DFid', 'Fnc': 'ObjFun', 'Regℓ1': 'RegL1'}¶
Dictionary mapping display column headers in
hdrtxt_objfn
to IterationStats entries
- eval_objfn()[source]¶
Compute components of objective function as well as total contribution to objective function.
- obfn_dfd()[source]¶
Compute data fidelity term \((1/2) \| \sum_m \mathbf{d}_m * \mathbf{x}_m - \mathbf{s} \|_2^2\). This function takes into account the unnormalised DFT scaling, i.e. given that the variables are the DFT of multi-dimensional arrays computed via
rfftn
, this returns the data fidelity term in the original (spatial) domain.
- obfn_f(Xf=None)[source]¶
Compute data fidelity term \((1/2) \| \sum_m \mathbf{d}_m * \mathbf{x}_m - \mathbf{s} \|_2^2\) This is used for backtracking. Since the backtracking is computed in the DFT, it is important to preserve the DFT scaling.
- solve()¶
Call graph
- class sporco.pgm.cbpdn.ConvBPDNMask(*args, **kwargs)[source]¶
Bases:
ConvBPDN
PGM algorithm for Convolutional BPDN with a spatial mask.
Solve the optimisation problem
\[\mathrm{argmin}_\mathbf{x} \; (1/2) \left\| W \left(\sum_m \mathbf{d}_m * \mathbf{x}_m - \mathbf{s}\right) \right\|_2^2 + \lambda \sum_m \| \mathbf{x}_m \|_1 \;\;,\]where \(W\) is a mask array.
See
ConvBPDN
for interface details.
- Parameters:
- Darray_like
Dictionary matrix
- Sarray_like
Signal vector or matrix
- lmbdafloat
Regularisation parameter
- Warray_like
Mask array. The array shape must be such that the array is compatible for multiplication with input array S (see
cnvrep.mskWshape
for more details).- opt
ConvBPDNMask.Options
objectAlgorithm options
- dimK0, 1, or None, optional (default None)
Number of dimensions in input signal corresponding to multiple independent signals
- dimNint, optional (default 2)
Number of spatial dimensions