/ecg-classification-1

ECG signal classification using Machine Learning

Primary LanguagePythonMIT LicenseMIT

ECG classification

This project aims to use machine learning algorithms(emphasis on Deep Learning) to classify/detect anomalies in ECG signals.

Requirements

  1. Python 3
  2. tensorflow/tensorflow-gpu (cnn.py tested with 1.13.1 and cnn_tf2.py tested with 2.0.0-beta0)
  3. wfdb (tested with version 10.6.1)

Usage

  • In order to download the datasets install wfdb
  • After wfdb is available generate the datasets using:
    $ python fetch_data.py
  • Install tensorflow and dependencies using the below command(installs tf without gpu support) or you can find other ways of installing here
    $ pip install -r requirements.txt
  • Run CNN model using Tensorflow 1:
    $ python cnn.py
  • Run CNN model using Tensorflow 2:
    $ python cnn_tf2.py

Remarks

  • Installing and setting up wfdb is probably the most error prone thing in using this project. Make sure that you have access to rdsamp in the current shell before executing fetch_data.py
  • Old implementation can be found in the old_keras_impl directory, but as far as I know it doesn't work.
  • Still needs more optimization(try different hyperparameters)
  • You can find the Tensorflow 2.0 implementation in tensorflow_impl/cnn_tf2.py

TODO

  • Add RNN/ResNet models
  • Add precision and recall metrics
  • Add more diseases
  • Tensorflow 2.0