The ECG is often corrupted by different types of noise, namely, power line interference, electrode contact and motion artifacts, respiration, electrical activity of muscles in the vicinity of the electrodes and interference from other electronic devices. Analysis of noisy ECGs is difficult for humans and for computer programs. In this work we place ourselves in context of automatic and semi automatic ECG analysis: denoising should facilitate automatic ECG analysis.
General denoising signal processing methods have been applied to ECG. Low pass linear filters are used for high frequency noise removal, namely power line interference and muscle activity artifacts. High pass linear filters can be applied to cancel baseline wander. The use of neural networks to ECG denoising has been, to our knowledge, limited to the removal of these two types of noise. Other denoising tools are median filter, wavelet transform methods, empirical mode decomposition, morphological filters, non linear bayesian filtering and template matching. We will focus on noise introduced by electrode motion which causes more difficulties in ECG analysis. Our method adapts to each particular ECG channel and learns how to reproduce it from a noisy version of the different channels available.
In the Physionet/Cinc Challenge 2010 it was shown that we can use some physiological signals to reconstruct another physiological signal, in particular an ECG [17, 20, 21]. This approach to reconstructing the noisy ECG channel is a simplified version, but equally effective, of the winning entry in that Challenge. We show that the procedure is robust against noise in the input signals and can include, as an input, the channel we want to denoise.
If an ECG channel we want to use for ECG analysis is, at some time segment, contaminated with noise, we call it the target channel in our denoising process.
The method uses a feedforward neural network. A prerequisite for applying it is the target channel to be free from noise for some minutes, in order to train the neural network. The other channels used by the procedure may have noise in training time. If one channel has much more noise than others, it might be better not to use it for the reconstruction, even if it is the target channel.
The neural network will receive the samples as input, from one or more channels, corresponding to time segments with a fixed length. The output will be the samples from the target channel corresponding to the time segment used in the input. We used time segments with lengths of between one and three seconds, depending on the channels we use for reconstruction: one second if we use the target channel and another channel, two seconds, if we do not use the target channel, and three seconds, if we only use the target channel.
To reconstruct one ECG channel we collected time segments, from the ECG each one starting 16 samples after the preceding segment. After obtaining the output of the neural network, corresponding to each of the , the value of the reconstruction on sample will be the average value of the sample outputs corresponding to , using all that contain .
The proposed method could be applied to a Holter record, reconstructing those time segments where an important level of noise is identified and using the remaining time of the Holter record for training.
2.1 Neural network architecture and training
We used a neural network with three hidden layers. The number of units on each of those layers was approximately 1000 in all experiments. To train the neural network, we constructed a sequence of time segments each one starting five samples after the beginning of the previous one. There is no need to use fiducial points to create input data to the neural network.
to learn the neural network weights: following initialization using a stack of Restricted Boltzmann Machines, we applied backpropagation algorithm to fine tune the weights. For details on the training procedure for Restricted Boltzmann Machines, we refer to Hinton.
As usual, when using feedforward neural networks, we normalized the input data, to accelerate the learning process. First we applied a moving average filter, with the window size equal to the sampling rate. Then we subtracted the result from the signal, thus reducing the baseline wander. In the output signal, instead of the moving average filter we applied a median filter: it is more effective in the removal of baseline wander. Finally, we scaled the output signal to have unit variance and multiplied the input signals by the same scale factor.
We implemented our method using GNU Octave language and, to reduce training and reconstruction time, we ran most time consuming code on a Graphics Processing Unit. Our code is available at the first author’s web page.
2.2 Evaluating the method
Evaluating ECG denoising methods is not an obvious task. A common way of doing it is to add add noise to an existing signal and measure the Root Mean Square Error (RMSE) of the denoised signal relative to the original signal. This approach has some disadvantages. Firstly, when using a large data base of ECGs, is difficult to avoid noise in the original signal, and we do not want to punish the denoising method for not reconstructing the noise in the original signal. Secondly, RMSE does not always reflect the difficulties in analysing a noisy ECG. For instance, a constant baseline shift in the reconstructed signal is not very disturbing, but might correspond to a high RMSE value.
In this study we report RMSE in the reconstructed signal when we artificially add noise in the ECG, but we also evaluate our method using some publicly available programs that analyse the ECG: we compare the results of applying these programs with and without denoising the corrupted ECG. Although those programs alredy have a preprocessing stage to deal with noise, we show that, in the presence of noise, our denoising method improves their results.
2.2.1 Programs used to test this method
is a recent QRS detector, not yet published: the author is George Moody. This program is open source and available with WFDB software, from Physionet. There is an accompaining post-processor ’gqpost’ intended to improve positive predictivity, at a cost of reduced sensitivity. We report the results of ’gqrs’ with and without using gqpost. ’gqpost’ uses a configuration file ’gqrs.conf’; we kept the default values of ’gqrs.conf’. The results of this program ’gqrs’ depend on the value of a threshold parameter; as we did not find a systematic way of determining, for each record, the best value for the threshold, we used the parameter’s default value. For this reason, we do not report the best possible results of this detector in the different records and therefore we should not use this study to compare the perfomance of the different qrs detectors.
- E.P. limited
All the programs listed above act on a single ECG channel, we did not find publicly available methods using more than one channel.
2.3 Statistics used to describe the results of QRS detectors and the beat classifier
For QRS detectors we used the following statistics:
where is the number of correctly detected beats, is the number of false detections and is the number of missed beats. For the beat classifier, we use, as in , the Sensitivity, Positive Predictivity,
where , , and are defined as follows:
is the number of beats correctly classified as VEB.
is the number of non VEBs correctly classified.
is the number of beats wrongly classified as VEB, excluding fusion and unclassifiable beats.
is the number of true VEB not classified as such.
2.4 Adding noise to an existing ECG
In most experiments, to test the behavior of our denoising method, we start with a ’clean’ ECG and add noise to it. For this we use the program nst, written by Geoge Moody .
The standard definition of signal to noise ratio (SNR), in decibels, is:
where and are the power of signal and noise. We used a slightly different value for and , following the method used by the program ’nst’. Next we quote ’nst’ man page :
“ A measurement based on mean squared amplitude, for example, will be proportional to the square of the heart rate. Such a measurement bears little relationship to a detector’s ability to locate QRS complexes, which is typically related to the size of the QRS complex. A less significant problem is that unweighted measurements of noise power are likely to overestimate the importance of very low frequency noise, which is both common and (usually) not troublesome for detectors. In view of these issues, nst defines S as a function of the QRS amplitude, and N as a frequency-weighted noise power measurement. “
More details on the way ’nst’ computes SNR can be found on the man page of ’nst’.
3.1 MIT-BIH Arrhythmia Database
We added noise to both channels in all the 48 records from Physionet MIT-BIH Arrhythmia Database [15, 3], and applied our method to reconstruct the first channel. As it is well known [16, 2], from the three types of noise, baseline wander, muscle artifact and electrode motion artifact, it is the last one that creates most difficulties to ECG analysis programs. We contaminated both channels of each record with electrode motion artifact noise, using the corresponding noise record from the MITBIH Noise Stress Test Database .
In all but one record, both channels were used as input to reconstruct the first channel. In record 103, the noise in the second channel is already very high, therefore, we chose to use only the target channel in the reconstruction.
The clean record and corrupted noisy versions of the same record were used as input for training the neural network. We always used the clean target channel for the output.
The default behavior of the program ’nst’ was followed to add noise to the records used in the tests: starting after the first five minutes from the beginning of each record, we added noise for two minutes, followed by two minutes without noise, repeating the process until the end of the record.
In order to train the neural network, we used all those segments of time where noise was not added in test time. In this way, the parts of noise used during training and testing do not overlap: we kept the neural network from learning the noise used in the test. The amount of noise, used for testing, corresponds to SNR values of 24 db, 18 db, 12 db, 6 db, 0 db and -6 db.
In table 1 we report the fraction of RMSE, in the noisy signal, present in the reconstructed signal: RMSE(denoised signal)/RMSE(noisy signal). As we can see in the table, there are no visible advantages, in terms of RMSE, in applying the denoising methods for low noise (SNR=24db), in fact, situations like the one in figure 2 introduce high values of RMSE because the method is not intended to learn to reproduce the noise of the original signal but just its main pattern. When the values of added noise increase, the errors in the reconstructed signal, due to noise in the original signal, lose their relative importance: for higher values of noise we notice an important reduction in the value of RMSE in the reconstructed signal.As supplementary material to this article, we present the detailed results for each record.
We applied the programs ’gqrs’ and ’EPlimited’ to the first channel, in noisy versions of each record and in the reconstructed signal, to verify whether, after applying our method, there were significant improvements in the performance of those programs. The results are reported in tables 2, 3, 4, 5 . The first column indicates the SNR of the resulting ECG, the same value for both channels, after corrupting it with noise. The second column refers to the signal used when applying the program to the first channel: denoised means the reconstructed noisy first channel, using our method. The tables present the sensitivity, positive predictivity, number of detection errors and error rate, in the case of QRS detectors, and VEB sensitivity, positive predictivity, false positive rate and classification rate, for the ’EP Limited’ beats classification. We used the following programs to report the results: ’bxb’, from WFDB software , in the case of ’gqrs’, and ’bxbep’, in the the case of ’EPLimited’. The numbers are relative to all the 48 records from the MIT-BIH Arrhythmia Database, 91225 beats, from which 6101 are VEBs: we started the test after the first 5 minutes and stopped one second before the end. In the case of EP limited we had to start the test one second later because we could not configure ’bxbep’to behave in another way.
|SNR||signal||VEB||VEB positive||VEB false||classification|
For QRS detectors, after applying our denoising procedure, there is always an improvement in positive predictivity in the tested programs, but, for high values of SNR there is a small reduction in the sensitivity: above 12 db for gqrs and above 6 db for EPLimited. Besides some ectopic beats not being well reconstructed, the reduction in sensitivity is due to a smaller amplitude of the QRS complex in the reconstructed signal; this occurs in the first beat from figure 3. We could improve the sensitivity in the reconstructed signal, at the cost of a reduction in the positive predictivity, multiplying the reconstructed signal by a factor greater than 1.0, but we chose not to do it.
For beat classification there is always a clear improvement after using the proposed method.
As supplementary material to this article, we present the detailed results for each program and record.
3.2 Record mgh124
The MGH/MF Waveform Database [22, 3] is a collection of electronic recordings of hemodynamic and electrocardiographic waveforms. Typical records include three ECG leads. In the case of record mgh124, the first two ECG channels are sometimes strongly contaminated with noise, while the third ECG channel mantains a relatively good quality, therefore we have reliable QRS annotations. Using record mgh124, we tested our denoising method on a real ECG, without having to artificially add noise. In this case we reconstructed the second ECG channel, using only that same channel as input: we trained a neural network to produce a clean segment of the second channel given a corrupted version of the same segment. The clean parts of the channel 2 were used to obtain training data for the neural network.
tables 6 and 7 show the results of ’gqrs’ and ’EP Limited’ on the original second ECG channel and on the reconstructed version. The total number of beats during testing time is 8573, from which 458 are classified as VEBs.
|signal||QRS detection||QRS error||QRS sensitivity||QRS positive|
|signal||VEB sensitivity||VEB positive||VEB false|
3.3 record sele0106 from QT database
Determination of peaks and limits of ECG waves is very important for ECG analysis: they are necessary for ECG measurements that are clinically relevant, namely, PQ interval, QRS duration, ST segment and QT interval.
Physionet QT data base was created to test QT detection algorithms . Each record contains at least 30 beats with manual annotations identifying the beginning, peak and end of the P-wave, the beginning and end of the QRS-complex and the peak and end of the T-wave.
We used the program ’ecgpuwave’ to show that, in some situations, we can improve automatic ECG delineation by using a clean channel to reconstruct a very noisy one.
Typically, the accuracy of ecgpuwave when detecting the limits or peak of some ECG characteristic wave is better in one of the channels. The best channel to locate one of those reference points changes with the different characteristic points and also from record to record.
Table 8 shows the results of ecgpuwave, on the two channels, when it locates P wave peak, P ending, QRS beginning and QRS ending. We are using the first annotator as reference. We can conclude that the error is smaller when ecgpuwave is applied to the second channel.
|reference point||channel||mean error||std error|
At this point we consider an easily imaginable situation, where the second channel is highly corrupted with noise, in such a way that it is better to use only the first channel for the reconstruction of the second channel. In this case we trained a neural network to produce a segment of channel 2 when it gets the corresponding segment of channel 1 as input.
We followed this procedure and applied ecpuwave to the reconstructed channel 2. The results are in table 9. One can see that we still get better results using reconstructed channel 2, from channel 1, than when applying ecgpuwave to clean channel 1.
|reference point||channel||mean error||std error|
|reconstructed channel 2||2.80||2.76|
|reconstructed channel 2||7.20||6.54|
|reconstructed channel 2||7.33||4.63|
|reconstructed channel 2||6.40||4.21|
4 Discussion of results and conclusions
Adding noise to existing records, we carried out extensive experiments on all the records from the MIT-BIH Arrhythmia Database. In the presence of high noise, SNR equal to 12db and lower, the programs we tested showed much better perfomance when we applied our denoising method to the ECGs. For low noise, SNR above 12db, after applying our method, QRS detectors show a slight reduction in sensitivity although there is an improvement in the positive predictivity. The experiments with records mgh124 and sele0106, without artificially adding noise in the test, confirm the advantages of using our method on a real ECG, a Holter record, for example. The experiment with record sele0106 also shows that the result of reconstructing a noisy channel can be exceptionally good when clean channels are available.
-  Yoshua Bengio and Yann Lecun. Scaling learning algorithms towards ai. In L. Bottou, O. Chapelle, D. Decoste, and J. Weston, editors, Large-Scale Kernel Machines. MIT Press, 2007.
-  Gartheeban Ganeshapillai and John V Guttag. Real Time Reconstruction of Multi Parameter Physiological Signals. EURASIP Journal on Advances in Signal Processing, 2012(173), 2012.
-  A. L. Goldberger, L. A. N. Amaral, L. Glass, J. M. Hausdorff, P. Ch. Ivanov, R. G. Mark, J. E. Mietus, G. B. Moody, C.-K. Peng, and H. E. Stanley. PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals. Circulation, 101(23):e215–e220, 2000 (June 13). Circulation Electronic Pages: http://circ.ahajournals.org/cgi/content/full/101/23/e215.
-  P. S. Hamilton and W. J. Tompkins. Quantitative investigation of QRS detection rules using the MIT/BIH arrhythmia database. IEEE Trans. Biomed. Eng, BME-33:1158–1165, 1987.
-  G. E. Hinton. To recognize shapes, first learn to generate images. In T. Drew P. Cisek and J. Kalaska (Eds.), editors, Computational Neuroscience: Theoretical Insights into Brain Function, chapter 3, pages 400–402. Elsevier, City, State of Publication, 1983.
-  G. E. Hinton. Learning Multiple Layers of Representations. Trends in cognitive Sciences, 11:428–434, 2007.
-  G. E. Hinton. A Practical Guide to Training Restricted Boltzmann Machines. Technical Report UTML TR 2010–003, Dept. of Comp. Sci., University of Toronto, 2010.
-  G. E. Hinton. Reducing the dimensionality of data with neural networks. Science, 313(5785):504–507, July 2006.
-  Geoffrey E. Hinton. Learning to represent visual input. Phil. Trans. R. Soc. B, 365:177–184, 2010.
-  Geoffrey E. Hinton, Simon Osindero, and Yee-Whye Teh. A Fast learning Algorithm for Deep Belief Nets. Neural Comput., 18(7):1527–1554, 2006.
-  Yu Hen Hu, Surekha Palreddy, and Willis J. Tompkins. A Patient-Adaptable ECG Beat Classifier Using a Mixture of Experts Approach. IEEE Transactions On Biomedical Engineering, 44(9):891–900, 1997.
-  R. Jané, A. Blasi, J. García, and P. Laguna. Evaluation of an automatic threshold based detector of waveform limits in Holter ECG with the QT database. Computers in Cardiology, 24:295–298, 1997.
-  P. Laguna, R. Jané, and P. Caminal. Automatic Detection of Wave Boundaries in Multilead ECG Signals: Validation with the CSE Database. Computers and Biomedical Research, 27(1):45–60, 1994.
-  G. B. Moody, C. L. Feldman, and J. J. Bailey. Standards and applicable databases for long-term ECG monitoring. Journal of Electrocardiology, 26:Suppl:151–155, 1993.
-  G. B. Moody and R. G. Mark. The impact of the MIT-BIH Arrhythmia Database. IEEE Engineering in Medicine and Biology Magazine, 20(3):45–50, 2001.
-  G. B. Moody, W. K. Muldrow, and R. G. Mark. A noise stress test for arrhythmia detectors. In Computers in Cardiology, pages 381–384, 1984.
-  George B. Moody. The PhysioNet/Computing in Cardiology Challenge 2010: Mind the Gap. In Computing in Cardiology 2010, volume 37, Belfast, 2010.
-  Moody, George B. nst man page. http://www.physionet.org/physiotools/wag/nst-1.htm.
-  Laguna P, Mark RG, Goldberger AL, and Moody GB. A Database for Evaluation of Algorithms for Measurement of QT and Other Waveform intervals in the ECG. In Computers in Cardiology, volume 24, pages 673–676, 1997.
-  R. Rodrigues. Filling in the Gap: a General Method using Neural Networks. In Computers in Cardiology, volume 37, pages 453–456, 2010.
-  A.M. Sullivan, H. Xia, and X. Zhao. Reconstruction of Missing Physiological Signals Using Artificial Neural Networks . In Computers in Cardiology, volume 37, pages 317–320, 2010.
-  J. P. Welch, P. J. Ford, R. S. Teplick, and R. M. Rubsamen. The Massachusetts General Hospital-Marquette Foundation Hemodynamic and Electrocardiographic Database – Comprehensive collection of critical care waveforms. Journal of Clinical Monitoring, 7(1):96–97, 1991.