├── AuxOps.py ├── CDLOps.py ├── README.md ├── SparseCoupledDictionaryTraining.py ├── args.py └── datasamples ├── input_hr.csv └── input_lr.csv /AuxOps.py: -------------------------------------------------------------------------------- 1 | """SPARSE COUPLED DICTIONARY LEARNING 2 | 3 | Sumplementary Methods for the execution of intermediate matrices (Lagrange multiplier matrices, sparse coding matrices) 4 | 5 | :Author: Nancy Panousopoulou 6 | 7 | :Reference document: Konstantina Fotiadou, Grigorios Tsagkatakis, Panagiotos Tsakalides `` Linear Inverse Problems with Sparsity Constraints'', DEDALE DELIVERABLE 3.1, 2016. 8 | 9 | :Date: December 2017 10 | 11 | """ 12 | 13 | import numpy as np 14 | 15 | from numpy.linalg import inv 16 | #from numpy.linalg import solve 17 | 18 | from scipy.linalg import solve 19 | 20 | 21 | def updateY(previousY, c, op1, op2, maxbeta=1e+6, beta=0.01): 22 | """Update Lagrange multiplier matrix (Equation (19)). 23 | 24 | Input Arguments 25 | ---------- 26 | previousY : np.array 27 | The previous value of the Lagrange multiplier matrix 28 | c: double 29 | Step size parameter for the augmentend Lagrangian function 30 | op1: np.array 31 | First operand matrix (thresholding values) 32 | op2 : np.array 33 | Second operand matrix (sparse coding coefficients) 34 | maxbeta, beta: double 35 | Auxiliary parameters for updating Lagrange multiplier matrices. 36 | 37 | 38 | """ 39 | return previousY + min(maxbeta, beta*c)*(op1-op2) 40 | 41 | 42 | def updThr(inputmat, lam=0.1): 43 | 44 | """ 45 | Update thresholding matrices (Equations (13)-(14)). 46 | 47 | Input Arguments 48 | ---------- 49 | inputmat : np.array 50 | The input matrix for thresholding 51 | lam: double 52 | The thresholding value 53 | 54 | 55 | """ 56 | 57 | th = lam/2. 58 | 59 | ttt = np.random.random(inputmat.shape) 60 | #ttt = a - th [a > th] 61 | 62 | 63 | for bb in range(inputmat.shape[0]): 64 | for aa in range(inputmat.shape[1]): 65 | #print('*************') 66 | #print(aa) 67 | #print('*************') 68 | if inputmat[bb,aa]>th: 69 | ttt[bb,aa] = inputmat[bb,aa]-th 70 | elif abs(inputmat[bb,aa]) <= th: 71 | ttt[bb,aa] = 0. 72 | elif inputmat[bb,aa] < (-1.)*th: 73 | ttt[bb,aa] = inputmat[bb,aa] +th 74 | 75 | 76 | 77 | return ttt 78 | 79 | 80 | 81 | def calcW(datain_h, datain_l, dictin_ht, dictin_lt, dtdh, dtdl, wh,wl, c1,c2,c3, y1,y2,y3,p,q): 82 | """ 83 | Update sparse coding parameters (Equation (11)). 84 | 85 | Input Arguments 86 | ---------- 87 | datain_h, datain_l : np.array 88 | The input data matrices in high and low resolution respectively 89 | dictin_ht, dictin_lt: np.array 90 | The transpose of the input dictionary in high and low resolution respectively 91 | wh, wl: np.array 92 | The previous sparse coding matrics in high and low resolution respectively 93 | c1,c2,c3: double 94 | Step size parameters for the augmentend Lagrangian function 95 | y1,y2,y3: np.array 96 | The Langrange multiplier matrices 97 | p,q: np. array 98 | The thresholding matrices for high and low resolution respectively. 99 | """ 100 | 101 | #wh: sparce coding in high resolution 102 | tmp2 = np.dot(dictin_ht, datain_h) + (y1 - y3) + c1*p + c3*wl 103 | 104 | tmp22 = np.dot(dtdh, tmp2)#+y1-y3) 105 | 106 | #wh: sparce coding in low resolution 107 | tmp4 = np.dot(dictin_lt, datain_l) + (y2 - y3) + c2*q + c3*tmp22 108 | 109 | tmp44 = np.dot(dtdl, tmp4) 110 | 111 | return [tmp22, tmp44] 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /CDLOps.py: -------------------------------------------------------------------------------- 1 | 2 | """SPARSE COUPLED DICTIONARY LEARNING 3 | 4 | Sumplementary Class and Methods for the execution of intermediate matrices (Lagrange multiplier matrices, sparse coding matrices) 5 | 6 | :Author: Nancy Panousopoulou 7 | 8 | :Reference document: Konstantina Fotiadou, Grigorios Tsagkatakis, Panagiotos Tsakalides `` Linear Inverse Problems with Sparsity Constraints'', DEDALE DELIVERABLE 3.1, 2016. 9 | 10 | :Date: December 2017 11 | 12 | """ 13 | 14 | import numpy as np 15 | import AuxOps as aops 16 | 17 | import copy 18 | 19 | 20 | 21 | class CDL(): 22 | """Coupled Dictionary Learning Class 23 | 24 | This class defines the intermediate matrices ((Lagrange multiplier matrices, sparse coding matrices) 25 | 26 | Parameters 27 | ---------- 28 | datain_h : np.ndarray 29 | Input data array, containing the data cubes in high resolution 30 | datain_l : np.ndarray 31 | Input data array, containing the data cubes in low resolution 32 | dictsize : int 33 | The size of the dictionaries 34 | imageN: int 35 | The number of samples in low and high resolution data cubes. 36 | """ 37 | 38 | def __init__(self, datain_h, datain_l, dictsize, imageN): 39 | 40 | 41 | 42 | 43 | 44 | 45 | self.datain_h = datain_h 46 | self.datain_l = datain_l 47 | 48 | #sparse coding matrices 49 | self.wh = np.zeros((dictsize,imageN)) 50 | self.wl = np.zeros((dictsize,imageN)) 51 | 52 | # 53 | self.p = np.zeros((dictsize, imageN)) 54 | self.q = np.zeros((dictsize, imageN)) 55 | 56 | #Lagrangian multiplier matrices 57 | self.y1 = np.zeros((dictsize, imageN)) 58 | self.y2 = np.zeros((dictsize, imageN)) 59 | self.y3 = np.zeros((dictsize, imageN)) 60 | 61 | self.dictsize = dictsize 62 | 63 | 64 | 65 | def updateCDL(cdlin, dictin_ht, dictin_lt, dtdh, dtdl, c1,c2,c3, maxbeta, beta, lamda): 66 | """ 67 | Method for updating intermediate matrices 68 | 69 | Input Arguments 70 | ---------- 71 | cdlin : CDL object 72 | The set of intermediate matrices to be updated 73 | dictin_ht: np.array 74 | The transpose of the input dictionary in high resolution 75 | dictin_lt: np.array 76 | The transpose of the input dictionary in low resolution 77 | dtdh: np.array 78 | Auxiliary matrix - first term of Equation (11) for the high resolution dictionaries 79 | dtdl: np.array 80 | Auxiliary matrix - first term of Equation (11) for the low resolution dictionaries 81 | c1, c2, c3: double 82 | Step size parameters for the augmentend Lagrangian function 83 | maxbeta, beta: double 84 | Auxiliary parameters for updating Lagrange multiplier matrices. 85 | lamda: double 86 | The threshold value. 87 | """ 88 | 89 | y11= cdlin.y1 90 | y22 = cdlin.y2 91 | 92 | y33 = cdlin.y3 93 | pp = cdlin.p 94 | 95 | qq = cdlin.q 96 | 97 | 98 | 99 | datain_h = cdlin.datain_h 100 | datain_l = cdlin.datain_l 101 | 102 | wl = cdlin.wl 103 | wh = cdlin.wh 104 | 105 | #print('wh & wl') 106 | #update the sparse coding matrices according to Eq. (11) 107 | 108 | whl = aops.calcW(datain_h, datain_l, dictin_ht,dictin_lt, dtdh, dtdl, wh, wl, c1,c2,c3, y11,y22,y33,pp,qq) 109 | 110 | 111 | #update the thresholding matrices according to Eq. (13) 112 | pp = aops.updThr(np.array(whl[0])-y11/c1, lamda) 113 | qq = aops.updThr(np.array(whl[1])-y22/c2, lamda) 114 | #update the Lagrange multiplier matrices according to Eq. (19). 115 | y11 = aops.updateY(y11, c1, pp, np.array(whl[0]), maxbeta, beta) 116 | y22 = aops.updateY(y22, c1, qq, np.array(whl[1]), maxbeta, beta) 117 | y33 = aops.updateY(y33, c3, np.array(whl[0]), np.array(whl[1]), maxbeta, beta) 118 | 119 | #print(y11.shape) 120 | #print(y22.shape) 121 | #print(y33.shape) 122 | 123 | #Save back to the CDL object and return 124 | cdlin.wh = np.array(whl[0]).copy() 125 | cdlin.wl = np.array(whl[1]).copy() 126 | 127 | 128 | cdlin.y1 = y11.copy() 129 | cdlin.y2 = y22.copy() 130 | cdlin.y3 = y33.copy() 131 | cdlin.p = pp.copy() 132 | cdlin.q = qq.copy() 133 | 134 | return cdlin 135 | 136 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SRARSE COUPLED DICTIONARY LEARNING 2 | ============= 3 | 4 | > Author: **Konstantina Fotiadou, Greg Tsagkatakis, Nancy Panousopoulou** 5 | > Year: **2017-2018** 6 | > Email: [kfot@ics.forth.gr](mailto:kfot@ics.forth.gr), [greg@ics.forth.gr](mailto:greg@ics.forth.gr) 7 | > Website: [https://github.com/spl-icsforth](https://github.com/spl-icsforth) 8 | > Reference Documents: 9 | > [1] Konstantina Fotiadou, Grigorios Tsagkatakis, Panagiotos Tsakalides, "Linear Inverse Problems with Sparsity Constraints," DEDALE DELIVERABLE 3.1, 2016. 10 | > [2] K. Fotiadou , G. Tsagkatakis, Mahta Moghaddam, & P. Tsakalides. Recovery of Soil Moisture Active Passive (SMAP) instrument's active measurements via coupled dictionary learning. To appear in Computational Imaging Conference, of Electronic Imaging Symbosium. (Jan. 2018) 11 | > [3] K. Fotiadou , G. Tsagkatakis, B. Moraes, F.B. Abdalla, & P. Tsakalides (2017, August). Denoising galaxy spectra with coupled dictionary learning. In Signal Processing Conference (EUSIPCO), 2017 25th European (pp. 498-502). IEEE. 12 | > [4] K. Fotiadou, G. Tsagkatakis, P. Tsakalides. Spectral Resolution Enhancement via Coupled Dictionary Learning. Under Review in IEEE Transactions on Remote Sensing. 13 | 14 | Contents 15 | ------------ 16 | 1. [Introduction](#intro_anchor) 17 | 1. [Dependencies](#depend_anchor) 18 | 1. [Execution](#exe_anchor) 19 | 1. [Input Format](#in_format) 20 | 1. [Required Input Parameters](#required) 21 | 1. [Optional Input Parameters](#optional) 22 | 1. [Example](#eg_anchor) 23 | 24 | 25 | 26 | ## Introduction 27 | 28 | This repository is designed for solving the problem of spectral super-resolution, adhering to a sparse-based machine learning technique. Our goal is to recover a high-spectral resolution multi- or hyperspectral image from only few spectral observations. The estimation of the high-spectral resolution scene is formulated as the joint estimation of the coupled pair of dictionaries, representing both the low and the high spectral resolution feature spaces, and the joint sparse coefficients. Specifically, we design a coupled dictionary learning (CDL) architecture, relying on the alternating direction method of multipliers (ADMM), which updates the dictionaries by closed form solutions. 29 | Our CDL algorithm considers as input multiple training examples (i.e. hyper-pixels) extracted from corresponding low- and high- spectral resolution data-cubes, along with a few specification parameters, such as: 30 | 31 | * The number of iterations in order to achieve high convergence rate; 32 | * The sparsity regularization parameter that balances the fidelity of the reconstruction; 33 | * The number of dictionary atoms, which denotes the coupled dictionaries size. 34 | 35 | The output of our algorithm include the coupled dictionaries (i.e. high and low spectral resolution), along with the reconstruction errors (RMSE) for both the dictionaries and the augmented lagrangian function. 36 | 37 | 38 | ## Dependencies 39 | 40 | 41 | ### Required Packages 42 | 43 | In order to run the code in this repository the following packages must be installed: 44 | 45 | * [Python](https://www.python.org/)** 46 | [Tested with v 2.7.12] 47 | 48 | * [Numpy](http://www.numpy.org/)** [Tested with v 1.14.0, v 1.13.3] 49 | 50 | * [Scipy](http://www.scipy.org/)** [Tested with v 1.0.0] 51 | 52 | 53 | 54 | ## Execution 55 | 56 | The code for execution is the python script ``SparseCoupledDictionaryTraining.py`` which considers as input a low- and high- spectral resolution data-cubes and calculates the coupled dictionanries (i.e. in low and high resolution), as well as the reconstruction errors (RMSE) for both the dictionaries and the augmented lagrangian function. 57 | 58 | The python scripts CDLOps.py and AuxOps.py contain sumplementary classes and methods for all intermediate steps. The args.py script defines the required and optional input parameters for executing the code. 59 | 60 | 61 | ### Input Format 62 | 63 | The input files should have the following format: 64 | 65 | - Input Data-cubes: Two csv files (one for low and one for high resolution) should be provided in the form (#of bands) x (#of samples). 66 | 67 | For example, if the number of bands in low resolution equals to 9, and the number of bands in high resolution equals 25, and each data cube has 100 samples, then the input for the high resolution is a matrix [25, 100] and the input for the low resolution is a matrix [9, 100]. 68 | 69 | Consult the csv files provided under the folder `data samples`. 70 | 71 | 72 | ### Required Input Parameters 73 | 74 | This library considers the following required input parameters: 75 | 76 | * '-ih', '--inputhigh': Input data file name (high resolution). 77 | * '-il', '--inputlow': Input data file name (low resolution). 78 | * '-d', '--dictsize': The number of atoms for the low and high resolution dictionaries 79 | * '-img', '--imageN': The size of the image (number of samples for input high and low resolution data cubes) 80 | 81 | 82 | ### Optional input parameters 83 | This library considers the following optional input parameters: 84 | 85 | * '-n', '--n_iter': The number of iterations for calculating the dictionaries (Default value: 150) 86 | * '--window': The window for calculating the RMSE 87 | * '--bands_h': The number of bands in high resolution. Default value 25. 88 | * '--bands_l': The number of bands in low resolution. Default value 9. 89 | * '--c1': Step size parameter for the augmentend Lagrangian function. Default value 0.4. 90 | * '--c2': Step size parameter for the augmentend Lagrangian function. Default value 0.4. 91 | * '--c3': Step size parameter for the augmentend Lagrangian function. Default value 0.8. 92 | * '--maxbeta': Auxiliary parameter for updating Lagrange multiplier matrices. Default value 1e+6 93 | * '--delta': Regularization factor. Default value 1e-4 94 | * '--beta': Auxiliary parameter for updating Lagrange multiplier matrices. Default value 0.01 95 | * '--lamda': The threshold value. Default value 0.1 96 | 97 | 98 | 99 | ### Running the executable script 100 | 101 | The code runs at a terminal (not in a Python session): 102 | 103 | ```bash 104 | $ python SparseCoupledDictionaryTraining.py --inputhigh INPUT_HR.csv --inputlow INPUT_LR.csv --dictsize DICTSIZE --imageN IMG --bands_h BANDS_H --bands_l BANDS_L --n_iter N --window W 105 | ``` 106 | 107 | Where: 108 | 109 | * `INPUT_HR.csv` is the csv file containing the data cubes in high resolution 110 | * `INPUT_LR.csv` is the csv file containing the data cubes in low resolution 111 | * `DICTSIZE` is the size (number of atoms) of the dictionaries that will be calculated 112 | * `IMG` is the size of the input data samples 113 | * `BANDS_H` is the number of bands in high resolution 114 | * `BANDS_L` is the number of bands in low resolution 115 | * `N` is the number of iterations for calculating the dictionaries 116 | * `W` is the window for calculating the RMSE 117 | 118 | 119 | 120 | ### Example 121 | 122 | The following example uses sample data cubes of size 25x100 in high resolution and 9x100 in low resolution, in order to produce two dictionaries (in low and high resolution) containing 64 atoms. 123 | 124 | The corresponding csv files are available at ``datasamples`` directory. 125 | 126 | 127 | ```bash 128 | $ python SparseCoupledDictionaryTraining.py --inputhigh datasamples/input_hr.csv --inputlow datasamples/input_lr.csv --dictsize 64 --imageN 100 --bands_h 25 --bands_l 9 --n_iter 100 --window 10 129 | ``` 130 | After the termination of the loop the output of the algorithm is stored in variables `dict_h`, `dict_l` (dictionaries in high and low resolution) and `err_h`, `err_l` (RMSE in high and low resolution). 131 | 132 | ## How to reference 133 | If you find any of this library useful for your research, please give credit in your publications where it is due. 134 | 135 | ## Disclaimer 136 | Copyright (c) 2017-2018, Signal Processing Lab (SPL), Institute of Computer Science (ICS), FORTH, Greece. 137 | 138 | All rights reserved. 139 | 140 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 141 | 142 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 143 | 144 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 145 | 146 | 3. Neither the name of the Signal Processing Lab, the Institute of Computer Science and FORTH, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 147 | 148 | THE SOFTWARE LIBRARIES AND DATASETS ARE PROVIDED BY THE INSTITUTE AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 149 | -------------------------------------------------------------------------------- /SparseCoupledDictionaryTraining.py: -------------------------------------------------------------------------------- 1 | 2 | """SPARSE COUPLED DICTIONARY LEARNING 3 | 4 | The main script for execution 5 | 6 | :Author: Nancy Panousopoulou 7 | 8 | ::Reference document: Konstantina Fotiadou, Grigorios Tsagkatakis, Panagiotos Tsakalides `` Linear Inverse Problems with Sparsity Constraints,'' DEDALE DELIVERABLE 3.1, 2016. 9 | 10 | :Date: December 2017 11 | 12 | """ 13 | import numpy as np 14 | 15 | 16 | #from numpy import linalg as la 17 | 18 | 19 | from numpy import genfromtxt 20 | from math import sqrt 21 | 22 | #import scipy.io as sio 23 | from numpy.linalg import inv 24 | from args import get_opts 25 | 26 | from CDLOps import CDL, updateCDL 27 | import time 28 | 29 | def normD(dictin): 30 | """ 31 | Normalize the dictionary between [0,1] 32 | 33 | Input Arguments 34 | ---------- 35 | dictin : np.array 36 | The input dictionary 37 | """ 38 | 39 | 40 | 41 | tmp = 1 / np.sqrt(np.sum(np.multiply(dictin, dictin), axis=0)) 42 | 43 | return np.dot(dictin, np.diag(tmp)) 44 | 45 | 46 | def run_script(): 47 | 48 | #the size of the image 49 | imageN = opts.imageN 50 | 51 | #the size of the dictionary 52 | dictsize = opts.dictsize 53 | 54 | #the number of bands in high resolution 55 | bands_h_N = opts.bands_h 56 | 57 | #the number of bands in low resolution 58 | bands_l_N = opts.bands_l 59 | 60 | #parameters for training. 61 | c1 = opts.c1 # Default value: 0.4 62 | 63 | c2 = opts.c2 # Default value: 0.4 64 | 65 | c3 = opts.c3 # Default value: 0.8 66 | 67 | maxbeta = opts.maxbeta #Default value: 1e+6 68 | 69 | delta = opts.delta #Default value: 1e-4 70 | beta = opts.beta #Default value: 0.01 71 | lamda = opts.lamda #Default value: 0.1 72 | 73 | #number of iterations for training 74 | train_iter =opts.n_iter #default value: 150 75 | 76 | #the window for calculating the value of the error. 77 | wind = opts.window 78 | 79 | 80 | #input data are in the from (# of Pixels) x (# of Bands) 81 | data_h = genfromtxt(opts.inputhigh, delimiter=',') 82 | data_l = genfromtxt(opts.inputlow, delimiter=',') 83 | 84 | #the initial dictionaries are in the from (Dictionary Size) x (# of Bands) 85 | dict_h = data_h[:, 0:dictsize] 86 | dict_l = data_l[:, 0:dictsize] 87 | 88 | 89 | #normalize the dictionaries 90 | #dict_l = dict_l /la.norm(dict_l) 91 | #dict_h = dict_h /la.norm(dict_h) 92 | 93 | 94 | #mat2save = './tttmpinit' + '_' + str(imageN) + 'x' + str(dictsize) + '.mat' 95 | #sio.savemat(mat2save, {'dicth_init':dict_h, 'dictl_init': dict_l}) 96 | 97 | #the CDL object responsible for all calculations... 98 | cdl = CDL(data_h, data_l, dictsize, imageN) 99 | 100 | phi_h = np.zeros(dictsize) 101 | phi_l = np.zeros(dictsize) 102 | 103 | dict_h_upd = np.zeros(dict_h.shape) 104 | dict_l_upd = np.zeros(dict_l.shape) 105 | 106 | 107 | for k in range(train_iter): 108 | 109 | print(k) 110 | ttime3 = time.time() 111 | ##prepare the updated values of dictionaries for updating Wh, Wl, P, Q, Y1,Y2, Y3 112 | dict_ht = np.transpose(dict_h) 113 | dict_lt = np.transpose(dict_l) 114 | 115 | 116 | #(D_h^{T} \times D_h + (c_1+c_3)\times I)^{-1} -- first term of equation (11) for high resolution 117 | dtdh = np.dot(np.transpose(dict_h), dict_h) + (c1 + c3)*np.eye(np.transpose(dict_h).shape[0]) 118 | dtdhinv = inv(dtdh) 119 | #(D_l^{T} \times D_l + (c_2+c_3)\times I)^{-1} -- first term of equation (11) for low resolution 120 | dtdl = np.dot(np.transpose(dict_l), dict_l) + (c2 + c3)*np.eye(np.transpose(dict_l).shape[0]) 121 | dtdlinv = inv(dtdl) 122 | 123 | 124 | 125 | print('update...') 126 | #update all auxiliary matrices Wh, Wl, P, Q, Y1, Y2, Y3 127 | cdl = updateCDL(cdl, dict_ht, dict_lt, dtdhinv, dtdlinv,c1,c2,c3, maxbeta, beta, lamda) 128 | 129 | 130 | for ii in range(dictsize): 131 | phi_h[ii] = np.dot(cdl.wh[ii,:], np.transpose(cdl.wh[ii,:])) + delta 132 | phi_l[ii] = np.dot(cdl.wl[ii,:], np.transpose(cdl.wl[ii,:])) + delta 133 | 134 | 135 | 136 | dict_h_upd = dict_h + np.dot(data_h, np.transpose(cdl.wh))/(phi_h) 137 | dict_l_upd = dict_l + np.dot(data_l, np.transpose(cdl.wl))/(phi_l) 138 | 139 | #print(dict_h_upd.shape) 140 | #print(dict_l_upd.shape) 141 | #normalize dictionaries between [0,1] 142 | #dict_h = dict_h_upd / la.norm(dict_h_upd) 143 | #dict_l = dict_l_upd / la.norm(dict_l_upd) 144 | dict_h = normD(dict_h_upd) 145 | dict_l = normD(dict_l_upd) 146 | 147 | 148 | if ~((k +1) % wind): 149 | 150 | 151 | 152 | 153 | err_h = sqrt(np.sum(np.sum(np.square(cdl.datain_h - np.dot(dict_h, cdl.wh)))) / (bands_h_N * imageN)) 154 | err_l = sqrt(np.sum(np.sum(np.square(cdl.datain_l - np.dot(dict_l, cdl.wl)))) / (bands_l_N * imageN)) 155 | 156 | 157 | 158 | print('ERROR HIGH:') 159 | print(err_h) 160 | 161 | print('ERROR LOW:') 162 | print(err_l) 163 | 164 | 165 | 166 | print('Time elapsed for this iteration: ') 167 | ttime3 = time.time()-ttime3 168 | print(ttime3) 169 | #print('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>') 170 | 171 | #mat2save = './results' + str(imageN) + 'x' + str(dictsize) + '_' + str(k) +'standalone.mat' 172 | 173 | #sio.savemat(mat2save, {'timeelapsed': ttime3, 'dicth':dict_h, 'dictl': dict_l, 'phi_h': phi_h, 'phi_l': phi_l, 'err_l':err_l, 'err_h': err_h})#, 'wh': wh, 'wl': wl})#'phih': phi_h, 'sw': sw}) 174 | 175 | 176 | def main(args=None): 177 | 178 | 179 | global opts 180 | opts = get_opts(args) 181 | run_script() 182 | 183 | 184 | if __name__ == "__main__": 185 | main() 186 | 187 | -------------------------------------------------------------------------------- /args.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """SF DECONVOLVE ARGUMENTS 4 | 5 | This module sets the arguments for sf_deconvolve.py. 6 | 7 | :Author: Samuel Farrens 8 | 9 | :Version: 2.4 10 | 11 | :Date: 23/10/2017 12 | 13 | """ 14 | 15 | import argparse as ap 16 | from argparse import ArgumentDefaultsHelpFormatter as formatter 17 | 18 | 19 | class ArgParser(ap.ArgumentParser): 20 | 21 | """Argument Parser 22 | 23 | This class defines a custom argument parser to override the 24 | default convert_arg_line_to_args method from argparse. 25 | 26 | """ 27 | 28 | def __init__(self, *args, **kwargs): 29 | 30 | super(ArgParser, self).__init__(*args, **kwargs) 31 | 32 | def convert_arg_line_to_args(self, line): 33 | """Convert argument line to arguments 34 | 35 | This method overrides the default method of argparse. It skips blank 36 | and comment lines, and allows .ini style formatting. 37 | 38 | Parameters 39 | ---------- 40 | line : str 41 | Input argument string 42 | 43 | Yields 44 | ------ 45 | str 46 | Argument strings 47 | 48 | """ 49 | 50 | line = line.split() 51 | if line and line[0][0] not in ('#', ';'): 52 | if line[0][0] != '-': 53 | line[0] = '--' + line[0] 54 | if len(line) > 1 and '=' in line[0]: 55 | line = line[0].split('=') + line[1:] 56 | for arg in line: 57 | yield arg 58 | 59 | 60 | def get_opts(args=None): 61 | 62 | """Get script options 63 | 64 | This method sets the PSF deconvolution script options. 65 | 66 | Returns 67 | ------- 68 | arguments namespace 69 | 70 | """ 71 | 72 | # Set up argument parser 73 | parser = ArgParser(add_help=False, usage='%(prog)s [options]', 74 | description='PSF Deconvolution Script', 75 | formatter_class=formatter, 76 | fromfile_prefix_chars='@') 77 | required = parser.add_argument_group('Required Arguments') 78 | optional = parser.add_argument_group('Optional Arguments') 79 | 80 | 81 | 82 | # Add arguments 83 | optional.add_argument('-h', '--help', action='help', 84 | help='show this help message and exit') 85 | 86 | 87 | optional.add_argument('-q', '--quiet', action='store_true', 88 | help='Suppress verbose.') 89 | 90 | required.add_argument('-ih', '--inputhigh', required=True, 91 | help='Input data file name (high resolution).') 92 | 93 | required.add_argument('-il', '--inputlow', required=True, 94 | help='Input data file name (low resolution).') 95 | 96 | 97 | required.add_argument('-d', '--dictsize', type=int, 98 | help='Dictionanry size.') 99 | 100 | required.add_argument('-img', '--imageN', type=int, 101 | help='Size of input image.') 102 | 103 | 104 | optional.add_argument('-n', '--n_iter', type=int, default=150, 105 | help='Number of iterations.') 106 | 107 | optional.add_argument('--window', type=int, default=1, 108 | help='Window to measure error.') 109 | 110 | optional.add_argument('--bands_h', type=int, default=25, help='Number of bands in high resolution') 111 | 112 | optional.add_argument('--bands_l', type=int, default=9, help='Number of bands in low resolution') 113 | 114 | optional.add_argument('--c1', type=float, default=0.4) 115 | optional.add_argument('--c2', type=float, default=0.4) 116 | optional.add_argument('--c3', type=float, default=0.8) 117 | 118 | optional.add_argument('--maxbeta', type=float, default=1e+6) 119 | 120 | optional.add_argument('--delta', type=float, default=1e-4) 121 | 122 | optional.add_argument('--beta', type=float, default=0.01) 123 | 124 | optional.add_argument('--lamda', type=float, default=0.1) 125 | 126 | 127 | # Return the argument namespace 128 | 129 | return parser.parse_args(args) 130 | 131 | -------------------------------------------------------------------------------- /datasamples/input_hr.csv: -------------------------------------------------------------------------------- 1 | 0.095795,0.086014,0.083084,0.086014,0.074295,0.094818,0.060608,0.003906,0.075272,0.008804,0.002930,0.003906,0.008804,0.068420,0.043015,0.006836,0.005859,0.093842,0.120239,0.040085,0.098724,0.105576,0.029327,0.077225,0.087982,0.109482,0.113388,0.022476,0.104599,0.127075,0.136856,0.043015,0.090912,0.115341,0.107529,0.085037,0.091888,0.109482,0.067444,0.035187,0.038116,0.132935,0.086014,0.060608,0.102631,0.116318,0.127075,0.068420,0.078201,0.097748,0.074295,0.089935,0.081131,0.104599,0.074295,0.006836,0.011734,0.101654,0.014664,0.082108,0.028351,0.004883,0.005859,0.003906,0.095795,0.041061,0.092865,0.067444,0.008804,0.025421,0.107529,0.041061,0.087982,0.097748,0.011734,0.024445,0.054733,0.008804,0.029327,0.070374,0.069397,0.011734,0.002930,0.005859,0.004883,0.015640,0.031281,0.030304,0.006836,0.133911,0.015640,0.084061,0.283478,0.006836,0.084061,0.018570,0.000977,0.043015,0.040085,0.033234 2 | 0.103622,0.092865,0.086014,0.094818,0.075272,0.106552,0.071350,0.004883,0.086990,0.007812,0.006836,0.002930,0.007812,0.080154,0.046921,0.002930,0.010757,0.105576,0.151520,0.051804,0.115341,0.123169,0.042038,0.105576,0.115341,0.140762,0.167160,0.030304,0.136856,0.188660,0.177902,0.055725,0.108505,0.171066,0.154449,0.094818,0.109482,0.130005,0.085037,0.051804,0.043991,0.175949,0.110458,0.085037,0.122192,0.165192,0.185730,0.092865,0.097748,0.125122,0.120239,0.109482,0.115341,0.141739,0.077225,0.014664,0.019547,0.121216,0.028351,0.087982,0.031281,0.010757,0.008804,0.010757,0.124146,0.058655,0.117294,0.077225,0.014664,0.030304,0.115341,0.053757,0.109482,0.110458,0.015640,0.038116,0.070374,0.008804,0.034210,0.087982,0.076248,0.006836,0.005859,0.009781,0.013687,0.018570,0.034210,0.032257,0.009781,0.154449,0.016617,0.096771,0.326492,0.004883,0.107529,0.021500,0.002930,0.054733,0.031281,0.041061 3 | 0.104599,0.112411,0.100677,0.099701,0.088959,0.124146,0.085037,0.001953,0.096771,0.006836,0.005859,0.005859,0.008804,0.078201,0.047897,0.008804,0.010757,0.109482,0.150528,0.048874,0.118271,0.116318,0.027374,0.094818,0.102631,0.140762,0.135880,0.024445,0.105576,0.143692,0.146622,0.048874,0.100677,0.137833,0.121216,0.095795,0.117294,0.130005,0.079178,0.037140,0.039093,0.145645,0.109482,0.078201,0.134888,0.135880,0.150528,0.086990,0.092865,0.123169,0.091888,0.106552,0.096771,0.128052,0.103622,0.008804,0.013687,0.124146,0.017593,0.104599,0.026398,0.010757,0.004883,0.007812,0.110458,0.046921,0.112411,0.078201,0.012711,0.031281,0.125122,0.049850,0.113388,0.119263,0.017593,0.031281,0.073318,0.012711,0.025421,0.080154,0.078201,0.012711,0.003906,0.009781,0.008804,0.014664,0.035187,0.033234,0.011734,0.163239,0.020523,0.093842,0.345062,0.007812,0.093842,0.027374,0.000000,0.059631,0.025421,0.043015 4 | 0.122192,0.115341,0.112411,0.107529,0.090912,0.120239,0.078201,0.003906,0.102631,0.011734,0.012711,0.006836,0.009781,0.091888,0.047897,0.006836,0.011734,0.119263,0.157379,0.041061,0.120239,0.129028,0.036163,0.096771,0.114365,0.131958,0.145645,0.022476,0.143692,0.153473,0.162262,0.058655,0.111435,0.145645,0.131958,0.096771,0.100677,0.128052,0.090912,0.043015,0.049850,0.156403,0.116318,0.086990,0.119263,0.137833,0.155426,0.092865,0.101654,0.121216,0.101654,0.116318,0.102631,0.137833,0.098724,0.009781,0.020523,0.129028,0.021500,0.102631,0.026398,0.012711,0.007812,0.007812,0.129028,0.046921,0.116318,0.082108,0.021500,0.034210,0.130005,0.051804,0.125122,0.112411,0.016617,0.025421,0.075272,0.015640,0.024445,0.082108,0.086014,0.010757,0.003906,0.013687,0.011734,0.019547,0.042038,0.040085,0.010757,0.173019,0.020523,0.101654,0.373413,0.006836,0.110458,0.020523,0.004883,0.058655,0.025421,0.048874 5 | 0.062561,0.059631,0.059631,0.063538,0.053757,0.070374,0.043015,0.000977,0.066467,0.007812,0.004883,0.001953,0.004883,0.055725,0.028351,0.003906,0.008804,0.065491,0.084061,0.026398,0.065491,0.072342,0.016617,0.054733,0.063538,0.076248,0.089935,0.011734,0.072342,0.086014,0.089935,0.026398,0.059631,0.087982,0.071350,0.063538,0.061584,0.072342,0.048874,0.017593,0.021500,0.086990,0.053757,0.040085,0.062561,0.082108,0.080154,0.043991,0.051804,0.072342,0.050827,0.060608,0.060608,0.082108,0.061584,0.007812,0.010757,0.076248,0.015640,0.062561,0.024445,0.004883,0.004883,0.011734,0.080154,0.024445,0.060608,0.050827,0.010757,0.015640,0.072342,0.032257,0.081131,0.072342,0.010757,0.017593,0.042038,0.004883,0.019547,0.046921,0.048874,0.008804,0.003906,0.004883,0.004883,0.013687,0.023453,0.020523,0.005859,0.100677,0.011734,0.053757,0.218964,0.002930,0.060608,0.016617,0.002930,0.031281,0.018570,0.029327 6 | 0.263931,0.241440,0.227753,0.238510,0.204300,0.271744,0.176926,0.009781,0.211136,0.011734,0.009781,0.009781,0.010757,0.189636,0.100677,0.011734,0.023453,0.263931,0.321594,0.074295,0.267838,0.257080,0.060608,0.201370,0.235580,0.298141,0.270767,0.044968,0.231674,0.306931,0.319641,0.100677,0.219940,0.294235,0.277603,0.205276,0.245346,0.269791,0.171066,0.083084,0.078201,0.329422,0.234604,0.155426,0.260010,0.288361,0.317688,0.194519,0.204300,0.251221,0.195496,0.215057,0.207230,0.274673,0.213089,0.016617,0.030304,0.275650,0.033234,0.228729,0.044968,0.012711,0.013687,0.012711,0.245346,0.087982,0.238510,0.190613,0.031281,0.059631,0.298141,0.092865,0.257080,0.276627,0.019547,0.032257,0.141739,0.015640,0.039093,0.159332,0.174973,0.019547,0.013687,0.018570,0.018570,0.038116,0.078201,0.068420,0.014664,0.361679,0.026398,0.219940,0.768311,0.013687,0.217010,0.051804,0.007812,0.100677,0.108505,0.097748 7 | 0.285431,0.262955,0.259033,0.259033,0.238510,0.302048,0.198441,0.010757,0.257080,0.015640,0.018570,0.006836,0.011734,0.216034,0.112411,0.012711,0.021500,0.286407,0.360703,0.077225,0.284454,0.290314,0.083084,0.232651,0.269791,0.321594,0.347015,0.056702,0.302048,0.387085,0.390030,0.110458,0.235580,0.372421,0.335281,0.210159,0.255127,0.289337,0.190613,0.086014,0.101654,0.384155,0.243393,0.198441,0.277603,0.338211,0.382202,0.208206,0.227753,0.301071,0.234604,0.245346,0.239487,0.325516,0.219940,0.022476,0.026398,0.353851,0.038116,0.253174,0.047897,0.018570,0.009781,0.011734,0.311829,0.117294,0.260010,0.202347,0.033234,0.061584,0.326492,0.124146,0.320618,0.305954,0.025421,0.053757,0.173019,0.011734,0.057678,0.209183,0.216034,0.013687,0.013687,0.024445,0.018570,0.040085,0.074295,0.073318,0.017593,0.400772,0.027374,0.238510,0.876816,0.012711,0.267838,0.049850,0.003906,0.105576,0.088959,0.099701 8 | 0.273697,0.251221,0.232651,0.241440,0.196472,0.269791,0.173996,0.009781,0.224823,0.018570,0.016617,0.010757,0.006836,0.185730,0.111435,0.010757,0.021500,0.247314,0.304001,0.078201,0.259033,0.261978,0.059631,0.211136,0.232651,0.291290,0.266861,0.056702,0.226776,0.298141,0.316711,0.097748,0.207230,0.299118,0.263931,0.204300,0.234604,0.272720,0.164215,0.085037,0.078201,0.315735,0.230698,0.155426,0.242416,0.283478,0.293243,0.187683,0.211136,0.248291,0.178879,0.217987,0.210159,0.282501,0.210159,0.016617,0.036163,0.276627,0.031281,0.234604,0.046921,0.014664,0.012711,0.011734,0.232651,0.080154,0.228729,0.180832,0.039093,0.064514,0.298141,0.101654,0.291290,0.278595,0.021500,0.051804,0.140762,0.019547,0.047897,0.162262,0.170090,0.017593,0.013687,0.023453,0.020523,0.036163,0.077225,0.074295,0.016617,0.369492,0.027374,0.222870,0.780045,0.009781,0.219940,0.053757,0.006836,0.105576,0.062561,0.096771 9 | 0.216034,0.204300,0.210159,0.197449,0.176926,0.222870,0.139786,0.007812,0.206253,0.011734,0.013687,0.008804,0.011734,0.171066,0.083084,0.006836,0.017593,0.197449,0.265884,0.062561,0.191589,0.234604,0.051804,0.180832,0.211136,0.221893,0.243393,0.041061,0.211136,0.272720,0.275650,0.095795,0.179855,0.252197,0.214066,0.145645,0.178879,0.206253,0.133911,0.065491,0.068420,0.276627,0.174973,0.134888,0.190613,0.202347,0.260986,0.156403,0.152496,0.222870,0.149551,0.172043,0.171066,0.238510,0.170090,0.017593,0.029327,0.256104,0.029327,0.198441,0.030304,0.012711,0.012711,0.007812,0.198441,0.072342,0.178879,0.143692,0.040085,0.049850,0.242416,0.085037,0.248291,0.217987,0.019547,0.039093,0.135880,0.013687,0.042038,0.136856,0.142715,0.017593,0.010757,0.020523,0.014664,0.030304,0.063538,0.056702,0.011734,0.313782,0.022476,0.170090,0.667633,0.006836,0.192566,0.036163,0.004883,0.081131,0.045944,0.073318 10 | 0.086014,0.074295,0.080154,0.076248,0.067444,0.089935,0.061584,0.005859,0.075272,0.008804,0.003906,0.002930,0.004883,0.066467,0.036163,0.006836,0.010757,0.082108,0.104599,0.029327,0.089935,0.082108,0.015640,0.069397,0.073318,0.095795,0.090912,0.018570,0.073318,0.101654,0.106552,0.036163,0.067444,0.099701,0.091888,0.071350,0.081131,0.088959,0.053757,0.033234,0.024445,0.110458,0.076248,0.045944,0.077225,0.088959,0.105576,0.058655,0.058655,0.090912,0.066467,0.068420,0.066467,0.093842,0.064514,0.006836,0.010757,0.103622,0.015640,0.077225,0.022476,0.001953,0.000977,0.002930,0.078201,0.024445,0.078201,0.054733,0.015640,0.016617,0.095795,0.033234,0.103622,0.086014,0.005859,0.020523,0.051804,0.005859,0.018570,0.054733,0.054733,0.005859,0.007812,0.005859,0.003906,0.012711,0.024445,0.026398,0.002930,0.120239,0.006836,0.068420,0.260010,0.003906,0.072342,0.014664,0.000000,0.035187,0.028351,0.026398 11 | 0.163239,0.145645,0.127075,0.141739,0.125122,0.155426,0.108505,0.007812,0.120239,0.011734,0.006836,0.003906,0.005859,0.110458,0.054733,0.008804,0.013687,0.151520,0.172043,0.042038,0.158356,0.144669,0.028351,0.114365,0.135880,0.166168,0.150528,0.026398,0.130005,0.173019,0.182800,0.072342,0.113388,0.169113,0.145645,0.124146,0.139786,0.156403,0.106552,0.045944,0.037140,0.185730,0.140762,0.072342,0.144669,0.166168,0.165192,0.102631,0.104599,0.136856,0.096771,0.125122,0.123169,0.155426,0.125122,0.007812,0.019547,0.178879,0.021500,0.134888,0.039093,0.011734,0.009781,0.011734,0.128052,0.044968,0.127075,0.125122,0.015640,0.048874,0.165192,0.060608,0.187683,0.173019,0.015640,0.030304,0.082108,0.012711,0.023453,0.100677,0.094818,0.014664,0.007812,0.011734,0.009781,0.022476,0.047897,0.042038,0.005859,0.225800,0.013687,0.129028,0.488754,0.002930,0.129028,0.025421,0.001953,0.062561,0.053757,0.063538 12 | 0.241440,0.218964,0.213089,0.217987,0.176926,0.243393,0.161285,0.005859,0.177902,0.013687,0.009781,0.006836,0.009781,0.160309,0.091888,0.006836,0.021500,0.232651,0.265884,0.067444,0.212112,0.224823,0.055725,0.173996,0.197449,0.236557,0.212112,0.046921,0.178879,0.247314,0.252197,0.107529,0.187683,0.242416,0.220917,0.176926,0.202347,0.223846,0.135880,0.073318,0.062561,0.272720,0.197449,0.127075,0.202347,0.232651,0.235580,0.165192,0.173996,0.224823,0.151520,0.181808,0.184753,0.242416,0.175949,0.015640,0.023453,0.238510,0.025421,0.204300,0.045944,0.011734,0.014664,0.009781,0.193542,0.069397,0.198441,0.168137,0.024445,0.054733,0.252197,0.078201,0.281525,0.241440,0.014664,0.036163,0.116318,0.015640,0.041061,0.126099,0.135880,0.019547,0.012711,0.019547,0.015640,0.029327,0.066467,0.063538,0.013687,0.340164,0.021500,0.185730,0.703796,0.005859,0.188660,0.044968,0.004883,0.086990,0.069397,0.086990 13 | 0.175949,0.164215,0.152496,0.160309,0.129028,0.178879,0.116318,0.007812,0.146622,0.006836,0.007812,0.005859,0.007812,0.114365,0.063538,0.007812,0.014664,0.155426,0.198441,0.055725,0.160309,0.170090,0.031281,0.133911,0.149551,0.183777,0.168137,0.023453,0.130981,0.177902,0.189636,0.062561,0.132935,0.173019,0.153473,0.117294,0.140762,0.162262,0.104599,0.045944,0.040085,0.194519,0.141739,0.087982,0.146622,0.167160,0.175949,0.107529,0.113388,0.160309,0.122192,0.143692,0.127075,0.176926,0.122192,0.008804,0.021500,0.179855,0.027374,0.156403,0.042038,0.011734,0.012711,0.006836,0.140762,0.049850,0.134888,0.122192,0.014664,0.041061,0.184753,0.055725,0.208206,0.171066,0.015640,0.031281,0.090912,0.011734,0.027374,0.099701,0.100677,0.012711,0.002930,0.008804,0.006836,0.024445,0.048874,0.044968,0.008804,0.235580,0.014664,0.137833,0.526871,0.001953,0.128052,0.026398,0.002930,0.068420,0.039093,0.061584 14 | 0.119263,0.112411,0.112411,0.109482,0.091888,0.122192,0.079178,0.000977,0.092865,0.008804,0.006836,0.006836,0.008804,0.085037,0.042038,0.004883,0.011734,0.108505,0.125122,0.030304,0.115341,0.122192,0.025421,0.093842,0.100677,0.126099,0.102631,0.017593,0.081131,0.118271,0.120239,0.041061,0.093842,0.110458,0.096771,0.086990,0.105576,0.111435,0.081131,0.041061,0.025421,0.127075,0.099701,0.053757,0.108505,0.105576,0.103622,0.079178,0.080154,0.114365,0.075272,0.091888,0.099701,0.116318,0.083084,0.004883,0.019547,0.121216,0.021500,0.115341,0.026398,0.010757,0.004883,0.001953,0.087982,0.032257,0.096771,0.088959,0.016617,0.027374,0.134888,0.034210,0.155426,0.117294,0.014664,0.019547,0.062561,0.010757,0.023453,0.063538,0.066467,0.014664,0.005859,0.014664,0.008804,0.014664,0.042038,0.031281,0.004883,0.186707,0.013687,0.092865,0.358749,0.004883,0.088959,0.019547,0.000977,0.038116,0.033234,0.038116 15 | 0.095795,0.080154,0.089935,0.083084,0.069397,0.086014,0.061584,0.004883,0.078201,0.011734,0.001953,0.002930,0.000000,0.061584,0.028351,0.004883,0.009781,0.079178,0.102631,0.027374,0.085037,0.081131,0.015640,0.065491,0.085037,0.087982,0.085037,0.009781,0.066467,0.093842,0.095795,0.030304,0.068420,0.092865,0.084061,0.060608,0.067444,0.082108,0.051804,0.027374,0.015640,0.108505,0.077225,0.047897,0.068420,0.082108,0.095795,0.049850,0.058655,0.078201,0.056702,0.062561,0.066467,0.093842,0.070374,0.007812,0.012711,0.093842,0.012711,0.083084,0.024445,0.006836,0.008804,0.002930,0.073318,0.025421,0.072342,0.062561,0.008804,0.021500,0.090912,0.036163,0.115341,0.082108,0.006836,0.016617,0.046921,0.006836,0.022476,0.054733,0.058655,0.007812,0.005859,0.009781,0.008804,0.013687,0.030304,0.024445,0.002930,0.121216,0.013687,0.068420,0.281525,0.000000,0.076248,0.015640,0.000977,0.037140,0.024445,0.031281 16 | 0.063538,0.062561,0.063538,0.061584,0.053757,0.080154,0.050827,0.003906,0.058655,0.007812,0.002930,0.002930,0.003906,0.053757,0.031281,0.006836,0.006836,0.065491,0.095795,0.028351,0.075272,0.073318,0.015640,0.057678,0.072342,0.089935,0.087982,0.012711,0.088959,0.097748,0.107529,0.029327,0.059631,0.097748,0.091888,0.057678,0.068420,0.074295,0.047897,0.023453,0.029327,0.116318,0.063538,0.046921,0.075272,0.092865,0.107529,0.050827,0.055725,0.075272,0.056702,0.063538,0.071350,0.086014,0.048874,0.005859,0.007812,0.088959,0.017593,0.065491,0.022476,0.007812,0.003906,0.003906,0.072342,0.029327,0.070374,0.050827,0.000977,0.022476,0.077225,0.039093,0.085037,0.077225,0.010757,0.020523,0.043991,0.000977,0.020523,0.053757,0.059631,0.011734,0.000977,0.000977,0.004883,0.010757,0.025421,0.022476,0.002930,0.105576,0.010757,0.060608,0.204300,0.000977,0.075272,0.014664,0.001953,0.037140,0.031281,0.024445 17 | 0.075272,0.077225,0.081131,0.071350,0.068420,0.083084,0.053757,0.004883,0.069397,0.008804,0.006836,0.002930,0.006836,0.059631,0.029327,0.001953,0.005859,0.082108,0.113388,0.035187,0.087982,0.087982,0.023453,0.068420,0.081131,0.100677,0.105576,0.016617,0.089935,0.114365,0.127075,0.033234,0.080154,0.111435,0.092865,0.068420,0.082108,0.087982,0.056702,0.026398,0.032257,0.120239,0.070374,0.056702,0.081131,0.103622,0.117294,0.060608,0.068420,0.088959,0.063538,0.072342,0.076248,0.089935,0.057678,0.007812,0.013687,0.093842,0.018570,0.082108,0.015640,0.008804,0.008804,0.004883,0.088959,0.032257,0.082108,0.061584,0.004883,0.020523,0.086990,0.038116,0.096771,0.086014,0.014664,0.024445,0.050827,0.008804,0.021500,0.058655,0.062561,0.013687,0.001953,0.006836,0.009781,0.017593,0.023453,0.026398,0.005859,0.125122,0.009781,0.062561,0.248291,0.003906,0.077225,0.018570,0.001953,0.038116,0.029327,0.028351 18 | 0.079178,0.067444,0.075272,0.075272,0.067444,0.080154,0.059631,0.003906,0.068420,0.003906,0.006836,0.001953,0.003906,0.049850,0.033234,0.004883,0.006836,0.074295,0.108505,0.032257,0.084061,0.091888,0.015640,0.070374,0.084061,0.103622,0.105576,0.015640,0.094818,0.107529,0.122192,0.027374,0.075272,0.113388,0.098724,0.072342,0.081131,0.091888,0.058655,0.027374,0.029327,0.121216,0.077225,0.056702,0.088959,0.110458,0.119263,0.065491,0.064514,0.094818,0.064514,0.076248,0.069397,0.095795,0.057678,0.008804,0.016617,0.092865,0.020523,0.073318,0.023453,0.005859,0.006836,0.007812,0.094818,0.040085,0.076248,0.057678,0.003906,0.021500,0.088959,0.043991,0.102631,0.086014,0.013687,0.028351,0.050827,0.011734,0.022476,0.063538,0.067444,0.007812,0.006836,0.006836,0.004883,0.008804,0.022476,0.024445,0.006836,0.125122,0.010757,0.069397,0.227753,0.004883,0.080154,0.018570,0.001953,0.045944,0.019547,0.026398 19 | 0.069397,0.060608,0.059631,0.055725,0.052780,0.063538,0.050827,0.006836,0.062561,0.006836,0.006836,0.004883,0.005859,0.049850,0.027374,0.005859,0.006836,0.054733,0.090912,0.022476,0.077225,0.075272,0.016617,0.063538,0.067444,0.088959,0.099701,0.013687,0.076248,0.109482,0.098724,0.024445,0.060608,0.092865,0.086014,0.059631,0.065491,0.081131,0.051804,0.023453,0.029327,0.100677,0.067444,0.053757,0.070374,0.094818,0.098724,0.057678,0.060608,0.072342,0.061584,0.055725,0.064514,0.087982,0.050827,0.009781,0.012711,0.073318,0.018570,0.064514,0.020523,0.004883,0.005859,0.002930,0.078201,0.035187,0.070374,0.045944,0.009781,0.015640,0.073318,0.036163,0.085037,0.066467,0.008804,0.024445,0.046921,0.010757,0.020523,0.053757,0.055725,0.010757,0.003906,0.011734,0.002930,0.014664,0.021500,0.019547,0.005859,0.104599,0.012711,0.049850,0.201370,0.007812,0.060608,0.013687,0.001953,0.032257,0.020523,0.021500 20 | 0.064514,0.049850,0.061584,0.062561,0.043991,0.059631,0.043991,0.000977,0.055725,0.002930,0.004883,0.004883,0.001953,0.048874,0.023453,0.006836,0.009781,0.046921,0.079178,0.017593,0.058655,0.066467,0.010757,0.055725,0.066467,0.067444,0.067444,0.005859,0.058655,0.080154,0.085037,0.018570,0.049850,0.086014,0.072342,0.048874,0.046921,0.060608,0.032257,0.010757,0.021500,0.094818,0.046921,0.030304,0.056702,0.069397,0.079178,0.041061,0.043015,0.063538,0.048874,0.053757,0.048874,0.064514,0.045944,0.007812,0.014664,0.067444,0.009781,0.059631,0.021500,0.007812,0.003906,0.006836,0.059631,0.022476,0.052780,0.039093,0.003906,0.013687,0.063538,0.029327,0.067444,0.060608,0.007812,0.013687,0.036163,0.006836,0.013687,0.040085,0.040085,0.007812,0.005859,0.004883,0.001953,0.006836,0.019547,0.023453,0.004883,0.088959,0.008804,0.045944,0.183777,0.002930,0.056702,0.012711,0.000000,0.032257,0.015640,0.019547 21 | 0.159332,0.160309,0.164215,0.167160,0.156403,0.183777,0.130981,0.007812,0.158356,0.008804,0.008804,0.006836,0.007812,0.132935,0.073318,0.010757,0.011734,0.181808,0.260010,0.076248,0.190613,0.208206,0.047897,0.172043,0.197449,0.235580,0.254150,0.035187,0.214066,0.280548,0.280548,0.072342,0.158356,0.283478,0.248291,0.157379,0.173996,0.200394,0.136856,0.061584,0.092865,0.278595,0.185730,0.149551,0.206253,0.249268,0.291290,0.139786,0.156403,0.209183,0.162262,0.175949,0.160309,0.223846,0.127075,0.014664,0.018570,0.227753,0.024445,0.157379,0.036163,0.009781,0.015640,0.009781,0.217987,0.087982,0.167160,0.152496,0.014664,0.049850,0.201370,0.097748,0.218964,0.190613,0.023453,0.040085,0.122192,0.008804,0.039093,0.143692,0.141739,0.019547,0.007812,0.012711,0.010757,0.025421,0.047897,0.052780,0.012711,0.250244,0.022476,0.141739,0.547394,0.003906,0.177902,0.042038,0.000977,0.073318,0.086014,0.064514 22 | 0.163239,0.169113,0.156403,0.162262,0.137833,0.164215,0.118271,0.008804,0.156403,0.013687,0.008804,0.009781,0.009781,0.130981,0.077225,0.013687,0.018570,0.169113,0.238510,0.082108,0.180832,0.199417,0.051804,0.157379,0.181808,0.208206,0.248291,0.038116,0.217987,0.257080,0.268814,0.080154,0.166168,0.248291,0.203323,0.149551,0.158356,0.201370,0.125122,0.060608,0.087982,0.258057,0.175949,0.139786,0.185730,0.229706,0.260010,0.140762,0.142715,0.203323,0.146622,0.165192,0.161285,0.224823,0.115341,0.014664,0.023453,0.223846,0.032257,0.162262,0.033234,0.013687,0.017593,0.011734,0.216034,0.082108,0.174973,0.144669,0.016617,0.041061,0.189636,0.089935,0.222870,0.174973,0.020523,0.034210,0.114365,0.011734,0.042038,0.127075,0.126099,0.021500,0.013687,0.014664,0.011734,0.023453,0.051804,0.049850,0.023453,0.253174,0.020523,0.123169,0.511230,0.014664,0.165192,0.034210,0.004883,0.077225,0.050827,0.066467 23 | 0.223846,0.208206,0.204300,0.220917,0.187683,0.239487,0.163239,0.012711,0.196472,0.015640,0.013687,0.008804,0.012711,0.170090,0.102631,0.010757,0.016617,0.208206,0.326492,0.108505,0.256104,0.271744,0.064514,0.224823,0.244370,0.296188,0.271744,0.046921,0.229706,0.305954,0.331375,0.098724,0.212112,0.327469,0.287384,0.220917,0.232651,0.269791,0.169113,0.082108,0.102631,0.353851,0.229706,0.168137,0.257080,0.310852,0.320618,0.180832,0.196472,0.270767,0.193542,0.222870,0.198441,0.283478,0.177902,0.015640,0.017593,0.262955,0.024445,0.204300,0.043991,0.012711,0.014664,0.015640,0.255127,0.092865,0.231674,0.181808,0.023453,0.060608,0.262955,0.095795,0.292267,0.260010,0.023453,0.038116,0.132935,0.010757,0.040085,0.158356,0.158356,0.023453,0.009781,0.016617,0.011734,0.031281,0.059631,0.062561,0.017593,0.347992,0.022476,0.175949,0.684250,0.008804,0.202347,0.043991,0.004883,0.096771,0.054733,0.085037 24 | 0.208206,0.197449,0.194519,0.177902,0.146622,0.196472,0.133911,0.012711,0.167160,0.014664,0.014664,0.006836,0.008804,0.140762,0.082108,0.008804,0.015640,0.166168,0.250244,0.074295,0.216034,0.224823,0.059631,0.181808,0.201370,0.234604,0.236557,0.054733,0.181808,0.251221,0.264908,0.089935,0.183777,0.247314,0.217010,0.179855,0.195496,0.218964,0.150528,0.069397,0.075272,0.269791,0.174973,0.144669,0.219940,0.236557,0.253174,0.166168,0.173996,0.222870,0.151520,0.177902,0.167160,0.242416,0.134888,0.017593,0.025421,0.201370,0.022476,0.179855,0.029327,0.015640,0.008804,0.011734,0.198441,0.082108,0.192566,0.151520,0.029327,0.051804,0.217010,0.077225,0.276627,0.208206,0.016617,0.033234,0.129028,0.006836,0.034210,0.119263,0.134888,0.021500,0.008804,0.022476,0.013687,0.024445,0.047897,0.056702,0.016617,0.317688,0.024445,0.140762,0.592361,0.009781,0.172043,0.041061,0.002930,0.073318,0.042038,0.071350 25 | 0.079178,0.071350,0.072342,0.071350,0.064514,0.083084,0.062561,0.006836,0.067444,0.007812,0.008804,0.004883,0.003906,0.054733,0.032257,0.002930,0.007812,0.070374,0.103622,0.029327,0.085037,0.084061,0.016617,0.070374,0.080154,0.093842,0.090912,0.013687,0.080154,0.098724,0.113388,0.036163,0.068420,0.104599,0.091888,0.069397,0.084061,0.088959,0.053757,0.028351,0.029327,0.115341,0.074295,0.056702,0.086014,0.101654,0.108505,0.064514,0.065491,0.097748,0.062561,0.062561,0.070374,0.087982,0.063538,0.004883,0.013687,0.086990,0.008804,0.079178,0.027374,0.004883,0.007812,0.001953,0.078201,0.033234,0.081131,0.056702,0.005859,0.013687,0.091888,0.037140,0.109482,0.081131,0.010757,0.017593,0.045944,0.004883,0.019547,0.055725,0.056702,0.013687,0.004883,0.004883,0.005859,0.017593,0.020523,0.026398,0.004883,0.120239,0.009781,0.054733,0.244370,0.003906,0.073318,0.018570,0.001953,0.041061,0.022476,0.029327 26 | -------------------------------------------------------------------------------- /datasamples/input_lr.csv: -------------------------------------------------------------------------------- 1 | 0.095795,0.086014,0.083084,0.086014,0.074295,0.094818,0.060608,0.003906,0.075272,0.008804,0.002930,0.003906,0.008804,0.068420,0.043015,0.006836,0.005859,0.093842,0.120239,0.040085,0.098724,0.105576,0.029327,0.077225,0.087982,0.109482,0.113388,0.022476,0.104599,0.127075,0.136856,0.043015,0.090912,0.115341,0.107529,0.085037,0.091888,0.109482,0.067444,0.035187,0.038116,0.132935,0.086014,0.060608,0.102631,0.116318,0.127075,0.068420,0.078201,0.097748,0.074295,0.089935,0.081131,0.104599,0.074295,0.006836,0.011734,0.101654,0.014664,0.082108,0.028351,0.004883,0.005859,0.003906,0.095795,0.041061,0.092865,0.067444,0.008804,0.025421,0.107529,0.041061,0.087982,0.097748,0.011734,0.024445,0.054733,0.008804,0.029327,0.070374,0.069397,0.011734,0.002930,0.005859,0.004883,0.015640,0.031281,0.030304,0.006836,0.133911,0.015640,0.084061,0.283478,0.006836,0.084061,0.018570,0.000977,0.043015,0.040085,0.033234 2 | 0.122192,0.115341,0.112411,0.107529,0.090912,0.120239,0.078201,0.003906,0.102631,0.011734,0.012711,0.006836,0.009781,0.091888,0.047897,0.006836,0.011734,0.119263,0.157379,0.041061,0.120239,0.129028,0.036163,0.096771,0.114365,0.131958,0.145645,0.022476,0.143692,0.153473,0.162262,0.058655,0.111435,0.145645,0.131958,0.096771,0.100677,0.128052,0.090912,0.043015,0.049850,0.156403,0.116318,0.086990,0.119263,0.137833,0.155426,0.092865,0.101654,0.121216,0.101654,0.116318,0.102631,0.137833,0.098724,0.009781,0.020523,0.129028,0.021500,0.102631,0.026398,0.012711,0.007812,0.007812,0.129028,0.046921,0.116318,0.082108,0.021500,0.034210,0.130005,0.051804,0.125122,0.112411,0.016617,0.025421,0.075272,0.015640,0.024445,0.082108,0.086014,0.010757,0.003906,0.013687,0.011734,0.019547,0.042038,0.040085,0.010757,0.173019,0.020523,0.101654,0.373413,0.006836,0.110458,0.020523,0.004883,0.058655,0.025421,0.048874 3 | 0.285431,0.262955,0.259033,0.259033,0.238510,0.302048,0.198441,0.010757,0.257080,0.015640,0.018570,0.006836,0.011734,0.216034,0.112411,0.012711,0.021500,0.286407,0.360703,0.077225,0.284454,0.290314,0.083084,0.232651,0.269791,0.321594,0.347015,0.056702,0.302048,0.387085,0.390030,0.110458,0.235580,0.372421,0.335281,0.210159,0.255127,0.289337,0.190613,0.086014,0.101654,0.384155,0.243393,0.198441,0.277603,0.338211,0.382202,0.208206,0.227753,0.301071,0.234604,0.245346,0.239487,0.325516,0.219940,0.022476,0.026398,0.353851,0.038116,0.253174,0.047897,0.018570,0.009781,0.011734,0.311829,0.117294,0.260010,0.202347,0.033234,0.061584,0.326492,0.124146,0.320618,0.305954,0.025421,0.053757,0.173019,0.011734,0.057678,0.209183,0.216034,0.013687,0.013687,0.024445,0.018570,0.040085,0.074295,0.073318,0.017593,0.400772,0.027374,0.238510,0.876816,0.012711,0.267838,0.049850,0.003906,0.105576,0.088959,0.099701 4 | 0.086014,0.074295,0.080154,0.076248,0.067444,0.089935,0.061584,0.005859,0.075272,0.008804,0.003906,0.002930,0.004883,0.066467,0.036163,0.006836,0.010757,0.082108,0.104599,0.029327,0.089935,0.082108,0.015640,0.069397,0.073318,0.095795,0.090912,0.018570,0.073318,0.101654,0.106552,0.036163,0.067444,0.099701,0.091888,0.071350,0.081131,0.088959,0.053757,0.033234,0.024445,0.110458,0.076248,0.045944,0.077225,0.088959,0.105576,0.058655,0.058655,0.090912,0.066467,0.068420,0.066467,0.093842,0.064514,0.006836,0.010757,0.103622,0.015640,0.077225,0.022476,0.001953,0.000977,0.002930,0.078201,0.024445,0.078201,0.054733,0.015640,0.016617,0.095795,0.033234,0.103622,0.086014,0.005859,0.020523,0.051804,0.005859,0.018570,0.054733,0.054733,0.005859,0.007812,0.005859,0.003906,0.012711,0.024445,0.026398,0.002930,0.120239,0.006836,0.068420,0.260010,0.003906,0.072342,0.014664,0.000000,0.035187,0.028351,0.026398 5 | 0.175949,0.164215,0.152496,0.160309,0.129028,0.178879,0.116318,0.007812,0.146622,0.006836,0.007812,0.005859,0.007812,0.114365,0.063538,0.007812,0.014664,0.155426,0.198441,0.055725,0.160309,0.170090,0.031281,0.133911,0.149551,0.183777,0.168137,0.023453,0.130981,0.177902,0.189636,0.062561,0.132935,0.173019,0.153473,0.117294,0.140762,0.162262,0.104599,0.045944,0.040085,0.194519,0.141739,0.087982,0.146622,0.167160,0.175949,0.107529,0.113388,0.160309,0.122192,0.143692,0.127075,0.176926,0.122192,0.008804,0.021500,0.179855,0.027374,0.156403,0.042038,0.011734,0.012711,0.006836,0.140762,0.049850,0.134888,0.122192,0.014664,0.041061,0.184753,0.055725,0.208206,0.171066,0.015640,0.031281,0.090912,0.011734,0.027374,0.099701,0.100677,0.012711,0.002930,0.008804,0.006836,0.024445,0.048874,0.044968,0.008804,0.235580,0.014664,0.137833,0.526871,0.001953,0.128052,0.026398,0.002930,0.068420,0.039093,0.061584 6 | 0.063538,0.062561,0.063538,0.061584,0.053757,0.080154,0.050827,0.003906,0.058655,0.007812,0.002930,0.002930,0.003906,0.053757,0.031281,0.006836,0.006836,0.065491,0.095795,0.028351,0.075272,0.073318,0.015640,0.057678,0.072342,0.089935,0.087982,0.012711,0.088959,0.097748,0.107529,0.029327,0.059631,0.097748,0.091888,0.057678,0.068420,0.074295,0.047897,0.023453,0.029327,0.116318,0.063538,0.046921,0.075272,0.092865,0.107529,0.050827,0.055725,0.075272,0.056702,0.063538,0.071350,0.086014,0.048874,0.005859,0.007812,0.088959,0.017593,0.065491,0.022476,0.007812,0.003906,0.003906,0.072342,0.029327,0.070374,0.050827,0.000977,0.022476,0.077225,0.039093,0.085037,0.077225,0.010757,0.020523,0.043991,0.000977,0.020523,0.053757,0.059631,0.011734,0.000977,0.000977,0.004883,0.010757,0.025421,0.022476,0.002930,0.105576,0.010757,0.060608,0.204300,0.000977,0.075272,0.014664,0.001953,0.037140,0.031281,0.024445 7 | 0.069397,0.060608,0.059631,0.055725,0.052780,0.063538,0.050827,0.006836,0.062561,0.006836,0.006836,0.004883,0.005859,0.049850,0.027374,0.005859,0.006836,0.054733,0.090912,0.022476,0.077225,0.075272,0.016617,0.063538,0.067444,0.088959,0.099701,0.013687,0.076248,0.109482,0.098724,0.024445,0.060608,0.092865,0.086014,0.059631,0.065491,0.081131,0.051804,0.023453,0.029327,0.100677,0.067444,0.053757,0.070374,0.094818,0.098724,0.057678,0.060608,0.072342,0.061584,0.055725,0.064514,0.087982,0.050827,0.009781,0.012711,0.073318,0.018570,0.064514,0.020523,0.004883,0.005859,0.002930,0.078201,0.035187,0.070374,0.045944,0.009781,0.015640,0.073318,0.036163,0.085037,0.066467,0.008804,0.024445,0.046921,0.010757,0.020523,0.053757,0.055725,0.010757,0.003906,0.011734,0.002930,0.014664,0.021500,0.019547,0.005859,0.104599,0.012711,0.049850,0.201370,0.007812,0.060608,0.013687,0.001953,0.032257,0.020523,0.021500 8 | 0.163239,0.169113,0.156403,0.162262,0.137833,0.164215,0.118271,0.008804,0.156403,0.013687,0.008804,0.009781,0.009781,0.130981,0.077225,0.013687,0.018570,0.169113,0.238510,0.082108,0.180832,0.199417,0.051804,0.157379,0.181808,0.208206,0.248291,0.038116,0.217987,0.257080,0.268814,0.080154,0.166168,0.248291,0.203323,0.149551,0.158356,0.201370,0.125122,0.060608,0.087982,0.258057,0.175949,0.139786,0.185730,0.229706,0.260010,0.140762,0.142715,0.203323,0.146622,0.165192,0.161285,0.224823,0.115341,0.014664,0.023453,0.223846,0.032257,0.162262,0.033234,0.013687,0.017593,0.011734,0.216034,0.082108,0.174973,0.144669,0.016617,0.041061,0.189636,0.089935,0.222870,0.174973,0.020523,0.034210,0.114365,0.011734,0.042038,0.127075,0.126099,0.021500,0.013687,0.014664,0.011734,0.023453,0.051804,0.049850,0.023453,0.253174,0.020523,0.123169,0.511230,0.014664,0.165192,0.034210,0.004883,0.077225,0.050827,0.066467 9 | 0.079178,0.071350,0.072342,0.071350,0.064514,0.083084,0.062561,0.006836,0.067444,0.007812,0.008804,0.004883,0.003906,0.054733,0.032257,0.002930,0.007812,0.070374,0.103622,0.029327,0.085037,0.084061,0.016617,0.070374,0.080154,0.093842,0.090912,0.013687,0.080154,0.098724,0.113388,0.036163,0.068420,0.104599,0.091888,0.069397,0.084061,0.088959,0.053757,0.028351,0.029327,0.115341,0.074295,0.056702,0.086014,0.101654,0.108505,0.064514,0.065491,0.097748,0.062561,0.062561,0.070374,0.087982,0.063538,0.004883,0.013687,0.086990,0.008804,0.079178,0.027374,0.004883,0.007812,0.001953,0.078201,0.033234,0.081131,0.056702,0.005859,0.013687,0.091888,0.037140,0.109482,0.081131,0.010757,0.017593,0.045944,0.004883,0.019547,0.055725,0.056702,0.013687,0.004883,0.004883,0.005859,0.017593,0.020523,0.026398,0.004883,0.120239,0.009781,0.054733,0.244370,0.003906,0.073318,0.018570,0.001953,0.041061,0.022476,0.029327 10 | --------------------------------------------------------------------------------