Git Product home page Git Product logo

amri95 / ecg-atrial-fibrillation-classification-using-cnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from animikhaich/ecg-atrial-fibrillation-classification-using-cnn

1.0 1.0 0.0 117 KB

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. The dataset details are given at the How to use section.

Jupyter Notebook 100.00%

ecg-atrial-fibrillation-classification-using-cnn's Introduction

ECG based AF Classifier using CNNs

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. The dataset details are given at the How to use section.

Additionally, Github often fails to load iPython Notebook files for preview. Hence, the Notebooks can also be viewed at the following links:

Dependencies:

  1. Python 3
  2. Pandas
  3. Numpy
  4. Matplotlib
  5. Tensorflow
  6. Keras

Installation for Python 3

Visit: https://www.python.org/downloads/ and download the version suitable for your System

Installation for Pandas

Open Command Prompt (Windows) or Terminal (Linux) and type in the following command:

pip install pandas

Visit: Pandas Install Instructions for details.

Installation for Numpy

Open Command Prompt (Windows) or Terminal (Linux) and type in the following command:

pip install numpy

Visit: Numpy Install Instructions for details.

Installation for Matplotlib

Open Command Prompt (Windows) or Terminal (Linux) and type in the following command:

pip install matplotlib

Visit: Matplotlib Install Instructions for details.

Installation for Tensorflow

There are two formats of Tensorflow. One is for the CPU version and the other is for GPU version (Nvidia only)

The CPU installation is quite straight forward installation by the following command:

pip install tensorflow

The GPU version requires the installation of CUDA and cuDNN drivers from Nvidia. This is a relatively complicated process and it is suggested to visit the official guide for this.

Visit: Tensorflow GPU Install Instructions for details.

Installation for Keras

Even though Keras comes built inside tensorflow, in this repository, the code that is used is using the external Keras library. It can be downloaded using the following method.

Open Command Prompt (Windows) or Terminal (Linux) and type in the following command:

pip install keras

Visit: Keras Install Instructions for details.

How to use?

  1. Download the dataset from HERE and select the following parameters:
    1. Database - PAF Prediction Challenge Database (afpdb)
    2. Record - nXX (for each Normal Patient data) and pXX (for each Abnoramal Patient data)
    3. Length - to end
    4. Time Format - Samples
    5. Toolbox - Export signals to CSV
  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.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.