This repository is the code for the paper Low-Cost FPGA Implementation of Deep Learning-based Heart Sound Segmentation for Real-Time CVDs Screening. If you use this code, please cite the following paper.
@ARTICLE{10506694,
author={Enériz, Daniel and Rodriguez-Almeida, Antonio J. and Fabelo, Himar and Ortega, Samuel and Balea-Fernandez, Francisco J. and Callico, Gustavo M. and Medrano, Nicolás and Calvo, Belén},
journal={IEEE Transactions on Instrumentation and Measurement},
title={Low-Cost FPGA Implementation of Deep Learning-based Heart Sound Segmentation for Real-Time CVDs Screening},
year={2024},
volume={},
number={},
pages={1-1},
keywords={Field programmable gate arrays;Integrated circuit modeling;Real-time systems;Phonocardiography;Hardware;Analytical models;Adaptation models;Convolutional neural networks;computer-aid diagnostic;cardiovascular diseases detection;deep learning;edge AI;embedded systems;FPGA;heart sound segmentation},
doi={10.1109/TIM.2024.3392271}}
This project aims to optimize the heart sound segmentation deep model presented in [1] for low-cost FPGA implementation, tested over the 2016 PhysioNet/Computing in Cardiology Challenge dataset [2] and the CirCor Digiscope dataset [3] (which was used for the George B. Moody/Physionet dataset). Firstly, two model reduction parameters are identified: the number of filters and the number of encoding/decoding layers. Then, the model is optimized for FPGA implementation using two different strategies: memory sharing for feature maps allocation and streaming for dataflow implementation. Additionally, fixed-point representation is used to reduce the memory footprint of the model.
Therefore the repository two main folders: training
and implementation
. The first one contains the code for the training of the model with the selected model parameters, and the second one contains the code for the optimization of the model for FPGA implementation using the Vivado High-Level Synthesis (HLS) tool. Additionally, in each folder there is auxiliary code to preprocess the data, evaluate the model and generate summary reports. In each folder there is a README.md
file with more details about the code and the usage of the scripts.
Also, the complete results report of the experiments is available in the complete-results.xlsx
file. The results are organized in the different sheets of the file.
This code was tested with Python 3.9.10 under Ubuntu 20.04.2 LTS. The requirements are listed in the requirements.txt
file. To install the requirements, you can use any Python package manager, such as pip
or conda
. For example, using pip
:
foo@bar:~/PCG-Segmentation-Model-Optimization$ pip install -r requirements.txt
or using conda
:
foo@bar:~/PCG-Segmentation-Model-Optimization$ conda install --file requirements.txt
The Vivado HLS tool is required to run the code for the FPGA implementation. The version used in this project is 2019.2. The tool can be downloaded from the Xilinx website.
The HLS C Simulations and Synthesis processes are launched from Python code, therefore the vivado_hls
executable must be accessible. Under Linux, you can enable this command by sourcing the Vivado settings64.sh
command:
foo@bar:~/PCG-Segmentation-Model-Optimization$ source /path/to/vivado_hls/settings64.sh
The datasets used in this project are not included in this repository. The datasets can be downloaded from the following links:
- 2016 PhysioNet/Computing in Cardiology Challenge dataset It is a
.mat
file with the example data provided by the paper [4]. Must be saved in the root folder of the repository under thephysionet.org
folder. - CirCor DigiScope dataset. Must be saved in the root folder of the repository under the
physionet.org
folder.
Both datasets can be downloaded using wget
:
foo@bar:~/PCG-Segmentation-Model-Optimization$ wget -r -N -c -np wget https://physionet.org/files/hss/1.0/example_data.mat
foo@bar:~/PCG-Segmentation-Model-Optimization$ wget -r -N -c -np https://physionet.org/files/circor-heart-sound/1.0.3/
After downloading the datasets, the folder structure should be as follows:
foo@bar:~/PCG-Segmentation-Model-Optimization$ tree
.
├── implementation
│ └── ···
├── physionet.org/
│ └── files
│ ├── circor-heart-sound
│ | └── 1.0.3
│ | ├── ···
│ | ├── training_data.csv
│ | └── training_data
│ | └── ···
│ └── hss
│ └── 1.0
│ └── example_data.mat
├── training
│ └── ···
├── README.md
└── requirements.txt
└── ···
If you want to use the datasets in a different folder, you must change the paths in the
training/utils/preprocessing.py
script.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
The authors of the project are Daniel Enériz and Antonio J. Rodríguez-Almeida.
[1] F. Renna, J. Oliveira and M. T. Coimbra, "Deep Convolutional Neural Networks for Heart Sound Segmentation," IEEE Journal of Biomedical and Health Informatics, vol. 23, no. 6, pp. 2435-2445, Nov. 2019, doi: 10.1109/JBHI.2019.2894222.
[2] C. Liu et al., "An open access database for the evaluation of heart sound algorithms", Physiol. Meas., vol. 37, no. 12, pp. 2181–2213, Dec. 2016, doi: 10.1088/0967-3334/37/12/2181.
[3] J. Oliveira et al., "The CirCor DigiScope Dataset: From Murmur Detection to Murmur Classification," IEEE Journal of Biomedical and Health Informatics, vol. 26, no. 6, pp. 2524-2535, June 2022, doi: 10.1109/JBHI.2021.3137048.