ECG-XPLAIM: Deep learning tool for accurate and explainable arrhythmia detection from 12-lead electrocardiogram (ECG) signals
Creators
Description
ECG-XPLAIM is a deep learning-based model designed for explainable ECG classification, optimized for multi-label classification of 12-lead electrocardiogram (ECG) signals. The model integrates a custom Inception-style one-dimensional convolutional neural network (CNN), specialized for time-series analysis, capturing both local waveform features (waves, intervals, QRS morphology) and global rhythm patterns (RR variability, conduction disturbances).
1. Multiple Versions for Different Classification Tasks
This repository provides different versions of ECG-XPLAIM, each trained and optimized for a specific arrhythmia classification task. Each model was trained separately using task-specific balanced subsets, allowing for more fine-tuned, task-specific performance. The versions include:
- TACHY (ecg_xplaim_TACHY.keras): Differentiates Atrial Fibrillation (AFib) from Sinus Tachycardia (STach) and non-AFib/STach samples.
- CD (ecg_xplaim_CD.keras): Detects Conduction Disturbances, including Right Bundle Branch Block (RBBB), Left Bundle Branch Block (LBBB), and Left Anterior Fascicular Block (LAFB).
- LQT (ecg_xplaim_LQT.keras): Identifies Long QT interval (LQT).
- WPW (ecg_xplaim_WPW.keras): Detects Wolff-Parkinson-White syndrome (WPW).
- PACE (ecg_xplaim_PACE.keras): Identifies paced ECG rhythms (PACE).
2. Input and Output Shape for Each Task
Input Shape (all versions): (batch_size, 5000, 12) [5000 time points, 10sec at 500Hz sampling, × 12 ECG leads, corresponding to: I, II, III, aVR, aVL, aVF, V1-V6]
Output Shape (multi-label classification): (batch_size, N_classes) [binary multi-label output for arrhythmia presence/absence]
Each output is a vector of probabilities (sigmoid activation; 0 to 1 probability), where each index corresponds to a specific arrhythmia class. The model does not assume mutual exclusivity—i.e., an ECG can have multiple conditions simultaneously.
| Task | Output Shape | Labels |
|---|---|---|
| TACHY | (batch_size, 2) |
[AFib, STach] |
| CD | (batch_size, 3) |
[RBBB, LBBB, LAFB] |
| LQT | (batch_size, 1) |
[LQT] |
| WPW | (batch_size, 1) |
[WPW] |
| PACE | (batch_size, 1) |
[PACE] |
3. How to Load and Use the Model in Python
ECG-XPLAIM is implemented in TensorFlow/Keras.
# Load TensorFlow/Kerasimport tensorflow as tf
# Load model (example for the TACHY version)model_path = "path/to/ecg_xplaim_TACHY.keras"model = tf.keras.models.load_model(model_path)
# Simulated ECG data (100 samples, of 12 leads, each with 5,000 data points)input_ecg_data = np.random.randn(100, 5000, 12).astype(np.float32)
# Get predicted labelsoutput_labels = model.predict(ecg_sample)
4. Additional Resources
- Code Repository: GitHub Repository (https://github.com/ppantele/ECG-XPLAIM)
- Published Paper: (link to be added soon)
Files
ecg_xplaim.zip
Files
(193.7 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:121ce05c670a6b7dbd8cd80cae539d44
|
193.7 MB | Preview Download |
Additional details
Dates
- Created
-
2025-03-04
Software
- Repository URL
- https://github.com/ppantele/ECG-XPLAIM
- Programming language
- Python
- Development Status
- Active