BiDAlab / ECGXtractor

12 stars 3 forks source link

ECGXtractor

ECGXtractor is a Python library that allows to investigate the topic of ECG biometric recognition. In particular, it executes the experiments described in the article specified at the end of this page.

Article

Melzi, Pietro, Ruben Tolosana, and Ruben Vera-Rodriguez. "Ecg biometric recognition: Review, system proposal, and benchmark evaluation." IEEE Access, 2023. Link

Setup

In the file requirements.txt you can find the list of dependencies required by this library. Run the following commands in Windows to set up a suitable virtual environment (replace \<env> with the mane of the environment). pip and virtualenv libraries are required to run the following commands.

python -m venv <env>
.\<env>\Scripts\activate
python -m pip install -r requirements.txt

Comparisons and Pretrained Models

In this folder you can find the list of genuine and impostor comparison pairs evaluated in the different executions of the experiments included in our paper, related to the task of verification.

We also provide here the weights of our pretrained models (saved.rar). They are used to perform the experiments described in our paper.

Data preparation

The following instructions refer to PTB database. Similarly, you can also run experiments with ECG-ID and CYBHI databases.

ECG signals

Download here ptb.rar and extract it in datasets\ptb. It contains:

ECG segments

Run the file build_segments.py after changing in the code the parameter consecutive_heartbeats to:

python src\ptb\build_segments_ptb.py

Files required to run experiments

Datasets files

In folder datasets, we provide the dataset files used in the different experiments involving PTB:

These files are obtained by running create_dataset_ptb.py.

Important: the datasets files contain the list of files considered in the experiment. The specific samples used to train and evaluate the system will be generated during execution, with functions contained in the source code.

Settings files

In folder settings, we provide the files containing the experimental settings considered when training the different models. As Autoencoder and verification networks are trained with the in-house database, which is not available, some fields of the json files are left empty (i.e., data_path, train, val).

In config_verification you can change the following parameters before running experiments for the verification task:

For the identification task, config_identification allows to change the following parameters, in addition to the previously described ones:

Important: some parameters, i.e., lead_i and initial_weight must be coherent with the dataset and the network architecture selected, otherwise an error message will appear during the execution.

Execution

Evaluation

To evaluate previously trained models for ECG biometric verification (or models trained for identification), run the following command:

python src\predict.py settings\config_verificaton.json --model_path <path of the saved model>

or

python src\predict.py settings\config_identification.json --model_path <path of the saved model>

Training

Additionally, if you want to train your model with your database and settings, you can run the following command:

python src\train.py settings\config_identification.json

Saved models

After each training experiment, the folder saved will be created. It will contain the weights of your trained models.

References

Melzi, Pietro, Ruben Tolosana, and Ruben Vera-Rodriguez. "Ecg biometric recognition: Review, system proposal, and benchmark evaluation." IEEE Access, 2023. Link

Please remember to reference the article on any work made public, whatever the form, based directly or indirectly on any part of ECGXtractor.

For further questions, please send an email to pietro.melzi@uam.es