Giter VIP home page Giter VIP logo

lstm-ecg's Introduction

Real Time Electrocardiogram Annotation with a Long Short Term Memory Neural Network

Here you will find code that describes a neural network model capable of labeling the R-peak of ECG recordings. This method has been tested on a wearable device as well as with public datasets.

This code trains a neural network with a loss function that maximizes F1 score (binary position of peak in a string of 0's and 1's.).

The model demonstrates high accuracy in labeling the R-peak of QRS complexes of ECG signal of public available datasets (MITDB and EDB). Results are compared with the gold standard method Pan-Tompkins. Our method demonstrates superior generalization performance across different datasets.

The network has been validated with data using an IMEC wearable device on an elderly population of patients which all have heart failure and co-morbidities. This demonstrates that the proposed solution is capable of performing close to human annotation 94.8% average accuracy, on single lead wearable data containing a wide variety of QRS and ST-T morphologies.

Model

model = Sequential()
model.add(Dense(32,W_regularizer=regularizers.l2(l=0.01), input_shape=(seqlength, features)))
model.add(Bidirectional(LSTM(64, return_sequences=True)))#, input_shape=(seqlength, features)) ) ### bidirectional ---><---
model.add(Dropout(0.2))
model.add(BatchNormalization())
model.add(Dense(64, activation='relu',W_regularizer=regularizers.l2(l=0.01)))
model.add(Dropout(0.2))
model.add(BatchNormalization())
model.add(Dense(dimout, activation='sigmoid'))
adam = optimizers.adam(lr=0.001, beta_1=0.9, beta_2=0.999, epsilon=1e-08, decay=0.0)
model.compile(loss='f1_loss', optimizer=adam, metrics=['f1_m, precision_m, recall_m, matthews_correlation']) 

Getting Started

Dependencies

You will need the following packages:

  • wfdb 1.3.4 ( not the newest >2.0); pip install wfdb==1.3.4
  • tensorflow
  • keras
  • numpy
  • scipy

Datasets

MIT-BIH Arrhythmia Database - https://physionet.org/content/mitdb/1.0.0/ Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh, Mark RG, Mietus JE, Moody GB, Peng C-K, Stanley HE. PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals (2003). Circulation. 101(23):e215-e220.

European ST-T Database - EDB Taddei A, Distante G, Emdin M, Pisani P, Moody GB, Zeelenberg C, Marchesi C. The European ST-T Database: standard for evaluating systems for the analysis of ST-T changes in ambulatory electrocardiography. European Heart Journal 13: 1164-1172 (1992).

Ipython notebook scripts:

train_lstm_edb.ipynb - works with European ST-T Dataset
train_lstm_mitd.ipynb - works with MIT-BIH Arrhythmia Database 

More info?

When using this resource, please cite the original publication:

F. Corradi, J. Buil, H. De Canniere, W. Groenendaal, P. Vandervoort. "Real Time Electrocardiogram Annotation with a Long Short Term Memory Neural Network", 2019 IEEE Biomedical Circuits and Systems Conference (BioCAS), Nara, Japan. 10.1109/BIOCAS.2019.8918723

https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8918723

lstm-ecg's People

Contributors

federicohyo 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

Watchers

 avatar  avatar

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.