# Classification of Respiratory States Using Spectrogram with Convolutional Neural Network
## 2 Related Research  
The diagnosis of apnea using biosignals has been actively carried out in the past decades [18; 19; 20]. It is divided into a method of diagnosing apnea using electrical biosignals obtained through PSG and a method of diagnosing apnea using ECG obtained via PSG. A scalogram-based convolutional neural network was introduced to detect sleep apnea using single-lead ECG signals [21]. In the work by [PERSON] et al. [13], the detection of sleep apnea employs a multiscale, dilated-attention, one-dimensional convolutional neural network and a weighted-loss time-dependent classification model. It reports that the combination of the weighted cross-entropy loss function and the hidden Markov model alleviated the problem of data imbalance. Furthermore, it improved the classification accuracy. PSG is a data acquisition method used for apnea diagnosis with electrical biosignals such as EEG, ECG, eye movement, and muscle movement. Usually, one needs more than a day in the laboratory to acquire vital signals. The obtained electrical biosignals are directly attached to the body to obtain low-noise data. PSG, a biosignal acquisition method designed for apnea diagnosis, has been actively studied in the past [22]. Although low-noise data are obtained by the method of acquiring electrical biosignals, there are restrictions on its use such as the cost of maintaining the experimental space and equipment and the time required for accurate diagnosis of more than one day. To alleviate this problem, ECG-based apnea diagnosis is being actively studied. ECG is one of the electrical biosignals obtained from PSG and refers to the electrical biosignals obtained from the heart. ECG is one of the means of diagnosing physical abnormalities such as arrhythmia, cardiac arrest, and apnea by analyzing the pattern of the heartbeat. ECG has partially relieved the limitations of PSG and enabled real-time diagnosis [23]. The method using ECG verified with similar accuracy compared to the method using various electrical biosignals acquired with PSG, and the cost and time constraints of the existing method were relaxed [24]. A flowchart that describes existing research about the detection of abnormal respiration states (e.g., apnea) is shown in Figure 1.  
Studies on ECG-based apnea diagnosis only classify ECG from values measured in PSG or use a data set provided by the National Institutes of Health (NIH) [25; 26]. Improvements such as optimizing the hyperparameters of the classifier are actively improving the performance of apnea diagnosis. Logistic regression (LR) was used to discriminate against apnea [27]. Logistic regression is used for regression and classification problems in the areas of image processing, pattern recognition, computer vision, etc. Although the learning speed and prediction are fast, it is difficult to interpret the weights by multiplying them. \(X_{i}\) is the input signal, \(B\) is the regression coefficient, and \(\epsilon\) is the error term. A quadratic discriminant analysis (QDA) was used to detect the resting state of respiration [28; 29]. You can set the variance matrix for each class that you need to classify, but it requires a lot of data. A decision boundary between classes is constructed, with the mean value corresponding to the \(k\)th class \(\prod_{k}\) and the variance matrix \(\mu_{k}\). The \(k\)-nearest neighbor algorithm (k-NN: k-Nearest Neighbor) is a method of classifying data using \(k\) classes located in adjacent locations. In this case, there are two methods of estimating the distance: Euclidean distance and Manhattan distance. There is no restriction on the distribution of data, but it requires a lot of data. Bidirectional Long Short-Term Memory (Bi-LSTM) solves the unidirectional limitation of the existing Long Short-Term Memory (LSTM) with a reverse LSTM layer. [PERSON] et al. showed an accuracy of 84% with the quadratic discriminant function method [28]. [PERSON] et al. showed 88% accuracy using the k-nearest neighbor algorithm and the artificial neural network [29].