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

**Authors:** Ya Zhou, Yujie Yang, Jianhuang Gan, Xiangjie Li, Jing Yuan, Wei Zhao

PMC · DOI: 10.1371/journal.pone.0343571 · PLOS One · 2026-03-17

## TL;DR

This paper introduces a new method for detecting and locating anomalies in ECG signals using a lightweight multi-scale masked autoencoder, reducing computational costs while improving performance.

## Contribution

The novel multi-scale masked autoencoder (MMAE-ECG) enables efficient ECG anomaly detection without requiring R-peak detection or segmentation.

## Key findings

- MMAE-ECG achieves state-of-the-art performance in ECG anomaly detection and localization.
- The method reduces inference FLOPs by 78 times and trainable parameters by 18 times compared to previous methods.
- Ablation studies confirm the effectiveness of the multi-scale components in improving anomaly score estimation.

## 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.

## Full-text entities

- **Diseases:** cardiac conditions (MESH:D006331), ECG anomaly (MESH:D008133), anomaly (MESH:D000013)

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/PMC12995306/full.md

## Figures

4 figures with captions in the complete paper: https://tomesphere.com/paper/PMC12995306/full.md

## References

50 references — full list in the complete paper: https://tomesphere.com/paper/PMC12995306/full.md

---
Source: https://tomesphere.com/paper/PMC12995306