Giter VIP home page Giter VIP logo

srinivas-natarajan / heart-arrhythmia-classification Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 1.0 6.66 MB

This program takes and input of an ECG in European Data Format (EDF) and outputs the classification for heartbeats into normal vs different types of arrhythmia . It uses a deep learning model for classification purposes.

Jupyter Notebook 89.74% PureBasic 9.90% Python 0.36%
deep-learning ecg-classification edf classification-model python time-series-analysis

heart-arrhythmia-classification's Introduction

Heart-Arrhythmia-Classification



Instructions to run

  1. Note down the location of the ".edf" file and enter it into the cmd line.

  2. Use the command where

    • PATH_TO_EDF_FILE - Location of your EDF file
    • SAVE_FILE_NAME - Name of the text and npy file which will be generated
    • MODEL_NUMBER -
      • 0 - Model from the paper
      • 1 - Simplified CNN model
   python predict.py PATH_TO_EDF_FILE SAVE_FILE_NAME MODEL_NUMBER

For example, the command below will generate a file called "ECG_100.txt" which will contain the classifications

    python predict.py ./files/100.edf ECG_100 


Dataset

The original datasets used are the MIT-BIH Arrhythmia Dataset and that are preprocessed based on the methodology described in the paper below in order to end up with samples of a single heartbeat each and normalized amplitudes.

Kachuee, M., Fazeli, S., & Sarrafzadeh, M. (2018). ECG Heartbeat Classification: A Deep Transferable Representation. 2018 IEEE International Conference on Healthcare Informatics (ICHI). https://doi.org/10.1109/ichi.2018.00092 (https://arxiv.org/pdf/1805.00794.pdf)


The process followed is:

  1. Splitting the continuous ECG signal to 10s windows and select a 10s window from an ECG signal.
  2. Normalizing the amplitude values to the range of between zero and one.
  3. Finding the set of all local maximums based on zerocrossings of the first derivative.
  4. Finding the set of ECG R-peak candidates by applying a threshold of 0.9 on the normalized value of the local maximums.
  5. Finding the median of R-R time intervals as the nominal heartbeat period of that window (T).
  6. For each R-peak, selecting a signal part with the length equal to 1.2T.
  7. Padding each selected part with zeros to make its length equal to a predefined fixed length.

MIT-BIH Arrhythmia dataset :

  • Number of Categories: 5
  • Number of Samples: 109446
  • Sampling Frequency: 125Hz
  • Data Source: Physionet’s MIT-BIH Arrhythmia Dataset
  • Classes: [’N’: 0, ‘S’: 1, ‘V’: 2, ‘F’: 3, ‘Q’: 4]

Class distribution in the dataset

  • Before Resampling


  • After Resampling




Model and Results


A. Paper based model


Figure 1: Model Structure



Figure 2: Accuracy and Loss Plot




Figure 3: Confusion Matrix




Figure 4: Classification Report




B. Simplified model




Figure 5: Simplified Model Structure



Figure 6: Accuracy and Loss Plot




Figure 7: Confusion Matrix




Figure 8: Classification Report



heart-arrhythmia-classification's People

Contributors

srinivas-natarajan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

aklos

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.