Professional Documents
Culture Documents
3, JULY 2006
Combining Algorithms in Automatic Detection of
QRS Complexes in ECG Signals
Carsten Meyer, Jos e Fern andez Gavela, and Matthew Harris
AbstractQRS complex and specically R-Peak detection is the
crucial rst step in every automatic electrocardiogram analysis.
Much work has been carried out in this eld, using various meth-
ods ranging fromltering and threshold methods, through wavelet
methods, to neural networks and others. Performance is generally
good, but each method has situations where it fails. In this paper,
we suggest an approach to automatically combine different QRS
complex detection algorithms, here the PanTompkins and wavelet
algorithms, to benet fromthe strengths of bothmethods. Inpartic-
ular, we introduce parameters allowing to balance the contribution
of the individual algorithms; these parameters are estimated in a
data-driven way. Experimental results and analysis are provided
on the Massachusetts Institute of Technology-Beth Israel Hospital
(MIT-BIH) Arrhythmia Database. We show that our combination
approach outperforms both individual algorithms.
Index TermsAutomatic QRS complex detection, automatic
R-peak detection, combination algorithm, ensemble method,
Massachusetts Institute of Technology-Beth Israel Hospital (MIT-
BIH) Arrhythmia Database, Pan-Tompkins algorithm, wavelet al-
gorithm.
I. INTRODUCTION
T
HE QRS complex is the most prominent feature in the
electrocardiogram (ECG) signal and corresponds to the
ventricular excitation. The automatic detection of QRS com-
plexes (and central R-peaks) in an ECG signal is the crucial
rst step in any automatic ECG analysis. A number of algorith-
mic techniques have been developed for automatic ECG signal
segmentation and, in particular, QRS complex detection.
Many QRS complex detection algorithms involve a prepro-
cessor stage, where the ECG signal is transformed to accentuate
the QRS complex, and a decision stage, where a QRS com-
plex is detected, using thresholding. The most well known such
method is the PanTompkins (PT) algorithm [1]. Neural net-
works, trained to be adaptive nonlinear predictors of the ECG
signal, have been used for QRS complex detection [2], [3]. As
most of the ECG signal contains non-QRS segments, and the
signal in a QRS segment looks very different to the rest of
the signal, such neural networks have a high-prediction error
on QRS segments (and low-prediction error elsewhere). Con-
sequently, the prediction error constitutes a feature for QRS
complex detection [2], [3]. In another method, adaptive lters
Manuscript received August 30, 2005; revised December 8, 2005 and
December 16, 2005. This work was supported by the E.U. Marie Curie In-
dustry Host Fellowship Program under Contract IST-2001-82941.
C. Meyer and M. Harris are with Philips Research Laboratories, D-52066
Aachen, Germany (e-mail: carsten.meyer@philips.com; matthew.harris@
philips.com).
J. Fern andez Gavela was with Philips Research Laboratories, D-52066
Aachen, Germany. He is now with Telef onica Soluciones, E-28020 Madrid,
Spain.
Digital Object Identier 10.1109/TITB.2006.875662
have been used to give an estimate of the current ECG sample
as a weighted sum of previous ECG samples. The weights in
the sum are updated according to the changing signal statistics.
Sharp changes in the weights and in the errors of the current ECG
sample estimate were used as features for QRS complex detec-
tion (see, e.g., [4]). Other approaches include cross-correlation
methods, where a QRS-complex template is aligned to the ECG
signal [5], and syntactic approaches, where the ECG signal is
represented as a piecewise linear approximation, and is analyzed
using syntactic rules [6], [7]. For an overview of these and other
approaches see, e.g., [8] and [9].
However, the large variation in the QRS complex waveforms
as well as noise continue to present challenges to the algorithms,
so that further performance improvements are still an important
goal of current research.
Instead of further optimizing any individual QRS detection
method, we focus in this paper on combining two such state-
of-the-art algorithms, namely, the PT [1] and the wavelet algo-
rithm[10][12]. This is motivated rst by the general notion that
such a combination approach, which can be seen as an example
for an ensemble classier,
1
may improve upon the perfor-
mance of the individual classiers [13]. Second, for the task of
QRS complex detection, the large performance gain that can be
achieved by the optimal combination of the two algorithms
determined on our database in a cheating experiment (see
Section III-B)strongly motivate a combination approach. The
goal of our paper is to develop a data-driven framework for
combining algorithms in automatic QRS complex detection.
In a previous approach, Moraes et al. [14] combined two QRS
detection methods, namely, an algorithm proposed by Engelse
and Zeelenberg [15] and a second one based on the PT and
LigtenbergKunt algorithms [16]. In this approach, classica-
tion by the secondary detector is invoked only in case the rst
classier observes an undened event [14]. In this case, the
output fromthe secondary detector is used to determine whether
the event is a QRS complex.
Our combination algorithm differs from the approach by
Moraes et al. in three aspects: First, in our approach, the predic-
tion of both algorithms always enter into determining the nal
decision. Second, we propose a exible (instead of a xed)
combination scheme which is triggered by two parameters al-
lowing to balance the inuence of the two individual algorithms.
Third, these parameters are estimated in a data-driven way al-
lowing to adapt our combination scheme to individual data sets.
In experiments on the Massachusetts Institute of Technology-
Beth Israel Hospital (MIT-BIH) Arrhythmia Database, we show
1
By classication we mean the binary decision of detecting or not detecting
a QRS complex in a given time frame.
1089-7771/$20.00 2006 IEEE
MEYER et al.: COMBINING ALGORITHMS IN AUTOMATIC DETECTION OF QRS COMPLEXES IN ECG SIGNALS 469
that our combination approach improves performance over both
individual algorithms.
This paper is organized as follows. In Section II, we give a
brief description of the PT and wavelet algorithms used in our
combination approach. Section III is dedicated to describing
our framework for combining the two QRS complex detection
methods. This also includes an oracle experiment yielding the
best possible combination performance (Section III-B). In Sec-
tion IV, we experimentally evaluate our algorithm, including
some analysis and examples. Finally, in Section V, we discuss
and conclude our study.
II. QRS COMPLEX DETECTION METHODS USED IN OUR
COMBINATION ALGORITHM
We apply our combination approach to the PT and wavelet
QRS detection algorithms, which are among the best perform-
ing algorithms for this task [17]. In this section, we briey
describe both methods; for more details, we refer the reader to
the corresponding papers.
A. PT Method
The PT algorithm [1] is the most well-known example of a
lter threshold method for QRS complex detection. It comprises
a bandpass lter, a differentiator, a squaring operation, and a
moving window integrator. The bandpass lter lters out excess
noise. The differentiator and squaring operation accentuate steep
prominent features and the integrator carries out a smoothing
operation, whose window length might be adjusted such that
features with a particular width are accentuated.
The key parameter in the PT method is the threshold . QRS
complexes are detected in regions where the ltered signal rises
above the threshold . If no peak is detected within a time
interval , QRS complexes are looked for where the ltered
signal rises above a second, lower threshold
2
(a xed fraction
of ). Also, QRS complexes are not allowed to be within 0.3 s
(refractory time
2
) of each other. The thresholds and
2
are
dynamically updated according to the amplitudes of the R-peak
maxima in the ltered signal. For a more detailed description of
the algorithm see [1].
Interesting for our combination approach is the threshold
parameter . By varying this parameter, we can control the
sensitivity of the algorithm and, thus, the number of detected
QRS complexes. Increasing results in only very prominent
maxima in the ltered signal being found (and thus very likely
QRS complexes) and lowering means more maxima will be
predicted, some of which may be noise.
B. Wavelet Method
In our experiments, we used the wavelet QRS detector de-
scribed by Li et al. [10] and Mallat and Hwang [11].
2
In our experiments on noisy excerpts, large P-waves between 200 and 300 ms
from the QRS complex were additionally detected as QRS complexes. There-
fore, we obtained better results on our database with 0.3 s refractory time than
with 0.2 s, as used in [1].
The wavelet transform is a decomposition of a signal into
a set of basis functions, similar to a Fourier decomposition.
In the Fourier decomposition, the basis functions are dilations
and translations of the sine function. Comparably, the wavelet
basis functions are dilations (characterized by a parameter a)
and translations (characterized by a parameter b) of a prototype
function (x) with bounded support, called the mother wavelet.
The transformation W(a, b) of function x(t) is, thus, dened as
W(a, b)(x) =
1
x(t)
t b
a
dt. (1)
Examining the components of the wider (more dilated) ba-
sis functions (large a) gives information about the lower fre-
quency components of the signal as a function of time (b in
the transformed space). Similarly, the components for small a
give high-frequency information about the signal as a function
of time. By choosing a = 2
j
and b = 2
j
l (called the dyadic
wavelet transform), the wavelet transformation can be simply
implemented with repeated use of nite-impulse response l-
ters [12], [17], [18]. We thus obtain a sequence of functions
(indexed by j), which are called scales. Low scales contain
high-frequency information about the signal and high scales
contain low-frequency information about the signal.
In the wavelet QRS detection algorithm from Li et al. [10],
the rst four scales of the wavelet transformation are considered.
The rst scale contains high-frequency noise and the QRS com-
plex. The QRS complex is so prominent that it is clearly visible
on all four scales; however, it is most prominent in the second
and third scales. The fourth scale contains lower frequency in-
formation including T-wave information and baseline drift. The
wavelet method for detecting QRS complexes involves identify-
ing clear peaks in each scale and matching themcorrectly across
the different scales. For more details, see [10].
III. COMBINATION APPROACH
A. Motivation
The PT algorithm is good at detecting clear QRS complexes,
but is less able to detect wider QRS complexes, like prema-
ture ventricular contractions. The implemented wavelet method
is better able to detect wider and unusually shaped QRS com-
plexes, but is sometimes prone to missing some normal shaped
complexes. By combining the predictions of the two classiers,
we aimto obtain an improved QRS complex detection algorithm
combining the strengths of the individual algorithms, while
compensating their weaknesses. Our combination approach is
an example for an ensemble classier (see, e.g., [13]). As dis-
cussed in [13], an ensemble classier can be more accurate than
any of its individual members if the individual classiers are
doing better than random guessing and if they make different
(uncorrelated) errors on new data points [19]. This motivates
our approach from a theoretical perspective.
The second motivation comes from an empirical validation,
by evaluating the maximal improvement that can be obtained by
combining the base algorithms, assuming the perfect decision
strategy if both classiers disagree in their predictions. This will
be explained in Section III-B.
470 IEEE TRANSACTIONS ON INFORMATION TECHNOLOGY IN BIOMEDICINE, VOL. 10, NO. 3, JULY 2006
B. Oracle Experiment
In this section, we determine the maximal performance gain
that can be achieved by our combination approach over the
individual algorithms by assuming the perfect decision strategy
(oracle experiment).
First, it is reasonable to assume that in case of agreement
of the two algorithms whether to predict a QRS complex
location or not, this decision is accepted (majority vote).
At times where both algorithms make the wrong decision, the
combination will also be incorrect. Thus, there is an intrinsic
lower bound to the error rate that can be achieved by the
optimal combination, dictated by the accuracy of the two
individual algorithms. If instead the two algorithms disagree
about the presence of a QRS complex at a given time, in the
oracle experiment the idea is to take the correct decision, using
the cardiologist annotation. Formally, this can be viewed as
adding a third classier to the ensemble performing a perfect
classication (corresponding to the manual annotation) and
accepting the majority vote of the three classiers. This is
a cheating experiment giving the result for the best possible
combination of the two individual algorithms. The results of the
oracle experiment (discussed in Section IV) demonstrate that
the QRS detection performance can be dramatically improved
by optimally combining the two individual detection methods.
This indicates that the PT and wavelet methods partly contain
complementary information about the location of the QRS
complexes. This strongly motivates a combination approach.
In Section III-C, we suggest an automatic decision strategy
that does not use the manual annotation.
C. Combination Algorithm
In our combination approach, rst the two individual algo-
rithms (wavelet and PT) are run in parallel. If both classiers
agree whether to predict a QRS complex location at time t, this
decision is accepted. In case of disagreement between the two
individual classiers at time t, the basic idea is to rerun the PT
algorithm
3
locally (i.e., in a suitable time windowaround time t),
however with adjusted threshold