Skip to content

Biswajit-Behera/ECG-classification-for-Arrhythmia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECG Arrhythmia Classification Using Deep Learning

This repository contains the implementation of recurrent neural network (RNN)-based deep learning architectures for detecting and classifying arrhythmias in ECG waveforms, distinguishing between normal and abnormal cardiac conditions.


Abstract

Electrocardiogram (ECG) signals capture the electrical activity of the heart, recorded using electrodes that detect the electrical potential generated during the depolarization and repolarization of cardiac muscles in each cardiac cycle.
The heart's rhythm is typically systematic, and deviations from this rhythm are known as arrhythmias. Arrhythmias are critical indicators of various cardiovascular diseases (CVDs) and are classified into multiple categories based on their type and origin. These irregularities can reveal heart conditions, the presence of heart blocks, or even predict severe complications such as myocardial infarction or stroke, which can be life-threatening. Therefore, the detection and classification of arrhythmias are essential for diagnosing cardiac diseases. An automated ECG classification system can assist healthcare professionals in diagnosing and providing timely and effective treatments.
This project proposes an ensemble recurrent neural network (RNN) model for classifying ECG signals into normal and arrhythmic categories. To address the challenge of noisy signals, a Naive Bayes classifier is employed to filter out noisy data, ensuring that only clean signals are processed by the deep learning model.
Additionally, a graphical user interface (GUI) was developed to enable visualization, interpretation, and real-time detection of arrhythmias and other cardiac conditions.

Dataset

The PhysioNet Challenge 2017 dataset was used for training the models. It contains 8,528 short single-lead ECG signals, each 30-60 seconds long and sampled at 300 Hz. The signals are categorized into four classes:

  • Normal Sinus Rhythm (N)
  • Atrial Fibrillation (A)
  • Other Rhythms (O)
  • Noisy Signals (~)

Signal-types


Methods

Data Preprocessing

  • The ECG signals and their corresponding labels were stored in a .mat file.
  • To maintain uniformity, all signals were standardized to 9,000 samples in length, minimizing excessive padding or truncation.
  • A Naive Bayes classifier was used to separate clean signals from noisy ones, ensuring the deep learning models were not misled by poor-quality data.

Feature Engineering

  • Data Augmentation: Applied to address class imbalance.
  • Feature Extraction: Spectral and morphological features were extracted to enhance classification performance.
  • Standardization: Z-scoring was applied to ensure equal weighting of features.
  • Train-Test Split: An 80:20 split was used for training and validation.

Model Architectures

Three RNN-based architectures were implemented:

  1. Long Short-Term Memory (LSTM)
  2. Bidirectional LSTM (BiLSTM)
  3. Gated Recurrent Units (GRU)

model-arch

Ensemble Learning

  • The best-performing models were saved, and their predictions were combined to create an ensemble model. This approach improved overall classification accuracy and robustness.

Graphical User Interface (GUI)

A GUI was developed to facilitate real-time ECG analysis and arrhythmia detection. The GUI provides the following functionalities:

  • R-Peak Detection: Identifies R-peaks in the ECG signal.
  • Amplitude Analysis: Displays the amplitude values of R-peaks.
  • Heart Rate Calculation: Computes and displays the heart rate.
  • RR Interval Analysis: Calculates the average RR interval and heart rate variability (HRV).
  • NN50 Value: Displays the NN50 value for HRV analysis.
  • Rhythm Classification: Classifies the rhythm as Normal, Atrial Fibrillation, or Other Rhythms.
  • Heart Rate Condition: Categorizes the heart rate as Normal, Tachycardia (Rapid), or Bradycardia (Slow).
  • Recommendations: Provides suggestions based on the rhythm and heart rate condition.

Results

  • Among the three architectures, GRU achieved the highest classification accuracy.
  • The ensemble model further improved accuracy by combining the strengths of individual models.
  • The GUI demonstrated real-time analysis capabilities, processing signals in <1 second, making it suitable for practical applications.

gui


References

  1. Mohebbanaaz, Y. P. Sai, and L. V. R. Kumari. "A Review on Arrhythmia Classification Using ECG Signals." 2020 IEEE International Students' Conference on Electrical, Electronics and Computer Science (SCEECS), 2020, pp. 1-6. doi: 10.1109/SCEECS48394.2020.9.
  2. Saadatnejad, Saeed, Mohammadhosein Oveisi, and Matin Hashemi. "LSTM-Based ECG Classification for Continuous Monitoring on Personal Wearable Devices." IEEE Journal of Biomedical and Health Informatics, 2019. doi: 10.1109/JBHI.2019.2911367.
  3. Zhou, Zhi-Hua, Jianxin Wu, and Wei Tang. "Ensembling Neural Networks: Many Could Be Better Than All." Artificial Intelligence, vol. 137, 2002, pp. 239-263. doi: 10.1016/S0004-3702(02)00190-X.

This project demonstrates the potential of deep learning in automating arrhythmia detection and classification, providing a valuable tool for healthcare professionals.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages