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

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 wit...

Full description

Saved in:
Bibliographic Details
Main Author: Manal Alghieth
Format: Article
Language:English
Published: Nature Portfolio 2025-07-01
Series:Scientific Reports
Subjects:
Online Access:https://doi.org/10.1038/s41598-025-07781-1
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1849238578101485568
author Manal Alghieth
author_facet Manal Alghieth
author_sort Manal Alghieth
collection DOAJ
description 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.
format Article
id doaj-art-daecca4eecb74e53a8a9d0bd7ad73c1a
institution Kabale University
issn 2045-2322
language English
publishDate 2025-07-01
publisher Nature Portfolio
record_format Article
series Scientific Reports
spelling doaj-art-daecca4eecb74e53a8a9d0bd7ad73c1a2025-08-20T04:01:34ZengNature PortfolioScientific Reports2045-23222025-07-0115112310.1038/s41598-025-07781-1DeepECG-Net: a hybrid transformer-based deep learning model for real-time ECG anomaly detectionManal Alghieth0Department of Information Technology, College of Computer, Qassim UniversityAbstract 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.https://doi.org/10.1038/s41598-025-07781-1Real-time ECG anomaly detectionHybrid transformer-CNN modelDeepECG-NetGlobal dependency learningEfficient deep learning framework
spellingShingle Manal Alghieth
DeepECG-Net: a hybrid transformer-based deep learning model for real-time ECG anomaly detection
Scientific Reports
Real-time ECG anomaly detection
Hybrid transformer-CNN model
DeepECG-Net
Global dependency learning
Efficient deep learning framework
title DeepECG-Net: a hybrid transformer-based deep learning model for real-time ECG anomaly detection
title_full DeepECG-Net: a hybrid transformer-based deep learning model for real-time ECG anomaly detection
title_fullStr DeepECG-Net: a hybrid transformer-based deep learning model for real-time ECG anomaly detection
title_full_unstemmed DeepECG-Net: a hybrid transformer-based deep learning model for real-time ECG anomaly detection
title_short DeepECG-Net: a hybrid transformer-based deep learning model for real-time ECG anomaly detection
title_sort deepecg net a hybrid transformer based deep learning model for real time ecg anomaly detection
topic Real-time ECG anomaly detection
Hybrid transformer-CNN model
DeepECG-Net
Global dependency learning
Efficient deep learning framework
url https://doi.org/10.1038/s41598-025-07781-1
work_keys_str_mv AT manalalghieth deepecgnetahybridtransformerbaseddeeplearningmodelforrealtimeecganomalydetection