eess.SPMay 5, 2026

Domain-Adaptive Arrhythmia Classification Using a Hybrid Transformer on Wearable Heart Signals

Authors: Maedeh H. ToosiSiamak Mohammadi

Organizations: School of Electrical and Computer Engineering, University of Tehran, Tehran, Iran

Abstract

Cardiovascular disease remains the leading cause of death globally, underscoring the need for effective, accessible monitoring solutions, particularly through wearable devices that enable continuous, real-time tracking of heart rhythms in home settings. However, deploying deep learning models trained on clinical electrocardiogram (ECG) datasets to wearable devices remains challenging, as differences in recording equipment, signal quality, and patient populations introduce domain shifts that degrade model performance. We propose a hybrid transformer model that processes continuous ECG signals alongside seven heart rate variability (HRV) features, where the raw signal path captures beat-level morphological patterns and the HRV path encodes rhythm regularity statistics, allowing the model to jointly leverage complementary information from both representations. To enhance the model's ability to generalize across domains, we employ representation learning techniques, including Maximum Mean Discrepancy (MMD), a non-parametric kernel-based metric that quantifies the distance between feature distributions of different domains, to align feature distributions between source and target domains, addressing the challenge of domain shifts between public datasets and wearable device data. By leveraging five public ECG datasets for training, the model learns robust, generalized representations that mitigate domain-specific biases. When tested on wearable device data with an unseen domain, the model achieved an F1-macro 95% and balanced accuracy of 96.15%. These results demonstrate minimal performance degradation, with only a 2% drop in F1-macro compared to seen-domain evaluation, highlighting the model's generalization capabilities and its potential for reliable, real-time heart monitoring applications in home and ambulatory settings.

Explore similar work

Jul 12, 2026cs.LG

LSTrans: Efficient Knowledge Transfer for Lightweight and Automated ECG Classification

Deploying deep learning models for automated electrocardiogram classification on resource-constrained wearable devices remains challenging due to high computational costs. To address this, we propose LSTrans, a lightweight hybrid model designed for efficient and sensitive ECG analysis. LSTrans introduces a specialized 1D convolutional backbone with an interleaved layer architecture to capture both macroscopic rhythmic trends and microscopic morphological variations. This backbone is cascaded with a Transformer encoder to model long-range temporal dependencies, incorporating Low-Rank Adaptation across critical layers to compress the model and reduce the trainable parameter space. We further employ homogeneous and heterogeneous knowledge distillation to transfer diagnostic expertise from high-capacity teacher models to the student. Experimental results on multiple benchmark datasets demonstrate that LSTrans achieves a competitive balance between diagnostic sensitivity and resource efficiency, substantially reducing peak memory footprints and training latency during downstream adaptation. The source code is available for review at https://github.com/zyee00128/LSTrans4BIBM.
Yi Zhao, Jiajun Gao, Chenyang Xu +2
May 23, 2026cs.AI

HeartBeatAI: An Interpretable and Robust Deep Learning Framework for Multi-Label ECG Arrhythmia Detection

While Deep Learning (DL) enhances automated electrocardiogram (ECG) analysis, clinical deployment is hindered by class imbalance and the generalization gap. This paper presents HeartBeatAI, a deep learning framework combining domain generalization, multi-scale feature aggregation, and clinical explainability for robust 12-lead ECG classification. Moving beyond image-based paradigms, HeartBeatAI integrates a Squeeze-and-Excitation (SE) ResNet to isolate diagnostic leads alongside a Multi-Layer Concentration Pipeline to capture macro-rhythm and micro-morphological anomalies. To mitigate domain shift, the framework employs MixStyle regularization and Label Smoothing. Rigorous benchmarking across four large-scale datasets using intra-source and Leave-One-Domain-Out (LODO) protocols demonstrates high performance (98% Macro F1-score) under intra-source conditions. However, LODO evaluations reveal significant degradation in detecting rare anomalies, highlighting a persistent challenge in cross-institutional deployment.
Shubham Gupta, Nikhil Panwar, Partha Pratim Roy
May 13, 2026cs.LG

ECG-NAT: A Self-supervised Neighborhood Attention Transformer for Multi-lead Electrocardiogram Classification

Electrocardiogram (ECG) arrhythmia classification remains challenging due to signal variability, noise, limited labeled data, and the difficulty in achieving both accuracy and efficiency in models. While self-supervised learning reduces label dependency, most methods target either global contextual features or local morphological patterns, but rarely implement hierarchical multi-scale feature extraction. ECG signals require architectures that simultaneously capture fine-grained beat-level morphology and broader rhythm-level dependencies with computational efficiency. To overcome this limitation, this paper proposes the Electrocardiogram Neighborhood Attention Transformer (ECG-NAT), a novel self-supervised learning approach tailored for multi-lead ECG classification. Our two-stage approach begins with generative pretraining, using a masked autoencoder to reconstruct partially masked ECG signals across multiple diverse datasets, enabling the model to learn robust, domain-invariant representations from unlabeled data. This is followed by discriminative fine-tuning with a dual-loss function that combines supervised contrastive and cross-entropy losses, aligning representation learning with label prediction. The hierarchical attention mechanism efficiently captures multi-scale temporal features from localized beat morphology to broader rhythm patterns at low computational cost. ECG-NAT achieves robust performance on benchmark datasets, with 88.1% accuracy using only 1% labeled data, demonstrating strong efficacy in low-resource settings. The framework combines superior classification performance with computational efficiency, making it practical for real-time ECG diagnosis. The code will be made available upon acceptance at: https://github.com/Mahsagazeran/ECG-NAT.
Mahsa Gazeran, Sayvan Soleymanbaigi, Fatemeh Daneshfar +2