A novel application for real-time arrhythmia detection using YOLOv8

Guang Jun Nicholas Ang, Aritejh Kr Goil, Henryk Chan, Xin Chun Lee, Raihan Bin Ahmad Mustaffa, Timotius Jason, Ze Ting Woon, Bingquan ShenarXiv 2023 · DOI · arXiv

Introduction

Cardiac arrhythmias are a significant global health challenge and a leading cause of cardiovascular mortality. Early detection is critical for life-saving interventions, yet arrhythmias are often intermittent and difficult to capture during standard clinical visits. Traditional Computer-Aided Diagnostic (CAD) systems typically rely on complex 1D signal processing, which necessitates a computationally intensive "beat segmentation" step to isolate individual heartbeats before classification. This requirement creates a significant bottleneck for real-time monitoring on low-power wearable devices.

Researchers have recently proposed a breakthrough by adapting the YOLOv8 object detection framework—originally designed for identifying objects like vehicles or pedestrians—to detect and classify heart arrhythmias. By reframing ECG signal processing as a computer vision task, the model achieves a remarkable 99.5% accuracy and an inference speed of just 2 milliseconds, offering a viable path for high-precision, home-based cardiac monitoring.

Methodology

The core innovation of this research lies in treating ECG waveforms as 2D images rather than 1D signals. The workflow involves several key stages, from data preprocessing to advanced model optimization.

The proposed research workflow, from 1D database processing to model evaluation.

2D Transformation and Architecture

1D ECG signals from the MIT-BIH database were converted into 2D images by plotting voltage-over-time waveforms onto a 640x640 canvas. The team utilized the "nano" version of YOLOv8 (YOLOv8n), a lightweight single-stage detector with only 3.2 million parameters, making it ideal for edge deployment.

Loss Function Enhancements

To tailor the model for medical diagnostics, two major modifications were introduced:

  • Dynamic Inverse-Class Frequency (DICF): This addresses the inherent class imbalance in cardiac data, where normal beats significantly outnumber arrhythmic ones. DICF dynamically adjusts weights during training to ensure the model remains sensitive to rare but critical arrhythmia types.
  • Wise IoU (WIoU v3): This improves the precision of bounding boxes around heartbeats, particularly when signal quality is degraded or annotations are slightly imprecise.
ECG waveforms transformed into 2D images with labeled bounding boxes for arrhythmia detection.

Data Preparation

The study utilized the MIT-BIH Arrhythmia Database, the gold standard in the field. The 1D data was transformed into 42,417 images, each containing roughly 4.3 heartbeats. Beats were labeled according to the AAMI standard into five categories: Normal (N), Supraventricular (S), Ventricular (V), Fusion (F), and Unknown (Q). During training, "Mosaic Augmentation" was used to combine segments of different images, helping the model generalize across various waveform patterns.

Key Results and Discussion

The model's performance sets a new benchmark for automated arrhythmia detection:

  • Accuracy: 99.5% average classification accuracy.
  • mAP50: 0.992 (Mean Average Precision), indicating high reliability in both beat localization and classification.
  • Speed: An inference time of 0.002 seconds (2ms) per frame on an NVIDIA Tesla V100, equating to roughly 430 FPS—far exceeding the requirements for real-time monitoring.

By treating the heartbeat as an "object," the model naturally captures the temporal relationships between P, QRS, and T waves without manual feature engineering. Furthermore, because YOLO predicts bounding boxes, it effectively performs segmentation and classification in a single forward pass, eliminating the traditional computational bottleneck.

Conclusion and Future Work

While the results are promising, the authors identify several areas for future development. The "black box" nature of deep learning remains a hurdle for clinical trust; future iterations will likely incorporate Explainable AI (XAI) to highlight the specific waveform features that trigger an alarm. Additionally, the model must be tested against the "noise" of real-world environments, such as motion artifacts in wearable sensors. Expanding the detection capabilities from five broad AAMI categories to all 17 specific arrhythmia types remains a primary goal for the next phase of research.

Summary updated

BibTeX
@misc{ang2023novel,
  author = {Guang Jun Nicholas Ang and Aritejh Kr Goil and Henryk Chan and Xin Chun Lee and Raihan Bin Ahmad Mustaffa and Timotius Jason and Ze Ting Woon and Bingquan Shen},
  title = {{A novel application for real-time arrhythmia detection using YOLOv8}},
  year = {2023},
  eprint = {2305.16727},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2305.16727},
}
Figure