Event_based_gQRS/038479220b10master
README.md
Event based gQRS
This is the official repository for the publication: Silvio Zanoli, Tomas Teijeiro, Fabio Montagna and David Atienza: "An Event-Based System for Low-Power ECG QRS Detection"
In this repository is possible to find the source code for the event-based gQRS algorithm for QRS complex detection in ECG signals.
The python demonstrative version, C version implemented on the PULP platform, Mr.Wolf, and the tools necessaries to extract and re-sample the data can be found here.
Getting Started
Prerequisites
Python version:
- Jupyter-notebook
- Python 3.6.x*
- Numpy
- Pandas
- Matplotlib
- wfdb
- tqdm
C version:
- Python 3.5.3*
- gCC
\* Note: the Pulp SDK is built to work within Ubuntu 16.04 with the default python version being: 3.5.3. The python version this code was designed with (the Python part) is python 3.6.x and tested on python 3.7.1. Our suggestion is to have a Ubuntu 16.04 machine with default python3 -> python3.5.3 and a second python 3.6.x installation used to execute exclusively this code. Alternatively, it is possible to run the C Version on an ubuntu 16.04 virtual machine once all the data and the python calls have been executed on a Linux OS with a python version 3.6.x or higher (tested on 3.7.1)
Installing and Running
- Create a data folder on the root direcotry of this project, this will be the directory of your RAW data and the output directory.
- Insert your dataset in the MIT-BIH database format (.dat and .hea files) in a subfolder, for example, "dataRaw".
- The database used for developing and testing this algorithm can be found at MIT-BIH Arrythmia Database. NOTE: The code
given here is designed to work specifically with this database
- Move in the "data_parsing" folder and lunch ECG_lvlCrossing.py
python3 ECG_lvlCrossing.py -i ../data/dataRaw -o ../data/dataOut -b 5 [-l 'MLII'][--hist 0]
This script will extract and resample with an emulated level crossing ADC with number of bits "-b" all the file in the MIT-BIH format found in the direcotry passed by the "-i" argument and output the results in the folder passed with "-o", in the subfolder "dataOut/lvlCrossingBitsHist". The default selected electrode is designated as 'MLII', it is possible to change the used electrode with the argument "-l 'Electrode Name'". By default no Hysteresis is used around the threshold levels. it is possible to give a histeresis value (in percentage) with the argument '--hist'
(Note: is possible also to pass the path of a single file as input.)
Python version:
- Run the jupiter notebook contained in the "python_gQRS" folder. This notebook will produce, at the end, a "result" folder (../data/results) in wich is possible to find the results (accuracy)
C version:
Important note: This is not a plain C-99 project. This project was developed for the PULP platform "Mr. Wolf". The C code check only one file
- Move in the "./c_gQRS" folder and lunch "makeDataHeader.py"
python3 makeDataHeader.py -f ../data/dataOut/[desired re-sampled folde]/[desired File].csv -d [Directory containing the atribute file for the target file] [ -a "Atribute extension" ]
This will create automatically the header containing the data from file "selectedFile" to be used by the C code (data.h in ./c_gQRS)
- Move to the "./c_gQRS" folder
- follow the steps at PULP platform SDK and toolchain.
- Execute:
make clean all run
This will start to run the simulation for the selected file multiple time, measuring several parameters of the simulation and returning an overview of the score-results and the performance-results
Built With
Authors
- Silvio Zanoli - ESL Lab
- Tomas Teijeiro - ESL Lab
- Fabio Montagna - University of Bologna
License
This project is licensed under the GPL License - see the <u>LICENSE.txt</u> file for details
Acknowledgments
Thanks to:
- Prof. Dr. David Atienza Alonso
- The Human Brain Project (HBP) SGA2 (GA No. 785907)
- The DeepHealth Project (GA No. 825111)
- The SNF through the ML-Edge Project (GA No. 182009)
- The ESL Lab