sporco.pgm.ccmod¶
PGM algorithms for the CCMOD problem
Classes
|
Base class for PGM algorithm for Convolutional Constrained MOD problem [26]. |
|
PGM algorithm for Convolutional Constrained MOD problem with a spatial mask [26]. |
Class Descriptions¶
- class sporco.pgm.ccmod.ConvCnstrMOD(*args, **kwargs)[source]¶
Bases:
PGMDFT
Base class for PGM algorithm for Convolutional Constrained MOD problem [26].
Solve the optimisation problem
\[\mathrm{argmin}_\mathbf{d} \; (1/2) \sum_k \left\| \sum_m \mathbf{d}_m * \mathbf{x}_{k,m} - \mathbf{s}_k \right\|_2^2 \quad \text{such that} \quad \mathbf{d}_m \in C\]via the PGM problem
\[\mathrm{argmin}_\mathbf{d} \; (1/2) \sum_k \left\| \sum_m \mathbf{d}_m * \mathbf{x}_{k,m} - \mathbf{s}_k \right\|_2^2 + \sum_m \iota_C(\mathbf{d}_m) \;\;,\]where \(\iota_C(\cdot)\) is the indicator function of feasible set \(C\) consisting of filters with unit norm and constrained support. Multi-channel problems with input image channels \(\mathbf{s}_{c,k}\) are also supported, either as
\[\mathrm{argmin}_\mathbf{d} \; (1/2) \sum_c \sum_k \left\| \sum_m \mathbf{d}_m * \mathbf{x}_{c,k,m} - \mathbf{s}_{c,k} \right\|_2^2 \quad \text{such that} \quad \mathbf{d}_m \in C\]with single-channel dictionary filters \(\mathbf{d}_m\) and multi-channel coefficient maps \(\mathbf{x}_{c,k,m}\), or
\[\mathrm{argmin}_\mathbf{d} \; (1/2) \sum_c \sum_k \left\| \sum_m \mathbf{d}_{c,m} * \mathbf{x}_{k,m} - \mathbf{s}_{c,k} \right\|_2^2 \quad \text{such that} \quad \mathbf{d}_{c,m} \in C\]with multi-channel dictionary filters \(\mathbf{d}_{c,m}\) and single-channel coefficient maps \(\mathbf{x}_{k,m}\). In this latter case, normalisation of filters \(\mathbf{d}_{c,m}\) is performed jointly over index \(c\) for each filter \(m\).
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
DFid
: Value of data fidelity term \((1/2) \sum_k \| \sum_m \mathbf{d}_m * \mathbf{x}_{k,m} - \mathbf{s}_k \|_2^2\)
Cnstr
: Constraint violation measure
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 coefficient map array Z (usually labelled X, but renamed here to avoid confusion with the X and Y variables in the PGM base class) is expected to be in standard form as computed by the GenericConvBPDN class.
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). Parameter dimK, with a default value of 1, indicates the number of multiple-signal dimensions in S:
Default dimK = 1, i.e. assume input S is of form S(N0, N1, C, K) or S(N0, N1, K) If dimK = 0 then input S is of form S(N0, N1, C, K) or S(N0, N1, C)The internal data layout for S, D (X here), and X (Z here) is:
dim<0> - dim<Nds-1> : Spatial dimensions, product of N0,N1,... is N dim<Nds> : C number of channels in S and D dim<Nds+1> : K number of signals in S dim<Nds+2> : M number of filters in D sptl. chn sig flt S(N0, N1, C, K, 1) D(N0, N1, C, 1, M) (X here) X(N0, N1, 1, K, M) (Z here)The dsz parameter indicates the desired filter supports in the output dictionary, since this cannot be inferred from the input variables. The format is the same as the dsz parameter of
cnvrep.bcrop
.Call graph
- Parameters:
- Zarray_like
Coefficient map array
- Sarray_like
Signal array
- dsztuple
Filter support size(s)
- optccmod.Options object
Algorithm options
- dimKint, optional (default 1)
Number of dimensions for multiple signals in input S
- dimNint, optional (default 2)
Number of spatial dimensions
- class Options(opt=None)[source]¶
Bases:
Options
ConvCnstrMOD algorithm options
Options include all of those defined in
pgm.PGMDFT.Options
, together with additional options:
ZeroMean
: Flag indicating whether the solution dictionary \(\{\mathbf{d}_m\}\) should have zero-mean components.
- Parameters:
- optdict or None, optional (default None)
ConvCnstrMOD algorithm options
- defaults = {'AutoStop': {'Enabled': False, 'Tau0': 0.01}, 'Backtrack': None, 'Callback': None, 'DataType': None, 'FastSolve': False, 'IterTimer': 'solve', 'L': None, 'MaxMainIter': 1000, 'Momentum': <sporco.pgm.momentum.MomentumNesterov object>, 'Monotone': False, 'RelStopTol': 0.001, 'StatusHeader': True, 'StepSizePolicy': None, 'Verbose': False, 'X0': None, 'ZeroMean': False}¶
Default content and allowed dict keys
- itstat_fields_objfn = ('DFid', 'Cnstr')¶
Fields in IterationStats associated with the objective function; see
eval_objfun
- hdrtxt_objfn = ('DFid', 'Cnstr')¶
Display column headers associated with the objective function; see
eval_objfun
- hdrval_objfun = {'Cnstr': 'Cnstr', 'DFid': 'DFid'}¶
Dictionary mapping display column headers in
hdrtxt_objfn
to IterationStats entries
- getdict(crop=True)[source]¶
Get final dictionary. If
crop
isTrue
, applycnvrep.bcrop
to returned array.
- 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\).
- 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.ccmod.ConvCnstrMODMask(*args, **kwargs)[source]¶
Bases:
ConvCnstrMOD
PGM algorithm for Convolutional Constrained MOD problem with a spatial mask [26].
Solve the optimisation problem
\[\mathrm{argmin}_\mathbf{d} \; (1/2) \left\| W \left(\sum_m \mathbf{d}_m * \mathbf{x}_m - \mathbf{s}\right) \right\|_2^2 \quad \text{such that} \quad \mathbf{d}_m \in C \;\; \forall m\]where \(C\) is the feasible set consisting of filters with unit norm and constrained support, and \(W\) is a mask array, via the PGM problem
\[\mathrm{argmin}_{\mathbf{d}} \; (1/2) \left\| W \left(X \mathbf{d} - \mathbf{s}\right) \right\|_2^2 + \iota_C(\mathbf{d}_m) \;\;,\]where \(\iota_C(\cdot)\) is the indicator function of feasible set \(C\), and \(X \mathbf{d} = \sum_m \mathbf{x}_m * \mathbf{d}_m\).
See
ConvCnstrMOD
for interface details.Call graph
- Parameters:
- Zarray_like
Coefficient map array
- Sarray_like
Signal array
- Warray_like
Mask array. The array shape must be such that the array is compatible for multiplication with the internal shape of input array S (see
cnvrep.CDU_ConvRepIndexing
for a discussion of the distinction between external and internal data layouts).- dsztuple
Filter support size(s)
- opt
ConvCnstrMODMask.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
- class Options(opt=None)[source]¶
Bases:
Options
ConvCnstrMODMask algorithm options
Options include all of those defined in
pgm.PGM.Options
.
- Parameters:
- optdict or None, optional (default None)
ConvCnstrMODMask algorithm options
- defaults = {'AutoStop': {'Enabled': False, 'Tau0': 0.01}, 'Backtrack': None, 'Callback': None, 'DataType': None, 'FastSolve': False, 'IterTimer': 'solve', 'L': None, 'MaxMainIter': 1000, 'Momentum': <sporco.pgm.momentum.MomentumNesterov object>, 'Monotone': False, 'RelStopTol': 0.001, 'StatusHeader': True, 'StepSizePolicy': None, 'Verbose': False, 'X0': None, 'ZeroMean': False}¶
Default content and allowed dict keys
- solve()¶
Call graph