Automated detection of cardiovascular diseases from 12-lead ECG images using Convolutional Neural Networks (CNNs).
This research investigates the role of lead-wise ECG segmentation in improving classification accuracy and explores the impact of individual leads in computer vision–based cardiovascular disease detection.
- Lead-wise ECG Processing: Extracts individual leads from full 12-lead ECG images using calibrated coordinates.
- CNN Classification: Deep learning model trained on individual lead images, with aggregated predictions for final classification.
- Comprehensive Evaluation: Includes accuracy, precision, recall, F1-score, and confusion matrices for both lead-wise and aggregated predictions.
- Source: Mendeley Data Repository
- Full ECG Images: 928 (12-lead ECG scans).
- Processed Leads: 11,136 individual lead images (928 × 12).
- Image Format: Original ECGs in JPG, processed as 128×128 grayscale lead images.
- Classes (4 categories):
- Normal: 284 ECGs → 3,408 leads
- Abnormal Heartbeat: 233 ECGs → 2,796 leads
- Myocardial Infarction (MI): 239 ECGs → 2,868 leads
- History of MI: 172 ECGs → 2,064 leads
Train/Test Split:
- Training: 9,600 images (80%)
- Testing: 2,400 images (20%)
-
Lead Extraction:
- Extracts 12 leads (I, II, III, aVR, aVL, aVF, V1–V6) from 3×4 ECG grid layout.
- Coordinate-based segmentation with logical pixel mapping.
-
Enhancement & Cleaning:
- Contrast (×1.2) and sharpness (×1.1) enhancement.
- Gaussian blur + adaptive thresholding for noise removal.
- Background removal via grayscale conversion and morphological operations.
-
Normalization:
- Pixel scaling to range [0,1].
- Standard resizing to 128×128 pixels.
- Input: 128×128×1 (grayscale lead images).
- CNN Layers:
- Conv2D(32, ReLU) → MaxPooling → Dropout
- Conv2D(64, ReLU) → MaxPooling → Dropout
- Flatten → Dense(128, ReLU) → Dense(4, Softmax)
- Optimizer: Adam
- Loss Function: Sparse Categorical Crossentropy
- Accuracy
- Precision
- Recall
- F1-score
- Confusion Matrices (per-class and aggregated)
- The model demonstrates strong classification accuracy across the four categories.
- Lead-wise analysis highlights the impact of individual leads in detecting cardiovascular abnormalities.
- Aggregated predictions improve robustness compared to single-lead classification.
- TensorFlow / Keras – model training
- OpenCV – image processing
- PIL (Pillow) – image manipulation
- Matplotlib – plotting and visualization
- NumPy – numerical operations
- Scikit-learn – evaluation metrics
© 2025 Saqlain Ahmed. For academic research and personal use only.
Redistribution or commercial use is prohibited without prior permission.
- Dataset provided by Mendeley Data Repository: https://data.mendeley.com/datasets/gwbz3fsgp8/2
- Research conducted as part of Final Year Project (FYP).
