1. Introduction
Sleep is necessary for everyone, and the quality of sleep directly affects people’s work and life. Humans spend lots of time sleeping, and sleep research has received a lot of attention because of the importance of quality sleep [
1]. The American Academy of Sleep Medicine (AASM) divides sleep into five stages: wakefulness (W), N1, N2, N3 and REM. Among them, N1, N2 and N3 form the non-rapid eye movement (NREM) part of the sleep cycle, and the remaining stage is REM [
1]. REM and NREM represent some important functions of the brain, including cell recovery, memory consolidation and brain metabolite clearance [
2]. Sleep apnea (SA) is a common respiratory sleep disorder. Due to SA, the patient will experience symptoms such as decreased blood oxygen saturation and repeated awakenings during sleep, resulting in decreased sleep quality and even cardiovascular, metabolic abnormalities, neurocognitive disorders and other diseases [
3,
4,
5,
6]. According to the pathogenesis, SA can be divided into obstructive sleep apnea (OSA), central nervous sleep apnea (CSA) and mixed sleep apnea, of which OSA is the most common SA type.
In clinical practice, SA is usually detected by polysomnography (PSG), which is also the gold standard for SA diagnosis [
7,
8,
9]. However, this method requires the patient to stay in a professional sleep laboratory for 1 to 2 nights. Sensors are used to collect electrocardiograph (ECG), respiratory signals and blood oxygen saturation (SpO
2) and other physiological signals [
10,
11], and then SA is manually labeled. The detection process is complex and costly, making it impossible for many patients to be diagnosed and treated in a timely manner. Therefore, it has become a consensus of researchers to explore convenient and inexpensive methods of detecting SA.
After an extensive analysis of many physiological signals related to sleep apnea, researchers find that when a breath apnea event occurs, the RR interval in the ECG signal changes periodically. For this reason, they proposed using single-channel ECG signals combined with machine learning to quickly detect sleep apnea. There are currently two types of SA detection methods based on single-channel ECG signals: models based on traditional machine learning and models based on deep learning. There are many typical patterns based on traditional machine learning. Pinho et al. [
12] uses heart rate variability (HRV) features and ECG-derived respiration (EDR) features, combined with artificial neural networks (ANN) and support vector machines (SVM), to achieve SA detection. Viswabhargav et al. [
13] uses EDR and sparse residual entropy (SRE) features, combined with fuzzy K-means clustering and SVM to detect SA. Feng et al. [
14] uses unsupervised learning to extract feature sets and uses time-dependent cost-sensitive (TDCS) to achieve SA detection. Although these methods have achieved some results, their performance is largely influenced by the characteristics of the manual design. Sharma et al. [
15] proposes a method based on biorthogonal antisymmetric wavelet filter bank (BAWFB).
In recent years, deep learning models have been receiving growing attention. Li et al. [
16] proposed an SA detection method based on sparse auto-encoder and hidden Markov model (HMM). This method first uses an unsupervised sparse autoencoder to learn features, and then SVM is used to classify ECG signals. Urtnasan et al. [
17] uses a convolutional neural network (CNN) composed of six optimized convolutional layers to implement the SA detection model. Compared with the model based on traditional machine learning, the model based on deep learning avoids the dependence on human-crafted features, but there are still some shortcomings.
Existing models based on CNN usually use single convolution kernels for feature extraction. However, in complex application scenarios, it is difficult for traditional convolutional to efficiently provide salient features. Meanwhile, there is a class imbalance in the SA database, which leads to the low sensitivity of the model. In order to resolve the above problems, the paper proposes a method of SA detection based on a multi-scale residual network. First, we analyze the physiological mechanism of SA and extract the derived RR interval signals and R peak signals of the ECG signals as input. Then, feature extraction is performed on the derived signals by using a multi-scale residual network to obtain sensitive features from different perspectives. Finally, a fully connected layer is used to achieve SA detection. In addition, a class imbalance in the database is put into consideration, and a focal loss function is adopted to replace the traditional cross-entropy loss function, so that the model focuses more on the learning of difficult samples in the training phase to reduce the impact of class imbalance. By testing on the Apnea-ECG database [
16,
17,
18], the proposed multi-scale residual network obtained an accuracy of 86.0%, a sensitivity of 84.1% and a specificity of 87.1%. Compared with the existing work, the method not only obtains a better classification accuracy but also effectively solves the problem of low sensitivity caused by class imbalance.
4. Conclusions
This paper proposes a sleep apnea detection method based on a multi-scale residual network. In this method, we use multi-scale convolution kernels to extract features at different levels, avoiding the limitations of the traditional single convolution topology. Considering that ECG signals contain a lot of information unrelated to sleep apnea, through the analysis of the physiological mechanism of sleep apnea, the derived RR interval signals and R peak signals in the ECG signals are extracted as the model input. In addition, in the study of sleep apnea detection, different types of ECG signal fragments have data imbalances. This study introduces a focus loss function to make the model focus more on the learning of difficult samples during the training phase to reduce the impact of data imbalance on performance. The experimental results on the public database Apnea-ECG show that the proposed method achieved an accuracy rate of 86.0%, a sensitivity of 84.1% and a specificity of 87.1%. Compared with existing work, the proposed method not only effectively improved the detection accuracy of sleep apnea, but it also effectively solved the problem of low sensitivity caused by data imbalance. Due to the limitations of the dataset used, the method proposed in this paper cannot distinguish between hypopnea and apnea. In the future, we will try to use wavelets to preprocess the proposed method, and we will verify it on other data sets many times to prove the generalization performance of the method.