"Enhancing clinical diagnostics with explainable, robust, and highly accurate one-dimensional convolutional neural networks."
Important
Implementation Note: This repository contains the core architecture and settings as described in the associated research paper. However, some code structures and experimental configurations have been slightly adjusted to facilitate educational study, modification, and independent testing. The codebase will be fully synchronized with the exact methodology presented in the manuscript upon the paper's final formal publication.
This repository contains the complete implementation for a highly optimized 1D Convolutional Neural Network (1D-CNN) designed for multi-class ECG arrhythmia classification using the globally recognized MIT-BIH Arrhythmia Dataset.
The system leverages Synthetic Minority Over-sampling Technique (SMOTE) to overcome severe clinical class imbalance and incorporates Grad-CAM visual interpretability to provide clinical trust in the model's decisions.
| Contribution | Description |
|---|---|
| ⚖️ SMOTE Balancing | Solves extreme MIT-BIH class imbalance (Group N dominates 82% of data) |
| 🧬 1D Convolutional Layers | Tailored to extract morphological wave structures from 187-timestep ECG signals |
| 🔍 Explainable AI (XAI) | 1D Grad-CAM implementation maps exactly which part of the QRS complex triggered the diagnosis |
| 📊 Research-Grade Visuals | Generates 10 fully automated, 4K true-white background clinical charts (Loss, Precision, Heatmaps) |
The network successfully categorizes 187-timestep waveforms into the AAMI recognized super-classes:
- N (Normal) - Normal beats & structural variations
- S (Supraventricular) - Premature or ectopic beats
- V (Ventricular) - Ventricular premature contraction
- F (Fusion) - Fusion of ventricular and normal beats
- Q (Unknown) - Paced beats, unclassified
┌─────────────────────────────────────────────────────────────┐
│ │
│ 🫀 ECG Signal Vector (Length: 187) │
│ │
│ ┌───────────────────────▼───────────────────────┐ │
│ │ Block 1: Conv1D (64 filters) │ High- │
│ │ Batch Norm → ReLU → Max Pooling (Pool=2) │ Freq │
│ └───────────────────────┬───────────────────────┘ │
│ │ │
│ ┌───────────────────────▼───────────────────────┐ │
│ │ Block 2: Conv1D (128 filters) │ Wave │
│ │ Batch Norm → ReLU → Max Pooling (Pool=2) │ Capture │
│ └───────────────────────┬───────────────────────┘ │
│ │ │
│ ┌───────────────────────▼───────────────────────┐ │
│ │ Block 3: Conv1D (256 filters) │ Deep │
│ │ Batch Norm → ReLU │ Morph. │
│ └───────────────────────┬───────────────────────┘ │
│ │ │
│ ┌───────────────────────▼───────────────────────┐ │
│ │ Global Average Pooling 1D │ │
│ │ Flattening structural sequence │ │
│ └───────────────────────┬───────────────────────┘ │
│ │ │
│ ┌───────────────────────▼───────────────────────┐ │
│ │ Fully Connected Integrator │ │
│ │ Dense (128) + Dropout (0.3) │ │
│ └───────────────────────┬───────────────────────┘ │
│ │ │
│ 📋 Softmax Classifier (5 Probabilities) │
│ [ N, S, V, F, Q ] │
└─────────────────────────────────────────────────────────────┘
📦 ECG-Arrhythmia-Classification-CNN/
│
├── 📁 training_code/
│ └── 🧠 ecg_cnn_classifier.py # Full Model, SMOTE, and Metrics Pipeline
│
├── 📁 training_data/
│ ├── 📊 mitbih_train.csv # MIT-BIH Training Matrix
│ └── 📊 mitbih_test.csv # MIT-BIH Testing Matrix
│
├── 📄 ECG_Arrhythmia_Classification_Paper.docx # Academic Manuscript
├── 📋 requirements.txt
└── 📖 README.md
-
Install Dependencies:
pip install -r requirements.txt
-
Execute Full Clinical Pipeline:
python training_code/ecg_cnn_classifier.py
-
Outputs Generated Automatically:
- Saved
Final_Clinical_Model.kerasengine - Sub-directory
ecg_outputs/populated with 10 Research-Grade Visuals (Data distribution, Confusion matrices, F1-Score mappings, and Grad-CAM interpretability heatmaps)
- Saved
@misc{abdullah2026ecgcnn,
title = {Automated Cardiac Arrhythmia Classification using Deep 1D Convolutional Neural Networks},
author = {Mohammed Ezzeldin Babiker Abdullah},
year = {2026}
}