Sleep stage determination method and device, equipment, storage medium and program product
By acquiring the photovoltaic pulse wave signal and motion signal, and combining the Transformer network model for feature extraction and prediction, the problem of inaccurate sleep staging results in the prior art is solved, and more accurate sleep staging detection is achieved.
Patent Information
- Application Number
- CN202510703913.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-29
- Publication Date
- 2025-08-12
AI Technical Summary
The prior art is not very accurate when determining the sleep staging results, and requires manual characteristics to be determined, resulting in inaccurate results.
By obtaining the photovoltaic pulse wave signal and motion signal of the subject being tested, physiological data such as heart rate, blood oxygen saturation, respiratory rate, etc. are determined, and feature extraction is performed. Sleep staging prediction is used using the Transformer network model, and sleep staging results are determined based on the multi-head self-attention mechanism and the feedforward neural network layer.
It improves the accuracy of sleep staging results, can more accurately determine the different stages of the subject being tested during the sleep process, and enhances the reliability of sleep condition detection.
Smart Images

Figure CN120458516A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of sleep analysis, and in particular to a method, apparatus, device, storage medium, and program product for determining sleep stages. Background Art
[0002] Sleep is an important part of human life. During the sleep process, people will periodically be in several stages, namely wakefulness (Wake), rapid eye movement (REM), and non-rapid eye movement (NREM). Each stage corresponds to a different sleep state. By studying sleep stages, the sleep condition of the subject can be detected.
[0003] In the prior art, sleep stage analysis is performed by extracting features from physiological signals and inputting them into a classifier. Feature extraction methods mainly include Fourier transform, wavelet transform, power spectrum, approximate entropy, etc.
[0004] However, in the existing technology, specific features need to be manually determined, and the accuracy in determining the sleep staging results is not high. Summary of the Invention
[0005] Based on this, it is necessary to provide a sleep staging determination method, apparatus, device, storage medium and program product that can accurately determine the sleep staging results in response to the above technical problems.
[0006] In a first aspect, the present application provides a method for determining sleep stages, comprising:
[0007] Acquiring a photoplethysmographic signal and a motion signal of the subject;
[0008] Determining physiological data of the subject based on the photoplethysmography signal and the motion signal, wherein the physiological data includes at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability;
[0009] Extracting features from the photoplethysmography signal and the motion signal to determine first feature data;
[0010] The physiological data and the first characteristic data are input into a sleep staging prediction model to determine a sleep staging result.
[0011] In one embodiment, the sleep stage prediction model is a Transformer network model, which includes multiple encoders and multiple decoders; each encoder includes a multi-head self-attention mechanism layer and a feedforward neural network layer, and each decoder includes a masked multi-head self-attention mechanism layer, an encoder-decoder attention layer and a feedforward neural network layer.
[0012] In one embodiment, inputting the physiological data and the first characteristic data into a sleep stage prediction model to determine a sleep stage result includes:
[0013] Performing position encoding processing on the physiological data and the first characteristic data to obtain second characteristic data;
[0014] The second feature data is input into each encoder, and the third feature data is determined based on the multi-head self-attention mechanism layer and the feedforward neural network layer;
[0015] The third feature data is input into a decoder, and a sleep stage result is determined according to an output of the decoder.
[0016] In one embodiment, feature extraction is performed on the photoplethysmography signal and the motion signal to determine first feature data, including:
[0017] Preprocessing the photoplethysmography signal and the motion signal, including normalization, standardization and filtering;
[0018] Performing feature extraction on the preprocessed photoplethysmography signal and the motion signal, respectively, to determine a first initial feature corresponding to the photoplethysmography signal and a second initial feature corresponding to the motion signal;
[0019] The first initial feature and the second initial feature are fused to determine first feature data.
[0020] In one embodiment, when the physiological data includes heart rate and blood oxygen saturation, determining the physiological data of the subject based on the photoplethysmography signal and the motion signal includes:
[0021] Denoising the photoplethysmography signal according to the motion signal to determine a target photoplethysmography signal;
[0022] determining the heart rate of the subject based on a peak detection algorithm and a target photoplethysmography signal;
[0023] The blood oxygen saturation of the subject is determined based on the DC component and AC component in the target photoplethysmography signal.
[0024] In one embodiment, the sleep stage determination method further includes:
[0025] acquiring a plurality of sample photoplethysmography signals and a sample motion signal;
[0026] Determining sample physiological data of the subject based on each sample photoplethysmography signal and the corresponding sample motion signal, the physiological data including at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability;
[0027] determining a plurality of first sample characteristic data for each sample photoplethysmography signal and the corresponding sample motion signal;
[0028] Obtaining a sample sleep stage type corresponding to each sample photoplethysmography signal and sample motion signal;
[0029] The plurality of first sample feature data and the corresponding sample sleep stage types are used as training samples to train the initial sleep stage prediction model to obtain a sleep stage prediction model.
[0030] In a second aspect, the present application further provides a sleep stage determination device, comprising:
[0031] an acquisition module, used to acquire a photoplethysmographic signal and a motion signal of a measured object;
[0032] a first determining module, configured to determine physiological data of the subject according to the photoplethysmography signal and the motion signal, wherein the physiological data includes at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability;
[0033] a second determining module, configured to extract features from the photoplethysmography signal and the motion signal to determine first feature data;
[0034] The prediction module is configured to input the physiological data and the first characteristic data into a sleep staging prediction model to determine a sleep staging result.
[0035] In one embodiment, the sleep stage prediction model is a Transformer network model, which includes multiple encoders and multiple decoders; each encoder includes a multi-head self-attention mechanism layer and a feedforward neural network layer, and each decoder includes a masked multi-head self-attention mechanism layer, an encoder-decoder attention layer and a feedforward neural network layer.
[0036] In one embodiment, the prediction module is specifically used to perform position encoding processing on the physiological data and the first feature data to obtain the second feature data; the second feature data is input into each encoder, and the third feature data is determined based on the multi-head self-attention mechanism layer and the feedforward neural network layer; the third feature data is input into the decoder, and the sleep staging result is determined according to the output of the decoder.
[0037] In one embodiment, the second determination module is specifically used to preprocess the photoplethysmography signal and the motion signal, and the preprocessing includes normalization, standardization and filtering; perform feature extraction on the preprocessed photoplethysmography signal and the motion signal respectively to determine the first initial feature corresponding to the photoplethysmography signal and the second initial feature corresponding to the motion signal; perform feature fusion on the first initial feature and the second initial feature to determine the first feature data.
[0038] In one embodiment, when the physiological data includes heart rate and blood oxygen saturation, the first determination module is specifically used to denoise the photoplethysmography signal based on the motion signal to determine the target photoplethysmography signal; determine the heart rate of the subject based on the peak detection algorithm and the target photoplethysmography signal; and determine the blood oxygen saturation of the subject based on the DC component and AC component in the target photoplethysmography signal.
[0039] In one embodiment, the sleep stage determination device also includes a training module, which is used to obtain multiple sample photoplethysmography signals and sample motion signals; determine sample physiological data of the subject based on each sample photoplethysmography signal and the corresponding sample motion signal, the physiological data including at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability; determine multiple first sample feature data for each sample photoplethysmography signal and the corresponding sample motion signal; obtain the sample sleep stage type corresponding to each sample photoplethysmography signal and the sample motion signal; use the multiple first sample feature data and the corresponding sample sleep stage types as training samples to train the initial sleep stage prediction model to obtain a sleep stage prediction model.
[0040] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements any of the methods described in the first aspect when executing the computer program.
[0041] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the methods described in the first aspect above.
[0042] In a fifth aspect, the present application also provides a computer program product, comprising a computer program, which implements any of the methods described in the first aspect when executed by a processor.
[0043] The above-mentioned sleep staging determination method, device, equipment, storage medium and program product obtain the photoplethysmogram signal and motion signal of the subject, determine the physiological data of the subject based on the photoplethysmogram signal and motion signal, and the physiological data include at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability. Feature extraction is performed on the photoplethysmogram signal and motion signal to determine first feature data, and the physiological data and the first feature data are input into a sleep staging prediction model to determine the sleep staging result. In the above-mentioned method, the physiological data and the first feature data are determined based on the photoplethysmogram signal and motion signal of the subject, and then the sleep staging result is determined based on the physiological data and the first feature data. In this way, the sleep staging result can be accurately determined based on the physiological data and the first feature data that have a strong correlation with sleep. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0045] Figure 1 1 is a flow chart of a method for determining sleep stages in one embodiment;
[0046] Figure 2 A flowchart of the steps for determining sleep stage results in one embodiment;
[0047] Figure 3 Schematic diagram of a flow chart of a step of determining first characteristic data in one embodiment;
[0048] Figure 4 FIG1 is a flow chart of the steps of determining physiological data of a measured subject in one embodiment;
[0049] Figure 5 is a flowchart of a method for determining sleep stages in another embodiment;
[0050] Figure 6 is a flowchart of a method for determining sleep stages in another embodiment;
[0051] Figure 7 is a structural block diagram of a sleep stage determination device in one embodiment;
[0052] Figure 8 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0054] Sleep is an important part of human life. During the sleep process, people will periodically be in several stages, namely wakefulness (Wake), rapid eye movement (REM), and non-rapid eye movement (NREM). Each stage corresponds to a different sleep state. By studying sleep stages, the sleep condition of the subject can be detected.
[0055] In the prior art, sleep stage analysis is performed by extracting features from physiological signals and inputting them into a classifier. Feature extraction methods mainly include Fourier transform, wavelet transform, power spectrum, approximate entropy, etc.
[0056] However, in the existing technology, specific features need to be manually determined, and the accuracy in determining the sleep staging results is not high.
[0057] In view of this, the present application provides a sleep staging determination method that can accurately determine the sleep staging results. The sleep staging determination method provided in the embodiment of the present application, its execution subject can be a sleep staging determination device, and the sleep staging determination device can be implemented by software, hardware, or a combination of software and hardware. It can be embedded in or independent of the processor in the computer device in the form of hardware, or it can be stored in the memory of the computer device in the form of software. In the following method embodiments, the execution subject is a computer device as an example for explanation, wherein the computer device can be a server, a computer, or a pulse oximeter device, such as a ring-type pulse oximeter device or a finger-clip type pulse oximeter device, etc. The embodiment of the present application does not limit the specific type of computer device.
[0058] In an exemplary embodiment, Figure 1 As shown, a method for determining sleep stages is provided, which is described by taking the method applied to a computer device as an example, and includes the following steps 101 to 104. Among them:
[0059] Step 101: Acquire a photoplethysmography signal and a motion signal of a measured object.
[0060] The pulse oximeter includes a photoelectric sensor and an accelerometer. A subject wears the pulse oximeter to measure their blood oxygen level. The pulse oximeter can collect the subject's photoplethysmography signal via the photoelectric sensor and the subject's motion signal via the accelerometer. Thus, the pulse oximeter can acquire both the subject's photoplethysmography signal and the subject's motion signal. It is understood that the subject is the user of the pulse oximeter.
[0061] Optionally, the photoelectric sensor and the acceleration sensor need to maintain the same sampling frequency when collecting the photoplethysmography signal and the motion signal, that is, the photoplethysmography signal and the motion signal are synchronized.
[0062] Optionally, the photoplethysmograph (PPG) signal is a physiological signal obtained through optical technology, mainly composed of DC and AC components. The DC component reflects the static absorption and scattering characteristics of light by the skin, tissue, etc.; the AC component is mainly related to the changes in blood volume caused by the pulsation of arterial blood vessels, and is the key information for analyzing cardiovascular function.
[0063] Optionally, the motion signal may include an acceleration signal. When the acceleration sensor includes a three-axis accelerometer and a three-axis gyroscope, a six-axis acceleration signal of the object under test may be obtained, ie, linear acceleration and angular acceleration in three-dimensional space.
[0064] Step 102 : determining physiological data of the subject according to the photoplethysmography signal and the motion signal.
[0065] The physiological data may include at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability.
[0066] Among them, heart rate refers to the number of times the heart beats per minute, blood oxygen saturation refers to the degree to which oxygen in the blood is bound to hemoglobin, usually expressed as a percentage, respiratory rate refers to the number of breaths per minute, and heart rate variability refers to the natural fluctuations in the time between heart beats.
[0067] Optionally, the PPG signal is easily interfered by various factors, such as motion artifacts, changes in ambient light, etc. Among them, motion artifacts are when the object under test is moving, which will cause large fluctuations in the PPG signal, affecting the quality and accuracy of the signal. Therefore, the PPG signal obtained by the pulse oximeter is superimposed with motion noise, and the PPG signal needs to be denoised according to the motion signal.
[0068] Optionally, after the PPG signal is denoised, different physiological data of the subject are determined based on the denoised PPG signal.
[0069] Optionally, the pulse oximeter device may include multiple photoelectric sensors and multiple acceleration sensors. Therefore, the acquired PPG signals and motion signals may be multiple. When determining physiological data based on the PPG signals and motion signals, the PPG signals may be merged, and the physiological data may be determined based on the merged PPG signals. Alternatively, the initial physiological data may be determined separately based on the PPG signals, and then for a type of physiological data, the initial physiological data corresponding to the PPG signals may be merged to determine the physiological data. The embodiments of the present application do not limit the merging process and the merging stages.
[0070] Step 103 : extracting features from the photoplethysmography signal and the motion signal to determine first feature data.
[0071] Among them, the first feature data is a multi-dimensional digital feature without clear physiological meaning, and has high feature stability.
[0072] Optionally, as can be seen from the above content, there are multiple PPG signals and motion signals. Therefore, when performing feature extraction on the PPG signals and motion signals, each PPG signal and each motion signal can be merged, and then feature extraction is performed on the merged signal to determine the first feature data. Alternatively, feature extraction is performed on each PPG signal and each motion signal separately to obtain multiple initial feature data, and then the initial features are characterized and merged to determine the first feature data. This embodiment of the present application is not limited to this.
[0073] Optionally, feature extraction of the PPG signal and the motion signal can be performed by a principal component analysis method, or feature extraction of the PPG signal and the motion signal can be performed by an autoencoder, or feature extraction can be performed by a convolutional neural network (such as GoogleNet, ResNet, Vgg). The embodiment of the present application does not limit the method of feature extraction.
[0074] Step 104 : Input the physiological data and the first characteristic data into a sleep staging prediction model to determine a sleep staging result.
[0075] Among them, sleep staging can be used to determine the stage of sleep of the subject based on PPG signals and motion signals. The sleep staging results can include the wakefulness stage, non-rapid eye movement sleep and rapid eye movement sleep. Among them, non-rapid eye movement sleep can be divided into three stages: stage 1 (N1), stage 2 (N2) and stage 3 (N3).
[0076] Optionally, the sleep staging prediction model may be a pre-trained neural network model that takes the physiological data and the first feature data as input and outputs a sleep staging result.
[0077] In one possible implementation, the sleep stage prediction model can be a classification model such as a decision tree, a random forest, or a support vector machine.
[0078] In another possible implementation, the sleep stage prediction model is a Transformer network model, which includes multiple encoders and multiple decoders; each encoder includes a multi-head self-attention mechanism layer and a feedforward neural network layer, and each decoder includes a masked multi-head self-attention mechanism layer, an encoder-decoder attention layer, and a feedforward neural network layer.
[0079] The above-mentioned sleep staging determination method obtains the photoplethysmography signal and motion signal of the subject, determines the physiological data of the subject based on the photoplethysmography signal and motion signal, and the physiological data includes at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability. Feature extraction is performed on the photoplethysmography signal and motion signal to determine first feature data, and the physiological data and the first feature data are input into a sleep staging prediction model to determine the sleep staging result. In the above-mentioned method, the physiological data and the first feature data are determined based on the photoplethysmography signal and motion signal of the subject, and then the sleep staging result is determined based on the physiological data and the first feature data. In this way, the sleep staging result can be accurately determined by the physiological data and the first feature data that have a strong correlation with sleep.
[0080] In an exemplary embodiment, Figure 2 As shown, optionally, inputting the physiological data and the first characteristic data into the sleep staging prediction model to determine the sleep staging result includes the following steps 201 to 203. Among them:
[0081] Step 201 : Perform position coding processing on the physiological data and the first characteristic data to obtain the second characteristic data.
[0082] Among them, position encoding is a method of providing the model with the position information of words or tokens in the sequence. Different positions have different encodings, and position encoding is additive.
[0083] Optionally, the physiological data and the first characteristic data may be determined into a sequence, and position coding processing may be performed on the data in the sequence.
[0084] For example, the physiological data and the first characteristic data may be position-encoded by combining sine and cosine functions, which can be expressed by the following formula:
[0085]
[0086]
[0087] Among them, PE(pos,i) represents the encoding of the i-th dimension of position pos, d model is the dimension of the model, i is the dimension index, and pos is the position of the data in the sequence.
[0088] In step 202, the second feature data is input into each encoder, and the third feature data is determined based on the multi-head self-attention mechanism layer and the feedforward neural network layer.
[0089] It can be understood that the output of each encoder will be used as the input of the next encoder, passed layer by layer, and the output of the last encoder will be used as the third feature data.
[0090] Optionally, an encoder can include a multi-head self-attention mechanism layer and a feedforward neural network layer. Each encoder is followed by a normalization operation to stabilize the training process. The multi-head self-attention mechanism captures the relationship between different parts of the input sequence through multiple attention heads. Each attention head independently calculates the attention score, and then the results are spliced together to form a new representation; the feedforward neural network consists of two linear transformation layers and a nonlinear activation function (such as ReLU). It introduces nonlinear transformations to improve the expressiveness of the model and learn more complex features.
[0091] Optionally, to avoid the vanishing gradient problem in deep networks, residual connections are introduced into each encoder. The input and output of each encoder are summed to preserve the input information. Layer normalization is then applied to ensure that the output data distribution of each encoder remains stable, reducing computational complexity and enhancing stability.
[0092] Optionally, self-attention generates an identifier containing contextual information by calculating the relationship between each data in the input sequence and other data. During the calculation process, the input data is mapped into three vectors: query, key, and value. The attention score is calculated by the similarity between these vectors, which can be expressed by the following formula:
[0093]
[0094] Among them, Q is the query matrix, K is the key matrix, and V is the value matrix. Q, K, and V are determined by performing matrix multiplication with each weight matrix based on the second feature. k is the key vector dimension, used to prevent the dot product from being too large and causing the gradient to disappear. is the normalized attention score matrix.
[0095] Optionally, in a multi-head attention mechanism, each head will generate an independent output matrix Attention(Q, K, V), but these output matrices cannot be directly input into the subsequent feedforward neural network, and these output matrices need to be merged into a single matrix.
[0096] For example, the output of each head can be concatenated by column, which can be expressed by the following formula:
[0097]
[0098] Among them, head i =Attention(Q i , K i 、V i ).
[0099] Step 203: Input the third characteristic data into a decoder, and determine a sleep stage result according to the output of the decoder.
[0100] Optionally, the output of each decoder will be used as the input of the next decoder and passed layer by layer, and the sleep staging result can be determined based on the output of the last decoder.
[0101] Optionally, in a decoder, a masked multi-head attention mechanism layer, an encoder-decoder attention layer, and a feedforward neural network layer may be included.
[0102] Among them, the masked multi-head attention mechanism can ensure that the model will not access future words when calculating the attention score of the current data, thereby ensuring the timing of the decoding process; the encoder-decoder attention layer enables the decoder to extract relevant information from the global context generated by the encoder based on the current decoding state. The query matrix comes from the output of the previous layer of the decoder, while the key and value matrices come directly from the final output of the encoder; the feedforward neural network of the decoder is the same as that of the encoder, and is connected through cross-layer methods such as residual connections and layer normalization to promote gradient flow and maintain output stability. The embodiments of this application will not be repeated here.
[0103] The above-mentioned position encoding processing is performed on the physiological data and the first feature data to obtain the second feature data; the second feature data is input into each encoder, and the third feature data is determined according to the multi-head self-attention mechanism layer and the feedforward neural network layer; the third feature data is input into the decoder, and the sleep staging result is determined according to the output of the decoder. In this way, through the multi-head attention mechanism and multi-layer structure, very rich feature representations can be extracted, which can be more accurate in determining the sleep staging results.
[0104] In an exemplary embodiment, Figure 3As shown, optionally, feature extraction is performed on the photoplethysmography signal and the motion signal to determine the first feature data, including the following steps 301 to 303. In which:
[0105] Step 301: pre-process the photoplethysmography signal and the motion signal.
[0106] Among them, preprocessing includes normalization, standardization and filtering.
[0107] Optionally, when there are multiple PPG signals acquired within the same period of time, each PPG signal may be preprocessed separately, and then the multiple PPG signals may be merged to obtain a preprocessed PPG signal. Similarly, for motion signals, when there are multiple motion signals acquired within the same period of time, each motion signal may be preprocessed separately, and then the multiple motion signals may be merged to obtain a preprocessed motion signal.
[0108] Step 302 : Feature extraction is performed on the pre-processed photoplethysmography signal and the motion signal respectively to determine a first initial feature corresponding to the photoplethysmography signal and a second initial feature corresponding to the motion signal.
[0109] Optionally, feature extraction is performed on the preprocessed PPG signal to determine a first initial feature, and feature extraction is performed on the preprocessed motion signal to determine a second initial feature. Other feature extraction methods are not described here in detail.
[0110] It can be understood that in the preprocessing stage, what is obtained is a merged PPG signal and a merged motion signal.
[0111] In another possible implementation, when pre-processing the PPG signal and the motion signal, signal merging may not be performed. Instead, normalization, standardization, and filtering may be performed on each PPG signal and motion signal respectively, and then feature extraction may be performed on each PPG signal and motion signal respectively to obtain a plurality of first initial features and a plurality of second initial features.
[0112] Step 303: Fusing the first initial feature and the second initial feature to determine first feature data.
[0113] In one possible implementation, when merging the PPG signals and merging the motion signals in the preprocessing stage, when performing feature fusion, the preset weight coefficients corresponding to the PPG signals and the weight coefficients corresponding to the motion signals can be obtained, and weighted fusion can be performed based on the weight coefficients, the first initial feature, and the second initial feature, and the fusion result is used as the first feature data.
[0114] In another possible implementation, when signal merging is not performed on the PPG signals and signal merging is not performed on the motion signals in the preprocessing stage, when performing feature fusion, the preset weight coefficients corresponding to the sensors can be obtained, and weighted fusion can be performed according to the weight coefficients, the first initial features and the second initial features, and the fusion result is used as the first feature data.
[0115] The above-mentioned preprocessing of the photoplethysmography signal and the motion signal is performed, and features are extracted from the preprocessed photoplethysmography signal and the motion signal respectively, and a first initial feature corresponding to the photoplethysmography signal and a second initial feature corresponding to the motion signal are determined. The first initial feature and the second initial feature are feature fused to determine the first feature data. In this way, the features corresponding to the PPG signal and the motion signal can be fused, and the sleep stage can be determined based on the PPG signal and the motion signal in the subsequent determination, thereby effectively improving the accuracy.
[0116] In an exemplary embodiment, Figure 4 As shown, optionally, when the physiological data includes heart rate and blood oxygen saturation, determining the physiological data of the subject according to the photoplethysmography signal and the motion signal includes the following steps 401 to 403. Among them:
[0117] Step 401 : De-noising the photoplethysmography signal according to the motion signal to determine a target photoplethysmography signal.
[0118] In one possible implementation, the PPG signal may be denoised according to a signal separation method.
[0119] Exemplarily, the PPG signal may be a mixed signal formed by a mixture of multiple independent signals (motion noise signals and target PPG signals). The motion noise signal and the target PPG signal have different statistical characteristics. The statistical characteristics of the motion noise signal can be determined based on the motion signal, and then the target PPG signal can be separated from the mixed signal based on the independent component analysis method.
[0120] In another possible implementation, the PPG signal may be denoised based on a filtering method.
[0121] For example, the PPG signal and the motion signal can be input into an adaptive filter. The filter continuously adjusts the weights through algorithms such as the least mean square error (LMS) algorithm and the recursive least squares (RLS) algorithm to estimate the running noise signal in the PPG signal, thereby obtaining the denoised target PPG signal.
[0122] Step 402 : Determine the heart rate of the subject based on a peak detection algorithm and the target photoplethysmography signal.
[0123] Optionally, the waveform of the target PPG signal typically exhibits periodic changes, with each cycle corresponding to a heart beat. Each heart beat results in an obvious peak (usually the highest point of the waveform). The frequency of these peaks is related to the heart rate, and the heart rate can be calculated by detecting the intervals between these peaks.
[0124] Exemplarily, the peak value of the target PPG signal can be determined by a first-order derivative method, a threshold method, or a peak detection algorithm (for example, a findpeaks function), and this embodiment of the present application is not limited thereto.
[0125] Optionally, after determining the time intervals between adjacent peaks, the average value is taken to obtain the average peak interval time corresponding to the target PPG signal, and then the heart rate is determined based on the ratio of 60 to the average peak interval time.
[0126] Step 403 : Determine the blood oxygen saturation of the subject based on the DC component and the AC component in the target photoplethysmography signal.
[0127] Optionally, the AC component and the DC component are different components in the target PPG signal, the AC component is a light absorption component that varies with the pulse, and the DC component is a light absorption component that does not vary with the pulse.
[0128] Optionally, the DC component may be a periodic average value of the PPG signal. The DC component may be determined by determining a periodic average value of the target PPG signal, and then the AC component may be determined based on the difference between the target PPG signal and the DC component.
[0129] Optionally, the target PPG signal may include a red light PPG signal and an infrared light PPG signal, the corresponding DC component may include a red light DC component and an infrared light DC component, and the AC component may include a red light AC component and an infrared light AC component.
[0130] Therefore, the ratio value R can be determined according to the ratio of the AC component to the DC component, and then the blood oxygen value can be calculated by means of a calibration curve. The calculation process of the ratio value R can be expressed by the following formula:
[0131] R=AC 红光 ÷DC 红光 ÷(AC 红外光 ÷DC 红外光 )
[0132] Among them, AC 红光 and AC 红外光 They are the AC components of red light and infrared light, DC 红光 and DC 红外光are the DC components of red light and infrared light respectively. The ratio value R can also be calculated by other variations of the above formula or equivalent formulas.
[0133] Optionally, when determining the heart rate of the subject, the heart rate variability may be determined based on the time intervals between adjacent peaks.
[0134] For example, the heart rate variability may be determined based on the standard deviation of the time intervals between all adjacent peaks.
[0135] Optionally, the respiratory signal can be extracted from the PPG signal by wavelet transformation or adaptive filter, and then the peaks in the respiratory signal are detected, and the time intervals between adjacent peaks are calculated, and the respiratory frequency is determined based on the average value of the time intervals between adjacent peaks of the respiratory signal.
[0136] In an exemplary embodiment, Figure 5 As shown, optionally, the sleep stage determination method further includes the following steps 501 to 505. Among them:
[0137] Step 501: Acquire a plurality of sample photoplethysmography signals and sample motion signals.
[0138] Optionally, the sample photoplethysmography signal and the sample motion signal are determined by detecting the subject using a pulse oximeter, which will not be described in detail here.
[0139] Step 502 : Determine sample physiological data of the subject according to each sample photoplethysmography signal and the corresponding sample motion signal.
[0140] The physiological data includes at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability.
[0141] Optionally, a set of sample physiological data can be determined based on a set of sample photoplethysmography signals and corresponding sample motion signals. It can be understood that the method of determining the sample physiological data based on the sample photoplethysmography signals and the sample motion signals is similar to the above steps 401 to 403 and will not be repeated here.
[0142] Step 503 : Determine a plurality of first sample feature data for each sample photoplethysmography signal and the corresponding sample motion signal.
[0143] Optionally, feature extraction can be performed on the sample PPG signal and the corresponding sample motion signal by a principal component analysis method, or by an autoencoder. Feature extraction can also be performed by a convolutional neural network (such as GoogleNet, ResNet, Vgg). The embodiment of the present application does not limit the method of feature extraction.
[0144] Likewise, a set of first sample feature data may be determined based on a set of sample PPG signals and corresponding sample motion signals.
[0145] Step 504 : Obtain the sample sleep stage type corresponding to each sample photoplethysmography signal and sample motion signal.
[0146] Optionally, an actually recorded sleep staging result may be obtained and used as a sample sleep staging type.
[0147] For example, the actual recorded sleep staging results can be determined by analyzing the sample PPG signals according to the staging rules and the features corresponding to different stagings.
[0148] Step 505 : Using the plurality of first sample feature data and the corresponding sample sleep stage types as training samples, an initial sleep stage prediction model is trained to obtain a sleep stage prediction model.
[0149] In one possible implementation, 80% of the training sample data is used to train the model, and 20% of the training sample data is used to test the correctness of the model. If the obtained sleep stage prediction model does not achieve the expected effect, the parameters are adjusted and continuously optimized to eventually obtain a model with higher accuracy.
[0150] In another possible implementation method, part of the training sample data is used as the initial training set, and the sleep stage prediction model is trained with the initial training set. If the obtained sleep stage prediction model does not achieve the expected effect, some samples with incorrect classification models are added to the initial training set, or some samples with correct classification models are removed from the initial training set, and the sleep stage prediction model is retrained using the updated initial training set until the sleep stage prediction model achieves the expected effect or until the training end conditions are met.
[0151] Optionally, the sleep stage prediction model can also be continuously updated based on the individual usage of the subject, so as to be more suitable for the subject.
[0152] The above-mentioned method obtains multiple sample photoplethysmogram signals and sample motion signals; determines sample physiological data of the subject according to each sample photoplethysmogram signal and the corresponding sample motion signal, and the physiological data is at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability; determines multiple first sample characteristic data for each sample photoplethysmogram signal and the corresponding sample motion signal; obtains the sample sleep stage type corresponding to each sample photoplethysmogram signal and the sample motion signal; uses the multiple first sample characteristic data and the corresponding sample sleep stage types as training samples, and trains the initial sleep stage prediction model to obtain the sleep stage prediction model; in this way, training the initial sleep stage prediction model according to the sample physiological data and the first sample characteristic data can improve the accuracy of the training results, thereby further improving the accuracy of the sleep stage determination.
[0153] As an optional implementation, Figure 6 As shown, the sleep stage determination method provided in the embodiment of the present application may include the following specific steps:
[0154] Step 601: Acquire the photoplethysmography signal and motion signal of the subject.
[0155] Step 602 : De-noising the photoplethysmography signal according to the motion signal to determine a target photoplethysmography signal.
[0156] Step 603 : Determine the heart rate of the subject based on the peak detection algorithm and the target photoplethysmography signal.
[0157] Step 604 : Determine the blood oxygen saturation of the subject based on the DC component and the AC component in the target photoplethysmography signal.
[0158] Step 605 : Preprocess the photoplethysmography signal and the motion signal. The preprocessing includes normalization, standardization, and filtering.
[0159] Step 606 : Perform feature extraction on the pre-processed photoplethysmography signal and the motion signal, respectively, to determine a first initial feature corresponding to the photoplethysmography signal and a second initial feature corresponding to the motion signal.
[0160] Step 607: perform feature fusion on the first initial feature and the second initial feature to determine first feature data.
[0161] Step 608: Perform position coding processing on the physiological data and the first characteristic data to obtain second characteristic data. The physiological data includes heart rate and blood oxygen saturation.
[0162] Step 609: Input the second feature data into each encoder, and determine the third feature data based on the multi-head self-attention mechanism layer and the feedforward neural network layer.
[0163] Step 610: Input the third feature data into a decoder, and determine a sleep stage result according to the output of the decoder.
[0164] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0165] Based on the same inventive concept, embodiments of the present application also provide a sleep stage determination device for implementing the aforementioned sleep stage determination method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more sleep stage determination device embodiments provided below can be found in the limitations of the sleep stage determination method described above and will not be further elaborated here.
[0166] In an exemplary embodiment, Figure 7 As shown, a sleep stage determination device 700 is provided, comprising: an acquisition module 701, a first determination module 702, a second determination module 703 and a prediction module 704, wherein:
[0167] An acquisition module 701 is used to acquire a photoplethysmography signal and a motion signal of a subject;
[0168] A first determining module 702 is configured to determine physiological data of the subject based on the photoplethysmography signal and the motion signal, wherein the physiological data is at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability;
[0169] A second determining module 703 is configured to extract features from the photoplethysmography signal and the motion signal to determine first feature data;
[0170] The prediction module 704 is configured to input the physiological data and the first characteristic data into a sleep staging prediction model to determine a sleep staging result.
[0171] In one embodiment, the sleep stage prediction model is a Transformer network model, which includes multiple encoders and multiple decoders; each encoder includes a multi-head self-attention mechanism layer and a feedforward neural network layer, and each decoder includes a masked multi-head self-attention mechanism layer, an encoder-decoder attention layer and a feedforward neural network layer.
[0172] In one embodiment, the prediction module 704 is specifically used to perform position encoding processing on the physiological data and the first feature data to obtain the second feature data; input the second feature data into each encoder, and determine the third feature data based on the multi-head self-attention mechanism layer and the feedforward neural network layer; input the third feature data into the decoder, and determine the sleep staging result based on the output of the decoder.
[0173] In one embodiment, the second determination module 703 is specifically used to preprocess the photoplethysmography signal and the motion signal, and the preprocessing includes normalization, standardization and filtering; perform feature extraction on the preprocessed photoplethysmography signal and the motion signal respectively to determine the first initial feature corresponding to the photoplethysmography signal and the second initial feature corresponding to the motion signal; perform feature fusion on the first initial feature and the second initial feature to determine the first feature data.
[0174] In one embodiment, when the physiological data includes heart rate and blood oxygen saturation, the first determination module 702 is specifically used to denoise the photoplethysmography signal based on the motion signal to determine the target photoplethysmography signal; determine the heart rate of the subject based on the peak detection algorithm and the target photoplethysmography signal; and determine the blood oxygen saturation of the subject based on the DC component and AC component in the target photoplethysmography signal.
[0175] In one embodiment, the sleep stage determination device also includes a training module, which is used to obtain multiple sample photoplethysmography signals and sample motion signals; determine sample physiological data of the subject based on each sample photoplethysmography signal and the corresponding sample motion signal, the physiological data including at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability; determine multiple first sample feature data for each sample photoplethysmography signal and the corresponding sample motion signal; obtain the sample sleep stage type corresponding to each sample photoplethysmography signal and the sample motion signal; use the multiple first sample feature data and the corresponding sample sleep stage types as training samples to train the initial sleep stage prediction model to obtain a sleep stage prediction model.
[0176] Each module in the sleep stage determination device described above may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0177] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means, and the wireless means can be achieved via Wi-Fi, mobile cellular networks, NFC (near-field communication), or other technologies. When executed by the processor, the computer program implements a method for determining sleep stages. The display unit of the computer device is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.
[0178] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0179] In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps described in any of the above method embodiments when executing the computer program.
[0180] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps described in any of the above method embodiments are implemented.
[0181] In one embodiment, a computer program product is provided, comprising a computer program, which implements the steps of any of the above method embodiments when executed by a processor.
[0182] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, and the like.
[0183] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0184] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for determining sleep stages, characterized in that: The method comprises: Acquiring a photoplethysmographic signal and a motion signal of the subject; determining physiological data of the subject according to the photoplethysmography signal and the motion signal, wherein the physiological data includes at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability; performing feature extraction on the photoplethysmography signal and the motion signal to determine first feature data; The physiological data and the first characteristic data are input into a sleep staging prediction model to determine a sleep staging result.
2. The method according to claim 1, characterized in that The sleep stage prediction model is a Transformer network model, which includes multiple encoders and multiple decoders; each encoder includes a multi-head self-attention mechanism layer and a feedforward neural network layer, and each decoder includes a masked multi-head self-attention mechanism layer, an encoder-decoder attention layer and a feedforward neural network layer.
3. The method according to claim 2, characterized in that Inputting the physiological data and the first characteristic data into a sleep staging prediction model to determine a sleep staging result includes: performing position coding processing on the physiological data and the first characteristic data to obtain second characteristic data; Inputting the second feature data into each of the encoders, and determining third feature data according to the multi-head self-attention mechanism layer and the feedforward neural network layer; The third feature data is input into a decoder, and the sleep stage result is determined according to the output of the decoder.
4. The method according to claim 1, wherein The step of extracting features from the photoplethysmography signal and the motion signal to determine first feature data includes: Preprocessing the photoplethysmography signal and the motion signal, wherein the preprocessing includes normalization, standardization, and filtering; performing feature extraction on the preprocessed photoplethysmography signal and the motion signal, respectively, to determine a first initial feature corresponding to the photoplethysmography signal and a second initial feature corresponding to the motion signal; The first initial feature and the second initial feature are subjected to feature fusion to determine first feature data.
5. The method according to claim 1, wherein When the physiological data includes heart rate and blood oxygen saturation, determining the physiological data of the subject according to the photoplethysmography signal and the motion signal includes: performing denoising processing on the photoplethysmography signal according to the motion signal to determine a target photoplethysmography signal; determining a heart rate of the subject based on a peak detection algorithm and the target photoplethysmography signal; The blood oxygen saturation of the measured object is determined based on the DC component and the AC component in the target photoplethysmography signal.
6. The method according to claim 1, characterized in that The method further comprises: acquiring a plurality of sample photoplethysmography signals and a sample motion signal; Determining sample physiological data of the subject according to each of the sample photoplethysmography signals and the corresponding sample motion signal, wherein the physiological data includes at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability; determining a plurality of first sample characteristic data for each of the sample photoplethysmography signals and the corresponding sample motion signals; Obtaining a sample sleep stage type corresponding to each of the sample photoplethysmography signals and the sample motion signal; The plurality of first sample feature data and the corresponding sample sleep stage types are used as training samples to train an initial sleep stage prediction model to obtain the sleep stage prediction model.
7. A sleep stage determination device, characterized in that: The device comprises: an acquisition module, used to acquire a photoplethysmographic signal and a motion signal of a measured object; a first determining module, configured to determine physiological data of the subject according to the photoplethysmography signal and the motion signal, wherein the physiological data includes at least one of the following: heart rate, blood oxygen saturation, respiratory rate, and heart rate variability; a second determining module, configured to extract features from the photoplethysmography signal and the motion signal to determine first feature data; The prediction module is configured to input the physiological data and the first characteristic data into a sleep staging prediction model to determine a sleep staging result.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.