Disclosure of Invention
The present invention has been made in view of the above-described problems occurring in the prior art.
Therefore, the invention provides a sleep state monitoring method based on a GM-GP algorithm, which solves the problem that the change of the sleep state is difficult to reflect in real time in the prior art.
In order to solve the technical problems, the invention provides the following technical scheme:
In a first aspect, the invention provides a sleep state monitoring method based on a GM-GP algorithm, which includes acquiring a multi-modal signal in real time through a physiological signal acquisition device, and performing preprocessing;
separating an electroencephalogram signal from the preprocessed multi-mode signal, extracting nonlinear characteristics, and calculating the correlation dimension;
Inputting the correlation dimension of the electroencephalogram signals into a GM model for modeling, and capturing dynamic change characteristics of different sleep stages;
Inputting the change characteristics of different sleep stages into a GP model for classification, and optimizing the accuracy of sleep stages by combining the correlation dimension of the electroencephalogram signals;
Introducing a hybrid memory enhancement network to predict trend of the time sequence of the electroencephalogram signals and the multi-mode signals;
Detecting the time proportion and the number of the users in different sleep stages in real time based on the prediction result of the hybrid memory enhanced network and the optimized sleep stage result;
The relevant dimension of the electroencephalogram signals is input into a GM model for modeling, the dynamic change characteristics of different sleep stages are captured, the specific steps are,
Constructing a time sequence by using the correlation dimension calculated by the electroencephalogram signals;
Performing accumulation generation operation on the associated dimension time sequence to obtain an accumulation generation sequence;
Based on the accumulation generation sequence, preliminary prediction is carried out on the accumulation generation sequence at the future moment through a GM model;
the accumulation of the preliminary prediction is carried out to generate a sequence, the sequence is restored to the original association dimension predicted value through the inverse accumulation generation operation, and the preliminary association dimension predicted sequence is output;
correcting the preliminary association dimension prediction sequence by adopting a feedforward neural network;
and capturing dynamic change characteristics of different sleep stages by analyzing the corrected association dimension prediction sequence and the change rate thereof.
As an optimal scheme of the sleep state monitoring method based on the GM-GP algorithm, the invention comprises the steps of acquiring the multi-mode signals in real time through physiological signal acquisition equipment, preprocessing, specifically,
The physiological signal acquisition equipment acquires and transmits the multi-mode signals to the computing equipment in real time through the transmission interface;
the computing device synchronizes signals with different sampling rates through downsampling and upsampling;
removing high-frequency noise and low-frequency drift from the synchronized signals by using a band-pass filter, and eliminating power frequency interference by using a notch filter;
the de-noised signals are subjected to baseline drift correction through a high-pass filter, and Z-score standardization is carried out;
and carrying out windowing processing on the standardized multi-mode signals, and integrating the standardized multi-mode signals into a uniform multi-mode signal matrix.
As a preferable scheme of the sleep state monitoring method based on the GM-GP algorithm, the invention separates the brain electrical signals from the preprocessed multi-mode signals, carries out nonlinear feature extraction, calculates the correlation dimension thereof, specifically comprises the steps of,
Filtering the multi-mode signal matrix by using an FIR filter, reserving an electroencephalogram signal frequency band, and outputting an electroencephalogram signal;
Selecting delay time based on an average mutual information method, determining an embedding dimension through a pseudo nearest neighbor algorithm, and embedding one-dimensional electroencephalogram signals into an m-dimensional phase space;
in the phase space, calculating Euclidean distance between reconstruction vectors, and generating a correlation integral through a correlation integral formula;
The correlation dimension of the electroencephalogram signal is estimated by linear fitting on a logarithmic scale of the correlation integral and the distance threshold.
As an optimal scheme of the sleep state monitoring method based on the GM-GP algorithm, the method adopts a feedforward neural network to correct a preliminary association dimension prediction sequence, specifically comprises the following steps of,
Taking the preliminary correlation dimension prediction sequence as input of the feedforward neural network, and training the feedforward neural network by taking the historical real correlation dimension sequence as a supervision signal;
Gradually updating the weight and bias of the feedforward neural network by minimizing the mean square error, and simultaneously using an optimizer to accelerate the convergence process;
And inputting the preliminary predicted value of the GM model into a trained neural network, and outputting a corrected association dimension predicted sequence.
As a preferable scheme of the sleep state monitoring method based on the GM-GP algorithm, the invention inputs the change characteristics of different sleep stages into the GP model for classification, and optimizes the accuracy of sleep stages by combining the correlation dimension of the electroencephalogram signals, specifically comprises the following steps,
Extracting key features from the associated dimension prediction sequence generated by the GM model;
integrating the extracted key features into a feature matrix;
The feature matrix X is used as GP model input, the labels are set to different sleep stages, and a training data set is constructed as target output;
Dividing the data set into a training set and a testing set;
In the GP model, an RBF kernel function is selected as a covariance function;
optimizing the hyper-parameters in the GP model by maximum likelihood estimation using the training dataset;
after training, predicting a test data set by using a GP model to obtain output distribution of each input sample;
For each test sample, calculating the posterior probability of each category, and selecting the category with the maximum posterior probability as the final classification result;
Taking the correlation dimension of the electroencephalogram signals as an input characteristic, and adding the input characteristic into a characteristic matrix X;
based on the new feature matrix X, the GP model is retrained, and the classification capacity of the model is optimized.
As an optimal scheme of the sleep state monitoring method based on the GM-GP algorithm, the invention introduces a hybrid memory enhancement network to conduct trend prediction on time sequences of electroencephalogram signals and multi-mode signals, and comprises the following specific steps of,
Preprocessing the acquired EEG signals and the multi-mode signals to form a time sequence tensorThe expression is:
;
Wherein,The length of the time series is indicated,The dimensions of the features are represented and,Representing a real set;
will input tensorCapturing a local mode of the time sequence through a bidirectional time convolution network, and processing front-back dependence output convolution characteristics of the time sequence through bidirectional convolution, wherein the expression is as follows:
;
Wherein,Is a time stepIs characterized by the convolution characteristics of (a),As a convolution kernel in the forward direction,As a backward convolution kernel,As a result of the bias term,For the window size of the convolution kernel,An index representing the convolution kernel,Representing time series tensorsAt time stepIs used for the feature vector of (a),Representing time series tensorsAt time stepIs a feature vector of (1);
processing convolution characteristics by adopting a short-term memory unit and combining a time gating mechanismOutputting the short-term memory state;
In a short-term memory stateIntroducing long-term memory cells on the memory layer of (C) to generate long-term memory state;
Introducing a recursive attention mechanism, adaptively weighting the importance of a specific time step in a time sequence, and outputting a weighted output state;
Based on the weighted output states, a trend prediction model is built by combining the output of short-term memory, long-term memory and recursive attention, and a time step is generatedPredicted value of (2)The expression is:
;
Wherein,Represent the firstThe attention weight of the individual time steps,A loss function representing a trend prediction model,Represents the partial derivative of the derivative,Representing hidden state of long-term memory cellThe gradient of the loss function is found and,Representing the adjustment of the weights of the long-term memory units in the memory mechanism;
Optimizing trend prediction, and simultaneously constructing a loss function of a trend prediction model by combining a mean square error, a time sequence smoothness constraint and an attention weight regularization termThe expression is:
;
Wherein,Representing normalized termsRepresenting time stepsIs used to determine the predicted value of (c),Representing time stepsIs used to determine the true value of (a),A hyper-parameter representing the weight of the smoothness constraint term in the control loss function,Representing time stepsIs used to determine the predicted value of (c),Representing the difference between the predicted values of adjacent time steps,A hyper-parameter representing the weight of the control attention weight regularization term,Representing an attention weight regularization term.
As an optimal scheme of the sleep state monitoring method based on the GM-GP algorithm, the method comprises the steps of detecting the time proportion and the number of different sleep stages of a user in real time based on a prediction result of a hybrid memory enhanced network and an optimized sleep stage result,
Each time step to be generatedPredicted value of (2)A sleep stage label;
The sleep stage labels are subjected to sectional processing and analysis by adopting a sliding window mechanism, and meanwhile, the occurrence times of different sleep stages are counted in each sliding window, and the time proportion of the sleep stages in the whole window is calculated;
Recording the starting time and the ending time of the current sleep stage for each time step along with the movement of the sliding window, and calculating the duration;
setting a minimum duration threshold and screening out valid sleep stage duration periods;
And carrying out trend analysis by using the long-term sleep data to calculate the sleep stage time proportion of the user at a plurality of nights, and analyzing the long-term change trend of the user.
In a second aspect, the invention provides a computer device comprising a memory and a processor, the memory storing a computer program, wherein the computer program, when executed by the processor, implements any step of the sleep state monitoring method based on the GM-GP algorithm according to the first aspect of the invention.
In a third aspect, the present invention provides a computer readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any step of the GM-GP algorithm-based sleep state monitoring method according to the first aspect of the present invention.
The invention has the beneficial effects that by combining the advantages of the GM model and the GP model, the invention can accurately capture the dynamic changes of different stages in the sleeping process, and remarkably improves the sleeping stage precision. In addition, the mixed memory enhanced network is adopted to conduct trend prediction on the multi-mode physiological signals, so that the real-time performance and the continuity of sleep state monitoring are guaranteed, and the stability and the reliability of overall monitoring are improved.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to specific embodiments thereof which are illustrated in the appended drawings.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, but the present invention may be practiced in other ways other than those described herein, and persons skilled in the art will readily appreciate that the present invention is not limited to the specific embodiments disclosed below.
Further, reference herein to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic can be included in at least one implementation of the invention. The appearances of the phrase "in one embodiment" in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments.
Embodiment 1, referring to fig. 1 and 2, is a first embodiment of the present invention, and this embodiment provides a sleep state monitoring method based on GM-GP algorithm, including the following steps:
S1, acquiring multi-mode signals in real time through physiological signal acquisition equipment, and preprocessing.
Further, the physiological signal acquisition device acquires and transmits the multi-mode signals (such as EEG, ECG, GSR and the like) to the computing device in real time through a transmission (such as USB, bluetooth or Wi-Fi) interface;
Specifically, the physiological signal acquisition device includes an electroencephalogram signal acquisition device (EEG), an electrocardiograph signal acquisition device (ECG), and a galvanic skin response acquisition device (GSR);
It should be noted that to ensure accuracy of signal acquisition, the acquisition device needs to be calibrated and the electrodes should be placed in a standard location (e.g., 10-20 system of EEG) to ensure reliability and consistency of the signals. The transmission delay in the acquisition process should be controlled to be as high as millisecond level as possible so as to ensure the real-time property of the data.
The computing device synchronizes signals with different sampling rates through uniform sampling rates of downsampling (for example, downsampling an ECG from 1000Hz to 256 Hz) and upsampling (for example, upsampling a GSR from 10Hz to 256 Hz), so that all modal signals have consistent time resolution on the same time axis, subsequent processing is facilitated, and linear interpolation or other interpolation methods are adopted for resampling to ensure smooth transition of the signals;
removing high-frequency noise and low-frequency drift from the synchronized signals by using a band-pass filter, and eliminating power frequency interference by using a notch filter;
It should be noted that the design of these filters should take into account the phase response to avoid phase distortion of the signal, especially when EEG signal processing, it is important to preserve the phase information of the signal.
The de-noised signals are subjected to baseline drift correction through a high-pass filter, and Z-score standardization is carried out;
it should be noted that the denoised signal refers to a signal that has been subjected to bandpass filtering and notch filtering.
Windowing the standardized multi-mode signals (wherein each window is set to a certain length and overlapped) and integrating the standardized multi-mode signals into a unified multi-mode signal matrix;
The purpose of the windowing process is to divide the continuous time series signal into blocks of fixed length, which facilitate subsequent feature extraction and analysis.
S2, separating the electroencephalogram signals from the preprocessed multi-mode signals, extracting nonlinear characteristics, and calculating the correlation dimension.
Further, an FIR filter is used for filtering the multi-mode signal matrix, non-electroencephalogram signal frequency components are removed, an electroencephalogram signal frequency band (0.5 Hz-50 Hz) is reserved, and an electroencephalogram signal EEG is output;
Selecting delay time based on an average mutual information method, determining an embedding dimension through a pseudo nearest neighbor algorithm, and embedding one-dimensional EEG (electroencephalogram) into an m-dimensional phase space;
Where m represents the dimension in the phase space, typically determined by some algorithm, such as a pseudo-nearest neighbor algorithm.
In the phase space, calculating Euclidean distance between reconstruction vectors, and generating a correlation integral through a correlation integral formula, wherein the correlation integral is used for describing the distance distribution condition of point pairs in the reconstruction space;
The correlation dimension of the EEG is estimated as the main nonlinear feature of the EEG by linear fitting on the logarithmic scale of the correlation integral and the distance threshold.
S3, inputting the correlation dimension of the electroencephalogram signals into a GM model for modeling, and capturing dynamic change characteristics of different sleep stages.
Furthermore, the correlation dimension calculated by the electroencephalogram signals is utilized to construct a time sequence for reflecting the change of the correlation dimension along with time;
It should be noted that the association dimension may be calculated by the Grassberger-Procaccia algorithm or the like. The magnitude of the value generally reflects the chaos of the signal, and the larger the value is, the higher the signal complexity is.
Performing Accumulation Generation Operation (AGO) on the associated dimension time sequence to obtain an accumulation generation sequence, and providing a basis for a subsequent gray model;
The purpose of the accumulation generation is to reduce randomness, so that a GM model applied subsequently can better fit the trend of the data.
Based on the accumulation generation sequence, preliminary prediction is carried out on the accumulation generation sequence at the future moment through a GM model;
the accumulation of the preliminary prediction is carried out to generate a sequence, the sequence is restored to the original association dimension predicted value through the inverse accumulation generation operation, and the preliminary association dimension predicted sequence is output;
It should be noted that the inverse accumulation generation operation ensures that the data recovered from the accumulation sequence still maintains the dimensionality and physical meaning of the original associated-dimensionality time series.
The feedforward neural network is adopted to correct the preliminary association dimension prediction sequence, and the specific steps are that,
Taking the preliminary correlation dimension prediction sequence as input of the feedforward neural network, and training the feedforward neural network by taking the historical real correlation dimension sequence as a supervision signal;
Gradually updating the weights and biases of the feedforward neural network by minimizing the mean square error, and simultaneously using an optimizer (e.g., adam) to accelerate the convergence process;
And inputting the preliminary predicted value of the GM model into a trained neural network, and outputting a corrected association dimension predicted sequence.
The "trained neural network" refers to a network model in which the weight and bias parameters of the network are iteratively updated by a training process using an optimizer (e.g., adam) to eventually converge or minimize a loss function (e.g., mean square error, MSE).
Preferably, the introduction of the feedforward neural network enables the model to capture nonlinear dynamic changes in the electroencephalogram signals and make up for the defects of the GM model, wherein the input of the feedforward neural network is a preliminary predicted value of the GM model, and the output is a corrected association dimension predicted sequence, and the corrected association dimension predicted sequence better captures the nonlinear changes in the electroencephalogram signals.
The dynamic change characteristics of different sleep stages are captured by analyzing the corrected associated dimension prediction sequence and the change rate thereof, and the specific implementation steps are as follows:
firstly, a preliminary association dimension prediction sequence is corrected through a feedforward neural network, and a corrected association dimension time sequence is output, wherein the sequence can better capture complex nonlinear changes in an electroencephalogram signal and is used as input data of the next step.
And secondly, after the corrected association dimension time sequence is obtained, calculating the change rate of the association dimension by carrying out differential operation on the association dimension values of adjacent time points.
It should be noted that the rate of change represents the rate of change of the time series at each moment, providing a basis for subsequent trend analysis and phase division.
The method has the advantages that the method can keep the main trend of the change rate through a denoising algorithm, filter out tiny random fluctuation and obtain a more representative change rate sequence.
And extracting the characteristics of the smoothed change rate sequence. By analyzing the overall trend and fluctuation of the rate of change, key statistical features that can reflect sleep stage changes are extracted. These features will be used to identify different electroencephalogram signal states such as average level of rate of change, fluctuation amplitude, etc.
And according to the extracted change rate statistical characteristics, carrying out phase division on the dynamic change of the electroencephalogram signals. And combining the characteristic expression of different sleep stages, and dividing the corrected association dimension sequence into dynamic change characteristics of different sleep stages such as a shallow sleep stage, a deep sleep stage, a rapid eye movement stage and the like through a classification method based on rules or machine learning.
S4, inputting the change characteristics of different sleep stages into the GP model for classification, and optimizing the accuracy of sleep stages by combining the correlation dimension of the electroencephalogram signals.
Further, key features are extracted from the associated dimension prediction sequence generated by the GM model;
the key features comprise instantaneous change rate of the associated dimension, local maximum and minimum values in the time sequence of the associated dimension, associated dimension mean values and variances in different time windows, autocorrelation features of the time sequence of the associated dimension;
integrating the extracted key features into a feature matrixThe expression is:
;
;
Wherein,Which are indicative of the various features,As a total number of features,Index variables representing features;
inputting the feature matrix X as a GP (Gaussian process) model, setting the labels to different sleep stages (such as wakefulness, REM, NREM1, NREM2, NREM3 and the like), and constructing a training data set as target output;
Furthermore, in order to improve the classifying capability, preferably, the nonlinear characteristics (association dimension) of the electroencephalogram signals are introduced, so that the training data set contains richer dynamic change information, and the classifying capability of the GP model on different sleep stages is obviously improved. Meanwhile, the robustness of classification is further enhanced by combining multi-modal signals (such as electrocardio signals and respiratory signals). The feature construction method is different from the traditional linear feature extraction mode, and can better capture complex nonlinear dynamics characteristics in the electroencephalogram signals.
Dividing the data set into a training set and a testing set;
In the GP model, an RBF kernel function (radial basis function) is selected as the covariance function;
preferably, the RBF core is capable of capturing well the nonlinear relationship between the associated dimensional features and the sleep stages.
Optimizing hyper-parameters (such as length scale of kernel/and noise term) in the GP model by Maximum Likelihood Estimation (MLE) using the training dataset;
after training, predicting a test data set by using a GP model to obtain output distribution of each input sample;
since the GP model has bayesian properties, it can give not only predicted values but also uncertainty estimates.
For each test sample, calculating the posterior probability of each category, and selecting the category with the maximum posterior probability as the final classification result;
It should be noted that, the category with the maximum posterior probability is selected as the final classification result, specifically,
For each test samplePredicting by using the trained GP model;
The GP model's output for each sample is a posterior probability distribution, i.e., the model will calculate for each possible class (e.g., awake, REM, NREM1, NREM2, NREM3, etc.) the probability that the sample belongs to that class.
Assuming that there isThe model outputs a model of length of each category (i.e., different sleep stages)The posterior probability vector of (a) has the expression:
;
Wherein,Representing a sampleBelongs to the category ofIs a function of the probability of (1),An index representing the category of the object is presented,Representing the total number of categories;
And finding out the probability with the largest value in the obtained posterior probability vector, namely the class which the model considers the sample most likely belongs to.
The specific operation is to select the category with the maximum posterior probabilityThe expression is:
;
Wherein,Representing the search results in posterior probabilities;
Maximum class of posterior probability found in stepAs the final predicted class of the test sample, i.e., the final classification result.
The correlation dimension of the EEG signal is used as an independent input feature and added into a feature matrixIn (a) and (b);
based on the new feature matrix, the GP model is retrained, and the classification capacity of the model is optimized.
S5, introducing a hybrid memory enhancement network to predict trend of the time sequences of the electroencephalogram signals and the multi-mode signals.
Further, the acquired electroencephalogram (EEG) signals and the multi-modal signals are preprocessed to form time series tensorsThe expression is:
;
Wherein,The length of the time series is indicated,The dimensions of the features are represented and,Representing a real set;
will input tensorCapturing a local mode of the time sequence through a bidirectional time convolution network, and processing front-back dependence output convolution characteristics of the time sequence through bidirectional convolution, wherein the expression is as follows:
;
Wherein,Is a time stepIs characterized by the convolution characteristics of (a),As a convolution kernel in the forward direction,As a backward convolution kernel,As a result of the bias term,For the window size of the convolution kernel,An index representing the convolution kernel,Representing time series tensorsAt time stepIs used for the feature vector of (a),Representing time series tensorsAt time stepIs a feature vector of (1);
processing convolution characteristics by adopting a short-term memory unit and combining a time gating mechanismOutputting the short-term memory state;
In a short-term memory stateIntroducing long-term memory cells on the memory layer of (C) to generate long-term memory state;
Introducing a recursive attention mechanism, adaptively weighting the importance of a specific time step in a time sequence, and outputting a weighted output state;
Based on the weighted output states, a trend prediction model is built by combining the output of short-term memory, long-term memory and recursive attention, and a time step is generatedPredicted value of (2)The expression is:
;
Wherein,Represent the firstThe attention weight of the individual time steps,A loss function representing a trend prediction model,Represents the partial derivative of the derivative,Representing hidden state of long-term memory cellThe gradient of the loss function is found and,Representing the adjustment of the weights of the long-term memory units in the memory mechanism;
it should be noted that,Can be regarded as a trainable weight matrix, and is specially used for weighting and adjusting the gradient information of the long-term memory state based on the loss function in the updating process of the long-term memory state. The generation process can be divided into the following steps:
In the initialization phase of the model,The generation may be by:
Random initialization-pairs typically using random distribution (e.g., xavier initialization or He initialization)And initializing to ensure the stability of model training.
In the course of the training process, the user can perform,Updates will be made by back propagation. Specifically, the model is utilized by the following processAdjust long-term memory state:
For each time stepIn obtaining long-term memory stateThe model will then be based on the loss functionThe gradient of this time step is calculated.
Then, gradientWill be associated withAnd performing weighted combination to generate an adjusted output.
In each of the training cycles of the training device,Will be updated along with other model parameters by the back propagation algorithm. Specifically, the loss function will be based on the error termCalculate gradients of the entire model and propagate updates to all parameters, including。
During the test phase, the model is no longer counter-propagating, and therefore the gradient of the loss function is not calculated. But during the course of the prediction process,The training has resulted in an optimized weight that can be used directly to adjust the final output of the long-term memory state.
In the trend prediction formula, although the gradient is not calculated any more in the test stage, the model can be regarded as a weighting matrix for post-adjusting the output of the long-term memory, so as to improve the prediction performance of the model.
Optimizing trend prediction, and simultaneously combining Mean Square Error (MSE), time sequence smoothness constraint and attention weight regularization term to construct a loss function of a trend prediction modelThe expression is:
Wherein,Represents the normalized term, used to average the error,Representing time stepsIs used to determine the predicted value of (c),Representing time stepsIs used to determine the true value of (a),A hyper-parameter representing the weight of the smoothness constraint term in the control loss function,Representing time stepsIs used to determine the predicted value of (c),Representing the difference between the predictors of adjacent time steps, for measuring the smoothness of the time series, which may not be smooth enough if the difference between the predictors of adjacent time steps is too large,A hyper-parameter representing the weight of the control attention weight regularization term,Representing an attention weight regularization term.
It should be noted that a recursive attention mechanism is used to dynamically weight each time step in the time series to highlight the importance of different time steps in the prediction, wherein the attention weightsIs calculated based on the input tensor and the memory state, and comprises the following specific steps:
Recursive attention mechanisms typically combine input features and hidden states to calculate attention weights.
Assume that at the current time stepAt the same time have input features(Output from short-term memory cell), long-term memory state。
An attention scoring function is defined for measuring the importance of each time step. This scoring function is typically expressed as a linear combination of input features and memory states or a nonlinear transformation
The recursive attention mechanism calculates the attention weight of each time step by means of an attention scoring function. Meanwhile, normalization is carried out through a softmax function to ensure that the attention weight forms a probability distribution on each time step;
Attention weights at all time steps after normalizationSatisfying the normalization condition;
Calculated attention weightFor short-term memory statesAnd long-term memory stateWeighting, generating an output of a recursive attention mechanism
In order to prevent the model from over-relying on the attention weights of certain time steps, the recursive attention mechanism introduces a regularization term. The regularization term's attention weight for each time stepSquare penalty is performed to ensure a more uniform distribution of attention.
S7, detecting the time proportion and the number of the users in different sleep stages in real time based on the prediction result of the hybrid memory enhanced network and the optimized sleep stage result.
Further, each time step to be generatedPredicted value of (2)Corresponding to sleep stage label;
Wherein,5 Different sleep stages are shown.
The sleep stage labels are subjected to sectional processing and analysis by adopting a sliding window mechanism, so that the sleep state of a user is ensured to be monitored in real time in different time periods;
meanwhile, in each sliding window, counting the occurrence times of different sleep stages (such as N1, N2, N3, REM and WAKE) and calculating the time duty ratio of the sleep stages in the whole window;
along with the movement of the sliding window, recording the starting time and the ending time of the current sleep stage for each time step, and calculating the duration;
Setting a minimum duration threshold (e.g., the minimum duration of the deep sleep stage N3 may be set to 20 minutes) and screening for a valid sleep stage duration period;
It should be noted that when setting the "minimum duration threshold", the main purpose is to filter out transient, ineffective sleep stage handovers, ensuring that only meaningful, consecutive sleep stages are analyzed. This setting needs to ensure that the detected sleep stage corresponds to the actual sleep cycle characteristics based on existing sleep studies and physiological laws. The following are specific considerations and steps for setting the minimum duration threshold:
first, thresholds may be set based on physiological laws, with various sleep stages (e.g., N1, N2, N3, REM, and WAKE) having different durations during the normal sleep cycle. We can set the threshold according to the typical duration of these phases:
N1 (light sleep) N1 phase is generally relatively short, with a duration of typically around 1-7 minutes. Thus, the minimum duration threshold may be set to 1-2 minutes to prevent a brief transitional period from being erroneously identified as a valid light sleep stage.
N2 (moderate sleep) N2 phase is longer in duration, typically between 10-25 minutes. Thus, the minimum duration threshold may be set to 5-10 minutes to avoid misunderstanding the instantaneous N2 switch as a complete sleep segment.
N3 (deep sleep) the deep sleep stage is very important and its duration is usually long. To ensure that a true deep sleep is detected, the minimum duration threshold is typically set to 20 minutes. If the period duration is too short, the user may not actually go into deep sleep.
REM (rapid eye movement sleep) the REM phase typically fluctuates within 10-60 minutes, especially during the latter half of the night, which is gradually prolonged. Thus, the minimum duration threshold may be set to 10 minutes to avoid misinterpreting brief arousals or mild activity as REM sleep.
WAKE phase is typically a brief period of arousal, especially nocturnal arousal. The minimum duration threshold may be set to 1-2 minutes to filter out sporadic, extremely short awake states.
Second, although physiological laws provide a universal threshold range, sleep habits and health conditions may vary for each user, based on personalized adjustments. In order to improve the detection accuracy, personalized adjustment can be performed according to long-term sleep data of the user:
dynamically adjusting the threshold by analyzing the user's sleep data over multiple nights, the average duration of each sleep stage can be calculated, and dynamically adjusting the minimum duration threshold based on the results. For example, if the average duration of the N3 phase for one user is short, the minimum threshold may be suitably lowered.
In practice, the step of setting the minimum duration threshold may be by initializing the threshold by referencing standard values in the sleep study, such as 1-2 minutes (N1), 5-10 minutes (N2), 20 minutes (N3), 10 minutes (REM), 1-2 minutes (WAKE), as mentioned above, and real-time detection by monitoring the start time and end time of each sleep stage within a sliding window. When a sleep stage duration is detected to be below a set threshold, the stage is marked as an "invalid stage" and the final statistics are not taken into account, the threshold is adjusted such that over time, these minimum duration thresholds may be automatically adjusted based on the user's long-term sleep mode. For example, if the user's deep sleep duration is always short for some period of time, the threshold for the N3 phase may be suitably lowered.
It should be noted that the minimum duration threshold is not set too high, which may otherwise lead to missed detection of certain valid sleep stages. For example, if the threshold for the N3 phase is set to 30 minutes, some shorter but still meaningful deep sleep segments may be missed. Therefore, the threshold should be set to balance accuracy and sensitivity as much as possible.
To further increase the accuracy of setting the threshold, other physiological signals (e.g., heart rate, respiratory rate, electromyographic signals, etc.) may be combined to assist in determining whether a stage is a valid sleep stage. For example, when the brain electrical signal shows that the user is in stage N3, but the heart rate and respiratory rate show that the user is still in a higher activity state, this stage may be considered ineffective deep sleep.
It should also be noted that sleep stages refer to different sleep stages (N1, N2, N3, REM) typically having respective typical durations. For example, the N3 (deep sleep) phase typically lasts longer, while the N1 (light sleep) phase is typically shorter.
The effective duration means that the duration of each sleep stage must exceed a preset minimum duration threshold in order to be considered effective. This threshold is to avoid misunderstanding a brief, momentary sleep stage shift (e.g., a fast shift from light sleep to deep sleep and back to light sleep) as a complete sleep stage.
Invalid sleep stages means that if a certain sleep stage is of a duration shorter than a set threshold value, it is considered invalid and may simply be a transition or a short fluctuation between sleep stages without sufficient physiological significance. These invalid phases are not counted nor used for the calculation of the time scale.
And carrying out trend analysis by using the long-term sleep data to calculate the sleep stage time proportion of the user at a plurality of nights, and analyzing the long-term change trend of the user.
The embodiment also provides computer equipment, which is suitable for the condition of the sleep state monitoring method based on the GM-GP algorithm and comprises a memory and a processor, wherein the memory is used for storing computer executable instructions, and the processor is used for executing the computer executable instructions to realize the sleep state monitoring method based on the GM-GP algorithm.
The computer device may be a terminal comprising a processor, a memory, a communication interface, a display screen and input means connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
The present embodiment also provides a storage medium having a computer program stored thereon, which when executed by a processor implements the sleep state monitoring method based on GM-GP algorithm as proposed in the above embodiment, and the storage medium may be implemented by any type of volatile or non-volatile storage device or combination thereof, such as a static random access Memory (Static Random Access Memory, SRAM for short), an electrically erasable Programmable Read-Only Memory (ELECTRICALLY ERASABLE PROGRAMMABLE READ-Only Memory, EEPROM for short), an erasable Programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM for short), a Programmable Read-Only Memory (ROM for short), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.
In summary, the invention can accurately capture the dynamic changes of different stages in the sleeping process by combining the advantages of the GM model and the GP model, and remarkably improves the sleeping stage precision. In addition, the mixed memory enhanced network is adopted to conduct trend prediction on the multi-mode physiological signals, so that the real-time performance and the continuity of sleep state monitoring are guaranteed, and the stability and the reliability of overall monitoring are improved.
It should be noted that the above embodiments are only for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the present invention may be modified or substituted without departing from the spirit and scope of the technical solution of the present invention, which is intended to be covered in the scope of the claims of the present invention.