A lightweight and robust method for electrocardiogram anomaly detection and localization using multi-scale masked autoencoder

Y Ya Zhou Y Yujie Yang (Key Laboratory of Colloid and Interface Chemistry of the Ministry of Education, School of Chemistry and Chemical Engineering, Shandong University) J Jianhuang Gan X Xiangjie Li J Jing Yuan W Wei Zhao

Abstract

Electrocardiogram (ECG) analysis is crucial for diagnosing cardiovascular conditions. While traditional classification models require large volumes of labeled data across multiple disease categories, anomaly detection offers a flexible alternative by identifying deviations from normal patterns—an approach particularly valuable given the rarity and diversity of cardiac conditions. However, existing anomaly detection methods often rely on R-peak detection or heartbeat segmentation, which increases preprocessing complexity and reduces robustness to signal variability. To address these limitations, we propose MMAE-ECG, a multi-scale masked autoencoder designed to capture both global and local dependencies without such preprocessing steps. MMAE-ECG integrates a multi-scale masking strategy and a multi-scale attention mechanism with distinct positional embeddings, enabling a lightweight Transformer encoder to efficiently model ECG signals. Additionally, an aggregation strategy is introduced to improve anomaly score estimation. Experiments demonstrate that MMAE-ECG achieves state-of-the-art performance in both anomaly detection and localization while significantly reducing computational costs. Specifically, it requires only approximately 1/78 of the inference FLOPs and 1/18 of the trainable parameters compared to the previous leading method. Ablation studies further validate the contributions of each component, demonstrating the potential of multi-scale masked autoencoders as an effective and efficient approach for ECG anomaly detection.

Article Details

Journal PLoS ONE
Volume / Issue Vol. 21, Issue 3
Published March 17, 2026
Pages e0343571
ISSN 1932-6203
Publisher Public Library of Science

Journal Info

PLoS ONE

Public Library of Science

ISSN: 1932-6203 Open Access Health Sciences

Authors (6)

Y

Ya Zhou

Y

Yujie Yang

Key Laboratory of Colloid and Interface Chemistry of the Ministry of Education, School of Chemistry and Chemical Engineering, Shandong University

J

Jianhuang Gan

X

Xiangjie Li

J

Jing Yuan

W

Wei Zhao