Giter Site home page Giter Site logo

ankur219 / ecg-arrhythmia-classification Goto Github PK

View Code? Open in Web Editor NEW
300.0 20.0 116.0 38 KB

ECG arrhythmia classification using a 2-D convolutional neural network

Python 93.49% HTML 6.51%
ecg keras tensorflow neural-network deep-learning machine-learning health artificial-intelligence ecg-signal

ecg-arrhythmia-classification's Introduction

ECG-Arrhythmia-classification

ECG arrhythmia classification using a 2-D convolutional neural network

This repository is an implementation of the paper ECG arrhythmia classification using a 2-D convolutional neural network in which we classify ECG into seven categories, one being normal and the other six being different types of arrhythmia using deep two-dimensional CNN with grayscale ECG images. By transforming one-dimensional ECG signals into two-dimensional ECG images, noise filtering and feature extraction are no longer required. This is important since some of ECG beats are ignored in noise filtering and feature extraction. In addition, training data can be enlarged by augmenting the ECG images which results in higher classification accuracy. Data augmentation is hard to be applied in 1-d signals since the distortion of 1-d ECG signal could downgrade the performance of the classifier. However, augmenting two-dimensional ECG images with different cropping methods helps the CNN model to train with different viewpoints of the single ECG images. Using ECG image as an input data of the ECG arrhythmia classification also benefits in the sense of robustness.

METHOD

alt text

MODEL

Here is the link to the model: Link

Deploying the model

  1. Clone my repository.
  2. Clone this repository.
  3. Download the weights.
  4. Replace app.py in the other repository you have downloaded with the app.py from my repository.
  5. Replace index.html as well that is present in the other repository with the index.html that is provided in my repo. If you face any other problem related to deploying you can check this repository.

The model works only if your data is similar to sample.csv

Here is a screenshot of the app from my system

alt text

Medium Blog

You can find all the procedures regarding training your own model and other details of this project on my Medium post.

ecg-arrhythmia-classification's People

Contributors

ankur219 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ecg-arrhythmia-classification's Issues

validation or test accuracy

Anyone knows about the validation or test accuracy of this model?

I implement the paper using keras and use 10% images of each category as validation data, it turns out the model performs outstanding on training data while the accuracy on validation data fluctuates wildly, from 10%~ 99%, quite strange.

The paper only mentions on accuracy on all images, this can be similar to training accuracy, but the high training accuracy can be a result of overfit.

Training phase

Thank you for the code you published, since I am very interested in reproducing these experiments, I noticed that there is no training phase of the neural network from which the model is generated. Can I have additional information on how you did this task?

I would like to make realtime arrhythmia classification system

I use ad8232 as device for get ecg signal

Here is my question

  1. Is all leads of ecg can be fed into that model to do prediction?
  2. The author turned ecg signal into 2d image and augmented it, this seems like he is talking about the former step of trainning phase, but does my signal which fed into the model to do prediction will be also transformed in 2d and augmented?
  3. Does my signal has to be denoised, because the article said signal don't have to be denoised if using 2d convolutional model to predict it
  4. The data generate from ad8232 is from 0 to 1024, but its sample data is from -1 < x < 1, If my data is usually between 300 < x < 700, can I process my data like this (x - 500)/1000, make it between -1 < x < 1. Is my method reasonable?

Some errors in web-app

As the person below said, nothing happens when I select a csv file.
If you have the same problem or have solved it, please tell me the solution.

Didn,t have static file in this project

Sorry author recently i fork your project and run it up ,I have runned up it successfully but it don,t have any JS and CSS to decorate it can author provide this templates static files?
Thank You!

Nothing happens after choosing .csv file to upload?

Anybody else run into this? Not sure if this is still being maintained, but, I followed all the instructions mentioned. After it takes a minute to load the page, I choose the sample.csv file, then nothing happens. There's supposed to be a predict button that shows up on the page, no?

the annotation files

i was wondering what is the type of the file passed to the beat_annotations method in gettingData.py file ? also what is the type of the file "records" passed to segmentation method ? Do i have to use wfdb library to convert .atr files and .hea files to .txt files ?

AttributeError: 'list' object has no attribute 'items'

I followed the tutorial,

  1. clone ECG-Arrhythmia-classification-master
  2. clone keras-flask-deploy-webapp-master
  3. replace the app.py and index.html
  4. download the weights(model):ecgScratchEpoch2.hdf5
  5. modify the path in app.py:
    model = load_model('/Users/happysheep224/Documents/python/ECG_PY/ECG-Arrhythmia-classification-master/ecgScratchEpoch2.hdf5');
    csv = pd.read_csv('/Users/happysheep224/Documents/python/ECG_PY/ECG-Arrhythmia-classification-master/sample.csv')
  6. run the script

the terminal show like this:
(ecg) bogon:keras-flask-deploy-webapp-master happysheep224$ python app.py
Using TensorFlow backend.
Traceback (most recent call last):
File "app.py", line 31, in
model = load_model('/Users/happysheep224/Documents/python/ECG_PY/ECG-Arrhythmia-classification-master/ecgScratchEpoch2.hdf5')
File "/Users/happysheep224/opt/anaconda3/envs/ecg/lib/python3.7/site-packages/tensorflow/python/keras/saving/save.py", line 184, in load_model
return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
File "/Users/happysheep224/opt/anaconda3/envs/ecg/lib/python3.7/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 178, in load_model_from_hdf5
custom_objects=custom_objects)
File "/Users/happysheep224/opt/anaconda3/envs/ecg/lib/python3.7/site-packages/tensorflow/python/keras/saving/model_config.py", line 55, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "/Users/happysheep224/opt/anaconda3/envs/ecg/lib/python3.7/site-packages/tensorflow/python/keras/layers/serialization.py", line 109, in deserialize
printable_module_name='layer')
File "/Users/happysheep224/opt/anaconda3/envs/ecg/lib/python3.7/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 362, in deserialize_keras_object
config, module_objects, custom_objects, printable_module_name)
File "/Users/happysheep224/opt/anaconda3/envs/ecg/lib/python3.7/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 325, in class_and_config_for_serialized_keras_object
for key, item in cls_config.items():
AttributeError: 'list' object has no attribute 'items'

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.