An Adaptive and Time-Efficient ECG R-Peak Detection Algorithm

Qin Qin, Jianqing Li, Yinggao Yue, Chengyu LiuJournal of Healthcare Engineering 2017 · DOI

TL;DR

This paper presents a novel, adaptive, and time-efficient algorithm for detecting R-peaks in ECG signals, crucial for diagnosing heart conditions. By combining wavelet analysis for signal enhancement with a unique adaptive thresholding approach, the algorithm achieves high accuracy while significantly reducing processing time compared to traditional methods.

What Problem Does This Paper Address?

Real-time monitoring of electrocardiogram (ECG) signals is increasingly important for early detection of cardiovascular diseases, especially with the rise of wearable and wireless devices. However, ECG signals are often corrupted by various noise sources like baseline drift, electrode motion, and muscle artifacts. These noises can significantly impede the accurate detection of R-peaks, which are fundamental markers for extracting other vital ECG features and diagnosing arrhythmias. Existing methods, while effective, can be computationally intensive, posing a challenge for resource-constrained portable devices. This paper aims to bridge this gap by developing an algorithm that is both accurate and computationally efficient, even on noisy ECG data.

Methods

The proposed algorithm employs a multi-stage approach:

  1. Wavelet Multiresolution Analysis (WMRA): This technique is used to enhance the ECG signal by decomposing it into different frequency sub-bands. It effectively filters out noise components outside the typical ECG frequency range (0.05-100 Hz), thereby improving the signal-to-noise ratio and strengthening the representation of relevant ECG features.
  2. Signal Mirroring: To address cases where R-peaks might have large negative amplitudes (e.g., in premature ventricular contractions), the algorithm mirrors these segments. This ensures that both positive and negative R-peaks are treated similarly for detection.
  3. Local Maximum Detection: A first-order forward differential approach is used to identify potential R-peak locations by detecting significant changes in the signal slope.
  4. Adaptive Amplitude and Time Interval Thresholding: This is the core of the algorithm's novelty. Instead of using fixed thresholds, the algorithm adaptively determines amplitude (a_t) and time interval (ti_t) thresholds based on the characteristics of the local maxima within a segment. This allows the algorithm to adjust to variations in heart rate and R-peak amplitudes, making it robust to different ECG signal qualities. The thresholds are dynamically updated as new signal segments arrive.

Datasets

The algorithm was evaluated on two widely recognized ECG databases:

  • MIT-BIH Arrhythmia Database (MITDB): This database contains 48 ECG records with a total of 109,966 beats. It is known for its diverse range of arrhythmias and signal quality variations, including noise.
  • QT Database (QTDB): This database consists of 105 15-minute ECG recordings, totaling 86,995 beats. It is designed to represent a wide variety of QRS and ST-T morphologies and real-world variability.

Key Insights and Ideas

  • Adaptive Thresholding is Key: The most significant insight is the effectiveness of adaptive thresholding. By dynamically adjusting amplitude and time interval thresholds based on the signal's local characteristics, the algorithm can better handle variations in heart rate and R-peak morphology, which are challenging for fixed-threshold methods.
  • WMRA for Robustness: Wavelet analysis proves to be a powerful tool for pre-processing ECG signals, effectively isolating the relevant frequency components and mitigating the impact of common noise sources.
  • Mirroring for Comprehensive Detection: The signal mirroring step is crucial for ensuring that R-peaks with negative amplitudes are not missed, a common issue in some detection algorithms.
  • Time Efficiency Without Sacrificing Accuracy: The algorithm demonstrates that high accuracy can be achieved without resorting to computationally expensive techniques, making it suitable for real-time applications.

Key Results

The proposed algorithm demonstrated excellent performance on both datasets:

  • MIT-BIH Arrhythmia Database:
    • Average Sensitivity (SEN): 99.39%
    • Average Positive Predictivity (+P): 99.49%
    • Average Accuracy (ACC): 98.89%
  • QT Database:
    • Average Sensitivity (SEN): 99.83%
    • Average Positive Predictivity (+P): 99.90%
    • Average Accuracy (ACC): 99.73%

In terms of time consumption, the algorithm significantly outperformed the traditional Pan-Tompkins method:

  • MITDB: Average time per record: 0.872 s (30.6% time reduction compared to Pan-Tompkins).
  • QTDB: Average time per record: 0.763 s (32.9% time reduction compared to Pan-Tompkins).

The algorithm exhibits linear time complexity, meaning its processing time scales linearly with the input data size, making it efficient for large datasets.

Limitations and Future Work

  • Small R-Peak Detection: The authors acknowledge that the amplitude thresholding might occasionally miss very small R-peaks, especially when they are mixed with large R-peaks or significant baseline drift (as seen in record 207 of MITDB).
  • Record 207 Anomaly: Record 207 in the MITDB database presents a particular challenge due to its highly distorted heartbeats, which even struggle to be recognized by cardiologists. This record significantly impacted the overall accuracy metrics.
  • Future Work: The authors suggest that further research could explore more advanced techniques to improve the detection of small R-peaks in challenging noisy environments. Additionally, investigating the optimal selection of the Kamp and Ktime coefficients for various signal types could be beneficial.

Summary updated

Abstract

R-peak detection is crucial in electrocardiogram (ECG) signal analysis. This study proposed an adaptive and time-efficient R-peak detection algorithm for ECG processing. First, wavelet multiresolution analysis was applied to enhance the ECG signal representation. Then, ECG was mirrored to convert large negative R-peaks to positive ones. After that, local maximums were calculated by the first-order forward differential approach and were truncated by the amplitude and time interval thresholds to locate the R-peaks. The algorithm performances, including detection accuracy and time consumption, were tested on the MIT-BIH arrhythmia database and the QT database. Experimental results showed that the proposed algorithm achieved mean sensitivity of 99.39%, positive predictivity of 99.49%, and accuracy of 98.89% on the MIT-BIH arrhythmia database and 99.83%, 99.90%, and 99.73%, respectively, on the QT database. By processing one ECG record, the mean time consumptions were 0.872 s and 0.763 s for the MIT-BIH arrhythmia database and QT database, respectively, yielding 30.6% and 32.9% of time reduction compared to the traditional Pan-Tompkins method.
BibTeX
@article{qin2017adaptive,
  author = {Qin Qin and Jianqing Li and Yinggao Yue and Chengyu Liu},
  title = {{An Adaptive and Time-Efficient ECG R-Peak Detection Algorithm}},
  journal = {Journal of Healthcare Engineering},
  year = {2017},
  doi = {10.1155/2017/5980541},
}
Figure