A lightweight and robust method for electrocardiogram anomaly detection and localization using multi-scale masked autoencoder
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.
Authors
- Yujie Yang (ORCID: https://orcid.org/0000-0002-5207-3573)
- John Q. Gan (ORCID: https://orcid.org/0000-0003-1230-7643)
- Xiangjie Li
- Jing Yuan
- Ya Zhou
- Wei Zhao
Institutions
- Chinese Academy of Medical Sciences & Peking Union Medical College (CN)
- National Health and Family Planning Commission (CN)
Publication Details
- Journal
- PLoS ONE
- Published
- 2026-03-17
- DOI
- https://doi.org/10.1371/journal.pone.0343571
- Primary Topic
- Anomaly Detection Techniques and Applications
- Type
- article
- Field-Weighted Citation Impact
- 0.00