# P-Wave Detection Using a Fully Convolutional Neural Network in Electrocardiogram Images
## 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 developingcountries 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.