The work from this repository, along with contributions from other reports, converged and has been merged into a final project:
Please visit the new repository for the latest developments, including updates, improvements, and Python implementations of the algorithms.
Fork to study and to port to python the work of Kronecker-based-CS-recovery
I will leave as description the original one by Hadi Zanddizari, it also includes all the references to Kronecker Technique, Compressed Sensing, SL0 recovery algorithm, MIT-BIH Arrhythmia database
Original description (by Hadi Zanddizari)
Kronecker Technique for Improving Signal Quality in Compressive Sensing Recovery
This code demonstrates the effect of the Kronecker technique on compressive sensing recovery. This technique has been used for different signals and measurement matrices and has been published in multiple journals and conference papers:
-
H. Zanddizari, S. Rajan, and H. Zarrabi, “Increasing the quality of reconstructed signal in compressive sensing utilizing Kronecker technique,”
Biomedical Engineering Letters, vol. 8, no. 2, pp. 239–247, May 2018. -
D. Mitra, H. Zanddizari, and S. Rajan, "Investigation of Kronecker-based recovery of compressed ECG signal,"
IEEE Transactions on Instrumentation and Measurement, pp. 1-1, 2019. -
D. Mitra, H. Zanddizari, and S. Rajan, “Improvement of signal quality during recovery of compressively sensed ECG signals,”
2018 IEEE International Symposium on Medical Measurements and Applications (MeMeA), June 2018, pp. 1–5. -
D. Mitra, H. Zanddizari, and S. Rajan, “Improvement of recovery in segmentation-based parallel compressive sensing,”
2018 IEEE International Symposium on Signal Processing and Information Technology (ISSPIT), Dec 2018, pp. 501–506.
Original Author (MATLAB): Hadi Zanddizari
Email: [email protected], [email protected]
For fast and efficient compression, the sensing phase in compressive sensing can be done in a very small size, because in this case:
- It requires a very small measurement matrix,
- Less number of multiplication and addition operations,
- Less delay for generating compressed samples,
These characteristics are particularly useful for sensors with low computational resources. However, sensing in small sizes degrades the quality of recovery. The Kronecker technique can be used to improve the quality of the recovered signal.
Any recovery algorithm can be used. In this code, Sl0, which is a very fast CS recovery algorithm, is used.
SL0 Reference: http://ee.sharif.edu/~SLzero/
In this code, an ECG signal from the MIT-BIH Arrhythmia Database, which is a public dataset, is used.
Database Reference: MIT-BIH Arrhythmia Database. Available: http://www.physionet.org/physiobank/database/mitdb/
- Python implementation that partially correctly emulates the original MATLAB code
- I never managed to build a dwt dictionary in the way MATLAB's
wmpdictionary, note that in the future Mathworks plans to remove the obsoletewmpdictionary, it will be substituted bysensingDictionary
- Python code is all in a Jupyter Notebook
- Both
MATLABandPythoncodes save all relevant variables incsvso that the two languages implementation can be compared.
Untouched copy of orginal folder
You need to have MATLAB installed: matlabDir is a stand-alone-content directory, just set MATLAB working directory to the it.
- Version: original code was written in 2008, I used it in 2024, no compatibility issues to this day.
- Mathworks website info:
wmpdictionaryis obsolete, will be soon replaced bysensingDictionary - Toolboxes:
'Wavelet Toolbox'required
It slightly depends on the following choice you make: you can either choose to use only the provided RECORD 100.mat from the repository or use other records from the MIT-BIH Arrhythmia Database.
-
Today: 23 August 2024 (worked fine up to this date)
-
Version: obviously need to have python installed (version 3.5 or above, worked both with 3.8 and 3.12)
-
Run all commands from
rootdirectory of the project -
You might want to install a python virtual environment, here shown with venv (but you're free to use conda or whatever you prefer)
# virtual environment
deactivate
python -m venv .kroneckerVenv
source .kroneckerVenv/bin/activate- Install this project package
compSensPackand all it's requirements
# install compSensPack
pip install .Simply run scripts/main_run.py
# run from CLI
python scripts/main_run.pyIf you want to use freely whole MIT-BIH Arrhythmia Database
- There is a dedicated python module to use the MIT-BIH Arrhythmia Database
- Beware: when I used this library in 2024 it didn't work with latest version of python (3.12), it did work fine using python3.8
# Python module to use MIT-BIH databases bind to Physionet.org
pip install wfdb- I didn't use it for my implementation, RECORD 100 already present in original repo was enough for the purpose of my study, so _the rest is up to you... (modify
scripts/main_run.pyto add it if you want)