DeepECG-Net: a hybrid transformer-based deep learning model for real-time ECG anomaly detection.

Journal: Scientific reports
Published Date:

Abstract

Real-time Electrocardiogram (ECG) anomaly detection is critical for accurate diagnosis and timely intervention in cardiac disorders. Existing models, such as CNNs and LSTMs, often struggle with long-range dependencies, generalization across multiple ECG patterns, and real-time inference with minimal latency. To address these limitations, we propose DeepECG-Net. This hybrid transformer-based deep learning model integrates CNNs and transformer architectures for enhanced feature representation and global dependency capture in ECG anomaly detection. Unlike conventional CNNs, which fail to handle long-term sequence dependencies, or LSTMs, which incur high computational costs, DeepECG-Net leverages a multi-head self-attention mechanism to learn both local and global ECG signal variations efficiently. This results in reduced computational overhead, improved interpretability, and superior real-time detection capabilities. DeepECG-Net achieves 98.2% accuracy with a hierarchical embedding strategy, outperforming ECGNet (88%) and LSTM models (90%). It also demonstrates significant signal reconstruction improvements, with SNR rising from 5.2 dB to 14.5 dB and MSE reducing from 0.042 to 0.007. Its low memory usage (30 MB) makes it ideal for deploying real-time clinical and wearable device applications. Our model achieves 98.2% precision, 96.8% recall, and 97.5% F1 score, closing the gap between AI-driven healthcare and real-time cardiac monitoring. The model is also extended with a federated learning framework for privacy-preserving distributed ECG anomaly detection, supporting deployment across wearable and clinical edge devices. The model was deployed on a Raspberry Pi 4B with 4 GB RAM, achieving sub-50 ms latency and 30 MB memory usage, making it ideal for real-time applications on standalone wearable platforms.

Authors

  • Manal Alghieth
    Department of Information Technology, College of Computer, Qassim University, Buraydah, 51452, Saudi Arabia. mgietha@qu.edu.sa.