SlideShare a Scribd company logo
IAES International Journal of Artificial Intelligence (IJ-AI)
Vol. 13, No. 4, December 2024, pp. 4129~4137
ISSN: 2252-8938, DOI: 10.11591/ijai.v13.i4.pp4129-4137  4129
Journal homepage: http://ijai.iaescore.com
Obstructive sleep apnea detection based on electrocardiogram
signal using one-dimensional convolutional neural network
Rahmat Widadi1
, Achmad Rizal2
, Sugondo Hadiyoso3
, Hilman Fauzi2
, Ziani Said4
1
Department of Biomedical Engineering, Faculty of Telecommunication and Electrical Engineering, Institut Teknologi Telkom
Purwokerto, Purwokerto, Indonesia
2
School of Electrical Engineering, Telkom University, Bandung, Indonesia
3
School of Applied Science, Telkom University, Bandung, Indonesia
4
Department of Health Technologies Engineering, Research Group in Biomedical Engineering and Pharmaceutical Sciences, ENSAM,
Mohammed V University, Rabat, Morocco
Article Info ABSTRACT
Article history:
Received Jun 25, 2023
Revised Apr 19, 2024
Accepted Jun 1, 2024
Obstructive sleep apnea (OSA) is a respiratory obstruction that occurs during
sleep and is often known as snoring. OSA is often ignored even though it can
cause cardiovascular problems. Early diagnosis is needed for prevention
towards worse complications. OSA clinical diagnosis can use
polysomnography (PSG) while the patient is sleeping. The PSG examination
includes calculating total apnea plus hypopnea every hour during sleep.
However, PSG examination tends to be high cost, takes a long time, and is
impractical. Since OSA is related to breathing and heart activity, the
electrocardiogram (ECG) examination is an alternative tool in OSA analysis.
Therefore, this study proposes OSA detection on single lead ECG using one-
dimensional (1D)-convolutional neural network (CNN). The proposed CNN
architecture consists of 4 convolutional layers, 4 pooling layers, 1 dropout
layer, 1 flatten layers, 2 dropout layers, 1 dense layer with rectified linear unit
(ReLU) activation function, and 1 dense layer with SoftMax activation
function. The proposed method was then tested on the ECG sleep apnea
dataset from PhysioNet. The proposed model produces an accuracy of 92.69%
with the average pooling scenario. The proposed method is expected to help
clinicians in diagnosing OSA based on ECG signals.
Keywords:
Convolutional neural network
Electrocardiogram
Obstructive sleep apnea
One dimensional
Polysomnography
This is an open access article under the CC BY-SA license.
Corresponding Author:
Sugondo Hadiyoso
School of Applied Science, Telkom University
Bandung, Indonesia
Email: sugondo@telkomuniversity.ac.id
1. INTRODUCTION
One of sleep disease or sleep disorder in obstructive sleep apnea (OSA) [1]. OSA conditions occur if
the intake of air is stopped for 10 seconds or more during sleep inspiration [1]. Apnea causes obstruction
because the body's muscles relax, causing the airways to collapse [2]. If the airway is closed, the patient will
wake up during sleep or experience a sudden transition to sleep. OSA is associated with several diseases,
including hypertension and several cardiovascular diseases such as heart failure or myocardial ischemia [3].
Depending on the signal to be observed, several methods are used to diagnose OSA. Became one of
the OSA observation standard is polysomnography (PSG). The disadvantage of this PSG is that it is
time-consuming, costly, and impractical, so it is only performed on patients with a specific level of severity
[4]. Through patient movement, video processing can be used to detect OSA [5]. Speech processing methods
can be used to analyze snoring so that OSA can be detected [6]. The analysis of speech signals is frequently
 ISSN: 2252-8938
Int J Artif Intell, Vol. 13, No. 4, December 2024: 4129-4137
4130
used to analyze sleep apnea using respiratory signals [7]. Voice activity detection (VAD) is a popular algorithm
for detecting the presence or absence of the respiratory process during sleep [8].
Numerous studies have examined the relationship between electrocardiogram (ECG) signals and
respiration, called as electrocardiogram-derived respiration (EDR) [9]. Respiration influences ECG signals
through a variety of mechanisms, including changes in thorax impedance resulting from lung volume changes
[10]. The subsequent mechanism is the alteration of the heart vector due to shifts or changes in heart orientation
associated with ECG electrodes [11], [12].
OSA classification using single-lead ECG has been explored by many researchers using various
methods. There are two essential parts in the OSA ECG classification process: feature extraction and
classification. In the feature extraction process, the heart rate variability (HRV) parameter is one of the top
choices for many researchers because it can be directly extracted from the ECG signal. Median, mean,
skewness (third momentum), kurtosis, minimum, and range calculated to get the HRV parameters. Another
parameter derived from the internal R-R is the standard deviation of successive differences between adjacent
R–R intervals (SDSD).
Differences in the number of R-R intervals that exceed a specific time, such as 50 ms or 20 ms, are
also extracted parameters such as NN50, NN20, pNN50, and pNN20 [13]. The extracted features can also be
features from the frequency domain. This frequency component usually represents the activities of
thermoregulation mechanisms, sympathetic activity, and parasympathetic activities [11]. Characteristics
associated with this frequency include the very low-frequency (VLF) band, low-frequency (LF) band, and
high-frequency (HF) band. Another method used for feature extraction is signal decomposition, and then
feature extraction is performed. For example, Zarei and Asl [14] used wavelet transforms and entropy for ECG
OSA classification. Another study used multiscale entropy as a feature [15]. This method is based on multiscale
signal complexity, which is considered related to OSA ECG.
The following process in the OSA ECG classification is the classifier. The support vector machine
(SVM) is one of the most widely used machine learning classifiers [16]. In its development, deep learning is
the next choice because of its advantages in performing feature extraction automatically [17]. Even so, some
researchers still combine feature extraction and deep learning. Singh and Majumder [18] used a scalogram and
convolutional neural network (CNN) to produce an accuracy of 86.2%. Bahrami and Forouzanfar [19] used
long short-term memory (LSTM) to have 80.67% accuracy, 75.04% sensitivity, and 84.13% specificity.
Meanwhile, another group of researchers using LTSM produced the highest accuracy of 99.8% with RR
interval as a feature [20]. The RR interval combined with a multiscale dilation attention (MSDA)-one
dimensional convolutional neural network (1D-CNN) resulted in the highest accuracy of 89.4% [21]. From the
several studies that have been described, it can be divided into two groups; those who use the feature extraction
method and who do not use the feature extraction method. Apart from these differences, another difference is
the method of processing or cutting data from the dataset used. To compare the performance of deep learning
for OSA classification from a single lead ECG without a feature extraction process, it is necessary to try using
deep learning directly without a feature extraction process or trimming the ECG signal further.
In this study, the classification of normal and OSA ECG signals was carried out using 1D-CNN.
Long-time ECG recording was cut into minute segments and used to input the 1D-CNN. In this study, the
feature extraction process was not carried out but directly using the clipped ECG signal. CNN is optimized to
get the best configuration to produce the highest accuracy. The proposed method can be an alternative for ECG
signal processing, especially for OSA signal classification.
2. MATERIAL AND METHODS
In this research, a modified CNN is proposed to solve the OSA ECG signal classification problem.
Figure 1 shows the block diagram of the proposed 1D-CNN. The proposed 1D-CNN architecture to classify
OSA ECG signals consists of 4 convolutional layers, 4 pooling layers, 1 dropout layer, 1 flatten layers,
2 dropout layers, 1 dense layer with rectified linear unit (ReLU) activation function, and 1 dense layer with
SoftMax activation function.
2.1. Dataset
This study used the PhysioNet ECG sleep apnea dataset [22], [23]. There are 70 records, with 35
belonging to the training set and 35 to the testing set. Each recording consists of a digital ECG signal and is
annotated by an expert [24]. ECG signal recording length ranges from seven to ten hours. In some recordings
there are also additional signals such as respiration and oxygen saturation, but these additional signals were not
used in this study. The ECG signal is truncated every 6,000 samples. This number is equal to a one-minute
signal because it has a sampling frequency of 100 Hz. This process produces 17,010 data for train and test the
Int J Artif Intell ISSN: 2252-8938 
Obstructive sleep apnea detection based on electrocardiogram signal … (Rahmat Widadi)
4131
proposed method. The normal ECG and OSA signals are shown in Figure 2. Based on Figure 2, the OSA ECG
signal Figure 2(a) has a different orientation in the spike area compared to normal ECG signals in Figure 2(b).
Figure 1. Block diagram of proposed 1D-CNN
(a)
(b)
Figure 2. Normal and OSA ECG signal, (a) standard ECG, one minute recoding and (b) OSA event in ECG
of the same subject
 ISSN: 2252-8938
Int J Artif Intell, Vol. 13, No. 4, December 2024: 4129-4137
4132
2.2. One-dimensional convolutional neural network
In general, 1D-CNN consists of two parts, namely the convolution layer and the multilayer perceptron
(MLP) layer [25]. In this study, the input of 1D-CNN is a multichannel ECG signal, and the output is the class
of the input signal. Figure 3 shows the general structure of a 1D-CNN. The convolution layers have
convolution, pooling, and flattening processes [26]. In the convolution process, there are kernels that are shifted
and multiplied by input signals. If the input signal 𝑥(𝑛) is of length 𝑛 and the kernel is ℎ(𝑘) of length 𝑘. Each
kernel is shifted by𝑠 (stride) after multiplied by 𝑥(𝑛). The convolution process between 𝑥(𝑛) and ℎ(𝑘) is
defined in (1).
𝑦(𝑛) = {
∑ 𝑥(𝑛 − 𝑖)ℎ(𝑖)
𝑘
𝑖=0 , 𝑛 = 𝑘 − 1
∑ 𝑥(𝑛 − 𝑖 + 𝑠 − 1)ℎ(𝑖)
𝑘
𝑖=0 , 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
(1)
Figure 3. 1D-CNN structure
The output of the convolution process is used in the pooling process to reduce the signal size [27].
Two types of pooling used in this study are average pooling and max pooling. Average pooling takes the
average value of the signal window along 𝑓. This window or filter is shifted on the signal by a shift of 𝑠 (stride).
A similar process occurs in max pooling, only that the value taken is the maximum value instead of the average.
Figure 4 shows example of max pooling process.
Figure 4. Example of max pooling operation: window size =3, stride =3
The next operation on convolution layers is flatten. The output signal in pooling operation has
dimensions of more than 1. To be used as input for the MLP stage, it needs to be converted into 1 dimension.
Figure 5 is an illustration of the flatten process.
Figure 5. Flatten process
The signals that have been flattened can be used as MLP inputs. MLP is also known as a fully
connected layer. This term is because each neuron in the previous layer is connected to all neurons in the next
layer. Figure 6 shows an example of an MLP with an input layer, one hidden layer, and an output layer. There
are seven neurons, namely 𝑥1 and 𝑥2 on the input layer, ℎ1, ℎ2, ℎ3 on the hidden layer, 𝑜1and 𝑜2 on the input
layer. The output of neurons in the hidden layer is determined using (2).
𝑦 = 𝑓(𝑤𝑇
𝑥) (2)
Input Signal Convolution Layer Multilayer Perceptron Output Class
Int J Artif Intell ISSN: 2252-8938 
Obstructive sleep apnea detection based on electrocardiogram signal … (Rahmat Widadi)
4133
Inner product weight w with input x is given to the activation function f so that it is non-linear. The activation
function used in this study is ReLU. The ReLU function is defined (3) [28].
𝑦 = max(0, 𝑤𝑇
𝑥) (3)
Figure 6. Example of MLP [29]
3. RESULTS AND DISCUSSION
The OSA detection system is tested for system performance by calculating system accuracy based on
two types of pooling: max pooling and average pooling. This accuracy measurement is carried out to determine
the difference in the effect of the type of pooling with the length and number of filters on system accuracy.
Filters vary from 1-10 while the number of filters is set to 5, 10, 15, and 20 filters. In addition to accuracy,
system performance measurements were also carried out with training parameters and validation loss for each
type of pooling. The distribution of OSA data is 80% for training and 20% for testing.
3.1. Max pooling test
The first stage is the training process, 1D-CNN is trained using 13,608 OSA data. System performance
is measured based on the loss parameter in the system training and validation process. One example of the
training process that will be discussed in this section is 1D-CNN with max pooling, filter length is 7, and the
number of filters is 15. Based on the loss measurement results, the gap between the validation process and
system training process loss values are getting higher as the epoch increases. The value of the gap loss at the
50th epoch is 0.05, with the training loss and validation loss values are 0.16 and 0.21, respectively. However,
the trend of loss values from the two processes has decreased with a similar pattern, as shown in the graph in
Figure 7.
Loss
Epoch
Figure 7. Training and validation loss on 1D-CNN by using filter length 7, number of filters 15, and max
pooling
The performance calculation of the system model classification is performed using the confusion
matrix from the testing stage. 1D-CNN was evaluated using 3,402 OSA data. The system model is a system
with max pooling at a filter length of 7, the number of filters is 15, and the epoch is 50th. The confusion matrix
value is obtained based on the evaluation results, as shown in Figure 8.
 ISSN: 2252-8938
Int J Artif Intell, Vol. 13, No. 4, December 2024: 4129-4137
4134
Figure 8. Example of a confusion matrix of max pooling 1D-CNN
Furthermore, by using an accuracy calculation based on the value of the confusion matrix, a system
classification accuracy of 90.8% is obtained.
𝐴𝑐𝑐𝑢𝑟𝑟𝑎𝑐𝑦 =
1,127+1,968
1,127+1,968+166+141
𝑥 100% = 90.8%
The results of measuring system accuracy using max pooling get considered good results. The
accuracy system results with max pooling can be seen in Table 1. The highest average accuracy of the system
based on filter length is 90% at a filter length of 9. Furthermore, the highest average accuracy system based on
the number of filters occurs in the number of filters 20, with an accuracy of 88.50%. Specifically, based on the
filter length and the number of filters on the max pooling type, the highest system accuracy was performed at
91% on filter lengths of 7 and 10 with the filter numbers of 15 and 20.
Table 1. Accuracy of 1D-CNN with max pooling
Pooling type Filter length Accuracy (%) Average
5 Filters 10 Filters 15 Filters 20 Filters
Max Pooling 1 65.00 83.00 69.00 81.00 74.50
2 79.00 86.00 83.00 87.00 83.75
3 81.00 88.00 89.00 88.00 86.50
4 85.00 89.00 88.00 90.00 88.00
5 85.00 88.00 90.00 90.00 88.25
6 89.00 90.00 90.00 90.00 89.75
7 88.00 90.00 91.00 91.00 90.00
8 87.00 90.00 90.00 90.00 89.25
9 89.00 90.00 90.00 89.00 89.50
10 87.00 89.00 91.00 89.00 89.00
Average 83.50 88.30 87.10 88.50
3.2. Average pooling test
In measuring the loss ratio of the training and validation system process, it was found that the
measured loss pattern decreased as the epoch value increased. In addition, compared to systems with the max
pooling type, systems with average pooling that use a filter length of 9 and number of filters of 20 have a lower
average gap loss between the training and validation processes. The graph of the ratio of the value of training
loss and validation loss based on the size of the epoch can be seen in Figure 9.
The system accuracy results with average pooling can be seen in Table 2. Based on the results of
testing the system on the average pooling type, the highest average accuracy value based on filter length is
obtained on all criteria for the number of filters, with a value of 91.51% at a filter length of 9. Meanwhile, the
highest average accuracy value based on the number of filters occurs in the number of 10 filters, with a value
of 87.42%. In testing the system with a specific filter length and number of filters, an accuracy of 92.69% is
obtained with a filter length of 9 with a number of 20 filters. With the accuracy value obtained, the system is
considered to have good performance in detecting OSA by processing the ECG signal using an average pooling.
Int J Artif Intell ISSN: 2252-8938 
Obstructive sleep apnea detection based on electrocardiogram signal … (Rahmat Widadi)
4135
Loss Epoch
Figure 1. Training and validation loss on 1D-CNN by using filter length 9, number of filters 20, and average
pooling
Table 2. Accuracy of 1D-CNN with average pooling
Pooling Type Filter Length Accuracy (%) Average
5 Filters 10 Filters 15 Filters 20 Filters
Average Pooling 1 60.12 69.43 74.15 64.71 67.10
2 82.99 85.09 76.27 66.49 77.71
3 85.32 88.22 84.34 90.05 86.98
4 85.11 87.18 88.87 89.36 87.63
5 86.24 89.95 91.34 91.89 89.86
6 88.05 91.02 88.97 91.44 89.87
7 89.61 91.36 92.00 91.63 91.15
8 86.93 90.06 92.20 91.79 90.25
9 89.52 91.55 92.26 92.69 91.51
10 90.57 90.30 90.91 90.95 90.68
Average 84.45 87.42 87.13 86.10
3.3. Performance comparison with previous studies
Table 3 presents previous studies related to OSA detection based on ECG signal. The comparison
here only uses research from the same data. This is intended to make the comparison fairer. Based on
Table 3, the method proposed in this paper has higher accuracy than previous studies.
Table 3. Comparison with previous studies
Ref. Feature extraction Classifier Accuracy (%)
[15] Multiscale entropy SVM 85.6
[3] Heart rate variability SVM 89.5
[30] Discrete wavelet transforms, 1st
order statistics Bagged trees 89.2
Proposed method N. A 1D-CNN 92.69
The advantage of this method is that it does not require a separate feature extraction process. CNN
has the ability to perform feature extraction automatically. The configuration of the designed CNN determines
accuracy. The weakness of using CNN is that it requires a large enough dataset for sufficient training. In
addition, it requires repeated optimization to get the configuration that produces the highest accuracy.
Experiments using other deep learning methods are an interesting research topic at a later stage.
4. CONCLUSION
Based on the results of measuring system performance with two types of pooling: max pooling and
average pooling, it is found that the average pooling type can produce better performance. It is evidenced by
measuring accuracy based on the filter effect, loss based on epoch values, and classification accuracy based on
confusion matrix values, all of which show that a system with average pooling is better than max pooling.
Based on the value of accuracy and the ability of the system to classify data, average pooling is considered
capable of providing higher values of 1.69% and 2.1%, respectively. In addition, even though both systems
show a similar loss pattern trend that both decrease in direct proportion to increasing epochs, the gap between
the training and validation loss values in the system with average pooling shows less value than the system
 ISSN: 2252-8938
Int J Artif Intell, Vol. 13, No. 4, December 2024: 4129-4137
4136
with max pooling. It shows that a system with average pooling using a filter length of nine with several 20
filters at the 50th epoch is proven to detect OSA through ECG signal processing with excellent system accuracy
and stability.
REFERENCES
[1] J. R. Tietjens et al., “Obstructive sleep apnea in cardiovascular disease: A review of the literature and proposed multidisciplinary
clinical management strategy,” Journal of the American Heart Association, vol. 8, no. 1, 2019, doi: 10.1161/JAHA.118.010440.
[2] J. S. -Soler, B. F. Giraldo, J. A. Fiz, and R. Jane, “Relationship between heart rate excursion and apnea duration in patients with
obstructive sleep apnea,” Proceedings of the Annual International Conference of the IEEE Engineering in Medicine and Biology
Society, EMBS, pp. 1539–1542, 2017, doi: 10.1109/EMBC.2017.8037129.
[3] A. Rizal, F. D. A. A. Siregar, and H. T. Fauzi, “Obstructive sleep apnea (OSA) classification based on heart rate variability (HRV)
on electrocardiogram (ECG) signal using support vector machine (SVM),” Traitement du Signal, vol. 39, no. 2, pp. 469–474, 2022,
doi: 10.18280/ts.390208.
[4] O. Faust, U. R. Acharya, E. Y. K. Ng, and H. Fujita, “A review of ECG-based diagnosis support systems for obstructive sleep
apnea,” Journal of Mechanics in Medicine and Biology, vol. 16, no. 1, 2016, doi: 10.1142/S0219519416400042.
[5] N. Febriana, A. Rizal, and E. Susanto, “Sleep monitoring system based on body posture movement using Microsoft Kinect sensor,”
AIP Conference Proceedings, vol. 2092, 2019, doi: 10.1063/1.5096680.
[6] O. Elisha, A. Tarasiuk, and Y. Zigel, “Detection of obstructive sleep apnea using speech signal analysis,” Models and Analysis of
Vocal Emissions for Biomedical Applications - 7th International Workshop, MAVEBA 2011, pp. 13–16, 2011.
[7] N. Selvaraj and R. Narasimhan, “Detection of sleep apnea on a per-second basis using respiratory signals,” Annual International
Conference of the IEEE Engineering in Medicine and Biology Society, EMBS, pp. 2124–2127, 2013, doi: 10.1109/EMBC.2013.6609953.
[8] H. Huang and F. Lin, “A speech feature extraction method using complexity measure for voice activity detection in WGN,” Speech
Communication, vol. 51, no. 9, pp. 714–723, 2009, doi: 10.1016/j.specom.2009.02.004.
[9] C. Varon, A. Caicedo, D. Testelmans, B. Buyse, and S. V. Huffel, “A novel algorithm for theautomaticdetection of sleep apneafrom single-
lead ECG,” IEEE Transactions on Biomedical Engineering, vol. 62, no. 9, pp. 2269–2278, 2015, doi: 10.1109/TBME.2015.2422378.
[10] P. Langley, E. J. Bowers, and A. Murray, “Principal component analysis as a tool for analyzing beat-to-beat changes in ECG
features: Application to ECG-derived respiration,” IEEE Transactions on Biomedical Engineering, vol. 57, no. 4, pp. 821–829,
2010, doi: 10.1109/TBME.2009.2018297.
[11] M. Bahrami and M. Forouzanfar, “Sleep apnea detection from single-lead ECG: a comprehensive analysis of machine learning and
deep learning algorithms,” IEEE Transactions on Instrumentation and Measurement, vol. 71, 2022, doi: 10.1109/TIM.2022.3151947.
[12] R. P. -Areny, J. C. -Balagué, and F. J. Rosell, “The effect of respiration-induced heart movents on the ECG,” IEEE Transactions
on Biomedical Engineering, vol. 36, no. 6, pp. 585–590, 1989, doi: 10.1109/10.29452.
[13] A. P. Razi, Z. Einalou, and M. Manthouri, “Sleep apnea classification using random forest via ECG,” Sleep and Vigilance, vol. 5,
no. 1, pp. 141–146, 2021, doi: 10.1007/s41782-021-00138-4.
[14] A. Zarei and B. M. Asl, “Automatic detection of obstructive sleep apnea using wavelet transform and entropy-based features from
single-lead ECG signal,” IEEE Journal of Biomedical and Health Informatics, vol. 23, no. 3, pp. 1011–1021, 2019, doi:
10.1109/JBHI.2018.2842919.
[15] A. Rizal, U. R. Iman, and H. Fauzi, “Classification of sleep apnea using multi scale entropy on electrocardiogram signal,” International
Journal of Online and Biomedical Engineering (iJOE), vol. 17, no. 14, pp. 79–89, Dec. 2021, doi: 10.3991/ijoe.v17i14.25905.
[16] L. Almazaydeh, K. Elleithy, and M. Faezipour, “Obstructive sleep apnea detection using SVM-based classification of ECG signal
features,” Proceedings of the Annual International Conference of the IEEE Engineering in Medicine and Biology Society, EMBS,
pp. 4938–4941, 2012, doi: 10.1109/EMBC.2012.6347100.
[17] Jondri and A. Rizal, “Classification of premature ventricular contraction (PVC) based on ecg signal using convolutional neural network
(CNN),” Indonesian Journal of Electrical Engineering and Informatics, vol. 8, no. 3, pp. 494–499, 2020, doi: 10.11591/ijeei.v8i3.1530.
[18] S. A. Singh and S. Majumder, “A novel approach OSA detection using single-lead ECG scalogram based on deep neural network,”
Journal of Mechanics in Medicine and Biology, vol. 19, no. 4, 2019, doi: 10.1142/S021951941950026X.
[19] M. Bahrami and M. Forouzanfar, “Detection of sleep apnea from single-lead ECG: Comparison of deep learning algorithms,” 2021 IEEE
International Symposium on Medical Measurements and Applications, MeMeA 2021, 2021, doi: 10.1109/MeMeA52024.2021.9478745.
[20] O. Faust, R. Barika, A. Shenfield, E. J. Ciaccio, and U. R. Acharya, “Accurate detection of sleep apnea with long short-term memory
network based on RR interval signals,” Knowledge-Based Systems, vol. 212, 2021, doi: 10.1016/j.knosys.2020.106591.
[21] Q. Shen, H. Qin, K. Wei, and G. Liu, “Multiscale deep neural network for obstructive sleep apnea detection using RR interval from
single-lead ECG signal,” IEEE Transactions on Instrumentation and Measurement, vol. 70, 2021, doi: 10.1109/TIM.2021.3062414.
[22] T. Penzel, G. B. Moody, R. G. Mark, A. L. Goldberger, and J. H. Peter, “The apnea-ECG database,” in Computers in Cardiology
2000, 2018, vol. 11, no. 1, pp. 255–258, doi: 10.1109/CIC.2000.898505.
[23] A. L. Goldberger et al., “PhysioBank, PhysioToolkit, and PhysioNet: components of a new research resource for complex
physiologic signals,” Circulation, vol. 101, no. 23, 2000, doi: 10.1161/01.cir.101.23.e215.
[24] T. Paul et al., “ECG and SpO2 signal-based real-time sleep apnea detection using feed-forward artificial neural network,” AMIA
Annual Symposium proceedings, AMIA Symposium, vol. 2022, pp. 379–385, 2022.
[25] Y. Sun, “The neural network of one-dimensional convolution-an example of the diagnosis of diabetic retinopathy,” IEEE Access,
vol. 7, pp. 69657–69666, 2019, doi: 10.1109/ACCESS.2019.2916922.
[26] A. Anton, N. F. Nissa, A. Janiati, N. Cahya, and P. Astuti, “Application of deep learning using convolutional neural network (CNN)
method for women’s skin classification,” Scientific Journal of Informatics, vol. 8, no. 1, pp. 144–153, 2021, doi: 10.15294/sji.v8i1.26888.
[27] A. Zafar et al., “A comparison of pooling methods for convolutional neural networks,” Applied Sciences, vol. 12, no. 17, 2022, doi:
10.3390/app12178643.
[28] B. Daróczy, “Gaussian perturbations in ReLU networks and the arrangement of activation regions,” Mathematics, vol. 10, no. 7,
2022, doi: 10.3390/math10071123.
[29] K. Z. -Mokhtar and J. M. -Saleh, “An oil fraction neural sensor developed using electrical capacitance tomography sensor data,”
Sensors, vol. 13, no. 9, pp. 11385–11406, 2013, doi: 10.3390/s130911385.
[30] A. Rizal, S. Hadiyoso, H. Fauzi, and R. Widadi, “Obstructive sleep apnea detection based on ECG signal using statistical features
of wavelet subband,” International Journal of Electrical and Computer Engineering Systems, vol. 13, no. 10, pp. 877–884, 2022,
doi: 10.32985/ijeces.13.10.13.
Int J Artif Intell ISSN: 2252-8938 
Obstructive sleep apnea detection based on electrocardiogram signal … (Rahmat Widadi)
4137
BIOGRAPHIES OF AUTHORS
Rahmat Widadi obtained a master’s degree in engineering at the Department of
Electrical Engineering and Information Technology, Universitas Gadjah Mada in 2018. Since
that year he has also been a lecturer at Institut Teknologi Telkom Purwokerto. His homebase is
in biomedical engineering with research interests related to signal processing either
one-dimensional or two-dimensional signals and artificial intelligence. Currently he is pursuing
his doctoral studies at the Department of Electrical Engineering and Information Technology,
Universitas Gadjah Mada. He can be contacted at email: rahmat@ittelkom-pwt.ac.id.
Achmad Rizal received Bachelor of Engineering in Telecommunication
Engineering from STT Telkom (now, Telkom University), Bandung Indonesia in 2000. He
received master’s degree in biomedical engineering from Institut Teknologi Bandung, Bandung,
Indonesia in October 2006. Received Ph.D. degree from Universitas Gadjah Mada, Yogyakarta,
Indonesia. His research interests include biomedical signal processing, biomedical image
processing, biomedical instrumentation, and telemedicine. Now he is associate professor in
School of Electrical Engineering, Telkom University. He can be contacted at email:
achmadrizal@telkomuniversity.ac.id.
Sugondo Hadiyoso received the Doctor in Electrical Engineering from Institut
Teknologi Bandung, Indonesia in March 2023. Since 2010, he joined as a Lecturer in the
Diploma of Telecommunication Technology, School of Applied Science, Telkom University.
He is also currently members of Biomedical Instrumentation Research Group in Telkom
Univesity. His research interests are wireless sensor network, embedded system, logic design
on FPGA, and biomedical engineering. The focus of his doctoral research is signal processing
and analysis of EEG signals. He can be contacted at email: sugondo@telkomuniversity.ac.id.
Hilman Fauzi received his master’s degree from STEI Institut Teknologi Bandung,
Indonesia in 2013. He received Ph.D. from Malaysia-Japan International Institute of
Technology, Universiti Teknologi Malaysia (UTM), Malaysia in 2020. Currently, he is a
researcher and lecturer at Telkom University Indonesia. His research interests include biosignal
processing, artificial intelligence, and biomedical engineering. He can be contacted at email:
hilmanfauzitsp@telkomuniversity.ac.id.
Ziani Said is a professor at the Department of Electrical Engineering at Hassan II
University (ESTC) in Casablanca, Morocco. He is with also Department of Health Technologies
Engineering, Research Group in Biomedical Engineering and Pharmaceutical Sciences,
ENSAM, Mohammed V University, Agdal, Morocco. His research interests include digital
design, industrial applications, industrial electronics, industrial informatics, power electronics,
motor drives, renewable energy, FPGA and DSP applications, embedded systems, adaptive
control, neural network control, automatic robot control, motion control, and artificial
intelligence. He is a senior member of IEEE with member/customer number: 98711129. He can
be contacted at email: said.ziani@univh2c.ma or ziani9@yahoo.fr.

More Related Content

PDF
AUTOMATIC HOME-BASED SCREENING OF OBSTRUCTIVE SLEEP APNEA USING SINGLE CHANNE...
PDF
Computer Aided Detection of Obstructive Sleep Apnea from EEG Signals
PDF
Computer Aided Detection of Obstructive Sleep Apnea from EEG Signals
PDF
Computer Aided Detection of Obstructive Sleep Apnea from EEG Signals
PDF
Computer Aided Detection of Obstructive Sleep Apnea from EEG Signals
PPTX
sleep apnea detection
PDF
IRJET - Sleep Apnea Detection using Physiological Signals
PDF
Ensemble Feature Selection (EFS) and Ensemble Convolutional Neural Network wi...
AUTOMATIC HOME-BASED SCREENING OF OBSTRUCTIVE SLEEP APNEA USING SINGLE CHANNE...
Computer Aided Detection of Obstructive Sleep Apnea from EEG Signals
Computer Aided Detection of Obstructive Sleep Apnea from EEG Signals
Computer Aided Detection of Obstructive Sleep Apnea from EEG Signals
Computer Aided Detection of Obstructive Sleep Apnea from EEG Signals
sleep apnea detection
IRJET - Sleep Apnea Detection using Physiological Signals
Ensemble Feature Selection (EFS) and Ensemble Convolutional Neural Network wi...

Similar to Obstructive sleep apnea detection based on electrocardiogram signal using one-dimensional convolutional neural network (20)

PDF
Arduino uno based obstructive sleep apnea detection using respiratory signal
PDF
Sleep Apnea Identification using HRV Features of ECG Signals
PDF
Reconstruction of Respiratory Signal from ECG
PPTX
Polysomnography
PDF
IRJET- Arrhythmia Detection using One Dimensional Convolutional Neural Network
PDF
Classifying electrocardiograph waveforms using trained deep learning neural n...
DOCX
An automatic screening approach for obstructive sleep apnea diagnosis based o...
PDF
IRJET - ECG based Cardiac Arrhythmia Detection using a Deep Neural Network
PDF
Arduino based wireless tracking of Sleep Apnea through monitoring of Health p...
PPTX
POLYSOMNOGRAPHY & EEG ACTIVATION METHODS
PDF
psgbasics03-04-2017-
PPTX
Polysomnography
PPTX
Obstructive sleep apnoea - clinical approach to a patient/ AASM guidelines
PDF
Extraction of respiratory rate from ppg signals using pca and emd
PDF
Extraction of respiratory rate from ppg signals using pca and emd
PDF
Polysomnography and its parameters- a complete overview.
PPT
Zyh Paperstudy
PDF
Electrocardiograph signal recognition using wavelet transform based on optim...
PDF
A Review on ECG -Signal Classification of Scalogram Snap shots the use of Con...
PPT
Polysomnography: recording and sleep staging
Arduino uno based obstructive sleep apnea detection using respiratory signal
Sleep Apnea Identification using HRV Features of ECG Signals
Reconstruction of Respiratory Signal from ECG
Polysomnography
IRJET- Arrhythmia Detection using One Dimensional Convolutional Neural Network
Classifying electrocardiograph waveforms using trained deep learning neural n...
An automatic screening approach for obstructive sleep apnea diagnosis based o...
IRJET - ECG based Cardiac Arrhythmia Detection using a Deep Neural Network
Arduino based wireless tracking of Sleep Apnea through monitoring of Health p...
POLYSOMNOGRAPHY & EEG ACTIVATION METHODS
psgbasics03-04-2017-
Polysomnography
Obstructive sleep apnoea - clinical approach to a patient/ AASM guidelines
Extraction of respiratory rate from ppg signals using pca and emd
Extraction of respiratory rate from ppg signals using pca and emd
Polysomnography and its parameters- a complete overview.
Zyh Paperstudy
Electrocardiograph signal recognition using wavelet transform based on optim...
A Review on ECG -Signal Classification of Scalogram Snap shots the use of Con...
Polysomnography: recording and sleep staging
Ad

More from IAESIJAI (20)

PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Abstractive summarization using multilingual text-to-text transfer transforme...
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Automatic detection of dress-code surveillance in a university using YOLO alg...
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
PDF
Improved convolutional neural networks for aircraft type classification in re...
PDF
Primary phase Alzheimer's disease detection using ensemble learning model
PDF
Deep learning-based techniques for video enhancement, compression and restora...
PDF
Hybrid model detection and classification of lung cancer
PDF
Adaptive kernel integration in visual geometry group 16 for enhanced classifi...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Enhancing fall detection and classification using Jarratt‐butterfly optimizat...
PDF
Deep ensemble learning with uncertainty aware prediction ranking for cervical...
PDF
Event detection in soccer matches through audio classification using transfer...
PDF
Detecting road damage utilizing retinaNet and mobileNet models on edge devices
PDF
Optimizing deep learning models from multi-objective perspective via Bayesian...
PDF
Squeeze-excitation half U-Net and synthetic minority oversampling technique o...
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
Exploring DenseNet architectures with particle swarm optimization: efficient ...
A comparative study of natural language inference in Swahili using monolingua...
Abstractive summarization using multilingual text-to-text transfer transforme...
Enhancing emotion recognition model for a student engagement use case through...
Automatic detection of dress-code surveillance in a university using YOLO alg...
Hindi spoken digit analysis for native and non-native speakers
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
Improved convolutional neural networks for aircraft type classification in re...
Primary phase Alzheimer's disease detection using ensemble learning model
Deep learning-based techniques for video enhancement, compression and restora...
Hybrid model detection and classification of lung cancer
Adaptive kernel integration in visual geometry group 16 for enhanced classifi...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Enhancing fall detection and classification using Jarratt‐butterfly optimizat...
Deep ensemble learning with uncertainty aware prediction ranking for cervical...
Event detection in soccer matches through audio classification using transfer...
Detecting road damage utilizing retinaNet and mobileNet models on edge devices
Optimizing deep learning models from multi-objective perspective via Bayesian...
Squeeze-excitation half U-Net and synthetic minority oversampling technique o...
A novel scalable deep ensemble learning framework for big data classification...
Exploring DenseNet architectures with particle swarm optimization: efficient ...
Ad

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Approach and Philosophy of On baking technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Machine learning based COVID-19 study performance prediction
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Chapter 3 Spatial Domain Image Processing.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Spectroscopy.pptx food analysis technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Approach and Philosophy of On baking technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Machine learning based COVID-19 study performance prediction
Dropbox Q2 2025 Financial Results & Investor Presentation
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Electronic commerce courselecture one. Pdf
Spectral efficient network and resource selection model in 5G networks
Chapter 3 Spatial Domain Image Processing.pdf
The AUB Centre for AI in Media Proposal.docx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Programs and apps: productivity, graphics, security and other tools
NewMind AI Weekly Chronicles - August'25 Week I
Advanced methodologies resolving dimensionality complications for autism neur...
MIND Revenue Release Quarter 2 2025 Press Release
Spectroscopy.pptx food analysis technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx

Obstructive sleep apnea detection based on electrocardiogram signal using one-dimensional convolutional neural network

  • 1. IAES International Journal of Artificial Intelligence (IJ-AI) Vol. 13, No. 4, December 2024, pp. 4129~4137 ISSN: 2252-8938, DOI: 10.11591/ijai.v13.i4.pp4129-4137  4129 Journal homepage: http://ijai.iaescore.com Obstructive sleep apnea detection based on electrocardiogram signal using one-dimensional convolutional neural network Rahmat Widadi1 , Achmad Rizal2 , Sugondo Hadiyoso3 , Hilman Fauzi2 , Ziani Said4 1 Department of Biomedical Engineering, Faculty of Telecommunication and Electrical Engineering, Institut Teknologi Telkom Purwokerto, Purwokerto, Indonesia 2 School of Electrical Engineering, Telkom University, Bandung, Indonesia 3 School of Applied Science, Telkom University, Bandung, Indonesia 4 Department of Health Technologies Engineering, Research Group in Biomedical Engineering and Pharmaceutical Sciences, ENSAM, Mohammed V University, Rabat, Morocco Article Info ABSTRACT Article history: Received Jun 25, 2023 Revised Apr 19, 2024 Accepted Jun 1, 2024 Obstructive sleep apnea (OSA) is a respiratory obstruction that occurs during sleep and is often known as snoring. OSA is often ignored even though it can cause cardiovascular problems. Early diagnosis is needed for prevention towards worse complications. OSA clinical diagnosis can use polysomnography (PSG) while the patient is sleeping. The PSG examination includes calculating total apnea plus hypopnea every hour during sleep. However, PSG examination tends to be high cost, takes a long time, and is impractical. Since OSA is related to breathing and heart activity, the electrocardiogram (ECG) examination is an alternative tool in OSA analysis. Therefore, this study proposes OSA detection on single lead ECG using one- dimensional (1D)-convolutional neural network (CNN). The proposed CNN architecture consists of 4 convolutional layers, 4 pooling layers, 1 dropout layer, 1 flatten layers, 2 dropout layers, 1 dense layer with rectified linear unit (ReLU) activation function, and 1 dense layer with SoftMax activation function. The proposed method was then tested on the ECG sleep apnea dataset from PhysioNet. The proposed model produces an accuracy of 92.69% with the average pooling scenario. The proposed method is expected to help clinicians in diagnosing OSA based on ECG signals. Keywords: Convolutional neural network Electrocardiogram Obstructive sleep apnea One dimensional Polysomnography This is an open access article under the CC BY-SA license. Corresponding Author: Sugondo Hadiyoso School of Applied Science, Telkom University Bandung, Indonesia Email: sugondo@telkomuniversity.ac.id 1. INTRODUCTION One of sleep disease or sleep disorder in obstructive sleep apnea (OSA) [1]. OSA conditions occur if the intake of air is stopped for 10 seconds or more during sleep inspiration [1]. Apnea causes obstruction because the body's muscles relax, causing the airways to collapse [2]. If the airway is closed, the patient will wake up during sleep or experience a sudden transition to sleep. OSA is associated with several diseases, including hypertension and several cardiovascular diseases such as heart failure or myocardial ischemia [3]. Depending on the signal to be observed, several methods are used to diagnose OSA. Became one of the OSA observation standard is polysomnography (PSG). The disadvantage of this PSG is that it is time-consuming, costly, and impractical, so it is only performed on patients with a specific level of severity [4]. Through patient movement, video processing can be used to detect OSA [5]. Speech processing methods can be used to analyze snoring so that OSA can be detected [6]. The analysis of speech signals is frequently
  • 2.  ISSN: 2252-8938 Int J Artif Intell, Vol. 13, No. 4, December 2024: 4129-4137 4130 used to analyze sleep apnea using respiratory signals [7]. Voice activity detection (VAD) is a popular algorithm for detecting the presence or absence of the respiratory process during sleep [8]. Numerous studies have examined the relationship between electrocardiogram (ECG) signals and respiration, called as electrocardiogram-derived respiration (EDR) [9]. Respiration influences ECG signals through a variety of mechanisms, including changes in thorax impedance resulting from lung volume changes [10]. The subsequent mechanism is the alteration of the heart vector due to shifts or changes in heart orientation associated with ECG electrodes [11], [12]. OSA classification using single-lead ECG has been explored by many researchers using various methods. There are two essential parts in the OSA ECG classification process: feature extraction and classification. In the feature extraction process, the heart rate variability (HRV) parameter is one of the top choices for many researchers because it can be directly extracted from the ECG signal. Median, mean, skewness (third momentum), kurtosis, minimum, and range calculated to get the HRV parameters. Another parameter derived from the internal R-R is the standard deviation of successive differences between adjacent R–R intervals (SDSD). Differences in the number of R-R intervals that exceed a specific time, such as 50 ms or 20 ms, are also extracted parameters such as NN50, NN20, pNN50, and pNN20 [13]. The extracted features can also be features from the frequency domain. This frequency component usually represents the activities of thermoregulation mechanisms, sympathetic activity, and parasympathetic activities [11]. Characteristics associated with this frequency include the very low-frequency (VLF) band, low-frequency (LF) band, and high-frequency (HF) band. Another method used for feature extraction is signal decomposition, and then feature extraction is performed. For example, Zarei and Asl [14] used wavelet transforms and entropy for ECG OSA classification. Another study used multiscale entropy as a feature [15]. This method is based on multiscale signal complexity, which is considered related to OSA ECG. The following process in the OSA ECG classification is the classifier. The support vector machine (SVM) is one of the most widely used machine learning classifiers [16]. In its development, deep learning is the next choice because of its advantages in performing feature extraction automatically [17]. Even so, some researchers still combine feature extraction and deep learning. Singh and Majumder [18] used a scalogram and convolutional neural network (CNN) to produce an accuracy of 86.2%. Bahrami and Forouzanfar [19] used long short-term memory (LSTM) to have 80.67% accuracy, 75.04% sensitivity, and 84.13% specificity. Meanwhile, another group of researchers using LTSM produced the highest accuracy of 99.8% with RR interval as a feature [20]. The RR interval combined with a multiscale dilation attention (MSDA)-one dimensional convolutional neural network (1D-CNN) resulted in the highest accuracy of 89.4% [21]. From the several studies that have been described, it can be divided into two groups; those who use the feature extraction method and who do not use the feature extraction method. Apart from these differences, another difference is the method of processing or cutting data from the dataset used. To compare the performance of deep learning for OSA classification from a single lead ECG without a feature extraction process, it is necessary to try using deep learning directly without a feature extraction process or trimming the ECG signal further. In this study, the classification of normal and OSA ECG signals was carried out using 1D-CNN. Long-time ECG recording was cut into minute segments and used to input the 1D-CNN. In this study, the feature extraction process was not carried out but directly using the clipped ECG signal. CNN is optimized to get the best configuration to produce the highest accuracy. The proposed method can be an alternative for ECG signal processing, especially for OSA signal classification. 2. MATERIAL AND METHODS In this research, a modified CNN is proposed to solve the OSA ECG signal classification problem. Figure 1 shows the block diagram of the proposed 1D-CNN. The proposed 1D-CNN architecture to classify OSA ECG signals consists of 4 convolutional layers, 4 pooling layers, 1 dropout layer, 1 flatten layers, 2 dropout layers, 1 dense layer with rectified linear unit (ReLU) activation function, and 1 dense layer with SoftMax activation function. 2.1. Dataset This study used the PhysioNet ECG sleep apnea dataset [22], [23]. There are 70 records, with 35 belonging to the training set and 35 to the testing set. Each recording consists of a digital ECG signal and is annotated by an expert [24]. ECG signal recording length ranges from seven to ten hours. In some recordings there are also additional signals such as respiration and oxygen saturation, but these additional signals were not used in this study. The ECG signal is truncated every 6,000 samples. This number is equal to a one-minute signal because it has a sampling frequency of 100 Hz. This process produces 17,010 data for train and test the
  • 3. Int J Artif Intell ISSN: 2252-8938  Obstructive sleep apnea detection based on electrocardiogram signal … (Rahmat Widadi) 4131 proposed method. The normal ECG and OSA signals are shown in Figure 2. Based on Figure 2, the OSA ECG signal Figure 2(a) has a different orientation in the spike area compared to normal ECG signals in Figure 2(b). Figure 1. Block diagram of proposed 1D-CNN (a) (b) Figure 2. Normal and OSA ECG signal, (a) standard ECG, one minute recoding and (b) OSA event in ECG of the same subject
  • 4.  ISSN: 2252-8938 Int J Artif Intell, Vol. 13, No. 4, December 2024: 4129-4137 4132 2.2. One-dimensional convolutional neural network In general, 1D-CNN consists of two parts, namely the convolution layer and the multilayer perceptron (MLP) layer [25]. In this study, the input of 1D-CNN is a multichannel ECG signal, and the output is the class of the input signal. Figure 3 shows the general structure of a 1D-CNN. The convolution layers have convolution, pooling, and flattening processes [26]. In the convolution process, there are kernels that are shifted and multiplied by input signals. If the input signal 𝑥(𝑛) is of length 𝑛 and the kernel is ℎ(𝑘) of length 𝑘. Each kernel is shifted by𝑠 (stride) after multiplied by 𝑥(𝑛). The convolution process between 𝑥(𝑛) and ℎ(𝑘) is defined in (1). 𝑦(𝑛) = { ∑ 𝑥(𝑛 − 𝑖)ℎ(𝑖) 𝑘 𝑖=0 , 𝑛 = 𝑘 − 1 ∑ 𝑥(𝑛 − 𝑖 + 𝑠 − 1)ℎ(𝑖) 𝑘 𝑖=0 , 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 (1) Figure 3. 1D-CNN structure The output of the convolution process is used in the pooling process to reduce the signal size [27]. Two types of pooling used in this study are average pooling and max pooling. Average pooling takes the average value of the signal window along 𝑓. This window or filter is shifted on the signal by a shift of 𝑠 (stride). A similar process occurs in max pooling, only that the value taken is the maximum value instead of the average. Figure 4 shows example of max pooling process. Figure 4. Example of max pooling operation: window size =3, stride =3 The next operation on convolution layers is flatten. The output signal in pooling operation has dimensions of more than 1. To be used as input for the MLP stage, it needs to be converted into 1 dimension. Figure 5 is an illustration of the flatten process. Figure 5. Flatten process The signals that have been flattened can be used as MLP inputs. MLP is also known as a fully connected layer. This term is because each neuron in the previous layer is connected to all neurons in the next layer. Figure 6 shows an example of an MLP with an input layer, one hidden layer, and an output layer. There are seven neurons, namely 𝑥1 and 𝑥2 on the input layer, ℎ1, ℎ2, ℎ3 on the hidden layer, 𝑜1and 𝑜2 on the input layer. The output of neurons in the hidden layer is determined using (2). 𝑦 = 𝑓(𝑤𝑇 𝑥) (2) Input Signal Convolution Layer Multilayer Perceptron Output Class
  • 5. Int J Artif Intell ISSN: 2252-8938  Obstructive sleep apnea detection based on electrocardiogram signal … (Rahmat Widadi) 4133 Inner product weight w with input x is given to the activation function f so that it is non-linear. The activation function used in this study is ReLU. The ReLU function is defined (3) [28]. 𝑦 = max(0, 𝑤𝑇 𝑥) (3) Figure 6. Example of MLP [29] 3. RESULTS AND DISCUSSION The OSA detection system is tested for system performance by calculating system accuracy based on two types of pooling: max pooling and average pooling. This accuracy measurement is carried out to determine the difference in the effect of the type of pooling with the length and number of filters on system accuracy. Filters vary from 1-10 while the number of filters is set to 5, 10, 15, and 20 filters. In addition to accuracy, system performance measurements were also carried out with training parameters and validation loss for each type of pooling. The distribution of OSA data is 80% for training and 20% for testing. 3.1. Max pooling test The first stage is the training process, 1D-CNN is trained using 13,608 OSA data. System performance is measured based on the loss parameter in the system training and validation process. One example of the training process that will be discussed in this section is 1D-CNN with max pooling, filter length is 7, and the number of filters is 15. Based on the loss measurement results, the gap between the validation process and system training process loss values are getting higher as the epoch increases. The value of the gap loss at the 50th epoch is 0.05, with the training loss and validation loss values are 0.16 and 0.21, respectively. However, the trend of loss values from the two processes has decreased with a similar pattern, as shown in the graph in Figure 7. Loss Epoch Figure 7. Training and validation loss on 1D-CNN by using filter length 7, number of filters 15, and max pooling The performance calculation of the system model classification is performed using the confusion matrix from the testing stage. 1D-CNN was evaluated using 3,402 OSA data. The system model is a system with max pooling at a filter length of 7, the number of filters is 15, and the epoch is 50th. The confusion matrix value is obtained based on the evaluation results, as shown in Figure 8.
  • 6.  ISSN: 2252-8938 Int J Artif Intell, Vol. 13, No. 4, December 2024: 4129-4137 4134 Figure 8. Example of a confusion matrix of max pooling 1D-CNN Furthermore, by using an accuracy calculation based on the value of the confusion matrix, a system classification accuracy of 90.8% is obtained. 𝐴𝑐𝑐𝑢𝑟𝑟𝑎𝑐𝑦 = 1,127+1,968 1,127+1,968+166+141 𝑥 100% = 90.8% The results of measuring system accuracy using max pooling get considered good results. The accuracy system results with max pooling can be seen in Table 1. The highest average accuracy of the system based on filter length is 90% at a filter length of 9. Furthermore, the highest average accuracy system based on the number of filters occurs in the number of filters 20, with an accuracy of 88.50%. Specifically, based on the filter length and the number of filters on the max pooling type, the highest system accuracy was performed at 91% on filter lengths of 7 and 10 with the filter numbers of 15 and 20. Table 1. Accuracy of 1D-CNN with max pooling Pooling type Filter length Accuracy (%) Average 5 Filters 10 Filters 15 Filters 20 Filters Max Pooling 1 65.00 83.00 69.00 81.00 74.50 2 79.00 86.00 83.00 87.00 83.75 3 81.00 88.00 89.00 88.00 86.50 4 85.00 89.00 88.00 90.00 88.00 5 85.00 88.00 90.00 90.00 88.25 6 89.00 90.00 90.00 90.00 89.75 7 88.00 90.00 91.00 91.00 90.00 8 87.00 90.00 90.00 90.00 89.25 9 89.00 90.00 90.00 89.00 89.50 10 87.00 89.00 91.00 89.00 89.00 Average 83.50 88.30 87.10 88.50 3.2. Average pooling test In measuring the loss ratio of the training and validation system process, it was found that the measured loss pattern decreased as the epoch value increased. In addition, compared to systems with the max pooling type, systems with average pooling that use a filter length of 9 and number of filters of 20 have a lower average gap loss between the training and validation processes. The graph of the ratio of the value of training loss and validation loss based on the size of the epoch can be seen in Figure 9. The system accuracy results with average pooling can be seen in Table 2. Based on the results of testing the system on the average pooling type, the highest average accuracy value based on filter length is obtained on all criteria for the number of filters, with a value of 91.51% at a filter length of 9. Meanwhile, the highest average accuracy value based on the number of filters occurs in the number of 10 filters, with a value of 87.42%. In testing the system with a specific filter length and number of filters, an accuracy of 92.69% is obtained with a filter length of 9 with a number of 20 filters. With the accuracy value obtained, the system is considered to have good performance in detecting OSA by processing the ECG signal using an average pooling.
  • 7. Int J Artif Intell ISSN: 2252-8938  Obstructive sleep apnea detection based on electrocardiogram signal … (Rahmat Widadi) 4135 Loss Epoch Figure 1. Training and validation loss on 1D-CNN by using filter length 9, number of filters 20, and average pooling Table 2. Accuracy of 1D-CNN with average pooling Pooling Type Filter Length Accuracy (%) Average 5 Filters 10 Filters 15 Filters 20 Filters Average Pooling 1 60.12 69.43 74.15 64.71 67.10 2 82.99 85.09 76.27 66.49 77.71 3 85.32 88.22 84.34 90.05 86.98 4 85.11 87.18 88.87 89.36 87.63 5 86.24 89.95 91.34 91.89 89.86 6 88.05 91.02 88.97 91.44 89.87 7 89.61 91.36 92.00 91.63 91.15 8 86.93 90.06 92.20 91.79 90.25 9 89.52 91.55 92.26 92.69 91.51 10 90.57 90.30 90.91 90.95 90.68 Average 84.45 87.42 87.13 86.10 3.3. Performance comparison with previous studies Table 3 presents previous studies related to OSA detection based on ECG signal. The comparison here only uses research from the same data. This is intended to make the comparison fairer. Based on Table 3, the method proposed in this paper has higher accuracy than previous studies. Table 3. Comparison with previous studies Ref. Feature extraction Classifier Accuracy (%) [15] Multiscale entropy SVM 85.6 [3] Heart rate variability SVM 89.5 [30] Discrete wavelet transforms, 1st order statistics Bagged trees 89.2 Proposed method N. A 1D-CNN 92.69 The advantage of this method is that it does not require a separate feature extraction process. CNN has the ability to perform feature extraction automatically. The configuration of the designed CNN determines accuracy. The weakness of using CNN is that it requires a large enough dataset for sufficient training. In addition, it requires repeated optimization to get the configuration that produces the highest accuracy. Experiments using other deep learning methods are an interesting research topic at a later stage. 4. CONCLUSION Based on the results of measuring system performance with two types of pooling: max pooling and average pooling, it is found that the average pooling type can produce better performance. It is evidenced by measuring accuracy based on the filter effect, loss based on epoch values, and classification accuracy based on confusion matrix values, all of which show that a system with average pooling is better than max pooling. Based on the value of accuracy and the ability of the system to classify data, average pooling is considered capable of providing higher values of 1.69% and 2.1%, respectively. In addition, even though both systems show a similar loss pattern trend that both decrease in direct proportion to increasing epochs, the gap between the training and validation loss values in the system with average pooling shows less value than the system
  • 8.  ISSN: 2252-8938 Int J Artif Intell, Vol. 13, No. 4, December 2024: 4129-4137 4136 with max pooling. It shows that a system with average pooling using a filter length of nine with several 20 filters at the 50th epoch is proven to detect OSA through ECG signal processing with excellent system accuracy and stability. REFERENCES [1] J. R. Tietjens et al., “Obstructive sleep apnea in cardiovascular disease: A review of the literature and proposed multidisciplinary clinical management strategy,” Journal of the American Heart Association, vol. 8, no. 1, 2019, doi: 10.1161/JAHA.118.010440. [2] J. S. -Soler, B. F. Giraldo, J. A. Fiz, and R. Jane, “Relationship between heart rate excursion and apnea duration in patients with obstructive sleep apnea,” Proceedings of the Annual International Conference of the IEEE Engineering in Medicine and Biology Society, EMBS, pp. 1539–1542, 2017, doi: 10.1109/EMBC.2017.8037129. [3] A. Rizal, F. D. A. A. Siregar, and H. T. Fauzi, “Obstructive sleep apnea (OSA) classification based on heart rate variability (HRV) on electrocardiogram (ECG) signal using support vector machine (SVM),” Traitement du Signal, vol. 39, no. 2, pp. 469–474, 2022, doi: 10.18280/ts.390208. [4] O. Faust, U. R. Acharya, E. Y. K. Ng, and H. Fujita, “A review of ECG-based diagnosis support systems for obstructive sleep apnea,” Journal of Mechanics in Medicine and Biology, vol. 16, no. 1, 2016, doi: 10.1142/S0219519416400042. [5] N. Febriana, A. Rizal, and E. Susanto, “Sleep monitoring system based on body posture movement using Microsoft Kinect sensor,” AIP Conference Proceedings, vol. 2092, 2019, doi: 10.1063/1.5096680. [6] O. Elisha, A. Tarasiuk, and Y. Zigel, “Detection of obstructive sleep apnea using speech signal analysis,” Models and Analysis of Vocal Emissions for Biomedical Applications - 7th International Workshop, MAVEBA 2011, pp. 13–16, 2011. [7] N. Selvaraj and R. Narasimhan, “Detection of sleep apnea on a per-second basis using respiratory signals,” Annual International Conference of the IEEE Engineering in Medicine and Biology Society, EMBS, pp. 2124–2127, 2013, doi: 10.1109/EMBC.2013.6609953. [8] H. Huang and F. Lin, “A speech feature extraction method using complexity measure for voice activity detection in WGN,” Speech Communication, vol. 51, no. 9, pp. 714–723, 2009, doi: 10.1016/j.specom.2009.02.004. [9] C. Varon, A. Caicedo, D. Testelmans, B. Buyse, and S. V. Huffel, “A novel algorithm for theautomaticdetection of sleep apneafrom single- lead ECG,” IEEE Transactions on Biomedical Engineering, vol. 62, no. 9, pp. 2269–2278, 2015, doi: 10.1109/TBME.2015.2422378. [10] P. Langley, E. J. Bowers, and A. Murray, “Principal component analysis as a tool for analyzing beat-to-beat changes in ECG features: Application to ECG-derived respiration,” IEEE Transactions on Biomedical Engineering, vol. 57, no. 4, pp. 821–829, 2010, doi: 10.1109/TBME.2009.2018297. [11] M. Bahrami and M. Forouzanfar, “Sleep apnea detection from single-lead ECG: a comprehensive analysis of machine learning and deep learning algorithms,” IEEE Transactions on Instrumentation and Measurement, vol. 71, 2022, doi: 10.1109/TIM.2022.3151947. [12] R. P. -Areny, J. C. -Balagué, and F. J. Rosell, “The effect of respiration-induced heart movents on the ECG,” IEEE Transactions on Biomedical Engineering, vol. 36, no. 6, pp. 585–590, 1989, doi: 10.1109/10.29452. [13] A. P. Razi, Z. Einalou, and M. Manthouri, “Sleep apnea classification using random forest via ECG,” Sleep and Vigilance, vol. 5, no. 1, pp. 141–146, 2021, doi: 10.1007/s41782-021-00138-4. [14] A. Zarei and B. M. Asl, “Automatic detection of obstructive sleep apnea using wavelet transform and entropy-based features from single-lead ECG signal,” IEEE Journal of Biomedical and Health Informatics, vol. 23, no. 3, pp. 1011–1021, 2019, doi: 10.1109/JBHI.2018.2842919. [15] A. Rizal, U. R. Iman, and H. Fauzi, “Classification of sleep apnea using multi scale entropy on electrocardiogram signal,” International Journal of Online and Biomedical Engineering (iJOE), vol. 17, no. 14, pp. 79–89, Dec. 2021, doi: 10.3991/ijoe.v17i14.25905. [16] L. Almazaydeh, K. Elleithy, and M. Faezipour, “Obstructive sleep apnea detection using SVM-based classification of ECG signal features,” Proceedings of the Annual International Conference of the IEEE Engineering in Medicine and Biology Society, EMBS, pp. 4938–4941, 2012, doi: 10.1109/EMBC.2012.6347100. [17] Jondri and A. Rizal, “Classification of premature ventricular contraction (PVC) based on ecg signal using convolutional neural network (CNN),” Indonesian Journal of Electrical Engineering and Informatics, vol. 8, no. 3, pp. 494–499, 2020, doi: 10.11591/ijeei.v8i3.1530. [18] S. A. Singh and S. Majumder, “A novel approach OSA detection using single-lead ECG scalogram based on deep neural network,” Journal of Mechanics in Medicine and Biology, vol. 19, no. 4, 2019, doi: 10.1142/S021951941950026X. [19] M. Bahrami and M. Forouzanfar, “Detection of sleep apnea from single-lead ECG: Comparison of deep learning algorithms,” 2021 IEEE International Symposium on Medical Measurements and Applications, MeMeA 2021, 2021, doi: 10.1109/MeMeA52024.2021.9478745. [20] O. Faust, R. Barika, A. Shenfield, E. J. Ciaccio, and U. R. Acharya, “Accurate detection of sleep apnea with long short-term memory network based on RR interval signals,” Knowledge-Based Systems, vol. 212, 2021, doi: 10.1016/j.knosys.2020.106591. [21] Q. Shen, H. Qin, K. Wei, and G. Liu, “Multiscale deep neural network for obstructive sleep apnea detection using RR interval from single-lead ECG signal,” IEEE Transactions on Instrumentation and Measurement, vol. 70, 2021, doi: 10.1109/TIM.2021.3062414. [22] T. Penzel, G. B. Moody, R. G. Mark, A. L. Goldberger, and J. H. Peter, “The apnea-ECG database,” in Computers in Cardiology 2000, 2018, vol. 11, no. 1, pp. 255–258, doi: 10.1109/CIC.2000.898505. [23] A. L. Goldberger et al., “PhysioBank, PhysioToolkit, and PhysioNet: components of a new research resource for complex physiologic signals,” Circulation, vol. 101, no. 23, 2000, doi: 10.1161/01.cir.101.23.e215. [24] T. Paul et al., “ECG and SpO2 signal-based real-time sleep apnea detection using feed-forward artificial neural network,” AMIA Annual Symposium proceedings, AMIA Symposium, vol. 2022, pp. 379–385, 2022. [25] Y. Sun, “The neural network of one-dimensional convolution-an example of the diagnosis of diabetic retinopathy,” IEEE Access, vol. 7, pp. 69657–69666, 2019, doi: 10.1109/ACCESS.2019.2916922. [26] A. Anton, N. F. Nissa, A. Janiati, N. Cahya, and P. Astuti, “Application of deep learning using convolutional neural network (CNN) method for women’s skin classification,” Scientific Journal of Informatics, vol. 8, no. 1, pp. 144–153, 2021, doi: 10.15294/sji.v8i1.26888. [27] A. Zafar et al., “A comparison of pooling methods for convolutional neural networks,” Applied Sciences, vol. 12, no. 17, 2022, doi: 10.3390/app12178643. [28] B. Daróczy, “Gaussian perturbations in ReLU networks and the arrangement of activation regions,” Mathematics, vol. 10, no. 7, 2022, doi: 10.3390/math10071123. [29] K. Z. -Mokhtar and J. M. -Saleh, “An oil fraction neural sensor developed using electrical capacitance tomography sensor data,” Sensors, vol. 13, no. 9, pp. 11385–11406, 2013, doi: 10.3390/s130911385. [30] A. Rizal, S. Hadiyoso, H. Fauzi, and R. Widadi, “Obstructive sleep apnea detection based on ECG signal using statistical features of wavelet subband,” International Journal of Electrical and Computer Engineering Systems, vol. 13, no. 10, pp. 877–884, 2022, doi: 10.32985/ijeces.13.10.13.
  • 9. Int J Artif Intell ISSN: 2252-8938  Obstructive sleep apnea detection based on electrocardiogram signal … (Rahmat Widadi) 4137 BIOGRAPHIES OF AUTHORS Rahmat Widadi obtained a master’s degree in engineering at the Department of Electrical Engineering and Information Technology, Universitas Gadjah Mada in 2018. Since that year he has also been a lecturer at Institut Teknologi Telkom Purwokerto. His homebase is in biomedical engineering with research interests related to signal processing either one-dimensional or two-dimensional signals and artificial intelligence. Currently he is pursuing his doctoral studies at the Department of Electrical Engineering and Information Technology, Universitas Gadjah Mada. He can be contacted at email: rahmat@ittelkom-pwt.ac.id. Achmad Rizal received Bachelor of Engineering in Telecommunication Engineering from STT Telkom (now, Telkom University), Bandung Indonesia in 2000. He received master’s degree in biomedical engineering from Institut Teknologi Bandung, Bandung, Indonesia in October 2006. Received Ph.D. degree from Universitas Gadjah Mada, Yogyakarta, Indonesia. His research interests include biomedical signal processing, biomedical image processing, biomedical instrumentation, and telemedicine. Now he is associate professor in School of Electrical Engineering, Telkom University. He can be contacted at email: achmadrizal@telkomuniversity.ac.id. Sugondo Hadiyoso received the Doctor in Electrical Engineering from Institut Teknologi Bandung, Indonesia in March 2023. Since 2010, he joined as a Lecturer in the Diploma of Telecommunication Technology, School of Applied Science, Telkom University. He is also currently members of Biomedical Instrumentation Research Group in Telkom Univesity. His research interests are wireless sensor network, embedded system, logic design on FPGA, and biomedical engineering. The focus of his doctoral research is signal processing and analysis of EEG signals. He can be contacted at email: sugondo@telkomuniversity.ac.id. Hilman Fauzi received his master’s degree from STEI Institut Teknologi Bandung, Indonesia in 2013. He received Ph.D. from Malaysia-Japan International Institute of Technology, Universiti Teknologi Malaysia (UTM), Malaysia in 2020. Currently, he is a researcher and lecturer at Telkom University Indonesia. His research interests include biosignal processing, artificial intelligence, and biomedical engineering. He can be contacted at email: hilmanfauzitsp@telkomuniversity.ac.id. Ziani Said is a professor at the Department of Electrical Engineering at Hassan II University (ESTC) in Casablanca, Morocco. He is with also Department of Health Technologies Engineering, Research Group in Biomedical Engineering and Pharmaceutical Sciences, ENSAM, Mohammed V University, Agdal, Morocco. His research interests include digital design, industrial applications, industrial electronics, industrial informatics, power electronics, motor drives, renewable energy, FPGA and DSP applications, embedded systems, adaptive control, neural network control, automatic robot control, motion control, and artificial intelligence. He is a senior member of IEEE with member/customer number: 98711129. He can be contacted at email: said.ziani@univh2c.ma or ziani9@yahoo.fr.