Abstract
Automatic detection and alarm of abnormal electrocardiogram (ECG) events play an important role in an ECG monitor system; however, popular classification models based on supervised learning fail to detect abnormal ECG effectively. Thus, we propose an ECG anomaly detection framework (ECG-AAE) based on an adversarial autoencoder and temporal convolutional network (TCN) which consists of three modules (autoencoder, discriminator, and outlier detector). The ECG-AAE framework is trained only with normal ECG data. Normal ECG signals could be mapped into latent feature space and then reconstructed as the original ECG signal back in our model, while abnormal ECG signals could not. Here, the TCN is employed to extract features of normal ECG data. Then, our model is evaluated on an MIT-BIH arrhythmia dataset and CMUH dataset, with an accuracy, precision, recall, F1-score, and AUC of 0.9673, 0.9854, 0.9486, 0.9666, and 0.9672 and of 0.9358, 0.9816, 0.8882, 0.9325, and 0.9358, respectively. The result indicates that the ECG-AAE can detect abnormal ECG efficiently, with its performance better than other popular outlier detection methods.
Introduction
Most AI-driven electrocardiogram (ECG) monitors rely on supervised learning, where a model is trained to recognize specific diseases using massive, labeled datasets. However, this approach faces significant hurdles, primarily data imbalance—where normal heartbeats vastly outnumber abnormal ones—and the "open set" problem, where it is nearly impossible to label every possible type of heart abnormality.
To address these issues, this research proposes reframing the task as outlier detection. Instead of teaching a machine what "sick" looks like, the ECG-AAE framework learns the characteristics of "healthy" heartbeats. Anything that deviates from this learned norm is flagged as an anomaly.
Methodology: The ECG-AAE Framework
The proposed ECG-AAE framework integrates three core modules to achieve robust anomaly detection:
- Temporal Convolutional Network (TCN): TCNs use dilated causal convolutions to capture long-term dependencies in ECG time-series data without the high memory overhead of Recurrent Neural Networks (RNNs).
- Adversarial Autoencoder (AAE): The core generative process involves an Encoder mapping the signal to a latent space and a Decoder reconstructing it. A Discriminator ensures the reconstructions are realistic through adversarial training.
- Outlier Detector: An Anomaly Score is calculated based on reconstruction error and the discriminator's score. If the score exceeds a set threshold (T), the signal is flagged as an anomaly.
Experimental Setup and Datasets
The model was validated using two datasets:
- MIT-BIH Arrhythmia Dataset: A benchmark containing 48 double-lead ECG recordings, categorized into five types: Normal (N), Left/Right bundle branch blocks (LBBB/RBBB), Atrial premature beats (APB), and Ventricular premature beats (PVC).
- CMUH Dataset: A real-world dataset from the First Affiliated Hospital of China Medical University, containing 12-lead records from over 44,000 patients.
The model was trained exclusively on "Normal" beats, allowing it to become an expert at reconstructing healthy patterns while failing to accurately reconstruct abnormal ones.
Results and Discussion
The ECG-AAE was compared against 13 other outlier detection methods. On the MIT-BIH dataset, it achieved an accuracy of 0.9673 and an AUC of 0.9672, with particularly high precision (0.9854). On the CMUH dataset, it maintained strong performance with an accuracy of 0.9358.
The results demonstrate that ECG-AAE consistently outperforms traditional machine learning models like GMM and iForest, as well as GAN-only approaches. The use of TCNs provides a larger receptive field, allowing the model to analyze the entire heartbeat structure effectively.
Conclusion
The ECG-AAE framework offers a promising unsupervised solution for ECG monitoring, overcoming the limitations of supervised learning in clinical settings. Future work will focus on reducing noise sensitivity and integrating multi-lead data to provide a more holistic view of cardiac health.
Summary updated