Enhanced ECG Classification Using Dual-Lead Gramian Angular Field Transformation and Deep Learning

Giwon Yoon and Segyeong Joo
Asan Medical Center (University of Ulsan College of Medicine)


Abstract

Background and Objective: Traditional ECG analysis methods, including manual review and handcrafted feature extraction, are time-consuming and prone to variability. Recent advances in deep learning and image-based analysis offer new opportunities for more accurate and automated classification. This study explores the effectiveness of transforming 1D ECG signals into 2D Gramian Angular Field (GAF) images and classifying them using a modern deep learning architecture to improve diagnostic accuracy for various cardiac conditions.

Methods: ECG recordings from the PTB-XL dataset were used to classify four diagnostic categories: Atrial Fibrillation (AFib), Left Ventricular Hypertrophy (LVH), Right Ventricular Hypertrophy (RVH), and Normal ECG. The raw 1D signals were converted into 2D images using Gramian Angular Field (GAF) transformation at three different resolutions: 5000x5000, 512x512, and 256x256 pixels. To enhance detection performance for LVH and RVH, GAF images were calculated using a dual-lead configuration (Lead II and V1), capturing inter-lead dynamics important for hypertrophy-related patterns. The ConvNext deep learning model was trained on the GAF images, and segmentation techniques were applied to isolate meaningful portions of the signal. Classification performance was assessed using accuracy, precision, recall, and F1-score. The model's generalizability was validated using the Chapman ECG dataset

Results: The 512x512 GAF images with segmentation provided the optimal balance between classification performance and computational cost, achieving F1-scores of 0.781 (AFib), 0.71 (LVH), 0.521 (RVH), and 0.792 (Normal). Larger GAF images (5000x5000) yielded slightly higher performance but at the cost of computational efficiency, while 256x256 images showed performance degradation. Results on the Chapman dataset demonstrated consistent performance, confirming the method's robustness.

Conclusion: Transforming ECG signals into GAF images combined with segmentation and deep learning enables effective classification of cardiac conditions. The approach offers a practical balance between performance and efficiency, showing promise for enhancing automated ECG analysis in clinical and remote monitoring applications.