Sleep stage classification method and system and wearable device
Through the pre-training and fine-tuning of the DeepSleepNet model, combined with the alignment experimental design of the homemade auxiliary device and the polysomnography device, the problem of low accuracy of the existing sleep stage classification method is solved, and a high-accuracy sleep stage classification is achieved. This method is suitable for wearable devices and has a good user experience.
Patent Information
- Application Number
- CN202411925603.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-03-28
AI Technical Summary
The existing sleep stage classification method has low accuracy, and there is a lack of a contact sleep stage classification device with high classification accuracy and good user experience.
The DeepSleepNet model is used to build a basic model for sleep stage classification, pre-training through public data sets and fine-tuning using experimental data sets, combining the alignment experimental design of homemade auxiliary devices and professional polysomnography devices, collect the sleep stage data of the subjects and perform classification label mapping.
The accuracy of sleep stage classification is achieved at 86.4%, which is more than 11 percentage points higher than the traditional SVM model. This method is easy to apply to wearable devices and has a better user experience.
Smart Images

Figure CN119719931A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of sleep monitoring, and in particular to a sleep stage classification method, system and wearable device. Background Art
[0003] Traditional sleep stage classification research mainly includes three processes: data preprocessing, feature extraction, and classifier classification. The noise that affects the received physiological signals mainly comes from two aspects. One is the noise in the physiological signal itself, and the other is the noise inherent in the receiving circuit. Failure to filter out these noises will seriously affect the accuracy of subsequent feature extraction. Therefore, it is necessary to preprocess the received signal. Since most of the human physiological signals are concentrated in the low-frequency part, and the above-mentioned main noise is in the relatively high-frequency stage, conventional filtering methods can be used, such as median filtering, mean filtering, FIR low-pass filtering, wavelet filtering, etc. In addition, there are noise reduction methods from the hardware perspective, such as self-zeroing, correlated double sampling, chopping and other technologies.
[0004] Extracting useful waveform features from the time domain is one of the earlier physiological signal analysis methods. Usually, the sleep information contained in the time domain waveform is considered. Common time domain features include the mean, standard deviation, mean square value, median, and interquartile range of the pulse rate interval sequence. Frequency domain features can transform the physiological waveform whose amplitude changes with time into a spectrum diagram whose power changes with frequency. Common frequency domain features include total power, percentage of low-frequency power in total power, percentage of high-frequency power in total power, and ratio of low-frequency power to high-frequency power. Traditional time-frequency features are not enough to take into account the nonlinear characteristics of sleep physiological signals, so it is necessary to introduce nonlinear dynamic features, which are generally obtained through analysis of Lyapunov exponents, complexity, correlation dimension, approximate entropy, multi-scale entropy, etc.
[0005] The K-means algorithm is a classic unsupervised learning clustering method and one of the earlier sleep stage classifiers. The general process is that after the physiological signals in units of 30s are extracted, K objects are randomly selected from the data set as the initial clustering center. Then the distance between all the remaining data in the data set and the K data is calculated, and they are classified into the class with the smallest distance. Then the centroid of each class is calculated as the new clustering center. Finally, the above steps are repeated until the centroid no longer changes to obtain the best classification center. At the same time, all data are also classified into the class with the closest distance. This method takes a long time, and the clustered classes are more subjective when corresponding to the recognized sleep stage categories. Support vector machine (SVM) is the most commonly used classifier in the traditional method of sleep stage classification. It is a machine learning method based on statistical learning theory. It improves the generalization ability of the model by seeking the minimum structured risk, and minimizes the empirical risk and confidence range, so as to achieve the purpose of obtaining good statistical laws even with a small number of statistical samples. It maps data into a high-dimensional space and searches for a separation plane that maximizes the interval. However, due to the high subjectivity of the feature data input into the SVM model, the classification accuracy is not high in actual use.
[0006] Traditional methods rely on manual filtering and feature extraction of signals, which are highly subjective and have poor generalization ability. Recently, with the innovation of computer hardware, big data technology and deep learning technology, natural language processing technology based on various large corpus databases and image recognition technology based on large image databases have made significant progress, and their applications in the field of sleep have gradually increased. The first method used to study sleep stage classification was the convolutional neural network (CNN), which automatically extracts features instead of relying on manual work and realizes end-to-end automatic sleep stage classification, but the classification effect is not as good as the traditional methods of the same period. In view of the advantages of recurrent neural network (RNN) in time series signal processing, it was introduced on the basis of the CNN model, which effectively improved the classification effect of the sleep model. Although the introduction of the deep learning model effectively avoids the subjectivity of feature selection, the application effect is not very ideal because the original sleep dataset is a small dataset with class imbalance.
[0007] Sleep monitoring systems can be roughly divided into two categories, one is non-contact, such as microwave radar-based monitoring systems, and the other is contact, such as polysomnography (PSG). Microwave radar-based systems can achieve non-sensing monitoring, but the accuracy is not high due to interference from items such as clothing and quilts on the collected signals and the incompleteness of the collected signals. The PSG method is the "gold standard" for diagnosing sleep disorders. It generally requires subjects to go to a hospital with relevant qualifications to monitor their sleep activities for multiple nights. In addition, the numerous electrodes and complex connections may cause psychological burden and physical discomfort to the subjects, making it difficult for them to fall asleep. Summary of the invention
[0008] The present invention provides a sleep stage classification method, system and wearable device, which solve the technical problem that the accuracy of the existing sleep stage classification method is still not high enough and there is a lack of a contact sleep stage classification device with high classification accuracy and good user experience.
[0009] In order to solve the above technical problems, the present invention provides a sleep stage classification method, comprising the steps of:
[0010] S1. The experimental data set is obtained by collecting the sleep stage data of the subjects and mapping the classification labels.
[0011] S2. Building a basic model for sleep stage classification based on the DeepSleepNet model, wherein the number of input channels of the basic model for sleep stage classification is equal to the data types of the experimental data set;
[0012] S3. Pre-training the sleep stage classification basic model using a public data set to obtain a sleep stage classification pre-training model;
[0013] S4, fine-tuning and testing the sleep stage classification pre-training model using the experimental data set to obtain a sleep stage classification model;
[0014] S5. Acquire the user's sleep stage data in real time and input it into the sleep stage classification model, and the sleep stage classification model outputs a corresponding classification result.
[0015] Furthermore, the step S1 specifically includes:
[0016] Fix the sensor on the subject and connect the polysomnography system to the corresponding part of the subject's body;
[0017] During the sleep of the subjects, data from the sensors and the polysomnography system were collected simultaneously;
[0018] Using the automatic sleep stage determination function of the polysomnography system to classify the data of the system at preset time intervals, the classification result of each segment of data is determined;
[0019] Correct the classification results output by the polysomnography system;
[0020] The corrected classification results are matched to the collected sensor data as the classification labels of the sensor data to obtain the experimental data set.
[0021] Furthermore, in step S2, the sleep stage classification basic model is improved compared with the DeepSleepNet model in that:
[0022] Expanding the CNN structure of the representation learning of the DeepSleepNet model from a single channel to multiple channels with the same number of channels as the sensor data;
[0023] After the multi-channel input signals are respectively subjected to convolution and pooling operations, the obtained features are added correspondingly and then input into the sequence residual learning of the DeepSleepNet model;
[0024] The multi-channel input signals use multiple signals in the same time period.
[0025] Furthermore, in step S4, before fine-tuning and testing the sleep stage classification pre-training model using the experimental dataset, the structure of the first convolutional layer of each input channel of the sleep stage classification pre-training model is modified to correspond to the sampling rate of the experimental dataset; during the fine-tuning process, the first convolutional layer of each input channel is randomly assigned as the initial value of the parameter, and the rest of the parameters are directly trained using the pre-trained parameter values of the sleep stage classification pre-training model as the initial value.
[0026] Furthermore, in step S3, the loss function used for pre-training the sleep stage classification basic model is a cross entropy loss function.
[0027] Furthermore, in step S4, the loss function used for fine-tuning the sleep stage classification pre-training model is a cross entropy loss function.
[0028] Furthermore, the sensor is wearably fixed on the forehead of the subject or user, and the sensor collects two-way data about the heart rate, red light and infrared light; in the step S1, the mapped classification labels include wakefulness, light sleep 1, light sleep 2, deep sleep, and rapid eye movement.
[0029] The present invention also provides a sleep stage classification system, the key of which is that it includes an experimental unit, a model construction unit, a model pre-training unit, a model fine-tuning and testing unit, and a model application unit. The experimental unit, the model construction unit, the model pre-training unit, the model fine-tuning and testing unit, and the model application unit are respectively used to execute steps S1 to S5 in the sleep stage classification method.
[0030] Preferably, the model building unit, the model pre-training unit, and the model fine-tuning and testing unit are intelligent devices including processors capable of completing model building, pre-training, model fine-tuning, and testing, respectively;
[0031] The model application unit is an intelligent module that can carry the sleep stage classification model and enable it to run.
[0032] The present invention also provides a wearable device for sleep stage classification, the key of which is that it includes an inner layer, an outer layer, and a sensor component, a main board component, and a display and button component embedded between the inner layer and the outer layer; the inner layer and the outer layer are both made of flexible materials suitable for the user's monitoring part; the sensor component sends the collected user data to the main board component, and the main board component inputs the user data into a sleep stage classification model generated by the sleep stage classification method and transplanted into the main board component; the sleep stage classification model obtains the classification results of each stage and sends them to the display and button component for display.
[0033] The present invention provides a sleep stage classification method, system and wearable device. The method collects the sleep stage data of the subjects and performs classification label mapping to obtain an experimental data set; constructs a sleep stage classification basic model based on the DeepSleepNet model; uses a public data set to pre-train the sleep stage classification basic model to obtain a sleep stage classification pre-trained model; uses an experimental data set to fine-tune and test the sleep stage classification pre-trained model to obtain a sleep stage classification model. The outstanding contributions of the present invention are:
[0034] 1. Through the alignment experiment design of the self-made auxiliary device and the professional polysomnography, it is convenient to collect the sensor sequence data and accurate label pairs of the subjects' sleep stages, thus providing a data basis for subsequent supervised model training;
[0035] 2. An improved DeepSleepNet model is proposed to meet the needs of multi-channel sensors. At the same time, considering the limited amount of self-collected experimental data, it is proposed to pre-train the model with a large public sleep dataset and then fine-tune the model with a small experimental dataset. The obtained sleep stage classification accuracy can reach 86.4%, which is more than 11 percentage points higher than the traditional SVM model.
[0036] 3. When applying the sleep stage classification model, less input data is used, the classification accuracy is higher, it is easy to apply to wearable devices, and the user experience is better. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a flow chart of a sleep stage classification method provided by an embodiment of the present invention;
[0038] Figure 2 is a flow chart of obtaining an experimental data set provided by an embodiment of the present invention;
[0039] Figure 3 is an example diagram of data of a polysomnography apparatus and a homemade auxiliary device provided in an embodiment of the present invention;
[0040] Figure 4 This is a research framework diagram of sleep stage classification provided by an embodiment of the present invention;
[0041] Figure 5 It is a framework comparison diagram of the DeepSleepNet model and the improved model provided in an embodiment of the present invention;
[0042] Figure 6 It is a schematic diagram of adjusting the first layer of the sleep stage classification pre-training model provided by an embodiment of the present invention;
[0043] Figure 7 is a diagram of training and testing results provided by an embodiment of the present invention;
[0044] Figure 8 is a processing flow chart based on the SVM model provided by an embodiment of the present invention;
[0045] Fig. 9 This is a diagram of the MAX30102 sensor data filtering process within 30 seconds provided by an embodiment of the present invention;
[0046] Fig.10 It is a peak point diagram of MAX30102 sensor data within 30 seconds provided by an embodiment of the present invention;
[0047] Fig.11 is an exploded diagram of a wearable device for sleep stage classification provided by an embodiment of the present invention.
[0048] Figure markings: 1-inner layer, 2-outer layer, 3-sensor assembly, 4-battery assembly, 5-mainboard assembly, 6-display and button assembly, 7-magnetic charging port. DETAILED DESCRIPTION
[0049] The following specifically illustrates the implementation mode of the present invention in conjunction with the accompanying drawings. The embodiments are provided for illustrative purposes only and cannot be understood as limiting the present invention. The accompanying drawings are provided for reference and illustration only and do not constitute a limitation on the scope of patent protection of the present invention, because many changes can be made to the present invention without departing from the spirit and scope of the present invention.
[0050] Example 1
[0051] An embodiment of the present invention provides a sleep stage classification method, such as Figure 1 As shown, the steps include:
[0052] S1. The experimental data set is obtained by collecting the sleep stage data of the subjects and mapping the classification labels.
[0053] S2. Build a basic model for sleep stage classification based on the DeepSleepNet model. The number of input channels of the basic model for sleep stage classification is equal to the data types of the experimental dataset.
[0054] S3. Pre-training a sleep stage classification basic model using a public data set to obtain a sleep stage classification pre-training model;
[0055] S4. Fine-tune and test the sleep stage classification pre-training model using the experimental dataset to obtain a sleep stage classification model.
[0056] S5. Acquire the user's sleep stage data in real time and input it into a sleep stage classification model, and the sleep stage classification model outputs a corresponding classification result.
[0057] In step S1, a corresponding sensor is generally used to obtain physiological signals of the subject when sleeping, and sleep stage data is obtained. In this embodiment, the sleep stage data of the subject includes at least two types of data (which can be obtained by the same or different sensors), and in order to give the user a good user experience, the data types do not exceed 5. This embodiment uses the MAX30102 sensor to collect red light and infrared two-way (type) data (heart rate signal) every preset time period (30 seconds in this example) as an example to illustrate. In order to correctly label each segment of dual-channel data of the collected red light and infrared light two-way data, this embodiment also uses a polysomnography system (PSG) for classification detection during the process of collecting dual-channel data, so as to align the collected red light and infrared light two-way data with the data collected by the polysomnography system (PSG) in time, and use the classification results of the polysomnography system (PSG) to label each segment of dual-channel data with classification labels, thereby obtaining a dual-channel data set with classification labels, that is, obtaining an experimental data set.
[0058] More specifically, in order to collect data for training and testing the sleep stage classification model, this embodiment designs the following Figure 2 The experimental scheme shown in the figure. A simple auxiliary device was made by ourselves, which mainly consists of MAX30102 sensor and STM32F407, and is used to collect red light and infrared data. The benchmark polysomnography system (PSG), namely polysomnography, is Philips Alice6LDxS, which covers 63 channels including EEG, EMG, EOG, ECG, body position, etc. The venue is relatively quiet. During the experiment, the subjects slept in bed all night. The sensors of the polysomnography were connected to the corresponding parts of the subjects' bodies according to the guidance of professional doctors, and the sensors of the homemade auxiliary device were fixed on the forehead of the subjects in the form of head-mounted. There are three forms of data flow: subjects to polysomnography, subjects to homemade auxiliary devices, and homemade auxiliary devices to polysomnography. The latter is used to align the data of the first two in time. In addition, a camera is installed in the experimental site to trace the abnormal sleeping conditions of the subjects.
[0059] This example selected 20 subjects aged between 30 and 50 (male to female ratio was 3:2) for sleep experiment. More than half of these subjects had varying degrees of sleep disorders. Each subject performed a full night of sleep experiment according to the above sleep plan. Some data are shown in Figure 3 ,in Figure 3 (a) is a screenshot of the data from the polysomnography, and (b) is a screenshot of the data from the homemade auxiliary device, which contains the red light and infrared light channel data of the MAX30102 sensor. In units of 30 seconds, a total of 16,956 segments of valid data were collected.
[0060] After collecting the data, data calibration is completed in the following three steps:
[0061] (1) Automatic classification. Using the automatic sleep stage determination function provided by Philips Alice 6LDxS, the collected data is determined in 30-second units to determine whether it belongs to the wakefulness stage, light sleep stage 1, light sleep stage 2, deep sleep, or rapid eye movement stage.
[0062] (2) Professional correction: Professional doctors correct the automatic classification results based on the channel data curves collected by Philips Alice 6LDxS.
[0063] (3) Label mapping. The corrected classification results are mapped to the data collected by the homemade auxiliary device according to the time period as their classification labels. Data pairs such as (sequence MAX30102 data in units of 30s, classification label) are used as the raw data for subsequent model training and testing.
[0064] This example uses Figure 4The framework shown in the figure studies the sleep stage classification method based on the MAX30102 sensor and distinguishes three different stages: supervised pre-training (steps S2 and S3), fine-tuning and testing (step S4), and comparison with traditional methods (to verify the effect).
[0065] Although step S1 obtains nearly 17,000 pairs of labeled data through experiments, it is not enough to use these data to train a deep learning model with high accuracy, which requires leveraging public sleep data sets. Among the many public data sets, there are almost no data sets that use the MAX30102 sensor channel. Therefore, this embodiment uses the MASS data set with multiple channels such as EEG and ECG, and has classification labels, for supervised pre-training. The pre-training model is improved on the basis of the published DeepSleepNet model (improved DeepSleepNet model, basic model for sleep stage classification) to meet the needs of 2-channel data input from the MAX30102 sensor.
[0066] In the fine-tuning and testing phase of step S4, the experimental data set is divided into two parts in proportion: a training set and a test set. The former is used to train and select the model, and the latter is used to evaluate the quality of the selected model. Since the sampling rate of the experimental data is different from that of the MASS data set, the improved DeepSleepNet model is adjusted again. For the model structure adjustment part, random values are assigned as the initial values of the parameters, while the rest of the model parameters are directly used as the initial values for training.
[0067] When compared with traditional methods, the experimental data were filtered, feature extracted, outliers removed and features selected in turn, and the support vector machine model (SVM) was used to classify the sleep stages, and finally the conclusions were drawn by comparison.
[0068] In the supervised pre-training phase of step S2, the pre-training dataset uses the MASS dataset, which includes PSG records of 200 subjects from different sleep laboratories. The PSG records contain EEG, EOG, EMG, ECG and respiratory signals, and the sampling frequency is 256Hz. The annotation of the MASS dataset is completed by sleep experts based on the AASM standard (SS1 and SS3 subsets) or the R&K standard (SS2, SS4 and SS5 subsets).
[0069] Figure 5 This is a comparison chart between the DeepSleepNet model and the improved DeepSleepNet model in this example. The DeepSleepNet model is an automatic sleep stage classification model based on the original single-channel EEG, which does not rely on manual work at all. The overall framework of the model is shown in Figure 5(a). The DeepSleepNet model consists of two parts: the first part is representation learning, which is used for filtering to extract time-invariant features from the original single-channel EEG signal; the second part is sequence residual learning, which is used to train the encoding of temporal information and discover the sleep stage classification rules from the features automatically extracted from a sequence EEG in the first part.
[0070] Specifically, the first part of the DeepSleepNet model uses two CNN structures, where the small CNN structure is used to capture temporal information and the large one is used to capture frequency domain information. Each CNN structure consists of four convolutional layers (conv) and two max-pool layers. Each convolutional layer performs three operations, one-dimensional convolution, batch normalization, and activation function ReLU, in sequence. Each pooling layer uses the max-pooling operation to downsample the input. In particular, the specification of the first convolutional layer of each structure depends on the sampling rate Fs of the EEG data. The second part of the DeepSleepNet model contains a bidirectional LSTM (Long-Short Term Memory) structure and a shortcut connection (ShortcutConnection) structure. The bidirectional LSTM extends the LSTM by using two LSTMs to process the forward and backward input sequences respectively. This part is reconstructed into a residual function for calculation using shortcut connections, so that the model can add the features extracted from the CNN in the first part, that is, the temporal information previously learned from the input sequence, and is not prone to the problem of gradient disappearance during training.
[0071] Since the data collected by the MAX30102 sensor has two channels, the single-channel DeepSleepNet model is not convenient for subsequent applications. This embodiment improves the DeepSleepNet model. The improved DeepSleepNet model is shown in Figure 5 (b). There are three improvements: first, the CNN structure of the first part of the original DeepSleepNet model is expanded from a single channel to a two-channel one; second, after the two-channel input signals are convolved and pooled, the corresponding features are added and then input into the second part; third, the two-channel inputs use EEG and ECG signals of the same time period respectively.
[0072] Table 1 shows the prediction and performance indicators of 20-fold cross validation on the MASS dataset. The loss function used is the cross entropy loss function, where W, N1, N2, N3, and REM represent the wakefulness period, light sleep 1, light sleep 2, deep sleep, and rapid eye movement period, respectively. In Table 1, the row of N1 indicates that when the actual label is N1, the number of records predicted as W, N1, N2, N3, and REM are 433, 2931, 735, 8, and 617, respectively, and the meanings of the remaining rows are similar. From the performance indicator (F1 value), N1 has the worst prediction, with an F1 value of only 62.2, while the indicators of other periods are obviously better, ranging between 80.9 and 90.1.
[0073] Table 1 Prediction and performance indicators of 20-fold cross validation on the MASS dataset
[0074]
[0075] The sampling rate of the MASS dataset is 256 Hz, while the sampling rate of the experimental data is 32 Hz. Therefore, in the fine-tuning stage, in addition to changing the 2-channel input to red light and infrared light, the structure of the first convolutional layer of the model needs to be adjusted. Figure 6 , so that it corresponds to the sampling rate of the experimental data, where 30-s RED epoch represents red light batch data and 30-s IR epoch represents infrared batch data. The improvement on the first convolution layer is that the sizes of the two convolution kernels are changed from 128 and 1024 to 16 and 128 respectively, and the stride is changed from 16 and 128 to 2 and 16 respectively to adapt to the sampling rate of the experimental data.
[0076] The experimental data set is divided roughly as follows: 10% of the data is used for testing, and 90% of the data is used for training. The training adopts 10-fold cross validation, and the loss function adopted is the cross entropy loss function. For the first convolutional layer of the model structure adjustment, random values are assigned as the initial values of the parameters, and the rest of the pre-trained model parameter values are directly used as the initial values for training.
[0077] After 200 rounds of training and testing, we obtained Figure 7 The results shown, Figure 7 (a) is the change curve of the training loss function, and the average loss value finally drops to about 0.35. Figure 7 (b) is the test accuracy change curve, which can reach 86.4%.
[0078] Below we compare the sleep stage classification model with traditional methods.
[0079] Traditional methods based on support vector machines (SVM), such as Figure 8As shown in the flowchart, it can be summarized into five steps: filtering, feature extraction, outlier removal, feature selection, and SVM model training.
[0080] (1) Filtering
[0081] In wearable devices, the fit may not be very secure. During breathing or body movement, the sensor may shift slightly or even occasionally hang in the air, making the collected data noisy. To reduce the impact of this type of noise, this embodiment processes the MAX30102 sensor data within every 30 seconds by using median filtering, mean filtering, wavelet decomposition and reconstruction, and FIR filtering in sequence. Fig. 9 It is a filtering process of a set of data in sequence. Among them, the size of the median and mean filter windows are both 9, the wavelet filter uses the coefficient "db7" to decompose and reconstruct in 3 layers, and the FIR is a 30-order bandpass filter.
[0082] (2) Feature extraction
[0083] Before calculating the eigenvalues of the MAX30102 sensor data over a 30s period, it is necessary to determine the peak-to-peak value based on the aforementioned filtering. Fig.10 It is the peak point of the above-mentioned filtered data. The principle is to find the peak by looking for the local maximum in the sequence data, and then compare the distance between adjacent peaks with the minimum distance (set to 10 sampling times in this example). If the distance is less than the minimum distance, only the highest peak is retained.
[0084] Based on the determined peak points, the pulse interval sequence (PPI) can be calculated, which is the time difference between adjacent peak points. According to PPI, this embodiment extracts 20 feature values, see Table 2, where vPPI represents the difference sequence between adjacent PPIs.
[0085] Table 2 Overview of feature extraction
[0086] serial number Feature Name illustrate Example Value 1 PR Pulse rate 66 2 avgPPI Average value of PPI 0.9094 3 stdPPI Standard deviation of PPI 0.0748 4 rmsPPI RMS of PPI 0.9124 5 avgV The average value of vPPI -0.0039 6 sdV Standard deviation of vPPI 0.0709 7 rmsV vPPI RMS 0.0698 8 n_pp50 The number of pulses greater than 50 ms in vPPI 19 9 p_pp50 The percentage of pulses longer than 50ms in vPPI 61.29% 10 median Median PPI 0.9000 11 mad The absolute difference between the median and mean of PPI 0.0094 12 iqr31 PPI interquartile range 0.0600 13 tm25 The ratio of the sum of the numbers between the quartiles of PPI to the quartile difference 0.9200 14 tm50 The ratio of the sum of the numbers between the quartiles of PPI to the quartile difference 0.9300 15 avgAD The average of the sum of the absolute differences between PPI and its mean 0.0581 16 avgCL Mean square value of vPPI 0.0049 17 avgE Mean square value of PPI 0.8324 18 entropy_PPI Cross Entropy of PPI 2.6663 19 logsumexp_PPI The logarithm of the sum of the PPI index 4.3778 20 logsumexp_vPPI Logarithm of the sum of the vPPI index 3.4325
[0087] (3) Outlier removal
[0088] The original data pairs such as (sequence MAX30102 data in units of 30s, classification label) are extracted according to the above feature extraction method to obtain feature data pairs such as (20 feature values in units of 30s, classification label). These feature data pairs are classified into 5 categories according to the classification labels: wakefulness, light sleep 1, light sleep 2, deep sleep, and rapid eye movement. For each category, the isolation forest algorithm is used to quickly detect abnormal data and eliminate them. A total of 1,134 data pairs are eliminated from the 5 categories, leaving 15,822 pairs.
[0089] (4) Feature selection
[0090] In order to find out some of the most important features from the extracted 20 features, and to avoid importing all features into the model for training, the recursive feature elimination (RFE) method is used to recursively reduce the features with smaller weights until the number of features reaches the preset value. The specific operations are as follows: 1. Randomly shuffle the order of the remaining 15,822 pairs of data; 2. Perform Z-Score standardization on these data pairs; 3. Use RFE to recursively select features, where the base model is the support vector machine, and the preset number of feature selections is 10. The selection results are shown in Table 3. So far, the data set for training and verifying the subsequent model is 15,822 data pairs of the form (10 feature values in units of 30s, classification labels).
[0091] Table 3 Feature selection results
[0092] New Number Original number Feature Name New Number Original number Feature Name 1 1 PR 6 15 avgAD 2 2 avgPPI 7 17 avgE 3 4 rmsPPI 8 18 entropy_PPI 4 8 n_pp50 9 19 logsumexp_PPI 5 9 p_pp50 10 20 logsumexp_vPPI
[0093] (5) SVM model training
[0094] In this embodiment, 10 SVM models for pairwise classification are trained. The training and test accuracies are shown in Table 4 and Table 5. It is not difficult to find that except for two or three models exceeding 80%, the accuracy of the remaining models is generally not high. Figure 7 (b), we can conclude that although the improved DeepSleepNet model is more computationally complex than SVM, it has two main advantages: one is automatic filtering and feature extraction without manual intervention; the other is higher accuracy, which is more than 11 percentage points higher than the SVM result.
[0095] Table 4 Sleep stage classification training accuracy
[0096]
[0097] Table 5 Sleep stage classification test accuracy
[0098]
[0099] In summary, the sleep stage classification method provided by the embodiment of the present invention obtains an experimental data set by collecting the sleep stage data of the subjects and mapping the classification labels; constructs a sleep stage classification basic model based on the DeepSleepNet model; uses a public data set to pre-train the sleep stage classification basic model to obtain a sleep stage classification pre-trained model; uses an experimental data set to fine-tune and test the sleep stage classification pre-trained model to obtain a sleep stage classification model. The outstanding contributions of this method are:
[0100] 1. Through the alignment experiment design of the self-made auxiliary device and the professional polysomnography, it is convenient to collect the sensor sequence data and accurate label pairs of the subjects' sleep stages, thus providing a data basis for subsequent supervised model training;
[0101] 2. An improved DeepSleepNet model is proposed to meet the requirements of the sensor's 2 channels. At the same time, considering the limited amount of self-collected experimental data, it is proposed to pre-train the model with a large public sleep dataset and then fine-tune the model with a small experimental dataset. The obtained sleep stage classification accuracy can reach 86.4%, which is more than 11 percentage points higher than the traditional SVM model.
[0102] 3. When applying the sleep stage classification model, less input data is used, the classification accuracy is higher, it is easy to apply to wearable devices, and the user experience is better.
[0103] Example 2
[0104] Based on a sleep stage classification method protected by Example 1, this embodiment provides a sleep stage classification system, which includes an experimental unit, a model building unit, a model pre-training unit, a model fine-tuning and testing unit, and a model application unit. The experimental unit, the model building unit, the model pre-training unit, the model fine-tuning and testing unit, and the model application unit are respectively used to execute steps S1 to S5 in a sleep stage classification method protected by Example 1.
[0105] Corresponding to Example 1, the experimental unit here includes a homemade auxiliary device and a polysomnography device, a camera, and a data calibration device. The data calibration device completes the professional correction and label mapping in the data calibration process shown in Example 1.
[0106] The model building unit, model pre-training unit, model fine-tuning and testing unit are intelligent devices, such as computers, that include a processor capable of completing model building, pre-training, model fine-tuning and testing.
[0107] The model application unit is an intelligent module that can carry the sleep stage classification model to enable it to run, such as a single-chip microcomputer. The model application unit can be separated from the experimental unit, the model building unit, the model pre-training unit, the model fine-tuning and testing unit and carried on other intelligent modules.
[0108] The sleep stage classification wearable system provided in this embodiment, as a specific application of the sleep stage classification method provided in Example 1, can achieve the same effect as Example 1.
[0109] Example 3
[0110] This embodiment provides a wearable device for sleep stage classification, such as Fig.11 As shown in the exploded diagram, the device includes an inner layer 1, an outer layer 2, and a sensor component 3, a battery component 4, a mainboard component 5, a display and button component 6, and a magnetic charging port 7 embedded between the inner layer 1 and the outer layer 2. The battery component 4 is connected to the magnetic charging port 7, and the magnetic charging port 7 is used to charge the battery component 4. The inner layer 1 and the outer layer 2 are both skin-friendly and flexible materials (flexible materials with appearance characteristics such as size and shape that are adapted to the user's monitoring part, and sponge is used in this embodiment). After the wearable device is placed in a suitable position on the user's head, the wearable device is worn on the user's head by pasting the head and tail of the wearable device (other fixing methods, such as buckles, can also be used). The battery component 4 is electrically connected to the mainboard component 5 and the sensor component 3 to supply power to them. The sensor component 3 and the display and button component 6 are connected to the mainboard component 5. The sensor component 3 sends the collected user data to the mainboard component 5. The mainboard component 5 inputs the user data into the sleep stage classification model transplanted in the mainboard component 5. The sleep stage classification model obtains the classification results of each stage and sends them to the display screen (OLED screen) in the display and button component 6 for display. The display screen also displays the wearing time of the device, the remaining power of the device, etc. The buttons in the display and button assembly 6 are used for turning on and off the device, operating and displaying historical data, etc.
[0111] Specifically, the sensor in the sensor assembly 3 (such as the MAX30102 sensor) is located on the inner side of the inner layer 1 and slightly protrudes from the surface of the inner layer 1, so that the sensor can fit the user's forehead to a greater extent. The display and button assembly 6 is connected to the mainboard assembly 5 and is located on the outside of the outer layer 2 to facilitate external display of data. The battery assembly 4 is located in the left inner layer 1, the magnetic charging port 7 is located on the left side of the outer layer 2, and the inner layer 1 and the outer layer 2 are sealed by wrapping cloth.
[0112] The specific installation steps of the device are:
[0113] (1) Use screws to fix the motherboard assembly 5 into the plastic shell, and use a little environmentally friendly glue to fix it to the outer layer 2;
[0114] (2) Assemble the MAX30102 sensor in the plastic shell, and then fix the plastic shell on the inner layer 1;
[0115] (3) The display and button assembly 6 is clamped on the outer side of the plastic shell of the mainboard assembly 5 and reinforced by positioning columns;
[0116] (4) Fix the battery assembly 4 in the plastic shell and fix it to the outer layer 2 with a little environmentally friendly glue;
[0117] (5) Apply a little environmentally friendly glue to fix the magnetic charging port 7 to the outer layer 2;
[0118] (6) Sew the inner layer 1 and the outer layer 2 together and seal the edges with a wrapping strip.
[0119] During charging, the charging chip of the battery assembly 4 charges the lithium battery and sends a charging signal to the mainboard assembly 5 (MCU) at the same time. The MCU obtains the power data of the coulomb meter and displays it on the OLED screen.
[0120] By pressing the button for 2 seconds (pressing it again for 2 seconds to shut down), the MCU obtains the detection signal, obtains the red light and infrared light 2-channel data of the sensor at a certain frequency, classifies the sleep stage by the sleep stage classification model obtained in Example 1, and displays the 2-channel data curve and the corresponding classification result on the OLED screen. At the same time, the MCU also displays the power data of the coulomb meter on the OLED screen.
[0121] The operating instructions of the device are as follows:
[0122] (1) Align the concave area of the device with the bridge of the nose and the eyes, and fix it to the subject's head using the Velcro straps at both ends.
[0123] (2) Press and hold the button for 2 seconds to turn on the device. The screen will display the 2-channel data curves and corresponding classification results within the most recent recording period (30 seconds), as well as the remaining battery power of the device.
[0124] (3) After the test, press and hold the button for 2 seconds to turn off the device.
[0125] (4) During the test, if the power display area is flashing, it is necessary to charge in time. When charging, it is necessary to connect it with the provided magnetic charger, and the charging progress will be displayed on the screen.
[0126] The sleep stage classification wearable device provided in this embodiment is easy to wear, has a high classification accuracy, and provides a good user experience.
[0127] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A sleep stage classification method, characterized in that: Includes steps: S1. The experimental data set is obtained by collecting the sleep stage data of the subjects and mapping the classification labels. S2. Building a basic model for sleep stage classification based on the DeepSleepNet model, wherein the number of input channels of the basic model for sleep stage classification is equal to the data types of the experimental data set; S3. Pre-training the sleep stage classification basic model using a public data set to obtain a sleep stage classification pre-training model; S4, fine-tuning and testing the sleep stage classification pre-training model using the experimental data set to obtain a sleep stage classification model; S5. Acquire the user's sleep stage data in real time and input it into the sleep stage classification model, and the sleep stage classification model outputs a corresponding classification result.
2. A sleep stage classification method according to claim 1, characterized in that: The step S1 specifically includes: Fix the sensor on the subject and connect the polysomnography system to the corresponding part of the subject's body; During the sleep of the subjects, data from the sensors and the polysomnography system were collected simultaneously; Using the automatic sleep stage determination function of the polysomnography system to classify the data of the system at preset time intervals, the classification result of each segment of data is determined; Correct the classification results output by the polysomnography system; The corrected classification results are matched to the collected sensor data as the classification labels of the sensor data to obtain the experimental data set.
3. A sleep stage classification method according to claim 2, characterized in that: In step S2, the sleep stage classification basic model is improved compared with the DeepSleepNet model in that: Expanding the CNN structure of the representation learning of the DeepSleepNet model from a single channel to multiple channels with the same number of channels as the sensor data; After the multi-channel input signals are respectively subjected to convolution and pooling operations, the obtained features are added correspondingly and then input into the sequence residual learning of the DeepSleepNet model; The multi-channel input signals use multiple signals in the same time period.
4. A sleep stage classification method according to claim 3, characterized in that: In the step S4, before fine-tuning and testing the sleep stage classification pre-training model using the experimental data set, the structure of the first convolutional layer of each input channel of the sleep stage classification pre-training model is modified to correspond to the sampling rate of the experimental data set; During the fine-tuning process, the first convolution layer of each input channel is randomly assigned as the initial value of the parameter, and the rest of the layers are directly trained using the pre-trained parameter values of the sleep stage classification pre-training model as initial values.
5. A sleep stage classification method according to any one of claims 1 to 4, characterized in that: In the step S3, the loss function used for pre-training the sleep stage classification basic model is a cross entropy loss function.
6. A sleep stage classification method according to any one of claims 1 to 4, characterized in that: In step S4, the loss function used for fine-tuning the sleep stage classification pre-training model is a cross entropy loss function.
7. A sleep stage classification method according to claim 2, characterized in that: The wearable sensor is fixed on the forehead of the subject or user, and the sensor collects two-way data about the heart rate, red light and infrared light; in the step S1, the mapped classification labels include wakefulness, light sleep 1, light sleep 2, deep sleep, and rapid eye movement.
8. A sleep stage classification system, characterized in that: It includes an experimental unit, a model building unit, a model pre-training unit, a model fine-tuning and testing unit, and a model application unit. The experimental unit, the model building unit, the model pre-training unit, the model fine-tuning and testing unit, and the model application unit are respectively used to execute steps S1 to S5 in a sleep stage classification method as described in any one of claims 1 to 7.
9. A sleep stage classification system according to claim 8, characterized in that: The model building unit, the model pre-training unit, and the model fine-tuning and testing unit are intelligent devices including processors capable of completing model building, pre-training, model fine-tuning, and testing, respectively; The model application unit is an intelligent module that can carry the sleep stage classification model and enable it to run.
10. A wearable device for sleep stage classification, characterized in that: The invention comprises an inner layer (1), an outer layer (2), a sensor component (3) embedded between the inner layer (1) and the outer layer (2), a main board component (5), and a display and button component (6); the inner layer (1) and the outer layer (2) are both made of flexible materials suitable for the user's monitoring part; the sensor component (3) sends the collected user data to the main board component (5), and the main board component (5) inputs the user data into a sleep stage classification model generated by a sleep stage classification method according to any one of claims 1 to 7 and transplanted into the main board component (5); the sleep stage classification model obtains the classification results of each stage and sends them to the display and button component (6) for display.
Citation Information
Patent Citations
Wearable device
CN112932788A
Wearable device
CN115209936A
Sleep staging algorithm
WO2022245593A1
Cited By
Sleep stage classification method, system and wearable apparatus
WO2026137982A1