Contributors Forks Stargazers Issues MIT License LinkedIn


ECG based Atrial Fibrillation Classifier using 1D CNNs

A CNN based to classify the ECG signals of a patient with and without Atrial Fibrillation. Accuracy Achieved: 93.33%.
Data Preprocessing Notebook ยท Model Notebook ยท Report Bug

Table of Contents

About The Project

This is a CNN based model which aims to automatically classify the ECG signals of a normal patient vs. a patient with Atrial Fibrillation and has been trained to achieve up to 93.33% validation accuracy.

The CNN used here is 1D Convolutional Neural Networks.

Jupyter Notebooks - nbViewer

Dataset Information

Note: The dataset has been moved from the original URL. Hence, the dataset provided above may be different from the one that was originally used to create this project.

How to Run

The experiment should be fairly reproducible. However, a GPU would be recommended for training. For Inference, a CPU System would suffice.

  1. Download the dataset from the above mentioned link.
  2. Put them in the desired path and change the path of the Data_Preprocessing.ipynb to be able to read the signals from the downloaded CSVs.
  3. Save the processed dataset as a Numpy Object in the desired location.
  4. In the file Model.ipynb read the saved processed dataset and train the model.
  5. Any unknown dataset can be then classified by using model.predict() function after the model has been trained successfully.

Hardware Used for the Experiment

  • CPU: AMD Ryzen 7 3700X - 8 Cores 16 Threads
  • GPU: Nvidia GeForce RTX 2080 Ti 11 GB
  • RAM: 32 GB DDR4 @ 3200 MHz
  • Storage: 1 TB NVMe SSD (This is not important, even a normal SSD would suffice)
  • OS: Ubuntu 20.10

Alternative Option: Google Colaboratory - GPU Kernel

Built With

Simple List of Deep Learning Libraries. The main Architecture/Model is developed with Keras, which comes as a part of Tensorflow 1.x


Since this is a Proof of Concept Project, I am not maintaining a at the moment. However, the primary goal is to improve the architecture to make the predicted masks more accurate.


Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request


Distributed under the MIT License. See LICENSE for more information.

Future Improvements

This is a preliminary attempt and is a work-in-progress:

  1. In this particular implementation, only 10 Normal patients' data and 10 Abnormal patients' data has been taken and used. The entire dataset has not been used. Using the complete dataset may significantly improve the model accuracy.
  2. The CNN architecture can be further modified so as to find an optimal architecture that will learn better than the existing one.
  3. As per experimentation, SGD (Stochastic Gradient Descent) optimizer works the best. However, with further change in model architecture, other optimizers like Adam and RMSProp may outperform the rather primitive SGD optimizer.


Animikh Aich

Ecg Atrial Fibrillation Classification Using Cnn

This is a CNN based model which aims to automatically classify the ECG signals of a normal patient vs. a patient with AF and has been trained to achieve up to 93.33% validation accuracy.

Ecg Atrial Fibrillation Classification Using Cnn Info

โญ Stars 25
๐Ÿ”— Homepage
๐Ÿ”— Source Code
๐Ÿ•’ Last Update 9 days ago
๐Ÿ•’ Created 3 years ago
๐Ÿž Open Issues 0
โž— Star-Issue Ratio Infinity
๐Ÿ˜Ž Author animikhaich