libpyhat.Unmixing package
Submodules
libpyhat.Unmixing.ELMM_ADMM module
- libpyhat.Unmixing.ELMM_ADMM.elmm_admm(data, A_init, psis_init, S0, lambda_s, lambda_a, lambda_psi, **kwargs)[source]
Unmix hyperspectral data using the Extended Linear Mixing Model
We find a stationary point of the following functional:
# % J(S,A,PSI) = 1/2 * sum_{k=1}^{N} (||x_k - S_k*a_k||_{2}^{2} + # % ||S_k - S0*psi_{k}||_{F}^{2}) + lambda_A R(A) + lambda_PSI R(PSI) # % # % with S a collection of endmember matrices for each pixel, A the # % abundances in each pixel and for each endmember, and PSI the scaling # % factors advocated by the ELMM. # % # % The abundances are subject to the usual nonnegativity and sum to one # % constraints. The scaling factors and endmember spectral are nonnegative # % as well. # % # % R(A) is a spatial regularization term on the abundances. It can be # % either an anisotropic total variation term TV(A) applied on each # % material or a Tikhonov like regularization on the spatial gradients of # % the abundance maps. R(PSI) is a differentiable Tikhonov regularization # % on the spatial gradients of the scaling factor maps.
Mandatory inputs:
-data: m*n*L image cube, where m is the number of rows, n the number of columns, and L the number of spectral bands. -A_init: P*N initial abundance matrix, with P the number of endmembers to consider, and N the number of pixels (N=m*n) -psis_init: P*N initial scaling factor matrix -S0: L*P reference endmember matrix -lambda_s: regularization parameter on the ELMM tightness -lambda_a: regularization parameter for the spatial regularization on the abundances. -lambda_psi: regularization parameter for the spatial regularization on the scaling factors The spatial regularization parameters can be scalars, in which case they will apply in the same way for all the terms of the concerned regularizations. If they are vectors, then each term of the sum (corresponding to each material) will be differently weighted by the different entries of the vector.
- Optional inputs (arguments are to be provided in the same order as in
the following list): -norm_sr: choose norm to use for the spatial regularization on the abundances. Can be ‘2,1’ (Tikhonov like penalty on the gradient) or ‘1,1’ (Total Variation) (default: ‘1,1’) -verbose: flag for display in console. Display if true, no display otherwise (default: true) -maxiter_anls: maximum number of iterations for the ANLS loop (default: 100) -maxiter_admm: maximum number of iterations for the ADMM loop (default: 100) -epsilon_s: tolerance on the relative variation of S between two consecutive iterations (default: 10^(-3)) -epsilon_a: tolerance on the relative variation of A between two consecutive iterations (default: 10^(-3)) -epsilon_psi: tolerance on the relative variation of psi between two consecutive iterations (default: 10^(-3)) -epsilon_admm_abs: tolerance on the absolute part of the primal and dual residuals (default: 10^(-2)) -epsilon_admm_rel: tolerance on the relative part of the primal and dual residuals (default: 10^(-2))
- Outputs:
-A: P*N abundance matrix -psi_maps: P*N scaling factor matrix -S: L*P*N tensor constaining all the endmember matrices for each pixel -optim_struct: structure containing the values of the objective function and its different terms at each iteration
libpyhat.Unmixing.MESMA module
libpyhat.Unmixing.MLM module
- class libpyhat.Unmixing.MLM.GBM(method='SLSQP', maxiter=100, random_starts=0)[source]
Bases:
object
Generalized bilinear model x = spectra (samples x wvl) E = endmembers (samples x wvl) method: Which solver scipy.minimize should use. Since this is constrained minimization, the options are:
SLSQP = Sequential Least Squares Programming trust-constr = Trust region (tends to be slow)
maxiter = Limits the number of iterations random_starts = If specified, the mixture of endmembers will be initialized this many times with random proportions
of each end member, and the results will be averaged. May help to avoid local minima, but slows down the calculation.
- class libpyhat.Unmixing.MLM.LMM(method='SLSQP', maxiter=100)[source]
Bases:
object
Linear Mixture Model x = spectra (samples x wvl) E = endmembers (samples x wvl) method: Which solver scipy.minimize should use. Since this is constrained minimization, the options are:
SLSQP = Sequential Least Squares Programming trust-constr = Trust region (tends to be slow)
maxiter = Limits the number of iterations
libpyhat.Unmixing.elmm module
libpyhat.Unmixing.unmix module
- libpyhat.Unmixing.unmix.unmix(spectra, endmembers, unmix_method, params=None, normalize=False, mask=None, em_names=None)[source]
Parameters
- spectralibpyhat spectra object
This contains spectral information and corresponding wavelength values
- endmembers :
Endmember spectra to use for unmixing
- unmix_methodstring
The name of the unmixing method. See supported_methods variable for the list of possibilities.
params : Only relevant to the non pysptools methods; contains parameter values for methods normalize : boolean
Only relevant to the pysptools methods; determines whether to normalize before analysis
- maskarray
Contains entry for each wvl column to indicate whether to mask
- em_nameslist of strings
Contains names of the end members
Returns
- resultsunmixing method results (varies)
Includes results from the unmixing algorithm