ecg-classifier-for-edge-computing
所属分类:物联网
开发工具:VHDL
文件大小:69600KB
下载次数:0
上传日期:2022-07-26 05:46:44
上 传 者:
sh-1993
说明: 基于张量流的轻量级ECG CNN分类器的开发及其在CMOD A7 FPGA上的实现
(Lightweight ECG CNN classifier developed with tensorflow and implemented on CMOD A7 FPGA for edge computing)
文件列表:
Model Building (0, 2022-07-26)
Model Building\afl_model_fpga.ipynb (640279, 2022-07-26)
Model Building\data_exploration.ipynb (262617, 2022-07-26)
Model Deployment (0, 2022-07-26)
Model Deployment\dev_files (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.cache (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.cache\wt (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.cache\wt\gui_handlers.wdf (7492, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.cache\wt\java_command_handlers.wdf (2296, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.cache\wt\project.wpc (59, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.cache\wt\synthesis.wdf (5345, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.cache\wt\synthesis_details.wdf (97, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.cache\wt\webtalk_pa.xml (6998, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.cache\wt\xsim.wdf (245, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.hw (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.hw\CONV_1D_Simulation_testing.lpr (335, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.ip_user_files (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.ip_user_files\mem_init_files (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.ip_user_files\mem_init_files\test_input.mem (4138, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.ip_user_files\mem_init_files\test_result_expected.mem (6, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs\vrs_config_1.xml (445, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs\vrs_config_10.xml (445, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs\vrs_config_11.xml (445, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs\vrs_config_2.xml (445, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs\vrs_config_3.xml (445, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs\vrs_config_4.xml (445, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs\vrs_config_5.xml (445, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs\vrs_config_6.xml (445, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs\vrs_config_7.xml (445, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs\vrs_config_8.xml (445, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\.jobs\vrs_config_9.xml (445, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\synth_1 (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\synth_1\.Vivado_Synthesis.queue.rst (0, 2022-07-26)
Model Deployment\dev_files\CONV_1D_1_layer\CONV_1D_Simulation_testing\CONV_1D_Simulation_testing.runs\synth_1\.vivado.begin.rst (216, 2022-07-26)
... ...
Jul 2021 - May 2022
# Lightweight ECG Classifier for Edge Computing
This project aims to develop a lightweight ECG Classifier and deploy it on an FPGA chip (CMOD A7) that is small enough to be embedded on a wearable sensor, so that ECG diagnosis can be performed on the device itself without requiring cloud connection. The device can then alert patients of a cardiac emergency.
The model was trained to predict Atrial Flutter (AFl) from a single ECG tracing, and the results are as follows:
```
Sensitivity (True-Positive): 80.4%
Specificity (True-Negative): 73.3%
```
Refer to this README for an implementation summary, or view the folders for in-depth description. "Model Building" contains the files for the development of the CNN model with tensorflow, while "Model Deployment" contains code to deploy the model on an FPGA.
## Model Building - Data & Preprocessing
A total of 121,149 12-Lead ECG tracings from different countries were obtained from open-source databases. The data can be downloaded from https://physionetchallenges.org/2021/.
```
1. CPSC Database: 13,256
2. INCART Database: 74
3. PTB and PTB-XL Database: 22,353
4. Georgia ECG Database: 20,672
5. Chapman-Shaoxing and Ningbo Database: 45,152
6. UMich Database: 19,***2
```
The preprocessing steps included reading the ECG metadata from the associated .mat files, before filtering out tracings which had unsuitable lenghts or data formats. A DataFrame of the final dataset was constructed that included the filepath and the labels for the 4 conditions mentioned, and then saved into "full_dataset.csv".
## Model Building - Training and Analysis
A 3-layer CNN Model with (8, 16, 32) filters respectively was constructed and trained on 1-Lead ECG tracings. The total number of parameters was kept under 2,600 to ensure it can fit on a lightweight FPGA.
Once the model reached sufficient accuracy (>75%), the entire lists of weights and biases of each layer was be printed out and saved into a text file for model deployment on the FPGA.
## Model Deployment - High Level Description
The high level architecture of the model implementation on the FPGA is as shown:
![Overall Pipeline](https://github.com/jonchuaenzhe/ecg-classifier-for-edge-computing/blob/master/images/overall_pipeline.png)
Essentially, the implementation consists of a read-only memory for weights (which we hard-code based on the generated weights from tensorflow model) and a computing unit with multipliers, adders, and comparators for the CNN calculations. The diagram below shows the operation flow:
![CNN Computation](https://github.com/jonchuaenzhe/ecg-classifier-for-edge-computing/blob/master/images/cnn_computation.png)
## Model Deployment - Relavant Files
The folders in "Model Development" contain the following information:
```
"final_implementation": full vivado file for the CNN implemenation on the FPGA
"verilog_code": verilog codes without the need to open vivado
"testing": sample inputs to test the CNN predictions. the ground truth is labelled in the file name.
"dev_files": files for testing the intermediate steps to the final implementation
```
近期下载者:
相关文件:
收藏者: