A sleep staging method and device based on sleep stage ratio
By introducing the sleep stage ratio and prior knowledge of sleep medicine in the sleep stage method, the problem of inaccurate sleep stage in the prior art is solved, and accurate identification of different sleep stages and guaranteeing the continuity and periodicity of sleep stages is achieved.
Patent Information
- Application Number
- CN202411060682.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-08-02
AI Technical Summary
The existing sleep staging methods cannot achieve accurate identification of different sleep stages, ignoring the continuity and dynamicity of sleep, as well as sleep periodicity.
The sleep staging method based on the sleep stage ratio is adopted, and data preprocessing is obtained by obtaining the original sleep brain wave signal, local and global features are extracted, and the EEG signal segmentation model is input for processing, and the corrected combination of sleep continuity and periodic prior knowledge is obtained to obtain accurate sleep staging results.
Accurate identification of different sleep stages is achieved, the continuity and dynamicity of sleep stages is ensured, and the periodicity of sleep stages is ensured by introducing prior knowledge of sleep medicine.
Smart Images

Figure CN118873101B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure belongs to the technical field of sleep staging, and in particular, relates to a sleep staging method and device based on sleep stage ratio. Background Art
[0002] Sleep staging is a key technology in the field of sleep medicine, which involves dividing the sleep process into different stages to facilitate the study and diagnosis of sleep disorders. Sleep is divided into wake (W, wake) stage, non-rapid eye movement (NREM) stage and rapid eye movement (REM) stage. The NREM stage is further subdivided into three stages: N1, N2 and N3. Among them, stage N1 is non-rapid eye movement sleep stage 1; stage N2 is non-rapid eye movement sleep stage 2; stage N3 is non-rapid eye movement sleep stage 3, and stage N3 is also called deep sleep stage or slow wave sleep stage. The REM stage is related to dream activity and usually occurs multiple times a night.
[0003] The accuracy of sleep staging is crucial for the diagnosis and treatment of sleep-related disorders. For example, sleep apnea syndrome, periodic leg movement syndrome, and insomnia may all be identified through sleep staging. In addition, sleep staging is also the basis for studying sleep structure, the relationship between sleep and cognitive function, and the development of new sleep intervention measures.
[0004] With the advancement of technology, sleep staging has become more refined and automated. Modern automatic sleep staging algorithms, usually based on machine learning technology, automatically identify and classify sleep stages by analyzing signals such as brain waves, eye movements, and electromyography (EMG). These algorithms can improve the efficiency and accuracy of sleep staging, especially in large-scale epidemiological studies and clinical practice.
[0005] Existing sleep staging methods often achieve sleep staging through segmental classification, but this sleep staging method ignores the continuity and dynamics of sleep. In addition, existing sleep staging methods often ignore the cyclical nature of sleep. Therefore, it is impossible to accurately identify different sleep stages.
[0006] Therefore, how to achieve accurate identification of different sleep stages is a technical problem to be solved. Summary of the invention
[0007] Based on this, it is necessary to provide a sleep staging method, apparatus, storage medium and device based on sleep stage ratio to address the defect that existing sleep staging methods cannot accurately identify different sleep stages.
[0008] In a first aspect, an embodiment of the present invention provides a sleep staging method based on a sleep stage ratio, the method comprising:
[0009] Obtain the original sleep EEG signal containing N channels and the corresponding sleep stage markers;
[0010] Performing data preprocessing on the original sleep brain wave signal to obtain a corrected sleep brain wave signal and a continuous sleep stage mark;
[0011] Performing local feature extraction based on the corrected sleep EEG signal to obtain corresponding local features; and performing global feature extraction based on the corrected sleep EEG signal to obtain corresponding global features;
[0012] Inputting the corrected sleep EEG signal, the local features and the global features into an EEG signal segmentation model for processing, and outputting a rough sleep stage segmentation result;
[0013] Based on the prior knowledge of sleep continuity, the coarse sleep staging segmentation result is corrected to obtain a locally corrected sleep staging result;
[0014] The locally corrected sleep staging result is corrected based on prior knowledge of sleep periodicity to obtain a globally corrected sleep staging result.
[0015] Optionally, the correcting the coarse sleep staging result based on the prior knowledge of sleep continuity to obtain a locally corrected sleep staging result includes:
[0016] Acquire the sleep stage in a known state and the sleep stage in an observed state; and acquire a local correction matrix of the sleep stage;
[0017] Based on the relationship between the known state and the observed state, selecting a plurality of correlation values of relevant positions in the local correction matrix of the sleep stage;
[0018] Based on the multiple correlation values, compare multiple values of the observed state corresponding to each known state, and use the observed state corresponding to the maximum value as the next sleep stage result;
[0019] Based on the next sleep stage result, the locally corrected sleep staging result is obtained.
[0020] Optionally, the correcting the locally corrected sleep staging result based on the prior knowledge of sleep periodicity to obtain a globally corrected sleep staging result includes:
[0021] Obtain the standard ratio of each sleep stage in the sleep cycle;
[0022] Get all the locally corrected sleep staging results, and perform the following operations on any locally corrected sleep staging result in a preset manner:
[0023] When it is determined that the current window is not in the awake state, the proportion of each stage in the sleep cycle in the current window is calculated;
[0024] Calculate the stage ratio of each sleep stage in the sleep cycle based on the stage proportion of each sleep stage in the sleep cycle in the current window and the standard ratio of each sleep stage in the sleep cycle;
[0025] The sleep stage with the largest stage ratio among the sleep stages in the sleep cycle is used as the recognition result of the current window to perform correction processing on the sleep stages in the sleep cycle;
[0026] The preset step length is used as the moving step length, and the same operation is performed in the preset manner until all the locally corrected sleep staging results are traversed to obtain the globally corrected sleep staging result.
[0027] Optionally, the step of inputting the corrected sleep EEG signal, the local features and the global features into an EEG signal segmentation model for processing, and outputting a rough sleep stage segmentation result, comprises:
[0028] Constructing the EEG signal segmentation model, and repeatedly iteratively training the EEG signal segmentation model until the EEG signal segmentation model converges;
[0029] Based on the corrected sleep EEG signal, local features and global features having the same length as the corrected sleep EEG signal, construct an input EEG signal; input the input EEG signal and the continuous sleep stage marker into the EEG signal segmentation model for processing, and divide the multiple sleep stages to which each signal point in the input EEG signal belongs;
[0030] Based on the multiple sleep stages to which each signal point in the input EEG signal belongs, the coarse sleep staging segmentation result representing N channels is generated.
[0031] Optionally, the constructing the EEG signal segmentation model and repeatedly iteratively training the EEG signal segmentation model until the EEG signal segmentation model converges includes:
[0032] Acquire the corrected sleep EEG signal, the local features and the global features, wherein the local features include: the ratio of the voltage amplitude before and after, the window voltage mean, the window voltage value standard deviation, the window zero crossing rate and the window derivative; and the global features include: the voltage mean difference, the voltage median difference and the voltage high-low ratio;
[0033] The corrected sleep EEG signal, all local features and all global features are spliced together to obtain the input EEG signal;
[0034] Taking the input EEG signal as the input of the EEG signal segmentation model, constructing the EEG signal segmentation model, and outputting the coarse sleep stage segmentation results representing N channels, where N is a positive integer greater than or equal to 2;
[0035] Initializing the weight parameters of the EEG signal segmentation model;
[0036] Extracting features of the input EEG signal through a forward propagation algorithm, and predicting the sleep stage of the current stage based on the extracted features to obtain a prediction result;
[0037] Based on the loss function of the EEG signal segmentation model, calculating the difference between the continuous sleep stage mark and the prediction result, and quantifying the difference as a loss value;
[0038] Based on the chain-derivation rule back-propagation algorithm and Adam optimization algorithm, the weight parameters are subjected to gradient update processing;
[0039] The EEG signal segmentation model updated by the weight parameters is repeatedly iterated and trained until the EEG signal segmentation model converges.
[0040] Optionally, the extracting local features based on the corrected sleep EEG signal to obtain corresponding local features includes:
[0041] Acquire multiple local feature extraction methods for performing local feature extraction, wherein the multiple local feature extraction methods include: a first local feature extraction method, a second local feature extraction method, a third local feature extraction method, a fourth local feature extraction method, and a fifth local feature extraction method;
[0042] Based on any one of the multiple local feature extraction methods, local feature extraction is performed on the corrected sleep brain wave signal to obtain corresponding local features.
[0043] Optionally, the performing layout feature extraction on the corrected sleep EEG signal based on any one of the multiple local feature extraction methods to obtain corresponding local features includes:
[0044] If the local feature to be extracted is the before-after voltage amplitude ratio, the first local feature extraction method is adopted to perform the following operation on the first channel of the N channels to extract the local feature:
[0045] From the second point of the first channel of the N channels, traverse the corrected sleep brain wave signal with a length of M, calculate the ratio of the voltage amplitude of the previous position to the voltage amplitude of the next position of the current position, until traversing to the M-1 position, and obtain the voltage amplitude ratio before and after to be filled, where M is a positive integer greater than or equal to P, and P is a positive integer determined by multiplying the acquisition time by the sampling rate S;
[0046] Obtaining the voltage amplitude ratio before and after the filling and the first filling mode;
[0047] Based on the first filling mode, filling processing is performed on the front-to-back voltage amplitude ratio to be filled to obtain the front-to-back voltage amplitude ratio of the corresponding single channel;
[0048] For the other N-1 channels, the same operation is performed in sequence using the first local feature extraction method to obtain the front-to-back voltage amplitude ratio of the corresponding single channel;
[0049] The front-to-back voltage amplitude ratios of the individual channels corresponding to the N channels are concatenated to obtain the front-to-back voltage amplitude ratios with a dimension of N×M; or,
[0050] If the local feature to be extracted is the window voltage mean, the second local feature extraction method is adopted to perform the following operations on the first channel of the N channels to extract the local feature:
[0051] From the first channel of the N channels, traverse the corrected sleep brain wave signal with a length of M with a first preset window width and a first preset moving step length, calculate the average voltage value of the window until traversing to the position corresponding to M-TL+1, and obtain the average voltage value of the window to be filled, where TL is the window width;
[0052] Obtaining the mean value of the voltage of the window to be filled and a second filling mode;
[0053] Based on the second filling mode, filling processing is performed on the window voltage mean to be filled to obtain the window voltage mean of the corresponding single channel;
[0054] For the other N-1 channels, the same operation is performed in sequence using the second local feature extraction method to obtain the window voltage mean of the corresponding single channel;
[0055] The window voltage means of the single channels corresponding to the N channels are concatenated to obtain the window voltage means with a dimension of N×M; or,
[0056] If the local feature to be extracted is the standard deviation of the window voltage value, the third local feature extraction method is adopted to perform the following operation on the first channel of the N channels to extract the local feature:
[0057] From the first channel of the N channels, traverse the corrected sleep brain wave signal with a length of M with a second preset window width and a second preset moving step length, calculate the standard deviation of the window voltage value, until traversing to the position corresponding to M-TL+1, and obtain the standard deviation of the window voltage value to be filled, where TL is the window width;
[0058] Obtaining a standard deviation of the voltage value of the window to be filled and a third filling method;
[0059] Based on the third filling method, the standard deviation of the window voltage value to be filled is filled to obtain the standard deviation of the window voltage value of the corresponding single channel;
[0060] For the other N-1 channels, the same operation is performed in sequence using the third local feature extraction method to obtain the window voltage value standard deviation of the corresponding single channel;
[0061] The standard deviations of the window voltage values of the individual channels corresponding to the N channels are concatenated to obtain the standard deviations of the window voltage values with a dimension of N×M; or,
[0062] If the local feature to be extracted is the window zero-crossing rate, the fourth local feature extraction method is adopted to perform the following operation on the first channel of the N channels to extract the local feature:
[0063] From the first channel of the N channels, traverse the corrected sleep brain wave signal with a length of M with a third preset window width and a third preset moving step length, calculate the zero-crossing rate of the window until traversing to the position corresponding to M-TL+1, and obtain the zero-crossing rate of the window to be filled, wherein the zero-crossing rate of the window refers to the ratio of the voltage waveform in the window passing through zero, and TL is the window width;
[0064] Obtaining the zero-crossing rate of the window to be filled and a fourth filling method;
[0065] Based on the fourth filling mode, the zero-crossing rate of the window to be filled is filled to obtain the zero-crossing rate of the window of the corresponding single channel;
[0066] For the other N-1 channels, the same operation is performed in sequence using the fourth local feature extraction method to obtain the window zero-crossing rate of the corresponding single channel;
[0067] The window zero-crossing rates of a single channel corresponding to N channels are concatenated to obtain a window zero-crossing rate with a dimension of N×M; or,
[0068] If the local feature to be extracted is the window derivative, the fifth local feature extraction method is adopted to perform the following operation on the first channel of the N channels to extract the local feature:
[0069] Traversing the corrected sleep brain wave signal of length M from the first point of the first channel of the N channels, calculating the derivative of the voltage amplitude at this position and the voltage amplitude at the next position, until traversing to the position corresponding to M-1, and obtaining the derivative of the window to be filled;
[0070] Obtaining the window derivative to be filled and a fifth filling method;
[0071] Based on the fifth filling method, the window derivative to be filled is filled to obtain the window derivative of the corresponding single channel;
[0072] For the other N-1 channels, the same operation is performed in sequence using the fifth local feature extraction method to obtain the window derivative of the corresponding single channel;
[0073] The window derivatives of a single channel corresponding to N channels are concatenated to obtain a window derivative with a dimension of N×M.
[0074] Optionally, performing global feature extraction based on the corrected sleep EEG signal to obtain corresponding global features includes:
[0075] Acquire multiple global feature extraction methods for performing global feature extraction, wherein the multiple global feature extraction methods include: a first global feature extraction method, a second global feature extraction method, and a third global feature extraction method;
[0076] Based on any one of the multiple global feature extraction methods, global feature extraction is performed on the corrected sleep brain wave signal to obtain corresponding global features.
[0077] Optionally, performing global feature extraction based on the corrected sleep EEG signal to obtain corresponding global features includes:
[0078] If the global feature to be extracted is the voltage mean difference, the first global feature extraction method is adopted to perform the following operations on the first channel of the N channels to extract the global feature:
[0079] Traversing the corrected sleep brain wave signal of length M from the first point of the first channel of the N channels, calculating the difference between the voltage amplitude at the current position and the voltage average value of the channel, until traversing to the position corresponding to M, and obtaining the voltage mean difference of a single channel;
[0080] For the other N-1 channels, the same operation is performed in sequence using the first global feature extraction method to obtain the voltage mean difference of the corresponding single channel;
[0081] The voltage mean differences of the individual channels corresponding to the N channels are concatenated to obtain a voltage mean difference with a dimension of N×M; or,
[0082] If the global feature to be extracted is the voltage median difference, the second global feature extraction method is adopted to perform the following operations on the first channel of the N channels to extract the global feature:
[0083] Traversing the corrected sleep brain wave signal of length M from the first point of the first channel of the N channels, calculating the difference between the voltage amplitude at the position and the median voltage of the channel, until traversing to the position corresponding to M, and obtaining the median voltage difference of a single channel;
[0084] For the other N-1 channels, the same operation is performed in sequence using the second global feature extraction method to obtain the voltage median difference of the corresponding single channel;
[0085] The voltage median differences of the individual channels corresponding to the N channels are concatenated to obtain a voltage median difference with a dimension of M×M; or,
[0086] If the global feature to be extracted is the voltage high-low ratio, the third global feature extraction method is adopted to perform the following operations on the first channel of the N channels to extract the global feature:
[0087] Traversing the corrected sleep brain wave signal of length M from the first point of the first channel of the N channels, calculating the voltage amplitude at the position and the ratio of the distance between the maximum voltage of the channel and the minimum voltage of the channel, until traversing to the position corresponding to M, obtaining the voltage high-low ratio of a single channel;
[0088] For the other N-1 channels, the same operation is performed in sequence using the third global feature extraction method to obtain the voltage high-low ratio of the corresponding single channel;
[0089] The voltage high-low ratios of individual channels corresponding to the N channels are concatenated to obtain a voltage high-low ratio with a dimension of N×M.
[0090] In a second aspect, an embodiment of the present invention provides a sleep staging device based on a sleep stage ratio, the device comprising:
[0091] An acquisition module, used to acquire original sleep EEG signals containing N channels and corresponding sleep stage markers;
[0092] A preprocessing module, used for performing data preprocessing on the original sleep brain wave signal to obtain a corrected sleep brain wave signal and a continuous sleep stage mark;
[0093] A feature extraction module, configured to extract local features based on the corrected sleep EEG signal to obtain corresponding local features; and to extract global features based on the corrected sleep EEG signal to obtain corresponding global features;
[0094] A segmentation module, used for inputting the corrected sleep EEG signal, the local features and the global features into an EEG signal segmentation model for processing, and outputting a rough sleep stage segmentation result;
[0095] A local correction module, used for correcting the coarse sleep staging result based on prior knowledge of sleep continuity to obtain a locally corrected sleep staging result;
[0096] The global correction module is used to correct the locally corrected sleep staging result based on prior knowledge of sleep periodicity to obtain a globally corrected sleep staging result.
[0097] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is used to execute the above method steps.
[0098] In a fourth aspect, an embodiment of the present invention provides an electronic device, the electronic device comprising:
[0099] processor;
[0100] a memory for storing instructions executable by the processor;
[0101] The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the above method steps.
[0102] In an embodiment of the present invention, an original sleep EEG signal containing N channels and a corresponding sleep stage mark are obtained; data preprocessing is performed on the original sleep EEG signal to obtain a corrected sleep EEG signal and a continuous sleep stage mark; local feature extraction is performed based on the corrected sleep EEG signal to obtain a corresponding local feature; and global feature extraction is performed based on the corrected sleep EEG signal to obtain a corresponding global feature; the corrected sleep EEG signal, the local feature and the global feature are all input into an EEG signal segmentation model for processing, and a coarse sleep staging result is output; the coarse sleep staging result is corrected based on prior knowledge of sleep continuity to obtain a locally corrected sleep staging result; and the locally corrected sleep staging result is corrected based on prior knowledge of sleep periodicity to obtain a globally corrected sleep staging result. The sleep staging method provided in the embodiment of the present invention can achieve more fine-grained sleep staging identification and ensure the continuity and dynamics of sleep stages; in addition, due to the introduction of prior knowledge of sleep medicine, the prior knowledge of sleep medicine includes: prior knowledge of sleep continuity and prior knowledge of sleep periodicity, and based on the prior knowledge of sleep medicine, the sleep stages are corrected to ensure the periodicity of the sleep stages, thereby ultimately achieving accurate identification of different sleep stages. BRIEF DESCRIPTION OF THE DRAWINGS
[0103] By referring to the following drawings, a more complete understanding of the exemplary embodiments of the present invention can be obtained. The drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the drawings, the same reference numerals generally represent the same components or steps.
[0104] Figure 1 A flowchart of a sleep staging method based on sleep stage ratio according to an exemplary embodiment of the present invention;
[0105] Figure 2 It is a display diagram of known states and observed states in specific application scenarios;
[0106] Figure 3 It is a schematic diagram of local correction of sleep stages in a specific application scenario;
[0107] Figure 4 It is a schematic diagram of global correction of sleep stages in a specific application scenario;
[0108] Figure 5 Schematic diagram of the structure of a sleep staging device 500 based on sleep stage ratio according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0109] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0110] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in the present invention should have the common meanings understood by those skilled in the art to which the present invention belongs.
[0111] In addition, the terms "first" and "second" etc. are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, device, product or equipment that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or equipment.
[0112] Embodiments of the present invention provide a sleep staging method and apparatus based on a sleep stage ratio, an electronic device, and a computer-readable medium, which are described below in conjunction with the accompanying drawings.
[0113] Example 1
[0114] The sleep staging method based on sleep stage ratio provided by the embodiment of the present invention accurately identifies the sleep stages by introducing segmentation neural networks and prior knowledge of sleep medicine, ensuring the accuracy of sleep stages in a short period of time while maintaining the stability of long-term sleep stage identification. Specifically, the fine-grainedness of sleep stage identification is improved from the fragment level to the sampling point level through the segmentation neural network. Sleep staging at the sampling point level ensures the continuity and dynamics of the sleep stages.
[0115] Please refer to Figure 1 , which shows a flowchart of a sleep staging method based on sleep stage ratio provided by some embodiments of the present invention, such as Figure 1 As shown, the sleep staging method based on sleep stage ratio may include the following steps:
[0116] Step S101: obtaining original sleep EEG signals containing N channels and corresponding sleep stage marks.
[0117] In step S101, the original sleep brain wave signal can be n Based on the preset EEG signal acquisition tool, the original sleep EEG signal X with a sampling rate of S and a length of M is collected. n , and based on the preset data American Academy of Sleep Medicine scoring standard, the data is marked with a sleep stage of 30 seconds in length, and the original sleep brain wave signal X containing N channels is obtained n and the corresponding sleep stage markers, where the sleep stage markers can be used Indicates; X n is an N×M matrix, for While collecting EEG signals, the subject's age and gender parameters are recorded. M is a positive integer greater than or equal to P. P is a positive integer determined by multiplying the acquisition time by the sampling rate S. N is a positive integer greater than or equal to 2.
[0118] It should be noted that, in the sleep staging method provided in the embodiment of the present invention, the ranges of M and N are not specifically limited.
[0119] Step S102: performing data preprocessing on the original sleep brain wave signal to obtain a corrected sleep brain wave signal and a continuous sleep stage mark.
[0120] In step S102, the data preprocessing process is specifically described as follows:
[0121] First, the original sleep EEG signal X containing N channels is n Perform a 0.1Hz to 40Hz bandpass filter to remove noise interference; then, take the mean value of the EEG signal of each channel as the baseline to obtain N baseline values; then, by converting the original sleep EEG signal X n Subtract N baseline values from the original sleep EEG signal X n Perform baseline correction to obtain the corrected sleep EEG signal Z n ; Finally, mark the sleep stage Extension to and correction of sleep EEG signal Z n Same length, get continuous sleep stage mark Y n Among them, Z n and Y n Both are N×M matrices.
[0122] Step S103: extracting local features based on the corrected sleep EEG signal to obtain corresponding local features; and extracting global features based on the corrected sleep EEG signal to obtain corresponding global features.
[0123] At present, the deep learning-based method still uses segment classification to realize automatic recognition of sleep stages, which ignores the continuity and periodicity of sleep. The sleep staging method provided by the embodiment of the present invention optimizes the label system, integrates effective features, and introduces medical knowledge of sleep continuity and periodicity, so that the sleep staging method is more adaptable to sleep changes, thereby obtaining more accurate staging results.
[0124] In step S103, based on the corrected sleep brain wave signal Z n Extract local features and all features respectively. Local features include the voltage amplitude ratio before and after LF1, the window (TL) voltage mean LF2, the window (TL) voltage standard deviation LF3, the window (TL) zero-crossing rate LF4, and the window (TL) derivative LF5; global features include the voltage mean difference GF1, the voltage median difference GF2, and the voltage high-low ratio GF3. Among them, LF1 is an N×(M-2) matrix, and 1 0 must be filled before and after LF1 to expand the dimension of LF1 to N×M. LF2, LF3, and LF4 are N×(M-TL+1) matrices (TL is an odd number and less than or equal to 21), and 0 must be filled before and after LF2, LF3, and LF4 respectively. 0s are added to expand the dimensions of LF2, LF3, and LF4 to N×M. GF1, GF2, and GF3 are all N×M matrices. LF5 is an N×(M-1) matrix, and a zero must be added to the end of LF5 to expand the dimension of LF5 to N×M.
[0125] In a possible implementation, extracting local features based on the corrected sleep EEG signal to obtain corresponding local features includes the following steps:
[0126] Acquire multiple local feature extraction methods for performing local feature extraction, the multiple local feature extraction methods including: a first local feature extraction method, a second local feature extraction method, a third local feature extraction method, a fourth local feature extraction method, and a fifth local feature extraction method;
[0127] Based on any one of a plurality of local feature extraction methods, local feature extraction is performed on the corrected sleep EEG signal to obtain corresponding local features, wherein the local features include: before-after voltage amplitude ratio, window voltage mean, window voltage standard deviation, window zero crossing rate and window derivative.
[0128] In a possible implementation, based on any one of a plurality of local feature extraction methods, performing layout feature extraction on the corrected sleep EEG signal to obtain corresponding local features includes the following steps:
[0129] If the local feature to be extracted is the ratio of the voltage amplitude before and after, the first local feature extraction method is adopted, and the following operation is performed on the first channel of the N channels to extract the local feature:
[0130] From the second point of the first channel of the N channels, traverse the corrected sleep EEG signal of length M, calculate the ratio of the voltage amplitude of the previous position to the voltage amplitude of the next position of the current position, until traversing to the M-1 position, and obtain the voltage amplitude ratio before and after to be filled, where M is a positive integer greater than or equal to P, and P is a positive integer determined by multiplying the acquisition time by the sampling rate S;
[0131] Obtaining the voltage amplitude ratio before and after filling and the first filling method;
[0132] Based on the first filling mode, the voltage amplitude ratio before and after the filling is filled to obtain the voltage amplitude ratio before and after the corresponding single channel;
[0133] For the other N-1 channels, the same operation is performed in turn using the first local feature extraction method to obtain the front-to-back voltage amplitude ratio of the corresponding single channel;
[0134] The front-to-back voltage amplitude ratios of the individual channels corresponding to the N channels are concatenated to obtain a front-to-back voltage amplitude ratio with a dimension of N×M.
[0135] In an actual application scenario, the first filling method may be: after obtaining the voltage amplitude ratio LF before and after the filling, 1ti After that, in LF 1tiThe front and rear ends of are filled with 1 0 to obtain the amplitude ratio LF of a single channel with a length of M. 1si (i∈[1,2,3,…,N]). The first filling method is an example in a specific application scenario, and the first filling method may be adjusted according to the requirements of different application scenarios, which will not be described in detail here.
[0136] In an actual application scenario, when the local feature to be extracted is the front-to-back voltage amplitude ratio LF1, the following operations are performed to extract the local feature, as described in detail below:
[0137] First, traverse the corrected sleep EEG signal of length M from the second point of the first channel, calculate the ratio of the voltage amplitude of the previous position to the voltage value of the next position, until traversing to the M-1 position, and obtain the voltage amplitude ratio LF before and after to be filled 1ti (i∈[1,2,3,…,N]). Then, the voltage amplitude ratio LF before and after filling is obtained 1ti After that, in LF 1ti The front and rear ends of the channel are filled with 1 0 to obtain the voltage amplitude ratio LF of a single channel with a length of M. 1si (i∈[1,2,3,…,N]). Finally, the same operation is performed on the other N-1 channels, and the voltage amplitude ratio LF of each single channel is calculated. 1si After splicing, the front-to-back amplitude ratio LF1 with a dimension of N×M is obtained.
[0138] In a possible implementation, based on any one of a plurality of local feature extraction methods, performing layout feature extraction on the corrected sleep EEG signal to obtain corresponding local features includes the following steps:
[0139] If the local feature to be extracted is the window voltage mean, the second local feature extraction method is used to perform the following operations on the first channel of the N channels to extract the local feature:
[0140] From the first channel of the N channels, traverse the corrected sleep brain wave signal of length M with a first preset window width and a first preset moving step length, calculate the average voltage value of the window until traversing to the position corresponding to M-TL+1, and obtain the average voltage value of the window to be filled, where WL is the window width;
[0141] Obtaining the voltage mean of the window to be filled and a second filling method;
[0142] Based on the second filling method, the window voltage mean to be filled is filled to obtain the window voltage mean of the corresponding single channel;
[0143] For the other N-1 channels, the same operation is performed in turn using the second local feature extraction method to obtain the window voltage mean of the corresponding single channel;
[0144] The window voltage means of the single channels corresponding to the N channels are concatenated to obtain a window voltage mean with a dimension of N×M.
[0145] In the above steps, the first preset window width can be TL, TL is the window, and the first preset moving step is 1. The above is only an example. The first preset window width and the first preset moving step can be adjusted according to the requirements of different application scenarios, which will not be repeated here.
[0146] In a specific application scenario, the second filling method may be: after obtaining the voltage mean LF of the window to be filled (TL), 2ti After that, in LF 2ti The front and back padding 0, and get the window (TL) voltage mean LF of a single channel with a length of M 2si (i∈[1,2,3,…,N]). The above is only an example, and the filling method of the second filling method can be adjusted according to the requirements of different application scenarios, which will not be repeated here.
[0147] In an actual application scenario, when the local feature to be extracted is the window (TL) voltage mean LF2, the following operations are performed to extract the local feature, as described in detail below:
[0148] First, from the first channel, TL is used as the window width and 1 is used as the moving step length to traverse the corrected sleep EEG signal with a length of M (TL is an odd number and less than or equal to 21), and the average voltage value of the window is calculated until it traverses to the position M-TL+1, and the voltage mean LF of the window to be filled (TL) is obtained. 2ti (i∈[1,2,3,…,N]). Then, the mean voltage LF of the window to be filled (TL) is obtained. 2ti After that, in LF 2ti The front and back padding 0, and get the window (TL) voltage mean LF of a single channel with a length of M 2si (i∈[1,2,3,…,N]). Finally, the same operation is performed on the other N-1 channels, and the window (TL) voltage average LF of each single channel is 2si The splicing process is performed to obtain the window (TL) voltage mean LF2 with a dimension of N×M.
[0149] In a possible implementation, based on any one of a plurality of local feature extraction methods, performing layout feature extraction on the corrected sleep EEG signal to obtain corresponding local features includes the following steps:
[0150] If the local feature to be extracted is the standard deviation of the window voltage value, the third local feature extraction method is used to perform the following operations on the first channel of the N channels to extract the local feature:
[0151] From the first channel of the N channels, traverse the corrected sleep brain wave signal of length M with a second preset window width and a second preset moving step length, calculate the standard deviation of the window voltage value, until traversing to the position corresponding to M-TL+1, and obtain the standard deviation of the window voltage value to be filled;
[0152] Obtain the standard deviation of the voltage value of the window to be filled and the third filling method;
[0153] Based on the third filling method, the standard deviation of the window voltage value to be filled is filled to obtain the standard deviation of the window voltage value of the corresponding single channel;
[0154] For the other N-1 channels, the same operation is performed in turn using the third local feature extraction method to obtain the standard deviation of the window voltage value of the corresponding single channel;
[0155] The standard deviations of the window voltage values of the individual channels corresponding to the N channels are concatenated to obtain the standard deviations of the window voltage values with a dimension of N×M.
[0156] In the above steps, the second preset window width can be TL, TL is the window, and the second preset moving step is 1. The above is just an example. The second preset window width and the second preset moving step can be adjusted according to the requirements of different application scenarios, which will not be repeated here.
[0157] In a specific application scenario, the third filling method may be: after obtaining the voltage standard deviation LF of the window to be filled (TL), 3ti After that, in LF 3ti The front and back padding 0 to obtain the standard deviation LF of the window (TL) voltage of a single channel with a length of M 3si (i∈[1,2,3,…,N]). The above is only an example, and the filling method of the third filling method can be adjusted according to the requirements of different application scenarios, which will not be repeated here.
[0158] In an actual application scenario, when the local feature to be extracted is the window (TL) voltage standard deviation LF3, the following operations are performed to extract the local feature, as described in detail below:
[0159] First, from the first channel, TL is used as the window width and 1 is used as the moving step length to traverse the corrected sleep EEG signal with a length of M (TL is an odd number and less than or equal to 21), and the standard deviation of the window voltage value is calculated until it traverses to the position M-TL+1, and the standard deviation LF of the voltage of the window to be filled (TL) is obtained. 3ti (i∈[1,2,3,…,N]). Then, the voltage standard deviation LF of the window to be filled (TL) is obtained. 3ti After that, in LF 3ti The front and back padding 0, and get the standard deviation LF of the window (TL) voltage of a single channel with a length of M 3si (i∈[1,2,3,…,N]). Finally, the same operation is performed on the other N-1 channels, and the standard deviation LF of the window (TL) voltage of each single channel is 3si The splicing process is performed to obtain the window (TL) voltage mean LF3 with a dimension of N×M.
[0160] In a possible implementation, based on any one of a plurality of local feature extraction methods, performing layout feature extraction on the corrected sleep EEG signal to obtain corresponding local features includes the following steps:
[0161] If the local feature to be extracted is the window zero-crossing rate, the fourth local feature extraction method is used to perform the following operations on the first channel of the N channels to extract the local feature:
[0162] From the first channel of the N channels, traverse the corrected sleep brain wave signal of length M with a third preset window width and a third preset moving step length, calculate the zero-crossing rate of the window until traversing to the position corresponding to M-TL+1, and obtain the zero-crossing rate of the window to be filled, wherein the zero-crossing rate of the window refers to the ratio of the voltage waveform in the window passing through zero;
[0163] Obtain the zero-crossing rate of the window to be filled and the fourth filling method;
[0164] Based on the fourth filling method, the zero-crossing rate of the window to be filled is filled to obtain the zero-crossing rate of the window of the corresponding single channel;
[0165] For the other N-1 channels, the same operation is performed in sequence using the fourth local feature extraction method to obtain the window zero-crossing rate of the corresponding single channel;
[0166] The window zero-crossing rates of a single channel corresponding to N channels are concatenated to obtain a window zero-crossing rate with a dimension of N×M.
[0167] In the above steps, the third preset window width can be TL, TL is the window, and the third preset moving step is 1. The above is just an example. The third preset window width and the third preset moving step can be adjusted according to the needs of different application scenarios, which will not be repeated here.
[0168] In an actual application scenario, the fourth filling method may be: after obtaining the zero crossing rate LF of the window to be filled (TL), 4ti After that, in LF 4ti The front and back padding 0, and get the zero-crossing rate LF of the window (TL) of a single channel with a length of M 4si (i∈[1,2,3,…,N]). The above is only an example, and the filling method of the fourth filling method can be adjusted according to the requirements of different application scenarios, which will not be repeated here.
[0169] In an actual application scenario, when the local feature to be extracted is the window (TL) zero crossing rate LF4, the following operations are performed to extract the local feature, as described in detail below:
[0170] First, from the first channel, TL is used as the window width and 1 is used as the moving step length to traverse the calibrated sleep EEG signal with a length of M (TL is an odd number and less than or equal to 21), and the ratio of the voltage waveform passing through 0 in the window is calculated until it traverses to the position of M-TL+1, and the zero-crossing rate LF of the window to be filled (TL) is obtained. 4ti (i∈[1,2,3,…,N]). Then, after obtaining the zero-crossing rate LF of the window to be filled (TL) 4ti After that, in LF 4ti The front and back padding 0, and get the zero-crossing rate LF of the window (TL) of a single channel with a length of M 4si (i∈[1,2,3,…,N]). Finally, the same operation is performed on the other N-1 channels, and the zero-crossing rate LF of the window (TL) of each single channel is 4si After splicing, the window (TL) mean LF4 with a dimension of N×M is obtained.
[0171] In a possible implementation, based on any one of a plurality of local feature extraction methods, performing layout feature extraction on the corrected sleep EEG signal to obtain corresponding local features includes the following steps:
[0172] If the local feature to be extracted is a window derivative, the fifth local feature extraction method is used to perform the following operations on the first channel of the N channels to extract the local feature:
[0173] Traverse the corrected sleep EEG signal of length M from the first point of the first channel of N channels, calculate the derivative of the voltage amplitude at this position and the voltage amplitude at the next position, until traversing to the position corresponding to M-1, and obtain the derivative of the window to be filled;
[0174] Get the derivative of the window to be filled and the fifth filling method;
[0175] Based on the fifth filling method, the window derivative to be filled is filled to obtain the window derivative of the corresponding single channel;
[0176] For the other N-1 channels, the same operation is performed in turn using the fifth local feature extraction method to obtain the window derivative of the corresponding single channel;
[0177] The window derivatives of a single channel corresponding to N channels are concatenated to obtain a window derivative with a dimension of N×M.
[0178] In the above steps, the fifth filling method may be: after obtaining the derivative LF of the window to be filled (TL) 5ti After that, in LF 5ti The end of is filled with 1 0 to obtain the window (TL) derivative LF of a single channel with a length of M. 5si (i∈[1,2,3,…,N]). The above is only an example, and the filling method of the fifth filling method can be adjusted according to the requirements of different application scenarios, which will not be repeated here.
[0179] In an actual application scenario, when the local feature to be extracted is the window (TL) derivative LF5, the following operations are performed to extract the local feature, as described in detail below:
[0180] First, traverse the corrected sleep EEG signal of length M from the first point of the first channel, calculate the derivative of the voltage amplitude at this position and the voltage value at the next position, until traversing to the M-1 position, and obtain the derivative LF of the window to be filled (TL) 5ti (i∈[1,2,3,…,N]). Then, the derivative LF of the window to be filled (TL) is obtained 5ti Later in LF 5ti The end of is filled with 1 0 to obtain the window (TL) derivative LF of a single channel with a length of M 5si (i∈[1,2,3,…,N]). Finally, the same operation is performed on the other N-1 channels, and the window derivative (TL) of each single channel LF is 5si After splicing, the front-to-back amplitude ratio LF5 with a dimension of N×M is obtained.
[0181] In a possible implementation, the following steps are included:
[0182] Acquire multiple global feature extraction methods for performing global feature extraction, the multiple global feature extraction methods including: a first global feature extraction method, a second global feature extraction method, and a third global feature extraction method;
[0183] Based on any one of a plurality of global feature extraction methods, global feature extraction is performed on the corrected sleep EEG signal to obtain corresponding global features; the global features include: voltage mean difference, voltage median difference and voltage high-low ratio.
[0184] In a possible implementation, performing global feature extraction based on the corrected sleep EEG signal to obtain corresponding global features includes the following steps:
[0185] If the global feature to be extracted is the voltage mean difference, the first global feature extraction method is adopted, and the following operations are performed on the first channel of the N channels to extract the global feature:
[0186] Traverse the corrected sleep EEG signal of length M from the first point of the first channel of N channels, calculate the difference between the voltage amplitude at the current position and the voltage average value of the channel, until traversing to the position corresponding to M, and obtain the voltage mean difference of a single channel;
[0187] For the other N-1 channels, the same operation is performed in turn using the first global feature extraction method to obtain the voltage mean difference of the corresponding single channel;
[0188] The voltage mean differences of the individual channels corresponding to the N channels are concatenated to obtain a voltage mean difference with a dimension of N×M.
[0189] In an actual application scenario, when the global feature to be extracted is the voltage mean difference GF1, the following operations are performed to extract the global feature, as described in detail as follows:
[0190] First, traverse the corrected sleep EEG signal of length M from the first point of the first channel, calculate the difference between the voltage amplitude at this position and the voltage average of the channel, until traversing to the M position, and obtain the voltage mean difference GF of a single channel 1si (i∈[1,2,3,…,N]). Then, the same operation is performed on the other N-1 channels, and the voltage mean difference GF of each single channel is 2si After splicing, a voltage mean difference GF1 with a dimension of N×M is obtained.
[0191] In a possible implementation, performing global feature extraction based on the corrected sleep EEG signal to obtain corresponding global features includes the following steps:
[0192] If the global feature to be extracted is the voltage median difference, the second global feature extraction method is used to perform the following operations on the first channel of the N channels to extract the global feature:
[0193] Traverse the corrected sleep EEG signal of length M from the first point of the first channel of the N channels, calculate the difference between the voltage amplitude at the position and the median voltage of the channel, until traversing to the position corresponding to M, and obtain the median voltage difference of a single channel;
[0194] For the other N-1 channels, the same operation is performed in turn using the second global feature extraction method to obtain the voltage median difference of the corresponding single channel;
[0195] The voltage median differences of the single channels corresponding to the N channels are concatenated to obtain a voltage median difference with a dimension of N×M.
[0196] In an actual application scenario, when the global feature to be extracted is the voltage median difference GF2, the following operations are performed to extract the global feature, as described in detail below:
[0197] First, traverse the corrected sleep EEG signal of length M from the first point of the first channel, calculate the difference between the voltage amplitude at that position and the median voltage of the channel, until traversing to the M position, and obtain the median voltage difference GF of a single channel 2si (i∈[1,2,3,…,N]). Then, the same operation is performed on the other N-1 channels, and the median difference GF of the voltage of each single channel is calculated. 2si The splicing process is performed to obtain a voltage median difference GF2 with a dimension of N×M.
[0198] In a possible implementation, performing global feature extraction based on the corrected sleep EEG signal to obtain corresponding global features includes the following steps:
[0199] If the global feature to be extracted is the voltage high-low ratio, the third global feature extraction method is used to perform the following operations on the first channel of the N channels to extract the global feature:
[0200] Traverse the corrected sleep EEG signal of length M from the first point of the first channel of N channels, calculate the voltage amplitude at the position, and the ratio of the distance between the maximum voltage of the channel and the minimum voltage of the channel, until traversing to the position corresponding to M, and obtain the voltage high-low ratio of a single channel;
[0201] For the other N-1 channels, the same operation is performed in turn using the third global feature extraction method to obtain the voltage high-low ratio of the corresponding single channel;
[0202] The voltage high-low ratios of individual channels corresponding to the N channels are concatenated to obtain a voltage high-low ratio with a dimension of N×M.
[0203] In an actual application scenario, when the global feature to be extracted is the voltage high-low ratio GF3, the following operations are performed to extract the global feature, as described in detail below:
[0204] Step S104: inputting the corrected sleep EEG signal, local features and global features into the EEG signal segmentation model for processing, and outputting a rough sleep stage segmentation result.
[0205] In actual application scenarios, the processing process based on the EEG signal segmentation model is as follows:
[0206] First, based on the corrected sleep EEG signal Z n And local features and global features of the same length, construct the input EEG signal F with N×8 channels n ; Then, the input EEG signal F n and continuous sleep stage marker Y n The signal is input to the encoder-decoder for learning and integration, and multiple sleep stages are divided into each signal point in the signal, where the multiple sleep stages are specifically: wakefulness (Wake), non-rapid eye movement sleep stage 1 (NREM N1 stage), rapid eye movement sleep stage 2 (NREM N2), non-rapid eye movement sleep stage 3 (NREM N3 stage) and rapid eye movement REM stage; finally, the coarse sleep stage segmentation result CS representing M channels is obtained n Among them, F n is a (N×8)×M matrix, CS n is a 5×M matrix.
[0207] In a possible implementation, the corrected sleep EEG signal, local features, and global features are all input into an EEG signal segmentation model for processing, and a rough sleep stage segmentation result is output, including the following steps:
[0208] Constructing an EEG signal segmentation model, and repeatedly iteratively training the EEG signal segmentation model until the EEG signal segmentation model converges;
[0209] constructing an input EEG signal based on the corrected sleep EEG signal, local features having the same length as the corrected sleep EEG signal, and global features;
[0210] Inputting the input EEG signal and the continuous sleep stage markers into the EEG signal segmentation model for processing, and dividing the multiple sleep stages to which each signal point in the input EEG signal belongs;
[0211] Based on the multiple sleep stages to which each signal point in the input EEG signal belongs, a coarse sleep stage segmentation result representing N channels is generated, where N is a positive integer greater than or equal to 2.
[0212] In a possible implementation, an EEG signal segmentation model is constructed, and the EEG signal segmentation model is repeatedly iteratively trained until the EEG signal segmentation model converges, including the following steps:
[0213] Obtain corrected sleep EEG signals, local features and global features. Local features include: before-after voltage amplitude ratio, window voltage mean, window voltage value standard deviation, window zero-crossing rate and window derivative; global features include: voltage mean difference, voltage median difference and voltage high-low ratio;
[0214] The corrected sleep EEG signal, all local features and all global features are spliced to obtain an input EEG signal;
[0215] Taking the input EEG signal as the input of the EEG signal segmentation model, constructing the EEG signal segmentation model, and outputting the coarse sleep stage segmentation results representing N channels;
[0216] Initialize the weight parameters of the EEG signal segmentation model;
[0217] The input EEG signal is feature extracted through the forward propagation algorithm, and the current sleep stage is predicted based on the extracted features to obtain the prediction result;
[0218] Based on the loss function of the EEG signal segmentation model, the difference between the continuous sleep stage labels and the predicted results is calculated and quantified as the loss value;
[0219] Based on the chain-derivation rule, the back-propagation algorithm and the Adam optimization algorithm are used to perform gradient update on the weight parameters.
[0220] The EEG signal segmentation model updated with weight parameters is repeatedly iterated and trained until the EEG signal segmentation model converges.
[0221] In actual application scenarios, the construction process of the EEG signal segmentation model is as follows:
[0222] (1) Segmentation model input construction: Correct the sleep EEG signal Z n It is concatenated with features LF1, LF2, LF3, LF4, LF5, GF1, GF2 and GF3 to obtain the input EEG signal F of the EEG signal segmentation model. n ;
[0223] (2) Constructing an EEG signal segmentation model: The EEG signal segmentation model structure, the input of which is the input EEG signal Fn ([B, D, N×8, M] tensor matrix), the output is the coarse sleep stage segmentation result CS representing N channels n (tensor matrix of [1, 1, 5, M])
[0224] (3) Initialization of EEG segmentation model weight parameters: Use a normal distribution with a mean of 0 and a variance of 1 to randomly initialize the parameters in the EEG signal segmentation model;
[0225] (4) Training of EEG signal segmentation model: First, the features of EEG signals are extracted through the forward propagation algorithm to predict the sleep stage and obtain the prediction result P n Subsequently, the continuous sleep stage labels Y are weighed by the loss function n And the model prediction result P n The difference between them is specifically quantified as a loss value. Then, the back propagation algorithm based on the chain derivative rule and the Adam optimization algorithm are combined to perform gradient update on the weight parameters in the EEG signal segmentation model. Finally, the EEG signal segmentation model with updated weight parameters is used to repeat iterative training until the EEG signal segmentation model converges.
[0226] Step S105: Correcting the coarse sleep staging result based on the prior knowledge of sleep continuity to obtain a locally corrected sleep staging result.
[0227] In a possible implementation, the coarse sleep staging segmentation result is corrected based on the prior knowledge of sleep continuity to obtain a locally corrected sleep staging result, including the following steps:
[0228] Acquire the sleep stage in a known state and the sleep stage in an observed state; and acquire a local correction matrix of the sleep stage;
[0229] Based on the relationship between the known state and the observed state, multiple correlation values of relevant positions in the local correction matrix of the sleep stage are selected, and the multiple correlation values may be 2 or 3 correlation values;
[0230] Based on multiple correlation values, multiple values of each known state corresponding to the observed state are compared, and the observed state corresponding to the maximum value is used as the next sleep stage result;
[0231] Based on the next sleep stage result, a locally corrected sleep staging result is obtained.
[0232] It should be noted that before obtaining the local correction matrix of the sleep stage, it is necessary to calculate the local correction matrix α of the sleep stage. cs1 .
[0233] In actual application scenarios, the local correction matrix of the sleep stage can be calculated as follows:
[0234] First, take the predicted probability P1 of the first position of length M and add P1 to the sleep stage weight matrix α local Multiply them together to get the local correction matrix α of the sleep stage at moment 1 cs1 , take the maximum value of the diagonal line of the matrix as the first sleep stage; then, start from the second position to traverse the coarse sleep stage segmentation result CS n , get the predicted probability P of the sleep stage at each position i (i∈[2,3,4,…,N]); Finally, the predicted probability of sleep stage at each position P i and the sleep stage weight matrix α local ×β (β is related to the previous observation state) to obtain the local correction matrix α of the sleep stage at time i csi .
[0235] In this step, first, the sleep stage weight matrix α is set according to the subject's gender, age, and sleep stage sequence. local ×β(Subjects of different genders and age groups have different weights α local ). Among them, α local is the initial sleep stage weight matrix, and β is the influencing factor. Then, the rough sleep stage result CS n and the sleep stage weight matrix α local Multiply them together to get the sleep stage local correction matrix α cs Finally, take the local correction matrix α cs The value of the local corrected sleep stage result LS n .
[0236] like Figure 3 As shown in FIG. , it is a schematic diagram of local correction of sleep stages in a specific application scenario. Figure 3 As shown, the process of local correction is described as follows:
[0237] (1) Determine the known state and the observed state: The sleep stages usually follow Wake—NREM (N1)—NREM (N2)—NREM (N3)—NREM (N2)—NREM (N1)—REM—NREM (N1)—… In addition, there is a possibility of Wake in each stage. Therefore, based on this knowledge, it can be determined as follows: Figure 2 The known and observed states are shown.
[0238] (2) Calculate the local correction matrix α of the sleep stage cs : First, take the predicted probability P1 of the first position of length M and compare P1 with the sleep stage weight matrix α local Multiply them together to get the local correction matrix α of the sleep stage at moment 1cs1 , take the maximum value of the diagonal line of the matrix as the first sleep stage; then, start from the second position to traverse the coarse sleep stage segmentation result CS n , get the predicted probability P of the sleep stage at each position i (i∈[2,3,4,…,N]); Finally, the predicted probability of sleep stage at each position P i and the sleep stage weight matrix α local ×β (β is related to the previous observation state) to obtain the local correction matrix α of the sleep stage at time i csi ;
[0239] (3) Local correction of sleep stage: Combine the relationship between the known state and the observed state, and take the α in the matrix cs(i,j) (i∈[1,2,3,4,5],j∈[1,2,3,4,5]) related positions ( Figure 3 α in cs(i,j) ) value. Then, compare the two or three values of each known state corresponding to the observed state, and the observed state corresponding to the maximum value is the next sleep stage result, thereby obtaining the locally corrected sleep stage result LS n .
[0240] Step S106: Correcting the locally corrected sleep staging result based on prior knowledge of sleep periodicity to obtain a globally corrected sleep staging result.
[0241] In a possible implementation, the locally corrected sleep staging result is corrected based on prior knowledge of sleep periodicity to obtain a globally corrected sleep staging result, including the following steps:
[0242] Obtain the standard ratio of each sleep stage in the sleep cycle, where sleep is divided into wakefulness (W, wake), rapid eye movement (REM), and non-rapid eye movement (NREM), each of which has different sleep characteristics. The non-rapid eye movement (NREM) stage is further subdivided into three stages: N1, N2, and N3. Among them, stage N1 is non-rapid eye movement sleep stage 1; stage N2 is non-rapid eye movement sleep stage 2; stage N3 is non-rapid eye movement sleep stage 3, and stage N3 is also called deep sleep stage or slow wave sleep stage. The REM stage is related to dream activities and usually occurs multiple times in one night;
[0243] Get all the locally corrected sleep staging results, and perform the following operations on any locally corrected sleep staging result in a preset manner:
[0244] When it is determined that the current window is not in the awake state, the proportion of each stage in the sleep cycle in the current window is calculated;
[0245] Calculate the stage ratio of each sleep stage in the sleep cycle based on the stage proportion of each sleep stage in the sleep cycle in the current window and the standard ratio of each sleep stage in the sleep cycle;
[0246] The sleep stage with the largest stage ratio among the sleep stages in the sleep cycle is used as the recognition result of the current window to perform correction processing on the sleep stages in the sleep cycle;
[0247] The preset step length is used as the moving step length, and the same operation is performed in a preset manner until all the locally corrected sleep staging results are traversed to obtain the globally corrected sleep staging result.
[0248] It should be noted that the preset step length can be adjusted according to the requirements of different application scenarios, and the preset step length is not specifically limited here.
[0249] In actual application scenarios, determining that the current window is in the wake-up state can be achieved through Wake screening and Wake review, as described below:
[0250] Wake screening: Take WT as the window width and calculate the proportion of wake phase in the window β W If β W If it is greater than 50%, the current window may be in the Wake phase. Otherwise, it is not in the Wake phase.
[0251] Wake review: When the current window may be in the Wake stage, the Wake stage is reviewed based on the three windows before the current window. If two consecutive windows close to the current window in the first three windows are not in the Wake stage, the current window is not in the Wake stage. Otherwise, the current window is in the Wake stage.
[0252] In this step, first, the standard ratio α of different sleep stages in a sleep cycle can be obtained according to the subject's gender, age and overall proportion of sleep stages. N1 ,α N2 ,α N3 and α REM Then, WT is used as the window width (WT is an odd number and less than or equal to 10 seconds), ST is used as the moving step, and the sleep staging result LS of the local correction is combined. n Perform global correction. Finally, obtain the globally corrected sleep stage result GS n . Globally corrected sleep staging results GS n This is the final sleep stage result.
[0253] like Figure 4 As shown in FIG. , it is a schematic diagram of global correction of sleep stages in a specific application scenario. Figure 4As shown, the process of global correction is as follows:
[0254] (1) Determine the standard ratio of each sleep stage in the sleep cycle: A sleep cycle usually includes three stages with different sleep characteristics: wake (W), rapid eye movement (REM), and non-rapid eye movement (NREM). The non-rapid eye movement (NREM) stage is further divided into three stages: N1, N2, and N3. Among them, stage N1 is non-rapid eye movement sleep stage 1; stage N2 is non-rapid eye movement sleep stage 2; stage N3 is non-rapid eye movement sleep stage 3, and stage N3 is also called deep sleep stage or slow wave sleep stage. Usually, the proportion of each cycle is relatively fixed at different ages and genders. Among them, the proportion of N1 is α N1 , N2 accounts for α N2 , N3 stage accounts for α N3 , the proportion of REM stage is α REM ;
[0255] (2) Global correction of sleep ratio:
[0256] 2.1 Wake screening: Taking WT as the window width, calculate the proportion of wake phase in the window β W If β W If it is greater than 50%, the current window may be in the Wake phase. Otherwise, it is not in the Wake phase.
[0257] 2.2 Wake review: When the current window may be in the Wake stage, the Wake stage is reviewed based on the three windows before the current window. If two consecutive windows close to the current window in the first three windows are not in the Wake stage, the current window is not in the Wake stage. Otherwise, the current window is in the Wake stage;
[0258] 2.3 Calculate N1, N2, N3 and REM stages: Calculate the proportion of N1 stage in the current window β N1 , N2 stage proportion β N2 , N3 stage accounts for β N3 and REM phase proportion β REM ;
[0259] 2.4N1, N2, N3 and REM stage correction: Calculate the N1 stage ratio based on the proportion of each stage in the current window and the standard ratio of each sleep stage in the sleep cycle N2 phase ratio N3 stage ratio REM STAGE RATIOS Among them, the sleep stage with the largest ratio is the recognition result of the current window.
[0260] 2.5 Using ST as the moving step, repeat steps 2.1 to 2.4 from left to right until the locally corrected sleep stage result LS is obtained. n is completely traversed.
[0261] The sleep staging method provided in the embodiment of the present invention can achieve more fine-grained sleep staging identification and ensure the continuity and dynamics of sleep stages; in addition, due to the introduction of prior knowledge of sleep medicine, the prior knowledge of sleep medicine includes: prior knowledge of sleep continuity and prior knowledge of sleep periodicity, and based on the prior knowledge of sleep medicine, the sleep stages are corrected to ensure the periodicity of the sleep stages, thereby ultimately achieving accurate identification of different sleep stages.
[0262] In the above-mentioned embodiment, a sleep staging method based on sleep stage ratio is provided. Correspondingly, the present invention also provides a sleep staging device based on sleep stage ratio. The sleep staging device based on sleep stage ratio provided in the embodiment of the present invention can implement the above-mentioned sleep staging method based on sleep stage ratio. The sleep staging device based on sleep stage ratio can be implemented by software, hardware or a combination of software and hardware. For example, the sleep staging device based on sleep stage ratio can include integrated or separate functional modules or units to perform the corresponding steps in the above-mentioned methods.
[0263] Example 2
[0264] Please refer to Figure 5 , which shows a schematic diagram of a sleep staging device based on sleep stage ratio provided by some embodiments of the present invention. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described below is only illustrative.
[0265] like Figure 5 As shown, the sleep staging apparatus 500 based on sleep stage ratio may include:
[0266] An acquisition module 501 is used to acquire original sleep EEG signals including N channels and corresponding sleep stage marks;
[0267] A preprocessing module 502 is used to perform data preprocessing on the original sleep brain wave signal to obtain a corrected sleep brain wave signal and a continuous sleep stage mark;
[0268] The feature extraction module 503 is used to extract local features based on the corrected sleep EEG signal to obtain corresponding local features; and to extract global features based on the corrected sleep EEG signal to obtain corresponding global features;
[0269] The segmentation module 504 is used to input the corrected sleep EEG signal, local features and global features into the EEG signal segmentation model for processing, and output a rough sleep stage segmentation result;
[0270] A local correction module 505 is used to correct the coarse sleep staging result based on the prior knowledge of sleep continuity to obtain a local corrected sleep staging result;
[0271] The global correction module 506 is used to correct the locally corrected sleep staging result based on the prior knowledge of sleep periodicity to obtain a globally corrected sleep staging result.
[0272] In some implementations of the embodiments of the present invention, the local correction module 505 is specifically used to:
[0273] Acquire the sleep stage in a known state and the sleep stage in an observed state; and acquire a local correction matrix of the sleep stage;
[0274] Based on the relationship between the known state and the observed state, multiple correlation values of relevant positions in the local correction matrix of the sleep stage are selected;
[0275] Based on multiple correlation values, multiple values of each known state corresponding to the observed state are compared, and the observed state corresponding to the maximum value is used as the next sleep stage result;
[0276] Based on the next sleep stage result, a locally corrected sleep staging result is obtained.
[0277] In some implementations of the embodiments of the present invention, the global correction module 506 is specifically used to:
[0278] Obtain the standard ratio of each sleep stage in the sleep cycle;
[0279] Get all the locally corrected sleep staging results, and perform the following operations on any locally corrected sleep staging result in a preset manner:
[0280] When it is determined that the current window is not in the awake state, the proportion of each stage in the sleep cycle in the current window is calculated;
[0281] Calculate the stage ratio of each sleep stage in the sleep cycle based on the stage proportion of each sleep stage in the sleep cycle in the current window and the standard ratio of each sleep stage in the sleep cycle;
[0282] The sleep stage with the largest stage ratio among the sleep stages in the sleep cycle is used as the recognition result of the current window to perform correction processing on the sleep stages in the sleep cycle;
[0283] The preset step length is used as the moving step length, and the same operation is performed in a preset manner until all the locally corrected sleep staging results are traversed to obtain the globally corrected sleep staging result.
[0284] In some implementations of the embodiments of the present invention, the segmentation module 504 is used to:
[0285] Constructing an EEG signal segmentation model, and repeatedly iteratively training the EEG signal segmentation model until the EEG signal segmentation model converges;
[0286] constructing an input EEG signal based on the corrected sleep EEG signal, local features having the same length as the corrected sleep EEG signal, and global features; inputting the input EEG signal and the continuous sleep stage markers into an EEG signal segmentation model for processing, and dividing multiple sleep stages to which each signal point in the input EEG signal belongs;
[0287] Based on the multiple sleep stages to which each signal point in the input EEG signal belongs, a coarse sleep stage segmentation result representing N channels is generated, where N is a positive integer greater than or equal to 2.
[0288] In some implementations of the embodiments of the present invention, the segmentation module 504 is specifically used to:
[0289] Obtain corrected sleep EEG signals, local features and global features. Local features include: before-after voltage amplitude ratio, window voltage mean, window voltage value standard deviation, window zero-crossing rate and window derivative; global features include: voltage mean difference, voltage median difference and voltage high-low ratio;
[0290] The corrected sleep EEG signal, all local features and all global features are spliced to obtain an input EEG signal;
[0291] Taking the input EEG signal as the input of the EEG signal segmentation model, constructing the EEG signal segmentation model, and outputting the coarse sleep stage segmentation results representing N channels;
[0292] Initialize the weight parameters of the EEG signal segmentation model;
[0293] The input EEG signal is feature extracted through the forward propagation algorithm, and the current sleep stage is predicted based on the extracted features to obtain the prediction result;
[0294] Based on the loss function of the EEG signal segmentation model, the difference between the continuous sleep stage labels and the predicted results is calculated and quantified as the loss value;
[0295] Based on the chain-derivation rule, the back-propagation algorithm and the Adam optimization algorithm are used to perform gradient update on the weight parameters.
[0296] The EEG signal segmentation model updated with weight parameters is repeatedly iterated and trained until the EEG signal segmentation model converges.
[0297] In some implementations of the embodiments of the present invention, the feature extraction module 503 is used to:
[0298] Acquire multiple local feature extraction methods for performing local feature extraction, the multiple local feature extraction methods including: a first local feature extraction method, a second local feature extraction method, a third local feature extraction method, a fourth local feature extraction method, and a fifth local feature extraction method;
[0299] Based on any one of a plurality of local feature extraction methods, local feature extraction is performed on the corrected sleep brain wave signal to obtain corresponding local features.
[0300] In some implementations of the embodiments of the present invention, the feature extraction module 503 is specifically used to:
[0301] If the local feature to be extracted is the ratio of the voltage amplitude before and after, the first local feature extraction method is adopted, and the following operation is performed on the first channel of the N channels to extract the local feature:
[0302] From the second point of the first channel of the N channels, traverse the corrected sleep EEG signal of length M, calculate the ratio of the voltage amplitude of the previous position to the voltage amplitude of the next position of the current position, until traversing to the M-1 position, and obtain the voltage amplitude ratio before and after to be filled, where M is a positive integer greater than or equal to P, and P is a positive integer determined by multiplying the acquisition time by the sampling rate S;
[0303] Obtaining the voltage amplitude ratio before and after filling and the first filling method;
[0304] Based on the first filling mode, the voltage amplitude ratio before and after the filling is filled to obtain the voltage amplitude ratio before and after the corresponding single channel;
[0305] For the other N-1 channels, the same operation is performed in turn using the first local feature extraction method to obtain the front-to-back voltage amplitude ratio of the corresponding single channel;
[0306] The front-to-back voltage amplitude ratios of the individual channels corresponding to the N channels are concatenated to obtain the front-to-back voltage amplitude ratios with a dimension of N×M; or,
[0307] If the local feature to be extracted is the window voltage mean, the second local feature extraction method is used to perform the following operations on the first channel of the N channels to extract the local feature:
[0308] From the first channel of the N channels, traverse the corrected sleep brain wave signal of length M with a first preset window width and a first preset moving step length, calculate the average voltage value of the window until traversing to the position corresponding to M-TL+1, and obtain the average voltage value of the window to be filled, TL is the window;
[0309] Obtaining the voltage mean of the window to be filled and a second filling method;
[0310] Based on the second filling method, the window voltage mean to be filled is filled to obtain the window voltage mean of the corresponding single channel;
[0311] For the other N-1 channels, the same operation is performed in turn using the second local feature extraction method to obtain the window voltage mean of the corresponding single channel;
[0312] The window voltage means of the single channels corresponding to the N channels are concatenated to obtain the window voltage means with a dimension of N×M; or,
[0313] If the local feature to be extracted is the standard deviation of the window voltage value, the third local feature extraction method is used to perform the following operations on the first channel of the N channels to extract the local feature:
[0314] From the first channel of the N channels, traverse the corrected sleep brain wave signal of length M with a second preset window width and a second preset moving step length, calculate the standard deviation of the window voltage value, until traversing to the position corresponding to M-TL+1, and obtain the standard deviation of the window voltage value to be filled, TL is the window;
[0315] Obtain the standard deviation of the voltage value of the window to be filled and the third filling method;
[0316] Based on the third filling method, the standard deviation of the window voltage value to be filled is filled to obtain the standard deviation of the window voltage value of the corresponding single channel;
[0317] For the other N-1 channels, the same operation is performed in turn using the third local feature extraction method to obtain the standard deviation of the window voltage value of the corresponding single channel;
[0318] The standard deviations of the window voltage values of the individual channels corresponding to the N channels are concatenated to obtain the standard deviations of the window voltage values with a dimension of N×M; or,
[0319] If the local feature to be extracted is the window zero-crossing rate, the fourth local feature extraction method is used to perform the following operations on the first channel of the N channels to extract the local feature:
[0320] From the first channel of the N channels, traverse the corrected sleep brain wave signal of length M with a third preset window width and a third preset moving step length, calculate the zero-crossing rate of the window until traversing to the position corresponding to M-TL+1, and obtain the zero-crossing rate of the window to be filled, the zero-crossing rate of the window refers to the ratio of the voltage waveform in the window passing through zero, TL is the window;
[0321] Obtain the zero-crossing rate of the window to be filled and the fourth filling method;
[0322] Based on the fourth filling method, the zero-crossing rate of the window to be filled is filled to obtain the zero-crossing rate of the window of the corresponding single channel;
[0323] For the other N-1 channels, the same operation is performed in sequence using the fourth local feature extraction method to obtain the window zero-crossing rate of the corresponding single channel;
[0324] The window zero-crossing rates of a single channel corresponding to N channels are concatenated to obtain a window zero-crossing rate with a dimension of M×M; or,
[0325] If the local feature to be extracted is a window derivative, the fifth local feature extraction method is used to perform the following operations on the first channel of the N channels to extract the local feature:
[0326] Traverse the corrected sleep EEG signal of length M from the first point of the first channel of N channels, calculate the derivative of the voltage amplitude at this position and the voltage amplitude at the next position, until traversing to the position corresponding to M-1, and obtain the derivative of the window to be filled;
[0327] Get the derivative of the window to be filled and the fifth filling method;
[0328] Based on the fifth filling method, the window derivative to be filled is filled to obtain the window derivative of the corresponding single channel;
[0329] For the other N-1 channels, the same operation is performed in turn using the fifth local feature extraction method to obtain the window derivative of the corresponding single channel;
[0330] The window derivatives of a single channel corresponding to N channels are concatenated to obtain a window derivative with a dimension of N×M.
[0331] In some implementations of the embodiments of the present invention, the feature extraction module 503 is used to:
[0332] Acquire multiple global feature extraction methods for performing global feature extraction, the multiple global feature extraction methods including: a first global feature extraction method, a second global feature extraction method, and a third global feature extraction method;
[0333] Based on any one of a plurality of global feature extraction methods, global feature extraction is performed on the corrected sleep EEG signal to obtain corresponding global features.
[0334] In some implementations of the embodiments of the present invention, the feature extraction module 503 is specifically used to:
[0335] If the global feature to be extracted is the voltage mean difference, the first global feature extraction method is adopted, and the following operations are performed on the first channel of the N channels to extract the global feature:
[0336] Traverse the corrected sleep EEG signal of length M from the first point of the first channel of N channels, calculate the difference between the voltage amplitude at the current position and the voltage average value of the channel, until traversing to the position corresponding to M, and obtain the voltage mean difference of a single channel;
[0337] For the other N-1 channels, the same operation is performed in turn using the first global feature extraction method to obtain the voltage mean difference of the corresponding single channel;
[0338] The voltage mean differences of the individual channels corresponding to the N channels are concatenated to obtain a voltage mean difference with a dimension of N×M; or,
[0339] If the global feature to be extracted is the voltage median difference, the second global feature extraction method is used to perform the following operations on the first channel of the N channels to extract the global feature:
[0340] Traverse the corrected sleep EEG signal of length M from the first point of the first channel of the N channels, calculate the difference between the voltage amplitude at the position and the median voltage of the channel, until traversing to the position corresponding to M, and obtain the median voltage difference of a single channel;
[0341] For the other N-1 channels, the same operation is performed in turn using the second global feature extraction method to obtain the voltage median difference of the corresponding single channel;
[0342] The voltage median differences of the individual channels corresponding to the N channels are concatenated to obtain the voltage median differences with a dimension of N×M; or,
[0343] If the global feature to be extracted is the voltage high-low ratio, the third global feature extraction method is used to perform the following operations on the first channel of the N channels to extract the global feature:
[0344] Traverse the corrected sleep EEG signal of length M from the first point of the first channel of N channels, calculate the voltage amplitude at the position, and the ratio of the distance between the maximum voltage of the channel and the minimum voltage of the channel, until traversing to the position corresponding to M, and obtain the voltage high-low ratio of a single channel;
[0345] For the other N-1 channels, the same operation is performed in turn using the third global feature extraction method to obtain the voltage high-low ratio of the corresponding single channel;
[0346] The voltage high-low ratios of individual channels corresponding to the N channels are concatenated to obtain a voltage high-low ratio with a dimension of N×M.
[0347] In some implementations of the embodiments of the present invention, the sleep staging device 500 based on sleep stage ratio provided by the embodiments of the present invention is based on the same inventive concept as the sleep staging method based on sleep stage ratio provided by the aforementioned embodiments of the present invention and has the same beneficial effects.
[0348] Example 3
[0349] An embodiment of the present invention provides a computer device, including a memory and a processor, wherein the processor is used to read instructions stored in the memory, and the instructions can execute a sleep staging method based on a sleep stage ratio in any of the above method embodiments.
[0350] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD ROM, optical storage, etc.) containing computer-usable program codes.
[0351] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0352] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0353] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0354] Example 4
[0355] This embodiment provides a computer-readable storage medium, wherein the computer storage medium stores computer-executable instructions, and the computer-executable instructions can execute a sleep staging method based on sleep stage ratio in any of the above method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid state drive (SSD), etc.; the storage medium can also include a combination of the above types of memories.
[0356] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the invention.
Claims
1. A sleep staging method based on sleep stage ratio, characterized in that: The method comprises: Obtain the original sleep EEG signal containing N channels and the corresponding sleep stage markers; Performing data preprocessing on the original sleep brain wave signal to obtain a corrected sleep brain wave signal and a continuous sleep stage mark; Performing local feature extraction based on the corrected sleep EEG signal to obtain corresponding local features; and performing global feature extraction based on the corrected sleep EEG signal to obtain corresponding global features; Inputting the corrected sleep EEG signal, the local features and the global features into an EEG signal segmentation model for processing, and outputting a rough sleep stage segmentation result; Based on the prior knowledge of sleep continuity, the coarse sleep staging segmentation result is corrected to obtain a locally corrected sleep staging result; The method of correcting the coarse sleep staging result based on the prior knowledge of sleep continuity to obtain a locally corrected sleep staging result includes: Acquire the sleep stage in a known state and the sleep stage in an observed state; and acquire a local correction matrix of the sleep stage; Based on the relationship between the known state and the observed state, selecting a plurality of correlation values of relevant positions in the local correction matrix of the sleep stage; Based on the multiple correlation values, compare multiple values of the observed state corresponding to each known state, and use the observed state corresponding to the maximum value as the next sleep stage result; Based on the next sleep stage result, obtaining the locally corrected sleep staging result; The locally corrected sleep staging result is corrected based on prior knowledge of sleep periodicity to obtain a globally corrected sleep staging result.
2. The sleep staging method according to claim 1, characterized in that: The step of correcting the locally corrected sleep staging result based on the prior knowledge of sleep periodicity to obtain a globally corrected sleep staging result includes: Obtain the standard ratio of each sleep stage in the sleep cycle; Get all the locally corrected sleep staging results, and perform the following operations on any locally corrected sleep staging result in a preset manner: When it is determined that the current window is not in the awake state, the proportion of each stage in the sleep cycle in the current window is calculated; Calculate the stage ratio of each sleep stage in the sleep cycle based on the stage proportion of each sleep stage in the sleep cycle in the current window and the standard ratio of each sleep stage in the sleep cycle; The sleep stage with the largest stage ratio among the sleep stages in the sleep cycle is used as the recognition result of the current window to perform correction processing on the sleep stages in the sleep cycle; The preset step length is used as the moving step length, and the same operation is performed in the preset manner until all the locally corrected sleep staging results are traversed to obtain the globally corrected sleep staging result.
3. The sleep staging method according to claim 1, characterized in that: The step of inputting the corrected sleep EEG signal, the local features and the global features into an EEG signal segmentation model for processing and outputting a rough sleep stage segmentation result includes: Constructing the EEG signal segmentation model, and repeatedly iteratively training the EEG signal segmentation model until the EEG signal segmentation model converges; constructing an input EEG signal based on the corrected sleep EEG signal, local features having the same length as the corrected sleep EEG signal, and global features; Inputting the input EEG signal and the continuous sleep stage marker into the EEG signal segmentation model for processing, and dividing the multiple sleep stages to which each signal point in the input EEG signal belongs; Based on the multiple sleep stages to which each signal point in the input EEG signal belongs, the coarse sleep staging segmentation result representing N channels is generated, where N is a positive integer greater than or equal to 2.
4. The sleep staging method according to claim 3, characterized in that: The step of constructing the EEG signal segmentation model and repeatedly iteratively training the EEG signal segmentation model until the EEG signal segmentation model converges includes: Acquire the corrected sleep EEG signal, the local features and the global features, wherein the local features include: the ratio of the voltage amplitude before and after, the window voltage mean, the window voltage value standard deviation, the window zero crossing rate and the window derivative; and the global features include: the voltage mean difference, the voltage median difference and the voltage high-low ratio; The corrected sleep EEG signal, all local features and all global features are spliced together to obtain the input EEG signal; Taking the input EEG signal as the input of the EEG signal segmentation model, constructing the EEG signal segmentation model, and outputting the coarse sleep stage segmentation results representing N channels; Initializing the weight parameters of the EEG signal segmentation model; Extracting features of the input EEG signal through a forward propagation algorithm, and predicting the sleep stage of the current stage based on the extracted features to obtain a prediction result; Based on the loss function of the EEG signal segmentation model, calculating the difference between the continuous sleep stage mark and the prediction result, and quantifying the difference as a loss value; Based on the chain-derivation rule back-propagation algorithm and Adam optimization algorithm, the weight parameters are subjected to gradient update processing; The EEG signal segmentation model updated by the weight parameters is repeatedly iterated and trained until the EEG signal segmentation model converges.
5. The sleep staging method according to claim 4, characterized in that: The extracting of local features based on the corrected sleep EEG signal to obtain corresponding local features includes: Acquire multiple local feature extraction methods for performing local feature extraction, wherein the multiple local feature extraction methods include: a first local feature extraction method, a second local feature extraction method, a third local feature extraction method, a fourth local feature extraction method, and a fifth local feature extraction method; Based on any one of the multiple local feature extraction methods, local feature extraction is performed on the corrected sleep brain wave signal to obtain corresponding local features.
6. The sleep staging method according to claim 5, characterized in that: The method of performing layout feature extraction on the corrected sleep EEG signal based on any one of the multiple local feature extraction methods to obtain corresponding local features includes: If the local feature to be extracted is the before-after voltage amplitude ratio, the first local feature extraction method is adopted to perform the following operation on the first channel of the N channels to extract the local feature: From the second point of the first channel of the N channels, traverse the corrected sleep brain wave signal with a length of M, calculate the ratio of the voltage amplitude of the previous position to the voltage amplitude of the next position of the current position, until traversing to the M-1 position, and obtain the voltage amplitude ratio before and after to be filled, where M is a positive integer greater than or equal to P, and P is a positive integer determined by multiplying the acquisition time by the sampling rate S; Obtaining the voltage amplitude ratio before and after the filling and the first filling mode; Based on the first filling mode, filling processing is performed on the front-to-back voltage amplitude ratio to be filled to obtain the front-to-back voltage amplitude ratio of the corresponding single channel; For the other N-1 channels, the same operation is performed in sequence using the first local feature extraction method to obtain the front-to-back voltage amplitude ratio of the corresponding single channel; The front-to-back voltage amplitude ratios of the individual channels corresponding to the N channels are concatenated to obtain the front-to-back voltage amplitude ratios with a dimension of N×M; or, If the local feature to be extracted is the window voltage mean, the second local feature extraction method is adopted to perform the following operations on the first channel of the N channels to extract the local feature: From the first channel of the N channels, traverse the corrected sleep brain wave signal with a length of M with a first preset window width and a first preset moving step length, calculate the average voltage value of the window until traversing to the position corresponding to M-TL+1, and obtain the average voltage value of the window to be filled, TL is the window; Obtaining the mean value of the voltage of the window to be filled and a second filling mode; Based on the second filling mode, filling processing is performed on the window voltage mean to be filled to obtain the window voltage mean of the corresponding single channel; For the other N-1 channels, the same operation is performed in sequence using the second local feature extraction method to obtain the window voltage mean of the corresponding single channel; The window voltage means of the single channels corresponding to the N channels are concatenated to obtain the window voltage means with a dimension of N×M; or, If the local feature to be extracted is the standard deviation of the window voltage value, the third local feature extraction method is adopted to perform the following operation on the first channel of the N channels to extract the local feature: From the first channel of the N channels, traverse the corrected sleep brain wave signal with a length of M with a second preset window width and a second preset moving step length, calculate the standard deviation of the window voltage value, until traversing to the position corresponding to M-TL+1, and obtain the standard deviation of the window voltage value to be filled, TL is the window; Obtaining a standard deviation of the voltage value of the window to be filled and a third filling method; Based on the third filling method, the standard deviation of the window voltage value to be filled is filled to obtain the standard deviation of the window voltage value of the corresponding single channel; For the other N-1 channels, the same operation is performed in sequence using the third local feature extraction method to obtain the window voltage value standard deviation of the corresponding single channel; The standard deviations of the window voltage values of the individual channels corresponding to the N channels are concatenated to obtain the standard deviations of the window voltage values with a dimension of N×M; or, If the local feature to be extracted is the window zero-crossing rate, the fourth local feature extraction method is adopted to perform the following operation on the first channel of the N channels to extract the local feature: From the first channel of the N channels, traverse the corrected sleep brain wave signal with a length of M with a third preset window width and a third preset moving step length, calculate the zero-crossing rate of the window until traversing to the position corresponding to M-TL+1, and obtain the zero-crossing rate of the window to be filled, wherein the zero-crossing rate of the window refers to the ratio of the voltage waveform in the window passing through zero, and TL is the window; Obtaining the zero-crossing rate of the window to be filled and a fourth filling method; Based on the fourth filling mode, the zero-crossing rate of the window to be filled is filled to obtain the zero-crossing rate of the window of the corresponding single channel; For the other N-1 channels, the same operation is performed in sequence using the fourth local feature extraction method to obtain the window zero-crossing rate of the corresponding single channel; The window zero-crossing rates of a single channel corresponding to N channels are concatenated to obtain a window zero-crossing rate with a dimension of N×M; or, If the local feature to be extracted is the window derivative, the fifth local feature extraction method is adopted to perform the following operation on the first channel of the N channels to extract the local feature: Traversing the corrected sleep brain wave signal of length M from the first point of the first channel of the N channels, calculating the derivative of the voltage amplitude at this position and the voltage amplitude at the next position, until traversing to the position corresponding to N-1, and obtaining the derivative of the window to be filled; Obtaining the window derivative to be filled and a fifth filling method; Based on the fifth filling method, the window derivative to be filled is filled to obtain the window derivative of the corresponding single channel; For the other N-1 channels, the same operation is performed in sequence using the fifth local feature extraction method to obtain the window derivative of the corresponding single channel; The window derivatives of a single channel corresponding to N channels are concatenated to obtain a window derivative with a dimension of N×M.
7. The sleep staging method according to claim 4, characterized in that: The extracting global features based on the corrected sleep EEG signal to obtain corresponding global features includes: Acquire multiple global feature extraction methods for performing global feature extraction, wherein the multiple global feature extraction methods include: a first global feature extraction method, a second global feature extraction method, and a third global feature extraction method; Based on any one of the multiple global feature extraction methods, global feature extraction is performed on the corrected sleep brain wave signal to obtain corresponding global features.
8. The sleep staging method according to claim 7, characterized in that: The extracting global features based on the corrected sleep EEG signal to obtain corresponding global features includes: If the global feature to be extracted is the voltage mean difference, the first global feature extraction method is adopted to perform the following operations on the first channel of the N channels to extract the global feature: Traversing the corrected sleep brain wave signal of length M from the first point of the first channel of the N channels, calculating the difference between the voltage amplitude at the current position and the voltage average value of the channel, until traversing to the position corresponding to M, and obtaining the voltage mean difference of a single channel; For the other N-1 channels, the same operation is performed in sequence using the first global feature extraction method to obtain the voltage mean difference of the corresponding single channel; The voltage mean differences of the individual channels corresponding to the N channels are concatenated to obtain a voltage mean difference with a dimension of N×M; or, If the global feature to be extracted is the voltage median difference, the second global feature extraction method is adopted to perform the following operations on the first channel of the N channels to extract the global feature: Traversing the corrected sleep brain wave signal of length M from the first point of the first channel of the N channels, calculating the difference between the voltage amplitude at the position and the median voltage of the channel, until traversing to the position corresponding to M, and obtaining the median voltage difference of a single channel; For the other N-1 channels, the same operation is performed in sequence using the second global feature extraction method to obtain the voltage median difference of the corresponding single channel; The voltage median differences of the individual channels corresponding to the N channels are concatenated to obtain the voltage median differences with a dimension of N×M; or, If the global feature to be extracted is the voltage high-low ratio, the third global feature extraction method is adopted to perform the following operations on the first channel of the N channels to extract the global feature: Traversing the corrected sleep brain wave signal of length M from the first point of the first channel of the N channels, calculating the voltage amplitude at the position and the ratio of the distance between the maximum voltage of the channel and the minimum voltage of the channel, until traversing to the position corresponding to M, obtaining the voltage high-low ratio of a single channel; For the other N-1 channels, the same operation is performed in sequence using the third global feature extraction method to obtain the voltage high-low ratio of the corresponding single channel; The voltage high-low ratios of individual channels corresponding to the N channels are concatenated to obtain a voltage high-low ratio with a dimension of N×M.
9. A sleep staging device based on sleep stage ratio, characterized in that: The device comprises: An acquisition module, used to acquire original sleep EEG signals containing N channels and corresponding sleep stage markers; A preprocessing module, used for performing data preprocessing on the original sleep brain wave signal to obtain a corrected sleep brain wave signal and a continuous sleep stage mark; A feature extraction module, configured to extract local features based on the corrected sleep EEG signal to obtain corresponding local features; and to extract global features based on the corrected sleep EEG signal to obtain corresponding global features; A segmentation module, used for inputting the corrected sleep EEG signal, the local features and the global features into an EEG signal segmentation model for processing, and outputting a rough sleep stage segmentation result; A local correction module, used for correcting the coarse sleep staging result based on prior knowledge of sleep continuity to obtain a locally corrected sleep staging result; The local correction module is specifically used for: The method of correcting the coarse sleep staging result based on the prior knowledge of sleep continuity to obtain a locally corrected sleep staging result includes: Acquire the sleep stage in a known state and the sleep stage in an observed state; and acquire a local correction matrix of the sleep stage; Based on the relationship between the known state and the observed state, selecting a plurality of correlation values of relevant positions in the local correction matrix of the sleep stage; Based on the multiple correlation values, compare multiple values of the observed state corresponding to each known state, and use the observed state corresponding to the maximum value as the next sleep stage result; Based on the next sleep stage result, obtaining the locally corrected sleep staging result; The global correction module is used to correct the locally corrected sleep staging result based on prior knowledge of sleep periodicity to obtain a globally corrected sleep staging result.
Citation Information
Patent Citations
Sleep staging method and system based on cloud platform
CN110327040A
Method and device for identifying rapid eye movement period in sleep period and storage medium
CN117503053A