Inam Abousaber , Hany El-Ghaish , Haitham F. Abdallah
{"title":"A novel explainable ECG classification with spatio-temporal transformers and hybrid loss optimization","authors":"Inam Abousaber , Hany El-Ghaish , Haitham F. Abdallah","doi":"10.1016/j.bspc.2025.108142","DOIUrl":null,"url":null,"abstract":"<div><div>This paper presents a novel deep learning framework for ECG arrhythmias detection, integrating Spatio-Temporal Adaptive Embedding (STAE) Transformers and Variational Autoencoders (VAEs) to improve classification accuracy and address class imbalance. Traditional ECG classification models struggle to capture long-range temporal dependencies and handle imbalanced datasets, leading to poor sensitivity for rare arrhythmias. The proposed system employs STAE Transformers to model intricate temporal and spatial relationships within ECG signals to overcome these challenges. At the same time, VAEs generate diverse and realistic ECG samples to enhance model generalization, particularly for underrepresented arrhythmias. Additionally, combining Focal Loss and Dice Loss, a Hybrid Loss Function further optimizes performance by focusing on hard-to-classify arrhythmias. The model is evaluated on the MIT-BIH Arrhythmias Database and PTB Diagnostic ECG Database using 5-fold cross-validation, achieving an accuracy of 99.56% and a macro F1-score of 95.40%, outperforming existing state-of-the-art methods, with a 3.5% improvement in sensitivity for rare arrhythmias. To ensure interpretability, SHapley Additive exPlanations (SHAP) and Gradient-weighted Class Activation Mapping (Grad-CAM) are utilized, highlighting the QRS complex and RR intervals as the most critical features and confirming that the model focuses on clinically relevant waveform regions. These results demonstrate the effectiveness of our approach in developing an accurate, interpretable, and robust deep learning system for ECG arrhythmias detection, paving the way for more reliable clinical decision support systems.</div></div>","PeriodicalId":55362,"journal":{"name":"Biomedical Signal Processing and Control","volume":"110 ","pages":"Article 108142"},"PeriodicalIF":4.9000,"publicationDate":"2025-05-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Biomedical Signal Processing and Control","FirstCategoryId":"5","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S1746809425006536","RegionNum":2,"RegionCategory":"医学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"ENGINEERING, BIOMEDICAL","Score":null,"Total":0}
引用次数: 0
Abstract
This paper presents a novel deep learning framework for ECG arrhythmias detection, integrating Spatio-Temporal Adaptive Embedding (STAE) Transformers and Variational Autoencoders (VAEs) to improve classification accuracy and address class imbalance. Traditional ECG classification models struggle to capture long-range temporal dependencies and handle imbalanced datasets, leading to poor sensitivity for rare arrhythmias. The proposed system employs STAE Transformers to model intricate temporal and spatial relationships within ECG signals to overcome these challenges. At the same time, VAEs generate diverse and realistic ECG samples to enhance model generalization, particularly for underrepresented arrhythmias. Additionally, combining Focal Loss and Dice Loss, a Hybrid Loss Function further optimizes performance by focusing on hard-to-classify arrhythmias. The model is evaluated on the MIT-BIH Arrhythmias Database and PTB Diagnostic ECG Database using 5-fold cross-validation, achieving an accuracy of 99.56% and a macro F1-score of 95.40%, outperforming existing state-of-the-art methods, with a 3.5% improvement in sensitivity for rare arrhythmias. To ensure interpretability, SHapley Additive exPlanations (SHAP) and Gradient-weighted Class Activation Mapping (Grad-CAM) are utilized, highlighting the QRS complex and RR intervals as the most critical features and confirming that the model focuses on clinically relevant waveform regions. These results demonstrate the effectiveness of our approach in developing an accurate, interpretable, and robust deep learning system for ECG arrhythmias detection, paving the way for more reliable clinical decision support systems.
期刊介绍:
Biomedical Signal Processing and Control aims to provide a cross-disciplinary international forum for the interchange of information on research in the measurement and analysis of signals and images in clinical medicine and the biological sciences. Emphasis is placed on contributions dealing with the practical, applications-led research on the use of methods and devices in clinical diagnosis, patient monitoring and management.
Biomedical Signal Processing and Control reflects the main areas in which these methods are being used and developed at the interface of both engineering and clinical science. The scope of the journal is defined to include relevant review papers, technical notes, short communications and letters. Tutorial papers and special issues will also be published.