A CNN-based Local-Global Self-Attention via Averaged Window Embeddings for Hierarchical ECG Analysis

Authors:
  • ABArthur Buzelin
    Arthur Buzelin
  • PDPedro Robles Dutenhefner
    Pedro Robles Dutenhefner
  • TRTuri Rezende
    Turi Rezende
  • LPLuisa G. Porfirio
    Luisa G. Porfirio
  • PBPedro Bento
    Pedro Bento
  • YAYan Aquino
    Yan Aquino
  • JFJose Fernandes
    Jose Fernandes
  • CSCaio Santana
    Caio Santana
  • GMGabriela Miana
    Gabriela Miana
  • GPGisele L. Pappa
    Gisele L. Pappa
  • ARAntonio Ribeiro
    Antonio Ribeiro
  • WMWagner Meira
    Wagner Meira

Abstract
Cardiovascular diseases remain the leading cause of global mortality, emphasizing the critical need for efficient diagnostic tools such as electrocardiograms (ECGs). Recent advancements in deep learning, particularly transformers, have revolutionized ECG analysis by capturing detailed waveform features as well as global rhythm patterns. However, traditional transformers struggle to effectively capture local morphological features that are critical for accurate ECG interpretation. We propose a novel Local-Global Attention ECG model (LGA-ECG) to address this limitation, integrating convolutional inductive biases with global self-attention mechanisms. Our approach extracts queries by averaging embeddings obtained from overlapping convolutional windows, enabling fine-grained morphological analysis, while simultaneously modeling global context through attention to keys and values derived from the entire sequence. Experiments conducted on the CODE-15 dataset demonstrate that LGA-ECG outperforms state-of-the-art models and ablation studies validate the effectiveness of the local-global attention strategy. By capturing the hierarchical temporal dependencies and morphological patterns in ECG signals, this new design showcases its potential for clinical deployment with robust automated ECG classification.
All Related Versions