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.
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 (~)
- The ECG signals and their corresponding labels were stored in a
.matfile. - 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.
- 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.
Three RNN-based architectures were implemented:
- Long Short-Term Memory (LSTM)
- Bidirectional LSTM (BiLSTM)
- Gated Recurrent Units (GRU)
- The best-performing models were saved, and their predictions were combined to create an ensemble model. This approach improved overall classification accuracy and robustness.
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.
- 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.
- 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.
- 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.
- 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.

