Sleep staging method based on hidden Markov model

Through the combination of hidden Markov model and neural network, the problem of poor sleep staging accuracy is solved, the sleep stage transfer relationship is considered, and the accuracy and reliability of sleep staging is improved.

CN119097284AInactive Publication Date: 2024-12-10NEUROFLUX (SHANGHAI) CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411569940.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2024-12-10
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, sleep staging accuracy is poor and the transfer relationship between different sleep stages is not considered.

Method used

Using the method based on the Hidden Markov model, the EEG signal data is obtained, the Hidden Markov model is constructed, and the sleep stage is predicted and weighted, and the Viterbi algorithm is used to calculate the maximum probability. The hidden state sequence of the sleep stage forms the predicted results.

Benefits of technology

It improves the accuracy of sleep staging, takes into account the transfer relationship between sleep stages, and enhances the credibility and reliability of predictions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119097284A_ABST
    Figure CN119097284A_ABST
Patent Text Reader

Abstract

The invention provides a sleep staging method based on a hidden Markov model. The sleep staging method solves the problems that in the prior art, the sleep staging accuracy is poor, and the transfer relation between different sleep stages is not considered. The method comprises the steps that an electroencephalogram signal sleep data set, electroencephalogram signal data and a corresponding polysomnogram are obtained, and training of a neural network model M and construction of a hidden Markov model are completed according to the sleep data set DATA1, the electroencephalogram signal data DATA2 and the corresponding polysomnogram; newly obtained multichannel electroencephalogram signal data passes through the hidden Markov model, and a prediction result of the sleep stage is generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a sleep staging method based on a hidden Markov model. Background Art

[0002] Sleep is an important physiological process of the human body, which is essential for restoring physical strength, consolidating memory and maintaining brain function. The assessment of sleep quality usually relies on sleep staging, which divides the sleep process into different stages according to physiological signals such as electroencephalogram (EEG), including wakefulness (W), rapid eye movement (REM) and three sleep stages: N1, N2 and N3. Accurate sleep staging is of great significance for diagnosing sleep disorders and evaluating sleep quality.

[0003] Traditional sleep staging relies on multiple physiological signals recorded by polysomnography (PSG), such as electroencephalogram (EEG), electrocardiogram (ECG), electrooculogram (EOG), and electromyogram (EMG). However, PSG equipment is complex, costly, inconvenient to use, data analysis is overly dependent on manual interpretation, and is time-consuming and subjective. Therefore, researchers began to explore methods for automatic sleep staging using single-channel EEG signals. However, existing methods for sleep staging using EEG signals have the problem of poor sleep staging accuracy. Summary of the invention

[0004] The invention provides a sleep staging method based on a hidden Markov model to solve the problem of poor accuracy of sleep staging in the prior art.

[0005] In a first aspect, the present invention provides a sleep staging method based on a hidden Markov model, which specifically comprises the following steps: Step S1, obtaining a public EEG signal sleep data set DATA1, EEG signal data DATA2, and a polysomnogram corresponding to the EEG signal data DATA2; Step S2, annotating the data DATA2 according to the polysomnography to form annotated EEG signal data DATA3; Step S3, preprocessing the data DATA3 to form data DATA4; Step S4, inputting the data DATA4 into the neural network model M to form a sleep staging result DATA5 for the data DATA4 and a trained neural network model M-New; Step S5, determining the parameters of the hidden Markov model, and constructing the hidden Markov model through the data DATA3 and the data DATA5; Step S6, acquiring newly collected multi-channel EEG signal data DATA6, preprocessing the data DATA6 to form data DATA7, and predicting the data DATA7 through the model M-New to form data DATA8; Step S7, performing weighted processing on the data DATA8 to form data DATA9, and passing the data DATA9 through the hidden Markov model to form a prediction result of the sleep stage.

[0006] Among them, the data Each data in is used as a hidden state; the data Each data in is taken as an observation state; Each data in the data DATA3 corresponds to each data in the data DATA5 (for example, data31 corresponds to data51, data32 corresponds to data52, ..., data3 n Corresponding to data5 n ).

[0007] Wherein, n is a positive integer.

[0008] Preferably, in step S3, the data DATA3 is preprocessed to form data DATA4, which specifically includes the following steps: Step S301, subtract the mean value of the data DATA3 from each piece of data in the data DATA3 to form data DATA3-1; Step S302, inputting the data DATA3-1 into the filter for filtering to form data DATA3-2; Step S303, divide the data DATA3-2 into 30-second segments to form data DATA4.

[0009] Preferably, in step S302, the filter uses a second-order Butterworth filter to perform filtering processing.

[0010] Preferably, in step S4, the neural network model M includes a convolutional neural network module, a first residual network module, a causal convolution module, a multi-head attention module, a second residual network module, a fully connected layer module and a Softmax module connected in sequence to form a link; The convolutional neural network module includes a large-scale convolutional neural network module and a small-scale convolutional neural network module arranged in parallel. Among them, in the present application, the large-scale convolutional neural network module includes a large-scale convolutional neural network; the small-scale convolutional neural network module includes a small-scale convolutional neural network; the first residual network module includes a residual network; the causal convolution module includes a causal convolutional network; the multi-head attention module includes a multi-head attention mechanism network; the second residual network module includes a residual network; the fully connected layer module includes a fully connected layer; and the Softmax module includes a Softmax network.

[0011] Preferably, in step S5, the parameters of the hidden Markov model are determined, and the hidden Markov model is constructed through the data DATA3 and the data DATA5, which specifically includes the following steps: Step S501, according to the actual sleep stage conversion rule, the data DATA5 is corrected and processed, and the direct conversion between the sleep stages that does not conform to the physiological logic is eliminated to form the data DATA5-New; Step S502, obtaining the transition probabilities of the sleep stages at all times in the data set DATA1 and the data DATA2, and forming a transition state probability matrix; Step S503, forming an average confusion matrix and a transmission probability matrix according to the data DATA3 and the data DATA5-New; Step S504: forming a hidden Markov model according to the transition state probability matrix, the average confusion matrix and the emission probability matrix.

[0012] In this application, the transition probability represents the probability of the sleep state transitioning from one stage to another; the transition probability matrix is ​​a square matrix, each element of which represents the probability of transitioning from one state to another, and the transition probability matrix describes the transition probability between each sleep stage.

[0013] Among them, in the present application, the confusion matrix is ​​a square matrix, each row of the confusion matrix represents the actual sleep stage, and each column represents the sleep stage result predicted by the neural network model; each element in the matrix represents the number of actual sleep stages predicted as a certain sleep stage.

[0014] Among them, in the present application, the emission probability matrix describes the relationship between the hidden state and the observed state, and gives the number of a certain sleep stage (the sleep stage predicted by the neural network model) observed (predicted) under a certain hidden state (the real sleep stage); the emission probability matrix is ​​represented by calculating the probability through the confusion matrix.

[0015] Preferably, in step S6, the data DATA6 is preprocessed, specifically comprising the following steps: Step S601, subtract the mean value of the data DATA6 from each piece of data in the data DATA6 to form data DATA6-1; Step S602, inputting the data DATA6-1 into the filter for filtering to form data DATA6-2; Step S603, divide the data DATA6-2 into 30-second segments to form data DATA7.

[0016] Preferably, in step S602, the filter uses a second-order Butterworth filter to perform filtering processing.

[0017] Preferably, in step S7, the weighted processing specifically includes the following steps: Step S701, calculating the standard deviation Std of each channel data in the data DATA8; Step S702 , add the inverse of the standard deviation to the data of each channel whose standard deviation of the channel data in the data DATA8 is lower than the threshold T, to form data DATA9 .

[0018] Preferably, in step S7, the hidden state sequence with the maximum probability is calculated by using the Viterbi algorithm to form a prediction result of the sleep stage.

[0019] In a second aspect, the present invention also provides a sleep staging device based on a hidden Markov model, which specifically includes the following modules: A data acquisition module, used to acquire a public EEG signal sleep data set DATA1, EEG signal data DATA2, and a polysomnogram corresponding to the EEG signal data DATA2; A data annotation module, used for annotating the data DATA2 according to the polysomnography to form annotated electroencephalogram signal data DATA3; A first data preprocessing module, used for preprocessing the data DATA3 to form data DATA4; A model sleep staging processing and model training module, used for inputting the data DATA4 into a neural network model M to form a sleep staging result DATA5 for the data DATA4 and a trained neural network model M-New; A hidden Markov model construction module, used for determining parameters of the hidden Markov model, and constructing the hidden Markov model through the data DATA3 and the data DATA5; The second data preprocessing module is used to obtain newly collected multi-channel EEG signal data DATA6, preprocess the data DATA6 to form data DATA7, and predict the data DATA7 through the model M-New to form data DATA8; The sleep stage prediction module is used to perform weighted processing on the data DATA8 to form data DATA9, and pass the data DATA9 through the hidden Markov model to form a prediction result of the sleep stage.

[0020] Among them, the data Each data in is used as a hidden state; the data Each data in is taken as an observation state; Each data in the data DATA3 corresponds to each data in the data DATA5 one by one (for example, data31 corresponds to data51).

[0021] Wherein, n is a positive integer.

[0022] Preferably, the first data preprocessing module specifically includes the following submodules: A first data preprocessing submodule, configured to subtract a mean value of the data DATA3 from each piece of data in the data DATA3 to form data DATA3-1; The second data preprocessing submodule is used to input the data DATA3-1 into the filter for filtering to form data DATA3-2; The third submodule of data preprocessing is used to process the data DATA3-2 into 30-second segments to form data DATA4.

[0023] Preferably, in the second submodule of data preprocessing, the filter uses a second-order Butterworth filter for filtering.

[0024] Preferably, in the model sleep staging processing and model training module, the neural network model M includes a convolutional neural network module, a first residual network module, a causal convolution module, a multi-head attention module, a second residual network module, a fully connected layer module and a Softmax module connected in sequence to form a link; Among them, the convolutional neural network module includes a large-scale convolutional neural network module and a small-scale convolutional neural network module arranged in parallel.

[0025] Preferably, the hidden Markov model construction module specifically includes the following submodules: The first submodule of the hidden Markov model is used to modify the data DATA5 according to the actual sleep stage conversion law, eliminate the direct conversion between the sleep stages that does not conform to the physiological logic, and form the data DATA5-New; The second submodule of the hidden Markov model is used to obtain the transition probability of the sleep stage at all times in the data set DATA1 and the data DATA2 to form a transition state probability matrix; The hidden Markov model constructs a third submodule, which is used to form an average confusion matrix and a transmission probability matrix according to the data DATA3 and the data DATA5-New; The fourth submodule of the hidden Markov model construction is used to form a hidden Markov model according to the transition state probability matrix, the average confusion matrix and the emission probability matrix.

[0026] Preferably, the second data preprocessing module specifically includes the following submodules: A fourth data preprocessing submodule is used to subtract the mean value of the data DATA6 from each piece of data in the data DATA6 to form data DATA6-1; The fifth data preprocessing submodule is used to input the data DATA6-1 into the filter for filtering to form data DATA6-2; The sixth data preprocessing submodule is used to process the data DATA6-2 into 30-second segments to form data DATA7.

[0027] Preferably, the fifth submodule of data preprocessing is used for the filter to perform filtering processing using a second-order Butterworth filter.

[0028] Preferably, the sleep stage prediction module specifically includes the following submodules: The first submodule of sleep stage prediction is used to calculate the standard deviation Std of each channel data in data DATA8; The second submodule for predicting the sleep stage is used to add the inverse of the standard deviation to the data of each channel whose standard deviation of the channel data in the data DATA8 is lower than the threshold T, so as to form the data DATA9.

[0029] Preferably, in the sleep stage prediction module, the hidden state sequence with the maximum probability is calculated by using the Viterbi algorithm to form a prediction result of the sleep stage.

[0030] In a third aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a multi-channel brain-computer sleep staging method based on a hidden Markov model as described in any one of the first aspects of the present application.

[0031] In a fourth aspect, the present invention further provides an electronic device, comprising: a memory storing a computer program; and a processor communicatively connected to the memory, for executing a multi-channel brain-computer sleep staging method based on a hidden Markov model as described in any one of the first aspects of the present application when the computer program is called.

[0032] Compared with the prior art, the present invention has the following obvious outstanding substantive features and significant advantages: The present invention provides a sleep staging method based on a hidden Markov model, which solves the problems of poor accuracy of sleep staging in the prior art and failure to consider the transition relationship between different sleep stages. The sleep staging method based on a hidden Markov model of the present invention includes: acquiring an electroencephalogram signal sleep data set DATA1, electroencephalogram signal data DATA2, and a corresponding polysomnogram; labeling the data DATA2 to form data DATA3; preprocessing the data DATA3 to form data DATA4; inputting the data DATA4 into a neural network model M to form a sleep staging result DATA5 for the data DATA4 and a trained neural network model M-New; constructing a hidden Markov model through data DATA3 and data DATA5; preprocessing the newly acquired multi-channel electroencephalogram signal data DATA6 to form data DATA7, and predicting the data DATA7 through the model M-New to form data DATA8; weighting the data DATA8 to form data DATA9, and passing the data DATA9 through the hidden Markov model to form a prediction result of the sleep stage. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The accompanying drawings, which constitute part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention. In the accompanying drawings: Figure 1 The present invention is a flowchart of a sleep staging method based on a hidden Markov model according to a preferred embodiment of the present invention.

[0034] Figure 2 The figure is a flowchart of a sleep staging method based on a hidden Markov model according to a preferred embodiment of the present invention.

[0035] Figure 3 It is a structural schematic diagram of a neural network model M in a sleep staging method based on a hidden Markov model in a preferred embodiment of the present invention.

[0036] Figure 4 It is a schematic diagram of a hidden Markov model in a sleep staging method based on a hidden Markov model in a preferred embodiment of the present invention.

[0037] Figure 5 It is a structural schematic diagram of a sleep staging device based on a hidden Markov model according to a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0038] The present invention provides a sleep staging method based on a hidden Markov model. In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0039] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0040] Embodiment 1: like Figure 1-Figure 4 As shown, the sleep staging method based on the hidden Markov model described in this embodiment specifically includes the following steps: Step S1, obtaining a public EEG signal sleep data set DATA1, EEG signal data DATA2, and a polysomnogram corresponding to the EEG signal data DATA2.

[0041] Specifically, an EEG sleep dataset containing five sleep stages, namely wakefulness (W), rapid eye movement (REM), N1, N2, and N3, is obtained from public datasets (such as Sleep-EDF and SHHS), and is recorded as DATA1. Multi-channel EEG signal data is collected, recorded as DATA2, and EEG signals during sleep are recorded, while polysomnography is collected.

[0042] Step S2: annotate the data DATA2 according to the polysomnography to form annotated EEG signal data DATA3.

[0043] For example, in combination with polysomnography, experts annotate the EEG signal dataset in DATA2 by stages, including five stages: W, REM, N1, N2, and N3, to form the annotated EEG signal dataset DATA3.

[0044] Step S3, pre-processing the data DATA3 to form data DATA4.

[0045] Optionally, step S3 specifically includes the following steps: Step S301 : subtract the mean value of the data DATA3 from each piece of data in the data DATA3 to eliminate the baseline drift, thereby forming data DATA3 - 1 .

[0046] Step S302, input the data DATA3-1 into the filter for filtering, remove noise and unnecessary frequency components, and form data DATA3-2; ​​wherein, in this embodiment, the filter adopts a second-order Butterworth filter for filtering.

[0047] Step S303, the data DATA3-2 is processed in 30-second segments to meet the needs of model training and prediction, and data DATA4 is formed.

[0048] Step S4, inputting the data DATA4 into the neural network model M to form a sleep staging result DATA5 for the data DATA4 and a trained neural network model M-New.

[0049] Among them, Figure 3 As shown, the neural network model M includes a convolutional neural network module, a first residual network module, a causal convolution module, a multi-head attention module, a second residual network module, a fully connected layer module and a Softmax module, which are connected in sequence to form a link.

[0050] Among them, the convolutional neural network module includes a large-scale convolutional neural network module (large-scale CNN) and a small-scale convolutional neural network module (small-scale CNN) arranged in parallel.

[0051] After the data data is input, the data data is respectively input into the large-scale convolutional neural network module and the small-scale convolutional neural network module for processing. The data processed by the large-scale convolutional neural network in the large-scale convolutional neural network module and the small-scale convolutional neural network in the small-scale neural network module are sequentially input into the first residual network module, the causal convolution module, the multi-head attention module, the second residual network module, the fully connected layer module and the Softmax module for processing, and then the prediction result of the neural network model M is output.

[0052] Step S5, determining the parameters of the hidden Markov model, and constructing the hidden Markov model through the data DATA3 and the data DATA5.

[0053] Optionally, step S5 specifically includes the following steps: Step S501: According to the actual sleep stage conversion rule, the data DATA5 is corrected and processed to eliminate the direct conversion between sleep stages that does not conform to the physiological logic, so as to form data DATA5-New.

[0054] In a normal sleep cycle, the human body goes through a series of orderly sleep stages, and there are certain transition patterns between these stages. These stages include falling asleep, light sleep, deep sleep, deep sleep, and rapid eye movement (REM). Each stage has its own unique electroencephalogram (EEG) characteristics and physiological manifestations, and the transition between stages is usually gradual and follows certain physiological laws.

[0055] The so-called "direct transitions between sleep stages that do not conform to physiological logic" means that in the normal sleep process, direct transitions between certain sleep stages are biologically impossible, or due to the limitations of physiological mechanisms, the probability of their occurrence is so low that it can be ignored. For example, it is very rare to directly transition from deep sleep (stage N3) to rapid eye movement sleep (REM) without going through lighter sleep stages (stages N1 or N2). Similarly, it is impossible to jump directly from the wakeful state (W) to deep sleep (stage N3) without going through stages N1 and N2.

[0056] Therefore, making necessary corrections to DATA5 and removing those direct conversions that do not conform to the actual sleep cycle patterns can ensure that the corrected data is more consistent with the actual sleep cycle pattern and enhance the credibility and reliability of the data.

[0057] Step S502: Count the transition probabilities of the sleep stages at all times from the data set DATA1 and the data DATA2 to form a transition state probability matrix. For example, the transition state probability matrix can be expressed as follows: W REM N1 N2 N3 W A11 A12 A13 A14 A15 REM A21 A22 A23 A24 A25 N1 A31 A32 A33 A34 A35 N2 A41 A42 A43 A44 A45 N3 A51 A52 A53 A54 A55 Among them, the row represents the current sleep stage, and the column represents the sleep state at the next moment; A11, A12, ..., A15, A21, ..., A55 represent the probability of transferring from the current sleep state to the sleep state at the next moment; for example, A21 means that the current sleep state stage is stage W (awake stage), and the probability of the sleep state stage at the next moment being REM (rapid eye movement stage) is A21.

[0058] Step S503: Form an average confusion matrix and a transmission probability matrix according to the data DATA3 and the data DATA5-New.

[0059] Step S504: forming a hidden Markov model according to the transition state probability matrix, the average confusion matrix and the emission probability matrix.

[0060] Step S6, obtaining newly collected multi-channel EEG signal data DATA6, preprocessing the data DATA6 to form data DATA7, and predicting the data DATA7 through the model M-New to form data DATA8.

[0061] Optionally, the data DATA6 is preprocessed in the same manner as step S3, specifically comprising the following steps: Step S601: Subtract the mean value of the data DATA6 from each piece of data in the data DATA6 to form data DATA6-1.

[0062] Step S602, input the data DATA6-1 into the filter for filtering processing to form data DATA6-2; wherein the filter adopts a second-order Butterworth filter for filtering processing.

[0063] Step S603, divide the data DATA6-2 into 30-second segments to form data DATA7.

[0064] Step S7, performing weighted processing on the data DATA8 to form data DATA9, and passing the data DATA9 through the hidden Markov model to form a prediction result of the sleep stage.

[0065] Optionally, the hidden state sequence with the maximum probability is calculated by the Viterbi algorithm to form a prediction result of the sleep stage.

[0066] Optionally, the weighted processing in step S7 specifically includes the following steps: Step S701, calculating the standard deviation Std of each channel data in the data DATA8.

[0067] Step S702 , add the inverse of the standard deviation to the data of each channel whose standard deviation of the channel data in the data DATA8 is lower than the threshold T, to form data DATA9 .

[0068] Among them, the data Each data in is used as a hidden state; the data Each data in the data DATA3 is used as an observation state; wherein each data in the data DATA5 corresponds one to one (for example: data31 corresponds to data51, data32 corresponds to data52, ..., data3 n Corresponding to data5 n ); where n is a positive integer.

[0069] like Figure 4As shown, Ptr represents the transition state probability matrix, and Pem represents the emission probability matrix. At the first moment, the sleep stage labeling result (hidden state) is S(1), and after S(1) is predicted and weighted by the neural network model M-New, the predicted result (observed state) is y(1); similarly, for any i-th (i is a positive integer) moment in the time series, the sleep stage labeling result is S(i), and after S(i) is predicted and weighted by the model, the predicted result is y(i). It should be noted that in a continuous time series, if the sleep stage S(i) at the i-th moment is different from the sleep stage S(i+1) at the i+1th moment, the transition from sleep stage S(i) to sleep stage S(i+1) does not follow a completely random pattern. In fact, the transition of sleep stages is strictly regulated by the physiological mechanism of the human body, and direct transitions between certain stages are physiologically very rare. For example, the direct transition from deep sleep stage (N3) to rapid eye movement sleep stage (REM) almost never occurs in a normal sleep cycle, because these two sleep stages follow a specific order and transition rules in the sleep cycle. Therefore, when using the neural network model to predict sleep stages, in addition to considering the prediction results at a single time point, it is also necessary to combine the transition probability and physiological laws of the sleep stage, and further optimize and correct the prediction results through statistical learning methods such as hidden Markov models to improve the overall accuracy and reliability of the prediction.

[0070] Embodiment 2: like Figure 5 As shown, based on the same design concept, this embodiment also provides a sleep staging device based on a hidden Markov model, which specifically includes the following modules: The data acquisition module is used to acquire the public EEG signal sleep data set DATA1, the EEG signal data DATA2 and the polysomnogram corresponding to the EEG signal data DATA2.

[0071] The data labeling module is used to label the data DATA2 according to the polysomnography to form labeled electroencephalogram signal data DATA3.

[0072] The first data preprocessing module is used to preprocess the data DATA3 to eliminate baseline drift, remove noise and perform segmentation processing to form data DATA4 suitable for model training and prediction.

[0073] The first data preprocessing module specifically includes the following submodules: The first data preprocessing submodule is used to subtract the mean value of the data DATA3 from each piece of data in the data DATA3 to form data DATA3-1.

[0074] The second submodule of data preprocessing is used to input the data DATA3-1 into the filter for filtering to form data DATA3-2; ​​wherein the filter adopts a second-order Butterworth filter for filtering.

[0075] The third submodule of data preprocessing is used to process the data DATA3-2 into 30-second segments to form data DATA4.

[0076] The model sleep staging processing and model training module is used to input the data DATA4 into the neural network model M to form a sleep staging result DATA5 for the data DATA4 and a trained neural network model M-New.

[0077] Among them, the neural network model M includes a convolutional neural network module, a first residual network module, a causal convolution module, a multi-head attention module, a second residual network module, a fully connected layer module and a Softmax module connected in sequence to form a link.

[0078] Among them, the convolutional neural network module includes a large-scale convolutional neural network module and a small-scale convolutional neural network module arranged in parallel.

[0079] The hidden Markov model construction module is used to determine the parameters of the hidden Markov model and construct the hidden Markov model through the data DATA3 and the data DATA5.

[0080] Among them, the hidden Markov model construction module specifically includes the following sub-modules: The hidden Markov model constructs the first submodule, which is used to correct the data DATA5 according to the actual sleep stage conversion rules, eliminate the direct conversion between sleep stages that does not conform to physiological logic, and form data DATA5-New.

[0081] The second submodule of the hidden Markov model construction is used to count the transition probabilities of the sleep stages at all times from the data set DATA1 and the data DATA2 to form a transition state probability matrix.

[0082] The hidden Markov model constructs a third submodule, which is used to form an average confusion matrix and a transmission probability matrix according to the data DATA3 and the data DATA5-New.

[0083] The fourth submodule of the hidden Markov model construction is used to form a hidden Markov model according to the transition state probability matrix, the average confusion matrix and the emission probability matrix.

[0084] The second data preprocessing module is used to obtain newly collected multi-channel EEG signal data DATA6, preprocess the data DATA6 to form data DATA7, and predict the data DATA7 through the model M-New to form data DATA8.

[0085] The second data preprocessing module specifically includes the following submodules: The fourth submodule of data preprocessing is used to subtract the mean value of the data DATA6 from each piece of data in the data DATA6 to form data DATA6-1.

[0086] The fifth submodule of data preprocessing is used to input the data DATA6-1 into a filter for filtering to form data DATA6-2; wherein the filter adopts a second-order Butterworth filter for filtering.

[0087] The sixth data preprocessing submodule is used to process the data DATA6-2 into 30-second segments to form data DATA7.

[0088] The sleep stage prediction module is used to perform weighted processing on the data DATA8 to form data DATA9, and pass the data DATA9 through the hidden Markov model to form a prediction result of the sleep stage.

[0089] Among them, the data Each data in is used as a hidden state; the data Each data in is taken as an observation state; Each data in the data DATA3 corresponds to each data in the data DATA5 (for example, data31 corresponds to data51); and n is a positive integer.

[0090] Among them, the sleep stage prediction module specifically includes the following sub-modules: The first submodule of sleep stage prediction is used to calculate the standard deviation Std of each channel data in the data DATA8.

[0091] The second submodule for predicting the sleep stage is used to add the inverse of the standard deviation to the data of each channel whose standard deviation of the channel data in the data DATA8 is lower than the threshold T, so as to form the data DATA9.

[0092] Among them, the hidden state sequence with the maximum probability is calculated through the Viterbi algorithm to form the prediction result of the sleep stage.

[0093] The specific embodiments of the present invention are described in detail above, but they are only examples, and the present invention is not limited to the specific embodiments described above. For those skilled in the art, any equivalent modifications and substitutions made to the present invention are also within the scope of the present invention. Therefore, the equalization changes and modifications made without departing from the spirit and scope of the present invention should be included in the scope of the present invention.

Claims

1. A sleep staging method based on hidden Markov model, It is characterized in that The specific steps include: Step S1, obtaining a public EEG signal sleep data set DATA1, EEG signal data DATA2, and a polysomnogram corresponding to the EEG signal data DATA2; Step S2, annotating the data DATA2 according to the polysomnography to form annotated EEG signal data DATA3; Step S3, preprocessing the data DATA3 to form data DATA4; Step S4, inputting the data DATA4 into the neural network model M to form a sleep staging result DATA5 for the data DATA4 and a trained neural network model M-New; Step S5, determining the parameters of the hidden Markov model, and constructing the hidden Markov model through the data DATA3 and the data DATA5; Step S6, acquiring newly collected multi-channel EEG signal data DATA6, preprocessing the data DATA6 to form data DATA7, and predicting the data DATA7 through the model M-New to form data DATA8; Step S7, performing weighted processing on the data DATA8 to form data DATA9, and passing the data DATA9 through the hidden Markov model to form a prediction result of the sleep stage; Among them, the data Each data in is used as a hidden state; the data Each data in the data DATA3 is used as an observation state; each data in the data DATA3 corresponds to each data in the data DATA5 one by one; Wherein, n is a positive integer.

2. A sleep staging method based on a hidden Markov model according to claim 1, It is characterized in that In step S3, the data DATA3 is preprocessed to form data DATA4, which specifically includes the following steps: Step S301, subtract the mean value of the data DATA3 from each piece of data in the data DATA3 to form data DATA3-1; Step S302, inputting the data DATA3-1 into the filter for filtering to form data DATA3-2; Step S303, processing the data DATA3-2 into 30-second segments to form data DATA4; Wherein, in step S302, the filter uses a second-order Butterworth filter for filtering.

3. The sleep staging method based on hidden Markov model according to claim 1, It is characterized in that In step S4, the neural network model M includes a convolutional neural network module, a first residual network module, a causal convolution module, a multi-head attention module, a second residual network module, a fully connected layer module and a Softmax module connected in sequence to form a link; Among them, the convolutional neural network module includes a large-scale convolutional neural network module and a small-scale convolutional neural network module arranged in parallel.

4. The sleep staging method based on hidden Markov model according to claim 1, It is characterized in that In step S5, the parameters of the hidden Markov model are determined, and the hidden Markov model is constructed through the data DATA3 and the data DATA5, which specifically includes the following steps: Step S501, according to the actual sleep stage conversion rule, the data DATA5 is corrected and processed, and the direct conversion between the sleep stages that does not conform to the physiological logic is eliminated to form the data DATA5-New; Step S502, obtaining the transition probabilities of the sleep stages at all times in the data set DATA1 and the data DATA2, and forming a transition state probability matrix; Step S503, forming an average confusion matrix and a transmission probability matrix according to the data DATA3 and the data DATA5-New; Step S504: forming a hidden Markov model according to the transition state probability matrix, the average confusion matrix and the emission probability matrix.

5. The sleep staging method based on hidden Markov model according to claim 1, It is characterized in that In step S6, the data DATA6 is preprocessed, specifically including the following steps: Step S601, subtract the mean value of the data DATA6 from each piece of data in the data DATA6 to form data DATA6-1; Step S602, inputting the data DATA6-1 into the filter for filtering to form data DATA6-2; Step S603, processing the data DATA6-2 into 30-second segments to form data DATA7; Wherein, in step S602, the filter uses a second-order Butterworth filter to perform filtering processing.

6. The sleep staging method based on hidden Markov model according to claim 1, It is characterized in that In step S7, the weighted processing specifically includes the following steps: Step S701, calculating the standard deviation Std of each channel data in the data DATA8; Step S702 , add the inverse of the standard deviation to the data of each channel whose standard deviation of the channel data in the data DATA8 is lower than the threshold T, to form data DATA9 .

7. The sleep staging method based on hidden Markov model according to claim 1, It is characterized in that In step S7, the hidden state sequence with the maximum probability is calculated by the Viterbi algorithm to form a prediction result of the sleep stage.

8. A sleep staging device based on hidden Markov model, It is characterized in that The modules include: A data acquisition module, used to acquire a public EEG signal sleep data set DATA1, EEG signal data DATA2, and a polysomnogram corresponding to the EEG signal data DATA2; A data annotation module, used for annotating the data DATA2 according to the polysomnography to form annotated electroencephalogram signal data DATA3; A first data preprocessing module, used for preprocessing the data DATA3 to form data DATA4; A model sleep staging processing and model training module, used for inputting the data DATA4 into a neural network model M to form a sleep staging result DATA5 for the data DATA4 and a trained neural network model M-New; A hidden Markov model construction module, used for determining parameters of the hidden Markov model, and constructing the hidden Markov model through the data DATA3 and the data DATA5; The second data preprocessing module is used to obtain newly collected multi-channel EEG signal data DATA6, preprocess the data DATA6 to form data DATA7, and predict the data DATA7 through the model M-New to form data DATA8; A sleep stage prediction module, used for performing weighted processing on the data DATA8 to form data DATA9, and passing the data DATA9 through the hidden Markov model to form a prediction result of the sleep stage; Among them, the data Each data in is used as a hidden state; the data Each data in the data DATA3 is used as an observation state; each data in the data DATA3 corresponds to each data in the data DATA5 one by one; Wherein, n is a positive integer.

9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the sleep staging method based on a hidden Markov model as described in any one of claims 1 to 7 is implemented.

10. An electronic device, It is characterized in that The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a sleep staging method based on a hidden Markov model as described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Multi-mode sleep staging method based on time sequence relevance driving

    CN112450881A

  • Time-space attention knowledge tracking method based on learning process fragments

    CN114021721A

  • Time series data anomaly detection method based on self-supervised learning multi-head attention network

    CN115309736A

  • Wave height prediction model and device

    CN115659828A

  • Method for constructing narcolepsy prediction model based on sleep stage characteristics

    CN117334340A