Deep learning has achieved strong performance for electrocardiogram (ECG) classification within individual datasets, yet dependable generalization across heterogeneous acquisition settings remains a major obstacle to clinical deployment and longitudinal monitoring. A key limitation of many model architectures is the implicit entanglement of morphological waveform patterns and rhythm dynamics, which can promote shortcut learning and amplify sensitivity to distribution shifts. We propose ECG-RAMBA, a framework that separates morphology and rhythm and then re-integrates them through context-aware fusion. ECG-RAMBA combines: (i) deterministic morphological features extracted by MiniRocket, (ii) global rhythm descriptors computed from heart-rate variability (HRV), and (iii) long-range contextual modeling via a bi-directional Mamba backbone. To improve sensitivity to transient abnormalities under windowed inference, we introduce a numerically stable Power Mean pooling operator ($Q=3$) that emphasizes high-evidence segments while avoiding the brittleness of max pooling and the dilution of averaging. We evaluate under a protocol-faithful setting with subject-level cross-validation, a fixed decision threshold, and no test-time adaptation. On the Chapman--Shaoxing dataset, ECG-RAMBA achieves a macro ROC-AUC $\approx 0.85$. In zero-shot transfer, it attains PR-AUC $=0.708$ for atrial fibrillation detection on the external CPSC-2021 dataset, substantially outperforming a comparable raw-signal Mamba baseline, and shows consistent cross-dataset performance on PTB-XL. Ablation studies indicate that deterministic morphology provides a strong foundation, while explicit rhythm modeling and long-range context are critical drivers of cross-domain robustness.
翻译:深度学习在心电图(ECG)分类任务中已在单一数据集内取得优异性能,然而,在异构采集设置间实现可靠的泛化能力,仍是临床部署与纵向监测面临的主要障碍。许多模型架构的一个关键局限在于其隐含地纠缠了形态波形模式与节律动态,这可能助长捷径学习并放大对分布偏移的敏感性。我们提出ECG-RAMBA框架,该框架首先分离形态与节律,再通过上下文感知融合将其重新整合。ECG-RAMBA结合了:(i)由MiniRocket提取的确定性形态特征,(ii)基于心率变异性(HRV)计算的全局节律描述符,以及(iii)通过双向Mamba主干网络实现的长程上下文建模。为提升在窗口化推理下对瞬态异常的敏感性,我们引入了一种数值稳定的幂平均池化算子($Q=3$),该算子强调高证据片段,同时避免了最大池化的脆弱性与平均池化的稀释效应。我们在遵循严格协议的环境下进行评估,包括受试者层级交叉验证、固定决策阈值且无测试时适应。在Chapman--Shaoxing数据集上,ECG-RAMBA实现了宏观ROC-AUC $\approx 0.85$。在零样本迁移中,其在外部CPSC-2021数据集上针对心房颤动检测获得了PR-AUC $=0.708$,显著优于可比的原始信号Mamba基线,并在PTB-XL数据集上表现出一致的跨数据集性能。消融研究表明,确定性形态特征提供了坚实基础,而显式的节律建模与长程上下文是跨域鲁棒性的关键驱动因素。