ECG based Atrial Fillibration Detection using AI
Overview
Table of Contents
Introduction
Atrial fibrillation (AF) is the most common sustained cardiac arrhythmia, associated with increased rates of death, stroke, and heart failure. This project aims to classify ECG signals into four categories:
- Normal rhythm (N)
- AF rhythm (A)
- Other rhythm (O)
- Noisy (~)
Methodology
Convolutional Neural Networks (CNN)
- Signal Filtering: The ECG signals were filtered to remove noise.
- Spectrogram Conversion: Each ECG signal was converted into spectrograms.
- Training: A 2D CNN was trained to classify the signals into the four categories.

Figure 1: Confusion Matrix from basic CNN
Generative Adversarial Networks (GANs) + CNN & LSTM
To address the overfitting issue caused by class imbalances, we implemented GANs for data augmentation:
- Data Augmentation: Artificial AF samples were generated to balance the dataset.

Figure 2:Artificially Generated Heartbeats by GANs
- Heartbeat Template Extraction: Heartbeat templates were extracted from each ECG signal to create artificial heartbeats.
- Training: The augmented dataset was then used to train the CNN.

Figure 3: Confusion Matrix from CNN-LSTM network
Results
The results from both the CNN and GAN methods are detailed below. The GAN approach significantly improved the model’s performance by addressing the class imbalance and reducing overfitting.

