Table of Contents
Fetching ...

Cardioformer: Advancing AI in ECG Analysis with Multi-Granularity Patching and ResNet

Md Kamrujjaman Mobin, Md Saiful Islam, Sadik Al Barid, Md Masum

TL;DR

Cardioformer addresses the challenge of ECG classification by capturing local morphology and long-range temporal dependencies in multichannel ECG signals. It introduces cross-channel multi-granularity patch embedding combined with a two-stage self-attention mechanism and residual refinement to fuse multi-scale representations. On PTB, PTB-XL, and MIMIC-IV under subject-independent splits, it achieves AUROCs of $96.34\%$, $89.99\%$, and $95.59\%$ respectively, and shows cross-dataset generalization when trained on MIMIC-IV ($49.18\%$ on PTB and $68.41\%$ on PTB-XL). The work demonstrates the potential of hybrid transformer-residual architectures for robust, multi-lead ECG diagnosis and provides open-source code for reproducibility at the provided GitHub link.

Abstract

Electrocardiogram (ECG) classification is crucial for automated cardiac disease diagnosis, yet existing methods often struggle to capture local morphological details and long-range temporal dependencies simultaneously. To address these challenges, we propose Cardioformer, a novel multi-granularity hybrid model that integrates cross-channel patching, hierarchical residual learning, and a two-stage self-attention mechanism. Cardioformer first encodes multi-scale token embeddings to capture fine-grained local features and global contextual information and then selectively fuses these representations through intra- and inter-granularity self-attention. Extensive evaluations on three benchmark ECG datasets under subject-independent settings demonstrate that model consistently outperforms four state-of-the-art baselines. Our Cardioformer model achieves the AUROC of 96.34$\pm$0.11, 89.99$\pm$0.12, and 95.59$\pm$1.66 in MIMIC-IV, PTB-XL and PTB dataset respectively outperforming PatchTST, Reformer, Transformer, and Medformer models. It also demonstrates strong cross-dataset generalization, achieving 49.18% AUROC on PTB and 68.41% on PTB-XL when trained on MIMIC-IV. These findings underscore the potential of Cardioformer to advance automated ECG analysis, paving the way for more accurate and robust cardiovascular disease diagnosis. We release the source code at https://github.com/KMobin555/Cardioformer.

Cardioformer: Advancing AI in ECG Analysis with Multi-Granularity Patching and ResNet

TL;DR

Cardioformer addresses the challenge of ECG classification by capturing local morphology and long-range temporal dependencies in multichannel ECG signals. It introduces cross-channel multi-granularity patch embedding combined with a two-stage self-attention mechanism and residual refinement to fuse multi-scale representations. On PTB, PTB-XL, and MIMIC-IV under subject-independent splits, it achieves AUROCs of , , and respectively, and shows cross-dataset generalization when trained on MIMIC-IV ( on PTB and on PTB-XL). The work demonstrates the potential of hybrid transformer-residual architectures for robust, multi-lead ECG diagnosis and provides open-source code for reproducibility at the provided GitHub link.

Abstract

Electrocardiogram (ECG) classification is crucial for automated cardiac disease diagnosis, yet existing methods often struggle to capture local morphological details and long-range temporal dependencies simultaneously. To address these challenges, we propose Cardioformer, a novel multi-granularity hybrid model that integrates cross-channel patching, hierarchical residual learning, and a two-stage self-attention mechanism. Cardioformer first encodes multi-scale token embeddings to capture fine-grained local features and global contextual information and then selectively fuses these representations through intra- and inter-granularity self-attention. Extensive evaluations on three benchmark ECG datasets under subject-independent settings demonstrate that model consistently outperforms four state-of-the-art baselines. Our Cardioformer model achieves the AUROC of 96.340.11, 89.990.12, and 95.591.66 in MIMIC-IV, PTB-XL and PTB dataset respectively outperforming PatchTST, Reformer, Transformer, and Medformer models. It also demonstrates strong cross-dataset generalization, achieving 49.18% AUROC on PTB and 68.41% on PTB-XL when trained on MIMIC-IV. These findings underscore the potential of Cardioformer to advance automated ECG analysis, paving the way for more accurate and robust cardiovascular disease diagnosis. We release the source code at https://github.com/KMobin555/Cardioformer.
Paper Structure (11 sections, 10 equations, 2 figures, 4 tables)

This paper contains 11 sections, 10 equations, 2 figures, 4 tables.

Figures (2)

  • Figure 1: multi-Granularity workflow
  • Figure 2: Architecture of Cardioformer for ECG classification, integrating multi-granularity embeddings, self-attention, and residual networks for enhanced feature extraction and classification.