Deep learning models for electrocardiogram (ECG) classification often suffer from significant performance degradation when deployed in unseen domains due to shifts in acquisition devices and patient populations. Test-time adaptation (TTA) offers a practical solution by adapting models using only unlabeled data at inference time. However, existing TTA methods often underperform on ECG tasks, since naive online updates ignore the hierarchical beat-rhythm structure of cardiac cycles and are vulnerable to signal artifacts, which leads to unstable adaptation and model drift. We propose BeatRhythm-TTA, an ECG-tailored TTA framework that explicitly accounts for ECG's noisy observations and structured beat-rhythm semantics under domain shift. First, to handle pervasive ECG artifacts, we introduce a Signal Quality Index (SQI)-gated adaptation scheme that selectively filters out low-quality signals to prevent harmful updates. Second, to leverage ECG's beat-rhythm semantics, we enforce dual-level consistency so the model preserves beat morphology and rhythm dynamics while adapting to shifted acquisition conditions. Extensive experiments on multi-label ECG diagnosis across three adaptation protocols, using PTB-XL as the source domain and CPSC2018/Georgia as two target domains, demonstrate the effectiveness of our method, yielding an average +2.70% relative improvement in Macro-F1 over the best competing method.
Figures & tables
Figure 1: Motivation of the proposed BeatRhythm-TTA. Comparison of TTA strategies. Generic TTA methods are brittle on ECG, while BeatRhythm-TTA leverages beat-rhythm semantics for robust adaptation. (AF denotes atrial fibrillation, a cardiac rhythm disorder.)
Figure 2: BeatRhythm-TTA Framework. Given an unlabeled target ECG, adaptation is driven by two complementary modules. (1) SQI-gated pseudo-labeling: Blocks self-training updates based on teacher confidence and beat-wise signal quality, where EMA (exponential moving average) maintains a slowly updated teacher for more stable pseudo-labels. (2) Dual-level consistency: Enforces rhythm- and beat-level agreement between clean and augmented views to stabilize adaptation.
Method
CPSC2018
Georgia
Avg
AUC
F1
AUC
F1
AUC
F1
Source Only
87.62
60.84
88.59
60.35
88.11
60.59
AdaBN [ 13 ]
83.25
46.71
87.33
52.29
85.29
49.50
TENT [ 25 ]
87.57
60.63
88.57
60.29
88.07
60.46
COME [ 30 ]
87.28
60.14
88.43
59.83
87.86
59.99
SAR [ 17 ]
83.43
47.63
87.48
53.40
85.45
50.52
Table 1: Offline TTA results. Bold : best, underlined : second best. All values are reported in percent (%).
Method
CPSC2018
Georgia
Avg
AUC
F1
AUC
F1
AUC
F1
Source Only
87.62
60.84
88.59
60.35
88.11
60.59
Continual Online TTA
AdaBN [ 13 ]
86.11
58.81
87.94
61.93
87.03
60.37
TENT [ 25 ]
84.92
53.68
87.40
56.15
86.16
54.92
COME [ 30 ]
87.29
60.63
88.54
60.33
87.92
60.48
Table 2: Online TTA results under continual and independent settings. Bold : best, underlined : second best within each setting. All values are reported in percent (%).
SQI
Consistency
CPSC2018
Georgia
Avg
Rhythm
Beat
AUC
F1
AUC
F1
AUC
F1
87.62
60.84
88.59
60.35
88.11
60.59
✓
88.45
61.73
88.89
61.58
88.67
61.66
✓
✓
88.55
61.95
88.91
61.82
88.73
61.89
✓
✓
88.65
62.38
88.95
62.13
88.80
62.26
✓
✓
✓
88.70
62.57
88.97
62.26
88.84
62.42
Table 3: Ablation study under offline setting. All values are reported in percent (%).
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
Department of Computer Science and Engineering, Indian Institute of Technology (ISM) Dhanbad, Dhanbad, Jharkhand, India. · Department of Computer Science and Engineering, Indian Institute of Technology Roorkee, Roorkee, Uttarakhand, India.
Electrocardiogram (ECG) beat classifiers lose accuracy on new patients and devices, and source-free adaptation methods that assume class-balanced target batches fail on real recordings, whose label-free prefix is 87.9--98.6% normal beats. We propose Normal-Anchored Geometric Transport (NAGT, GA_NS), which estimates a closed-form symmetric positive-definite congruence map from label-free normal anchors in the first 5 min of each recording and applies it only to the normal and supraventricular prototypes, keeping the ventricular and fusion prototypes fixed. The score offsets and decision rules were set on MIT-BIH only; the rate-invariant RR head (relA) was adopted after the development databases (INCART, SVDB) had been opened; the frozen model was then evaluated once on Icentia11k chest-patch recordings under a pre-registered protocol. In 493 patients (973 recordings, 3,615,388 evaluated beats), NAGT reached an arrhythmia macro-F1J=21(S-F1+V-F1)=48.7% [95% CI 42.1, 54.7] versus 34.5% without adaptation (ΔJ=+14.1 [+8.6, +19.3] pp; 59.8% versus 43.9% in non-AF) and outperformed all five Holm-adjusted comparators, including AdaBN, Tent and T3A. In the 75-patient test subgroup of the historical split (73 analyzed), the gain was not significant (+6.1 [-8.5, +23.4] pp). Adaptation takes a median of 5.8 ms per record without back-propagation.
JinKook Kim
AI Division, HUINNO Co., Ltd., Seoul, Republic of Korea
Transformer-based electrocardiogram (ECG) models commonly tokenize waveforms into fixed temporal patches. Though convenient, fixed patching can split heartbeat structures across token boundaries. We study beat-synchronous tokenization as a physiologically grounded alternative, comparing fixed patches with three beat-aligned strategies: resampled beats, adaptive pooled beats, and resampled beats augmented with R--R interval information. Experiments span two settings: 10-second 12-lead diagnostic classification on PTB-XL after MIMIC-IV-ECG masked pretraining, and 60-second single-lead rhythm classification on Icentia11k after patient-level contrastive pretraining. On PTB-XL, resampled beat tokens achieve the highest mean macro Area Under the ROC Curve (AUROC; 0.8945) and nearly match the best fixed-patch macro Area Under the Precision-Recall Curve (AUPRC; 0.7414), reducing average sequence length from 100 to 11.2 tokens. On Icentia11k, beat-synchronous tokenizers obtain comparable AUPRC to fixed patching with better stability across runs. These results suggest morphology-preserving beat tokenization is a compact, competitive alternative to fixed temporal patching.
Ahmed Sameh, Nolan Wilson, Max Enderlein +1
Computer Science & Engineering, University of Minnesota Twin Cities, Minneapolis, MN 55455, USA.