Skip to content

dumplingman0403/Afib_classification

Repository files navigation

Atrial Fibrillation Classification via 1D-CNN and 2D-CNN

Requirements

Dataset

In this project, I use the open ECG dataset from AF Classification from a Short Single Lead ECG Recording - The PhysioNet Computing in Cardiology Challenge 2017, dataset can be found in here.

ECG Recordngs

In dataset, there are total 8528 short single lead ECG recordings collected by AliveCor device. The ECG recordings last from 9s to 60s and were sampled as 300Hz and have been band pass filtered by AliverCor device. The recordings have been categorized into 4 types: Normal rhythm, Atrial fibrillation, other rhythm and noisy recordings.

Type Recording Mean SD Max Median Min
Normal 5154 31.9 10.0 61.0 30 9.0
AF 771 31.6 12.5 60 30 10.0
Other 2557 34.1 11.8 60.9 30 9.1
Noisy 46 27.1 9.0 60 30 10.2
Total 8528 32.5 10.9 61.0 30 9.0

Methodology

Overview

overview_img

Preprocessing

PSD spectrogram

spectrogram

Segmentation

QRS complex detection

Apply Hamilton QRS complex detection algorithm to locate the R peaks of ECG signals.

QRS_image

Heartbeat segmentation

seg_img

Feature Extraction

feature_extraction_img

Model

1D-CNN

1d_cnn_img

2D-CNN

2d_cnn_img

Usage

  1. Download ECG dataset: Download dataset in here and extract training2017 and sample2017 folders.

  2. Execute preprocess.py to prepare training input for further CNN training

python3 Preprocess.py
  1. Execute main.py for training model via convolution neural network
python3 main.py
  1. After training, to see training result with tensorboard, execute following command in terminal. Copy the url and open it with web broswer.
tensorboard --logdir logs/

Demo

  • 1DCNN_med_wave.ipynb : Use median wave extraction method to select features as training data, and training data with one dimension convolution neural network.
  • 2DCNN_templates.ipynb: Use heartbeat extraction method to generate heartbeat images as training data, and training data with two dimension convolution neural network.
  • 2DCNN_specg.ipynb: Use spectrogram as training data, and training data with two dimension convolution neural network.

Conclusion

conclusion_table_image

Reference

About

Atrial Fibrillation Classification via 1D-CNN and 2D-CNN

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published