Next Article in Journal
Removal of Pb(II) Ions from Wastewater by Using Polyethyleneimine-Functionalized Fe3O4 Magnetic Nanoparticles
Next Article in Special Issue
ECG Arrhythmia Classification using High Order Spectrum and 2D Graph Fourier Transform
Previous Article in Journal
Recent Research Progress in Surface Ligand Exchange of PbS Quantum Dots for Solar Cell Application
Previous Article in Special Issue
Pre-Configured Deep Convolutional Neural Networks with Various Time-Frequency Representations for Biometrics from ECG Signals
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

P-Wave Detection Using a Fully Convolutional Neural Network in Electrocardiogram Images

by
Rana N. Costandy
1,*,
Safa M. Gasser
2,
Mohamed S. El-Mahallawy
2,
Mohamed W. Fakhr
3 and
Samir Y. Marzouk
1
1
Department of Basic and Applied Sciences, Arab Academy for Science, Technology and Maritime Transport, Cairo P.O. Box 2033, Egypt
2
Department of Electronics and Communications, Arab Academy for Science, Technology and Maritime Transport, Cairo P.O. Box 2033, Egypt
3
Department of Computer Engineering, Arab Academy for Science, Technology and Maritime Transport, Cairo P.O. Box 2033, Egypt
*
Author to whom correspondence should be addressed.
Appl. Sci. 2020, 10(3), 976; https://doi.org/10.3390/app10030976
Submission received: 11 December 2019 / Revised: 15 January 2020 / Accepted: 16 January 2020 / Published: 3 February 2020
(This article belongs to the Special Issue Electrocardiogram (ECG) Signal and Its Applications)

Abstract

:
Electrocardiogram (ECG) signal analysis is a critical task in diagnosing the presence of any cardiac disorder. There are limited studies on detecting P-waves in various atrial arrhythmias, such as atrial fibrillation (AFIB), atrial flutter, junctional rhythm, and other arrhythmias due to P-wave variability and absence in various cases. Thus, there is a growing need to develop an efficient automated algorithm that annotates a 2D printed version of P-waves in the well-known ECG signal databases for validation purposes. To our knowledge, no one has annotated P-waves in the MIT-BIH atrial fibrillation database. Therefore, it is a challenge to manually annotate P-waves in the MIT-BIH AF database and to develop an automated algorithm to detect the absence and presence of different shapes of P-waves. In this paper, we present the manual annotation of P-waves in the well-known MIT-BIH AF database with the aid of a cardiologist. In addition, we provide an automatic P-wave segmentation for the same database using a fully convolutional neural network model (U-Net). This algorithm works on 2D imagery of printed ECG signals, as this type of imagery is the most commonly used in developing countries. The proposed automatic P-wave detection method obtained an accuracy and sensitivity of 98.56% and 98.78%, respectively, over the first 5 min of the second lead of the MIT-BIH AF database (a total of 8280 beats). Moreover, the proposed method is validated using the well-known automatically and manually annotated QT database (a total of 11,201 and 3194 automatically and manually annotated beats, respectively). This results in accuracies of 98.98 and 98.9%, and sensitivities of 98.97 and 97.24% for the automatically and manually annotated QT databases, respectively. Thus, these results indicate that the proposed automatic method can be used for analyzing long-printed ECG signals on mobile battery-driven devices using only images of the ECG signals, without the need for a cardiologist.

1. Introduction

According to the World Health Organization, deaths due to cardiac disorder will reach about 23.3 million worldwide by 2030 [1]. Therefore, improvement in cardiovascular diagnosis technologies is especially important for humanity.
In developed countries, modern electrocardiograms (ECGs) that produce digital output are the most commonly used diagnosis technology. On the other hand, in developing countries, paper-based ECGs are still dominant [2,3]. This study is concerned with the medical environment in developing countries where paper-based ECGs are used. These paper-based ECG images require digitization so that they can be transformed into 1D signals in order to apply the state-of-the-art algorithms that have been well studied in the literature. Working on a digitized version of paper-based ECGs (1D version) has important advantages in terms of storage space and the ease of exchanging patients’ clinical information between healthcare facilities [2,4,5]. Yet, certain limitations remain, such as dealing with alignment issues, the loss of relative timing between leads, and inaccuracy in high-frequency regions, to name of few. Moreover, digitizing the output of paper-based ECGs requires costly and complicated algorithms [6]. Thus, there is a need to develop a highly accurate and sensitive automatic segmentation algorithm that works directly on paper-based ECGs (a 2D version) without the need for digitization.
An ECG signal consists of these main components: the P-waves, followed by the QRS complex, and then the T-waves [7]. In many cases, cardiologists need to manually analyze ECG recordings acquired from patients over several days, making the task very troublesome and time-consuming [8]. The automatic annotation of ECG waves is important for understanding the regulation of heartbeats during sleep and hypertension [9,10,11,12,13,14], for diagnosing several cardiac arrhythmias [15,16,17,18,19,20,21,22], and for detecting other atrial disorders. Many research methods have been devoted to annotating the QRS complex (R-peaks) [23]. Although R-peaks have robust noise resistance due to their high signal-to noise ratio (SNR), there is a limitation in the information conveyed by them. Annotation of P-waves is even more challenging for many reasons, such as a low SNR, the possible overlapping of P- and T-waves, and their absence and variability due to some specific morphologies [24].
To our knowledge, there have been limited attempts to automatically annotate P-waves in available standard datasets [25]. This is due to a lack of available standard datasets with annotated P-waves used as a benchmark for validation. Therefore, there is a growing need for P-wave annotation in different available datasets.
The QT Database [26] is considered one of the most commonly used databases for P-wave annotation purposes. This database contains a total of 105 15-min records of two-channel ECGs, each sampled at 250 Hz. The records have been selected mainly from the currently available ECG databases, including the MIT-BIH Arrhythmia Database [27], the European Society of Cardiology ST-T Database [28], and several other ECG databases obtained at the Beth Israel Deaconess Medical Center in Boston, and recordings of patients who experienced sudden cardiac death. This makes this dataset an excellent source of varied and well-characterized data.
The MIT-BIH AF database [29,30] is considered a challenging database for P-wave annotation. This dataset contains a total of 25 10-h records of two-channel ECGs, each sampled at 250 Hz. The records are of people suffering from atrial problems, such as atrial fibrillation (AFIB), atrial flutter (AFL), junctional rhythms (AV), and other rhythms. Unfortunately, the MIT-BIH AF database [29,30] includes only annotations of R-peaks and lacks P-wave annotation. Hence, in this paper, the manual annotation of P-waves in the MIT-BIH AF database [29,30] is performed with the help of a cardiologist who was used as a benchmark for the evaluation of different algorithms. However, there is no guarantee that all present P-waves have been labeled, nor that all labels are correct.
In the literature, P-waves have been automatically detected using different techniques. In [31,32,33,34,35,36,37], the authors presented an automatic P-waves detection technique based on wavelet transform. However, the authors in [31,32,33] did not validate the algorithms with any standard databases. In [33], no P-wave delineation criterion is explained. In [38,39,40], the authors proposed an automated P-wave detection method based on second order derivatives and low-pass differentiation. In [41,42], other algorithms for automatic P-wave detection based on adaptive threshold are presented. Although the algorithm in [42] achieved high sensitivity, it was not validated with any standard database. In [43,44,45], the authors introduced deep neural networks for P-wave detection. The authors of [43], used a neural network with asymmetric basis functions for the purpose of extracting the features of P-waves in the MIT-BIH Arrhythmia Database [27], but the detection rate is not mentioned.
Over the past few years, deep convolutional neural networks have gained attention in the field of visual recognition [46,47]. However, in biomedical image processing, the desired output should include localization and pixel labels. In [48], the authors trained a deep convolutional network using a sliding-window to label each pixel in the image by providing a patch around that pixel as an input. This network is good at localizing, but suffers from redundancy, due to overlapping patches. In [49], the authors introduced the U-Net fully convolutional neural network architecture. This network provides good classification, as well as localization, using very few training images.
To our knowledge, this paper is the first to introduce the manual annotation of P-waves in the MIT-BIH AF database [29,30] to be used as a benchmark for validation and evaluation purposes. In addition, it introduces an automated prediction algorithm for P-waves, with their variable morphologies, in the aforementioned database. This should help clinicians in diagnosing several cardiac arrhythmias. Furthermore, the proposed algorithm works on printed ECG signals, which are the most commonly used in developing countries, without the need for digitalization, as in [2]. The proposed automated algorithm uses U-Net deep fully convolutional networks. The proposed algorithm is validated over the well-known QT database [26] and the performance is compared to other algorithms in the literature.
This paper is organized as follows; in Section 2, we provide information on datasets used in this article. In addition, we introduce the proposed algorithm. In Section 3, we present the experimental results obtained, and our conclusions are given in Section 4.

2. Materials and Methods

2.1. Used Databases

The presence of standard ECG databases is essential for the evaluation of ECG signal detection algorithms. Most of these databases contain annotation files for QRS, but lack P-wave annotation. In this study, two databases were used to evaluate the performance of the proposed algorithm. A self-annotated database (MIT-BIH AF database) and a standard annotated database (QT database). In Table 1, we provide a summary of the aforementioned databases.

2.1.1. Self-Annotated Database (MIT-BIH AF)

The MIT-BIH AF database [29,30] recordings were made at Boston’s Beth Israel Hospital (now the Beth Israel Deaconess Medical Center) using ambulatory ECG recorders with a typical recording bandwidth of approximately 0.1 to 40 Hz. This database contains 605 episodes for different rhythms of atrial fibrillation (AFIB), atrial flutter (AFL), junctional rhythms (AV), and other rhythms. This database provides an opportunity to test the robustness of P-wave detection in many different cases: the absence of P-waves in AFIB (f-waves), sawtooth P-waves in AFL, inverted P-waves in AV, and normal P-waves in other rhythms.
Annotation files for R-peaks in this standard database are available for the evaluation of the QRS detection algorithms, but, this is not the case for P-waves. Thus, in this paper, a cardiologist manually annotated the P-waves in the MIT-BIH AF database [29,30]. Manual annotation is performed for the first 5 min of each record from Lead II, as sinus P-waves are usually most prominently seen in Lead II [3]. Figure 1 and Figure 2 provide samples of the manual annotations obtained, where P-waves have sometimes been detected for normal and abnormal beats, and other times are absent for atrial fibrillation. The annotation file of P-waves can be found as Supplementary Material.

2.1.2. Standard Annotated Database (QT Database)

Since the MIT-BIH AF database [29,30] is self-annotated, a standard annotated database must be used to validate the proposed automatic algorithm. The standard annotated QT database [26] is used for this purpose.
This database has two types of annotations: manual annotation and automatic annotation. The manual annotation was carried by two cardiologists who annotated only the selected beats (in a file called “q1c”) in all recordings except “sel35” and “sel37”. The automatic annotation of the whole database was carried out using ECGPUWAVE” software, which reads “pu” files. In this study, the P-wave duration of Lead II of the entire automatically annotated QT database [26], along with the manually annotated beats for the same database, is used for validation purposes for the proposed automatic detection algorithm.

2.2. Proposed P-Wave Image-Based Detection Algorithm

In this study, a knowledge-based P-wave detection algorithm based on fully convolutional networks is proposed and evaluated. This algorithm is inspired by the framework proposed in [49], which is mainly used for the segmentation of biomedical images, such as brain lesion segmentation [50], tumor segmentation [51], and many other segmentation applications. We build upon this approach to automatically detect P-waves from ECG images, taking into consideration that an ECG is always printed on a grid paper. The grid background can be removed by the algorithm proposed in [2], as a pre-processing stage. Our proposed algorithm is then used to detect P-waves in the image-based ECG.

Segmentation via U-Net Architecture

The U-Net is a fully convolutional network that was developed in [49] for biomedical image segmentation. The goal of the U-Net is to produce a semantic segmentation, with an output that is the same size as the original input image, but in which each pixel in the image is colored one of X colors, where X represents the number of classes to be segmented.
The U-Net architecture, as shown in Figure 3, consists of two paths. The first path is the encoder path, which is used to capture the image’s contents. The encoder is just traditional blocks of convolutional and maximum pooling layers. The convolutional operation has two inputs: the input image of size n*n* number of channels, where n*n is the image pixel size and there is a set of ‘k’ filters (also called kernels or feature extractors), each one of size f × f × number of channels, where f is typically 3 [52]. The output of a convolutional operation is also a 3D output image of size (nout × nout × k). The relationship between nin and nout is given by [49]
n o u t = n i n + 2 p k s  
where nin is the number of input features, nout is the number of output features, k is the convolution kernel size, p is the convolution padding size, and s is the convolution stride size.
The maximum pooling layer is then used to retain the maximum value of a pre-defined area and stores its position in a switch variable. This creates a pooling map that reduces the feature map size, which results in fewer network parameters.
The filter and stride sizes are two important parameters in the maximum pooling operation. The idea is to retain only the important features of the maximum valued pixels from each region and neglect the rest. Both the convolution operation and the pooling operation result in down-sampled images. When applying the convolution operation again, the filters in the next layer will be able to show the larger context. As the number of filters used gradually increases, more complex features from the image can be extracted. By down-sampling, the model better understands what is present in the image, but it loses the information of where it is present.
The second path is the decoder, which is used to obtain precise localization using transposed convolutions. Transposed convolution (deconvolution) is a technique to perform the up-sampling of an image with learnable parameters. Transposed convolution is exactly the opposite process of a normal convolution, where the input volume is a low-resolution image and the output volume is a high-resolution image with location information. It is followed by the merged layer, where the output of the transposed convolution layers is merged with the feature maps from the encoder at the same level to obtain more precise locations.

3. Experimental Results

3.1. Experimental Setup

The U-Net model was run on a K80 GPU with a total of 12 GB of ram with the Python 3.5 anaconda package, tensor flow 1.2.1, and Keras 1.0. As the MIT-BIH AF database [29,30] consists of ECG signals in the time domain while the U-Net inputs must be images, the data were first converted to 2D ECG images. This makes this approach applicable to any printed ECG signal after background removal. A total of 690 one-channel input images of time-domain ECG signals were used, each of 10 s from the MIT-BIH AF database [29,30]. They were divided into a training set and a testing set (2:1). Every image had corresponding manually annotated ground truth labeling. Four hundred and sixty images were used for training. This number of images is not nearly enough to feed a deep learning neural network. Therefore, we used a module called “ImageDataGenerator” in a Keras preprocessing image to perform data augmentation [48]. The remaining images (230 images) were used to test the trained U-Net model. The model takes less than 15 min to train over 20 epochs. This number of epochs was used as the test accuracy did not increase much for the last five epochs, as shown in Figure 4.
In the encoder process of the U-Net model, each input image of size 512 × 512 × 1 was first fed to two convolutional layers of size 2 × 2 and strides of 2, and this process was repeated until an output image size of 32 × 32 × 1024 was obtained, while in the decoder process successive layers of deconvolution and merge layers were applied till the output image of size 512 × 512 × 1 was obtained. The output represents the segmented P-waves and their corresponding locations.
Since there are only two classes (P and no P), each pixel within the image has a value between 0 and 1. Zero represents no P-waves, and 1 represents P-wave presence. We take 0.5 as the threshold to decide whether to classify a pixel as 0 or 1.

3.2. Evaluation Metrics

The performance of the P–wave detection algorithms were evaluated using three statistical measures: sensitivity (SE), positive predictivity (+P), and accuracy given by Equations (2)–(4), where TP represents the number of true positives (P-waves as detected similarly to the manually annotated P-waves), FN represents the number of false negatives (the annotated P-wave has not been detected by the proposed method), and FP represents the number of false positives (P-waves detected by the system but not similar to the manually annotated data).
S E = T P T P + F N
+ P = T P T P + F P
A c c u r a c y = # C o r r e c t l y   p r e d i c t e d   d a t a # T o t a l   b e a t s

3.3. Evaluation Results

The proposed algorithm was evaluated using the MIT-BIH AF database. The MIT-BIH AF database [29,30] contains ECG signals with no P-waves in the case of AFIB, sawtooth P-waves in the case of AFL, and normal P-waves in other cases. Figure 5 indicates that the proposed algorithm is able to successfully detect the P-waves, even when the P- and T-waves are merged in the ECG signals. It correctly located P-waves in normal and abnormal cases. The abnormal cases have overlapping P and T waves, the presence of U-waves between P- and T-waves, and negative polarization. It can also be deduced that the proposed algorithm is not affected by noise and that it is thus a robust algorithm.
Table 2 illustrates the evaluation results obtained over the test data in 23 records of the MIT-BIH AF database. These results were obtained by training the model using 460 images of ECG recordings, each consisting of 10 s for 23 patients (00735 and 03665 are unavailable signals), and tested by using 230 images of the same specifications for the same patients. The proposed algorithm achieved a training accuracy of 99.8%, a testing accuracy of 98.56% after 20 epochs, a sensitivity of 98.78%, and a positive predictivity of 97.41%.

4. Performance Validation and Discussion

As the MIT-BIH AF database is self-annotated, it is essential to validate the performance of the proposed algorithm over a standard annotated database. Thus, the well-known QT database [26] was used for this purpose. The algorithm was applied on the automatically annotated records of the QT database, and the performance was compared to [45]. The authors in [45] combined four different deep recurrent neural networks (RNNs), for example, long-short term memory (LSTM), and each was trained to extract useful features from ECG signals and determine the absence or presence of P-waves. The outputs of these networks were then combined for the final detection of P-waves using a five-fold cross-validation method. This output was then evaluated using the automatically annotated QT database. In addition, the proposed algorithm was applied to the manually annotated beats in the QT database and the results were compared to [35,37,39,40,44]. The authors in [35,37] detected P-waves depending on wavelet transform. In [39,40], the authors proposed automated P-wave detection algorithms based on second-order derivatives and low-pass differentiation. These techniques are mathematically simple. However, they only detect monophasic P-waves and are not suitable for biphasic waves. In [44], three different deep neural network architectures were implemented and their results were compared to each other’s, showing that the best P-wave detection architecture is the ConvNet.

4.1. Automatically Annotated QT Database Results

The detection performance of the automatically annotated QT database obtained by the proposed P-wave detector is shown in Table 3. 9,450 images were divided into 6300 images for training and 3150 images for testing. When comparing the output to the automatic annotation, the detection performance over the automatically annotated QT database obtained an average SE of 98.97%, a +P of 99.45%, a training accuracy of 99.7% and a test accuracy of 98.74%.
Table 4 summarizes the performance comparison of the proposed P-wave detection algorithm over the automatically annotated QT database along with [45]. The performance comparison is in terms of the number of beats, methodology, SE, and accuracy. Using five-fold validation, the proposed algorithm achieved an average sensitivity of 98.4% and an accuracy of 98.74%. The proposed algorithm scored slightly higher performances on SE and accuracy overall when compared to [45]. It is clear that the proposed algorithm can handle ECG recordings with high performance over the 111,201 automatically annotated heartbeats.

4.2. Manually Annotated QT Database

The detection performance on the manually annotated QT database obtained by the proposed P-wave detector is shown in Table 5. As the manually annotated beats are random, the whole database was introduced to the automatic detector. 9450 images were divided into 6300 images for training and 3150 images for testing. When comparing the output to the manual annotation, the detection performance over the manually annotated QT database obtained an average SE of 97.24%, a +P of 97.22%, a training accuracy of 99.92%, and a test accuracy of 98.9%.
Table 6 summarizes the performance comparison of the proposed P-wave detection algorithm over the manually annotated QT database along with [35,37,39,40,44]. The comparison is in terms of the number of beats, the methodology, SE, and accuracy. The proposed algorithm scored a lower sensitivity and a higher +P than that achieved using wavelet transform in [35,37,39]. Fortunately, our proposed algorithm achieved a higher accuracy than that achieved by the ConvNet proposed in [44]. Moreover, the proposed algorithm’s performance is comparable to other algorithm performances found in the literature [53].
Thus, the results are promising, as the algorithm can detect P-waves over different databases, sampling frequencies, different types of arrhythmias, and noise

5. Conclusions

Automatic analysis of an ECG signal delivers important information for diagnosis to medical experts. The MIT-BIH AF database is considered a challenging ECG database, as it contains various types of ECG signals. To our knowledge, this paper is the first to manually annotate P-waves in the MIT-BIH AF database. In addition, it is the first to develop an efficient automated algorithm to detect the absence or presence of the different shapes of P-waves using a fully convolutional neural network model (U-Net). This automated algorithm works on 2D images of printed ECGs without the need for its digitization.
The proposed automatic P-wave detection method achieved an accuracy and sensitivity of 98.56 and 98.78%, respectively, over the first 5 min of Lead II of the MIT-BIH AF database (a total of 8280 beats). Moreover, the proposed method was validated using the well-known automatically and manually annotated QT database. This resulted in accuracies of 98.98 and 98.9% and sensitivities of 98.97 and 97.24% for the automatically and manually annotated QT database, respectively. Thus, this indicates that the results are promising, as this image-based approach can be applied in analyzing old ECG records when only printed versions are available. It also stands as a benchmark for testing and validation purposes. This study also provides a positive proof of concept for detecting P-waves in abnormal ECG beats with atrial disorders using a small amount of training data. However, further generalization is required to detect QRS complexes and T-waves.

Supplementary Materials

The following are available online at https://www.mdpi.com/2076-3417/10/3/976/s1.

Author Contributions

Methodology, R.N.C., S.M.G., M.S.E.-M. and M.W.F.; Software, R.N.C. and M.W.F.; Supervision, S.M.G., M.S.E.-M. and M.W.F.; Validation, S.M.G.; Visualization, S.Y.M.; Writing—original draft, R.N.C.; Writing—review & editing, S.M.G. and M.S.E.-M. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Goss, J.R.; Australian Institute of Health and Welfare. Projection of Australian Health Care Expenditure by Disease, 2003 to 2033; Australian Institute of Health and Welfare: Canberra, Australia, 2008; ISBN 978-1-74024-862-4.
  2. Tun, H.M. Analysis on conversion process from paper record ECG to computer based ECG. MOJ Appl. Bionics Biomech. 2017, 1. [Google Scholar] [CrossRef] [Green Version]
  3. Meek, S. ABC of clinical electrocardiography: Introduction. II—Basic terminology. BMJ 2002, 324, 470–473. [Google Scholar] [CrossRef] [PubMed]
  4. Hossain, A.; Quaresma, R.; Rahman, H. Investigating factors influencing the physicians’ adoption of electronic health record (EHR) in healthcare system of bangladesh: An empirical study. Int. J. Inf. Manag. 2019, 44, 76–87. [Google Scholar] [CrossRef]
  5. Ravichandran, L.; Harless, C.; Shah, A.J.; Wick, C.A.; Mcclellan, J.H.; Tridandapani, S. Novel Tool for complete digitization of paper electrocardiography data. IEEE J. Transl. Eng. Health Med. 2013, 1, 1800107. [Google Scholar] [CrossRef] [PubMed]
  6. Waits, G.S.; Soliman, E.Z. Digitizing paper electrocardiograms: Status and challenges. J. Electrocardiol. 2017, 50, 123–130. [Google Scholar] [CrossRef]
  7. Sadhukhan, D.; Mitra, M. R-peak detection algorithm for ECG using double difference and RR interval processing. Procedia Technol. 2012, 4, 873–877. [Google Scholar] [CrossRef] [Green Version]
  8. Mitra, R.N.; Pramanik, S.; Mitra, S.; Chaudhuri, B.B. A robust technique for delineation and features extraction of ECG signal from mobile-phone photography. In Proceedings of the 2012 International Conference on Communications, Devices and Intelligent Systems (CODIS), West Bengal, India, 28–29 December 2012; pp. 121–124. [Google Scholar]
  9. Bonnet, M.H.; Arand, D.L. Heart rate variability in insomniacs and matched normal sleepers. Psychosom. Med. 1998, 60, 610–615. [Google Scholar] [CrossRef]
  10. Otzenberger, H.; Gronfier, C.; Simon, C.; Charloux, A.; Ehrhart, J.; Piquard, F.; Brandenberger, G. Dynamic heart rate variability: A tool for exploring sympathovagal balance continuously during sleep in men. Am. J. Physiol. Heart Circ. Physiol. 1998, 275, H946–H950. [Google Scholar] [CrossRef]
  11. Busek, P.; Vanková, J.; Opavský, J.; Salinger, J.; Nevsímalová, S. Spectral analysis of the heart rate variability in sleep. Physiol. Res. 2005, 54, 369–376. [Google Scholar]
  12. Jurysta, F.; van de Borne, P.; Migeotte, P.-F.; Dumont, M.; Lanquart, J.-P.; Degaute, J.-P.; Linkowski, P. A study of the dynamic interactions between sleep EEG and heart rate variability in healthy young men. Clin. Neurophysiol. 2003, 114, 2146–2155. [Google Scholar] [CrossRef]
  13. Scholz, U.J.; Bianchi, A.M.; Cerutti, S.; Kubicki, S. Vegetative background of sleep: Spectral analysis of the heart rate variability. Physiol. Behav. 1997, 62, 1037–1043. [Google Scholar] [CrossRef]
  14. Trinder, J.; Kleiman, J.; Carrington, M.; Smith, S.; Breen, S.; Tan, N.; Kim, Y. Autonomic activity during human sleep as a function of time and sleep stage. J. Sleep Res. 2001, 10, 253–264. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  15. Tsipouras, M.G.; Fotiadis, D.I.; Sideris, D. Arrhythmia classification using the RR-interval duration signal. In Proceedings of the Computers in Cardiology, Memphis, TN, USA, 22–25 September 2002; pp. 485–488. [Google Scholar]
  16. Exarchos, T.P.; Tsipouras, M.G.; Exarchos, C.P.; Papaloukas, C.; Fotiadis, D.I.; Michalis, L.K. A methodology for the automated creation of fuzzy expert systems for ischaemic and arrhythmic beat classification based on a set of rules obtained by a decision tree. Artif. Intell. Med. 2007, 40, 187–200. [Google Scholar] [CrossRef] [PubMed]
  17. Homaeinezhad, M.R.; Atyabi, S.A.; Tavakkoli, E.; Toosi, H.N.; Ghaffari, A.; Ebrahimpour, R. ECG arrhythmia recognition via a neuro-SVM–KNN hybrid classifier with virtual QRS image-based geometrical features. Expert Syst. Appl. 2012, 39, 2047–2058. [Google Scholar] [CrossRef]
  18. Balasundaram, K.; Masse, S.; Nair, K.; Umapathy, K. A classification scheme for ventricular arrhythmias using wavelets analysis. Med. Biol. Eng. Comput. 2013, 51, 153–164. [Google Scholar] [CrossRef]
  19. Da Luz, E.J.S.; Schwartz, W.R.; Cámara-Chávez, G.; Menotti, D. ECG-based heartbeat classification for arrhythmia detection: A survey. Comput. Methods Programs Biomed. 2016, 127, 144–164. [Google Scholar] [CrossRef]
  20. Thong, T.; McNames, J.; Aboy, M.; Goldstein, B. Prediction of paroxysmal atrial fibrillation by analysis of atrial premature complexes. IEEE Trans. Biomed. Eng. 2004, 51, 561–569. [Google Scholar] [CrossRef]
  21. Bashour, C.A.; Visinescu, M.; Gopakumaran, B.; Wazni, O.; Carangio, F.; Yared, J.-P.; Starr, N. Characterization of premature atrial contraction activity prior to the onset of postoperative atrial fibrillation in cardiac surgery patients. Chest 2004, 126, 831S. [Google Scholar] [CrossRef]
  22. De Chazal, P.; O’Dwyer, M.; Reilly, R.B. Automatic classification of heartbeats using ecg morphology and heartbeat interval features. IEEE Trans. Biomed. Eng. 2004, 51, 1196–1206. [Google Scholar] [CrossRef] [Green Version]
  23. Elgendi, M.; Eskofier, B.; Dokos, S.; Abbott, D. Revisiting QRS detection methodologies for portable, wearable, battery-operated, and wireless ECG systems. PLoS ONE 2014, 9, e84018. [Google Scholar] [CrossRef] [Green Version]
  24. Chen, R.; Huang, Y.; Wu, J. Multi-window detection for P-wave in electrocardiograms based on bilateral accumulative area. Comput. Biol. Med. 2016, 78, 65–75. [Google Scholar] [CrossRef] [PubMed]
  25. Leutheuser, H.; Gradl, S.; Anneken, L.; Arnold, M.; Lang, N.; Achenbach, S.; Eskofier, B.M. Instantaneous P- and T-wave detection: Assessment of three ECG fiducial points detection algorithms. In Proceedings of the 2016 IEEE 13th International Conference on Wearable and Implantable Body Sensor Networks (BSN), San Francisco, CA, USA, 14–17 June 2016; pp. 329–334. [Google Scholar]
  26. Laguna, P.; Mark, R.G.; Goldberger, A.; Moody, G.B. A database for evaluation of algorithms for measurement of QT and other waveform intervals in the ECG. In Proceedings of the IEEE Computers in Cardiology, Lund, Sweden, 7–10 September 1997; pp. 673–676. [Google Scholar]
  27. Moody, G.B.; Mark, R.G. The impact of the MIT-BIH arrhythmia database. IEEE Eng. Med. Biol. Mag. 2001, 20, 45–50. [Google Scholar] [CrossRef] [PubMed]
  28. Taddei, A.; Distante, G.; Emdin, M.; Pisani, P.; Moody, G.B.; Zeelenberg, C.; Marchesi, C. The European ST-T database: Standard for evaluating systems for the analysis of ST-T changes in ambulatory electrocardiography. Eur. Heart J. 1992, 13, 1164–1172. [Google Scholar] [CrossRef] [PubMed]
  29. Moody, G.B.; Mark, R.G. MIT-BIH Atrial Fibrillation Database 1992. Available online: https://physionet.org/content/afdb/1.0.0/ (accessed on 20 January 2020).
  30. Goldberger, A.L.; Amaral, L.A.N.; Glass, L.; Hausdorff, J.M.; Ivanov, P.C.; Mark, R.G.; Mietus, J.E.; Moody, G.B.; Peng, C.-K.; Stanley, H.E. PhysioBank, physiotoolkit, and physioNet: Components of a new research resource for complex physiologic signals. Circulation 2000, 101, e215–e220. [Google Scholar] [CrossRef] [Green Version]
  31. Cuiwei Li; Chongxun Zheng; Changfeng Tai detection of ECG characteristic points using wavelet transforms. IEEE Trans. Biomed. Eng. 1995, 42, 21–28. [CrossRef]
  32. Senhadji, L.; Wang, F.; Hernandez, A.I.; Carrault, G. Wavelets extrema representation for QRS-T cancellation and P wave detection. In Proceedings of the Computers in Cardiology, Memphis, TN, USA, 22–25 September 2002; pp. 37–40. [Google Scholar]
  33. Sovilj, S.; Jeras, M.; Magjarevic, R. Real time P-wave detector based on wavelet analysis. In Proceedings of the 12th IEEE Mediterranean Electrotechnical Conference (IEEE Cat. No.04CH37521), Dubrovnik, Croatia, 12–15 May 2004; pp. 403–406. [Google Scholar]
  34. Wan, X.; Qin, S.; Liang, X.; Ding, J. A new approach to wavelet-based P-wave detection. Sheng Wu Yi Xue Gong Cheng Xue Za Zhi 2006, 23, 722–725. [Google Scholar]
  35. Martinez, J.P.; Almeida, R.; Olmos, S.; Rocha, A.P.; Laguna, P. A wavelet-based ECG delineator: Evaluation on standard databases. IEEE Trans. Biomed. Eng. 2004, 51, 570–581. [Google Scholar] [CrossRef]
  36. Xie, G.; Nie, Z.; Xiang, H.; Zeng, Z. Detection of P wave through wavelet transform and neural network. Sheng Wu Yi Xue Gong Cheng Xue Za Zhi 1999, 16, 320–323. [Google Scholar]
  37. Lenis, G.; Pilia, N.; Oesterlein, T.; Luik, A.; Schmitt, C.; Dössel, O. P wave detection and delineation in the ECG based on the phase free stationary wavelet transform and using intracardiac atrial electrograms as reference. Biomed. Eng. Biomed. Tech. 2016, 61, 37–56. [Google Scholar] [CrossRef]
  38. Goutas, A.; Ferdi, Y.; Herbeuval, J.-P.; Boudraa, M.; Boucheham, B. Digital fractional order differentiation-based algorithm for P and T-waves detection and delineation. ITBM RBM 2005, 26, 127–132. [Google Scholar] [CrossRef]
  39. Laguna, P.; Jané, R.; Caminal, P. Automatic Detection of Wave Boundaries in Multilead ECG Signals: Validation with the CSE Database. Comput. Biomed. Res. 1994, 27, 45–60. [Google Scholar] [CrossRef] [PubMed]
  40. Panigrahy, D.; Sahu, P.K. P and T wave detection and delineation of ECG signal using differential evolution (DE) optimization strategy. Australas. Phys. Eng. Sci. Med. 2018, 41, 225–241. [Google Scholar] [CrossRef] [PubMed]
  41. Zhou, N.Q. A new method to detect P-wave based on quadratic function. In Advanced Materials Research; Trans Tech Publications: Zurich, Switzerland, 2011; Volume 267, pp. 462–467. [Google Scholar]
  42. Sbrollini, A.; Mercanti, S.; Agostinelli, A.; Morettini, M.; Di Nardo, F.; Fioretti, S.; Burattini, L. AThrIA: A new adaptive threshold identification algorithm for electrocardiographic P waves. In 2017 Computing in Cardiology (CinC); IEEE: Piscataway, NJ, USA, 2017; pp. 1–4. [Google Scholar]
  43. de Azevedo Botter, E.; Nascimento, C.L.; Yoneyama, T. A neural network with asymmetric basis functions for feature extraction of ECG P waves. IEEE Trans. Neural. Netw. 2001, 12, 1252–1255. [Google Scholar] [CrossRef] [PubMed]
  44. Abrishami, H.; Campbell, M.; Han, C.; Czosek, R.; Zhou, X. P-QRS-T localization in ECG using deep learning. In Proceedings of the 2018 IEEE EMBS International Conference on Biomedical & Health Informatics (BHI), Las Vegas, NV, USA, 4–7 March 2018; pp. 210–213. [Google Scholar]
  45. Peimankar, A.; Puthusserypady, S. An Ensemble of Deep Recurrent Neural Networks for P-wave Detection in Electrocardiogram. In Proceedings of the ICASSP 2019—2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Brighton, UK, 12–17 May 2019; pp. 1284–1288. [Google Scholar]
  46. Krizhevsky, A.; Sutskever, I.; Hinton, G.E. Imagenet classification with deep con-volutional neural networks. In Proceedings of the Neural Information Processing Systems, Stateline, NV, USA, 3–8 December 2012; pp. 1097–1105. [Google Scholar]
  47. Girshick, R.; Donahue, J.; Darrell, T.; Malik, J. Rich feature hierarchies for accurate object detection and semantic segmentation. arXiv 2013, arXiv:1311.2524. [Google Scholar]
  48. Ciresan, D.C.; Gambardella, L.M.; Giusti, A.; Schmidhuber, J. Deep neural networks segment neuronal membranes in electron microscopy images. In Proceedings of the Neural Information Processing Systems, Stateline, NV, USA, 3–8 December 2012; pp. 2843–2851. [Google Scholar]
  49. Ronneberger, O.; Fischer, P.; Brox, T. U-net: Convolutional networks for biomedical image segmentation. arXiv 2015, arXiv:1505.04597. [Google Scholar]
  50. Kao, P.-Y.; Chen, J.W.; Manjunath, B.S. Improving 3D U-net for brain tumor segmentation by utilizing lesion prior. arXiv 2019, arXiv:1907.00281. [Google Scholar]
  51. Dong, H.; Yang, G.; Liu, F.; Mo, Y.; Guo, Y. Automatic brain tumor detection and segmentation using u-net based fully convolutional networks. In Medical Image Understanding and Analysis; Valdés Hernández, M., González-Castro, V., Eds.; Springer International Publishing: Cham, Switzerland, 2017; Volume 723, pp. 506–517. ISBN 978-3-319-60963-8. [Google Scholar]
  52. Gu, J.; Wang, Z.; Kuen, J.; Ma, L.; Shahroudy, A.; Shuai, B.; Liu, T.; Wang, X.; Wang, G.; Cai, J.; et al. Recent advances in convolutional neural networks. Pattern Recognit. 2018, 77, 354–377. [Google Scholar] [CrossRef] [Green Version]
  53. Beraza, I.; Romero, I. Comparative study of algorithms for ECG segmentation. Biomed. Signal Process. Control. 2017, 34, 166–173. [Google Scholar] [CrossRef]
Figure 1. Samples of manually annotated P-waves in the MIT-BIH AF database for normal beats. (a) 05091 record; (b) 08405 record; (c) 08455 record; and (d) 08215 record, where the light blue areas represent P-wave duration.
Figure 1. Samples of manually annotated P-waves in the MIT-BIH AF database for normal beats. (a) 05091 record; (b) 08405 record; (c) 08455 record; and (d) 08215 record, where the light blue areas represent P-wave duration.
Applsci 10 00976 g001
Figure 2. Samples of manually annotated P-waves in the MIT-BIH AF database, where the P-wave is absent in case of atrial fibrillation, (a) 07162 record; (b) 04126 record; (c) 06426 record; and (d) 06995 record.
Figure 2. Samples of manually annotated P-waves in the MIT-BIH AF database, where the P-wave is absent in case of atrial fibrillation, (a) 07162 record; (b) 04126 record; (c) 06426 record; and (d) 06995 record.
Applsci 10 00976 g002aApplsci 10 00976 g002b
Figure 3. U-Net architecture and the parameters used in the proposed algorithm. Each box contains an n* n* k input and 2@Conv layers (which means that two consecutive convolution Layers are applied). The left-hand side is the contraction path (Encoder), where we apply regular convolutions and max-pooling layers, and the right-hand side is the expansion path (Decoder) where we apply transposed convolutions along with regular convolutions.
Figure 3. U-Net architecture and the parameters used in the proposed algorithm. Each box contains an n* n* k input and 2@Conv layers (which means that two consecutive convolution Layers are applied). The left-hand side is the contraction path (Encoder), where we apply regular convolutions and max-pooling layers, and the right-hand side is the expansion path (Decoder) where we apply transposed convolutions along with regular convolutions.
Applsci 10 00976 g003
Figure 4. Model accuracy chart, where the blue line represents the training accuracy, while the orange one represents the validation (testing) accuracy.
Figure 4. Model accuracy chart, where the blue line represents the training accuracy, while the orange one represents the validation (testing) accuracy.
Applsci 10 00976 g004
Figure 5. Demonstrating the performance of the proposed P-wave detection algorithm on the MIT-BIH atrial fibrillation database. The P-wave is detected in electrocardiogram (ECG) signals that contain: (a) high-frequency noise; (b) normal sinus rhythm without U-waves; (c) normal sinus rhythm with U-waves; (d) normal sinus rhythm with negative polarization; (e) merged P- and T-waves. Here, the red circle asterisk represents detection of merged P- and T-waves. (f) No P-wave detected in case of premature atrial fibrillation.
Figure 5. Demonstrating the performance of the proposed P-wave detection algorithm on the MIT-BIH atrial fibrillation database. The P-wave is detected in electrocardiogram (ECG) signals that contain: (a) high-frequency noise; (b) normal sinus rhythm without U-waves; (c) normal sinus rhythm with U-waves; (d) normal sinus rhythm with negative polarization; (e) merged P- and T-waves. Here, the red circle asterisk represents detection of merged P- and T-waves. (f) No P-wave detected in case of premature atrial fibrillation.
Applsci 10 00976 g005
Table 1. Databases used for evaluation and validation.
Table 1. Databases used for evaluation and validation.
Database# Annotated Beats# RecordsRecord Duration
MIT-BIH AF [29,30]8280235 min
QT Manual Annotation [26]319410315 min
QT Automatic Annotation [26]11,20110515 min
Table 2. P-wave detection performance over the annotated MIT-BIH Atrial Fibrillation database.
Table 2. P-wave detection performance over the annotated MIT-BIH Atrial Fibrillation database.
RecordTPFPFNSE (%)+P (%)
040151377298.695.1
040431755298.997.2
0404812000100100
0412625410498.496.2
047461081199.199.1
049081653199.498.2
0493611000100100
0509110000100100
051211234010096.8
0526112700100100
0642611800100100
064531340610095.7
0699510000100100
071621086298.194.7
0785914411010092.9
078791071199.199.1
07910913495.796.8
082151281298.499.2
082191162199.1498.3
083781291010099.23
084051291010099.23
084348912118988.11
084551086298.1894.73
2920743998.7897.41
Table 3. P-wave detection performance over the automatically annotated QT database.
Table 3. P-wave detection performance over the automatically annotated QT database.
RecordTPFPFNSE (%)+P (%)
Sel1003740399.2100
Sel1024500100100
Sel10310800100100
Sel1041091298.299.1
Sel1147300100100
Sel1163941499.099.7
Sel1172550199.6100
Sel12323200100100
Sel2133921698.599.7
Sel22133312094.399.7
Sel2233630199.7100
Sel230356153690.896
Sel2312420199.6100
Sel23226700100100
Sel23339032494.299.2
Sel30143400100100
Sel3024811199.899.8
Sel3062771697.999.6
Sel3072831010099.6
Sel3083343498.899.1
Sel31058800100100
Sel80332013390.6599.7
Sel808297101395.896.7
Sel81123300100100
Sel8203611199.799.7
Sel8213231199.799.7
Sel8403381299.499.7
Sel84726300100100
Sel853316239999.4
Sel8713020199.7100
Sel87232300100100
Sel87328600100100
Sel883292131694.895.8
Sel89135200100100
Sel162653173399.199.1
Sel1627228200100100
Sel1627336700100100
Sel164203530199.7100
Sel1648336200100100
Sel1653930600100100
Sel1677333417259395.1
Sel1678630700100100
Sel167952530199.6100
Sel1745334600100100
Sele010426700100100
Sele010629800100100
Sele01072678897.197.1
Sele01102890199.6100
Sele011130100100100
Sele011217833348484.4
Sele01142093398.698.6
Sele011623300100100
Sele012147600100100
Sele012247100100100
Sele01243701299.599.7
Sele012631362891.898.1
Sele012920200100100
Sele01331281199.299.2
Sele01362421199.699.6
Sele016627100100100
Sele017029900100100
Sele020312000100100
Sele021035400100100
Sele02115061199.899.8
Sele03033470199.7100
Sele040539901097.5100
Sele040621600100100
Sele04094081199.799.7
Sele04113830199.7100
Sele05097100100100
Sele06032781199.699.6
Sele06043431099.799.7
Sele06064580199.8100
Sele060739400100100
Sele06093731199.799.7
Sele06122500199.6100
Sele070435311296.799.7
Sel3033600100100
Sel313482199.799.4
Sel3236000100100
Sel3317400100100
Sel342561010099.6
Sel357000100100
Sel361416894.695.9
Sel371901199.599.5
Sel3816400100100
Sel3937700100100
Sel403000199.7100
Sel4130100100100
Sel4241200100100
Sel434481299.599.7
Sel4435200100100
Sel453091199.699.6
Sel46841010098.8
Sel4729400100100
Sel484531199.899.8
Sel4921600100100
Sel5010300100100
Sel512491199.699.6
Sel524681010099.8
Sel1715246900100100
Sel1404641000100100
Sel141574300100100
Sel141722171199.599.5
Sel1581433700100100
31,51115333498.9799.45
Table 4. P-wave detection performance comparison on the automatic annotated QT database [N/R: not reported].
Table 4. P-wave detection performance comparison on the automatic annotated QT database [N/R: not reported].
PublicationMethod# BeatsAnnotation (File Name)SE [%]Accuracy [%]+P [%]
Proposed AlgorithmU-Net111,201Automatic.(pu)98.498.7498.74
Peimankar, Puthusserypady [45]LSTM111,201Automatic.(pu)97.2298.48N/R
Table 5. P-wave detection performance over the manual annotated QT database.
Table 5. P-wave detection performance over the manual annotated QT database.
RecordTPFPFNSE (%)+P (%)
Sel1001000100100
Sel1031000100100
Sel10451010083
Sel114160194.1100
Sel116172010089.5
Sel117100191100
Sel1231000100100
Sel21323129295.8
Sel2231000100100
Sel2301600100100
Sel2311700100100
Sel23310119191
Sel3011000100100
Sel3021000100100
Sel3061200100100
Sel30791010090
Sel308162194.188.9
Sel8031000100100
Sel8081000100100
Sel8111000100100
Sel8209119090
Sel82190190100
Sel840151288.293.7
Sel8471100100100
Sel8531000100100
Sel871221195.695.6
Sel8721000100100
Sel8731100100100
Sel8831000100100
Sel891180194.7100
Sel162651000100100
Sel1627210119191
Sel162731000100100
Sel16420100191100
Sel164831000100100
Sel165391000100100
Sel167738218980
Sel167861000100100
Sel167951000100100
Sel174531000100100
Sele01041000100100
Sele01061000100100
Sele01079237582
Sele0110100191100
Sele01111000100100
Sele0112143287.582.3
Sele01141000100 100
Sele01161000100100
Sele01211000100100
Sele01221000100100
Sele0124171010094.4
Sele012672187.577.7
Sele01291000100100
Sele01331000100100
Sele013671187.587.5
Sele01661200100100
Sele01701000100100
Sele02031000100100
Sele02101000100100
Sele02119119090
Sele0303100191100
Sele0405100191100
Sele040691010090
Sele04091000100100
Sele04111000100100
Sele05091000100100
Sele06039119191
Sele06041000100100
Sele060663185.766.6
Sele06071000100100
Sele060981188.888.8
Sele06121000100100
Sele07041000100100
Sel301000100100
Sel311000100100
Sel321000100100
Sel331000100100
Sel34900100100
Sel36100100100
Sel381000100100
Sel391000100100
Sel4090191100
Sel411000100100
Sel421000100100
Sel4381010088.8
Sel44800100100
Sel45800100100
Sel46800100100
Sel471000100100
Sel481000100100
Sel491000100100
Sel5190190100
Sel521000100100
Sel171521000100100
Sel14046100191100
Sel141571000100100
Sel141721600100100
Sel158141000100100
1027313297.2497.22
Table 6. P-wave detection performance comparison on the manual annotated QT database. [N/R: not reported].
Table 6. P-wave detection performance comparison on the manual annotated QT database. [N/R: not reported].
PublicationMethod# BeatsAnnotation (File Name)SE [%]Accuracy [%]+P [%]
Proposed AlgorithmU-Net3194Manual.(q1c)97.2498.9 97.22
Martinez et al. [35]Wavelets3194Manual.(q1c)98.87N/R91.03
Laguna et al. [39]Low-pass differentiation3194Manual.(q1c)97.70N/R91.17
Lenis, G. [37]Wavelets3194Manual.(q1c)100N/R88.15
Panigrahy [40]Differential Evolution3194Manual.(q1c)98.998.5N/R
Abrishami, H. [44]ConvNet3194Manual.(q1c)N/R96.2N/R

Share and Cite

MDPI and ACS Style

Costandy, R.N.; Gasser, S.M.; El-Mahallawy, M.S.; Fakhr, M.W.; Marzouk, S.Y. P-Wave Detection Using a Fully Convolutional Neural Network in Electrocardiogram Images. Appl. Sci. 2020, 10, 976. https://doi.org/10.3390/app10030976

AMA Style

Costandy RN, Gasser SM, El-Mahallawy MS, Fakhr MW, Marzouk SY. P-Wave Detection Using a Fully Convolutional Neural Network in Electrocardiogram Images. Applied Sciences. 2020; 10(3):976. https://doi.org/10.3390/app10030976

Chicago/Turabian Style

Costandy, Rana N., Safa M. Gasser, Mohamed S. El-Mahallawy, Mohamed W. Fakhr, and Samir Y. Marzouk. 2020. "P-Wave Detection Using a Fully Convolutional Neural Network in Electrocardiogram Images" Applied Sciences 10, no. 3: 976. https://doi.org/10.3390/app10030976

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop