An auxiliary diagnosis system for patients with consciousness disorders based on automatic sleep staging
By collecting and processing EEG data through polysomnography and combining it with improved deep learning technology, automatic sleep staging and auxiliary diagnosis of patients with impaired consciousness can be achieved, solving the problems of traditional diagnosis being time-consuming and labor-intensive and having a high misdiagnosis rate, and improving diagnostic efficiency and accuracy.
Patent Information
- Application Number
- CN202310455125.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-25
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2043-04-25
AI Technical Summary
In the existing technology, the sleep staging diagnosis of patients with consciousness disorders requires manual analysis by professional physicians, which is time-consuming and labor-intensive, has a high misdiagnosis rate, and is difficult to assist in the diagnosis of consciousness status efficiently and accurately.
Polysomnography was used to collect EEG data, which were preprocessed through re-referencing, bandpass filtering and independent component analysis. Combined with improved adaptive time-frequency domain feature selection and intra-frame and inter-frame long short-term memory neural network (LSTM), channel attention mechanism and inter-frame temporal attention layer were used for feature extraction and classification to achieve automatic sleep staging and auxiliary diagnosis of consciousness disorders.
It improves the efficiency and accuracy of automated analysis of sleep staging, can quickly and effectively assist in diagnosing the state of consciousness of patients with disorders of consciousness, provide a reference basis for clinical medicine, and reduce the misdiagnosis rate.
Smart Images

Figure CN116687422B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of deep learning and biomedicine, and in particular to an auxiliary diagnosis system for patients with consciousness disorders based on automatic sleep staging. Background Art
[0002] Disorders of consciousness, as a medical condition, manifest as decreased alertness, diminished or confused consciousness, and altered responses to environmental stimuli. Patients often experience reduced or absent self-protective reflexes and the ability to adapt to environmental changes, making them susceptible to various secondary injuries. Advances in critical care have significantly increased the number of patients surviving acute severe brain injury. While the majority of these patients recover from the subsequent coma within the first few days after injury, some permanently lose all brain function, while others progress to a state of "unresponsive lucidity" or a vegetative state. Those recovering from these states typically progress through distinct phases, such as a minimally conscious state, before reaching full or partial recovery. Therefore, assessing a patient's state of consciousness and providing targeted treatment based on this status is crucial for recovery.
[0003] Differential diagnosis between patients with VS and MCS is challenging, with a high misdiagnosis rate. The gold standard Coma Recovery Scale-Revised is the best behavioral assessment for diagnosing minimally conscious or vegetative states, but patients unable to follow commands due to motor impairment may be incorrectly diagnosed with a vegetative state. Consequently, misdiagnosis rates as high as 43% have been reported. Electroencephalography (EEG), a noninvasive, safe, and relatively convenient technique for recording brain activity, allows for the quantitative detection of changes and patterns in EEG signals associated with patients with impaired consciousness. Certain EEG features are signs of corticothalamic integrity, which is considered a primary foundation of lucid consciousness.
[0004] In 2020, the European Academy of Neurology published guidelines for the diagnosis of coma and other disorders of consciousness. These guidelines recommend investigating sleep patterns and using sleep staging analysis and statistical analysis as part of a complex multimodal diagnostic approach for disorders of consciousness. The guidelines also mention that EEG analysis using machine learning methods and artificial intelligence can be an additional factor in improving diagnostic accuracy. Furthermore, sleep neurophysiology, which has been thoroughly studied in healthy populations, indicates that sleep is associated with normal cognitive and emotional processes during wakefulness and contributes to memory consolidation, hormonal regulation, and immune system function. Therefore, restoring and maintaining circadian rhythms can help restore consciousness and improve the patient's overall physical condition.
[0005] Sleep staging was first proposed in 1968 as a useful tool for studying circadian rhythms and sleep patterns. Between 1968 and 2007, the only globally accepted macrostructure of sleep was the 1968 rules by Rechtschaffen and Kales (R&K). In May 2007, the American Academy of Sleep Research published the "Sleep and Event-Related Event Scoring Manual" for sleep stage classification, which superseded the R&K rules. The American Academy of Sleep Research divides sleep into three states: wakefulness (W), non-rapid eye movement (NREM), and rapid eye movement (REM). R&K divides NREM into four stages: S1, S2, S3, and S4, while the American Academy of Sleep Medicine divides it into three stages: N1, N2, and N3. These stages reflect light sleep (S1 and N1), medium to deep sleep (S2 and N2), and deep sleep (S3, S4, and N3), respectively.
[0006] Currently, sleep staging is a tedious and lengthy process typically performed by sleep specialists. Therefore, research into automated sleep staging technology has become increasingly important in recent years. Numerous studies have investigated automated sleep staging classification methods based on multiple signals, such as electroencephalograms (EEGs), electrooculograms (EOGs), and electromyograms (EMGs), or single-channel EEGs. Classification objectives are typically achieved through statistical rules and deep learning techniques. The former focuses on feature and classifier selection and does not require extensive training data, while the latter focuses on neural network inputs and structures and offers greater automation and reduced dependency compared to the former. Therefore, the use of deep learning strategies for automated sleep staging is of great significance. Summary of the Invention
[0007] The purpose of the present invention is to overcome the shortcomings and deficiencies of the existing technology and propose an auxiliary diagnosis system for patients with consciousness disorders based on automatic sleep staging. It overcomes the defect that traditional sleep staging diagnosis requires professional physicians to analyze the patient's sleep signals, which is time-consuming and laborious. The efficient automated analysis greatly improves the analysis efficiency and accuracy. At the same time, the sleep conditions of patients with consciousness disorders are analyzed to assist in the diagnosis of their consciousness conditions, providing a certain degree of reference basis for the classification diagnosis of patients with consciousness disorders in clinical medicine.
[0008] To achieve the above objectives, the present invention provides a technical solution: an auxiliary diagnosis system for patients with consciousness disorders based on automatic sleep staging, comprising:
[0009] The sleep EEG data acquisition module uses polysomnography to collect the original sleep EEG data of patients with impaired consciousness and marks the sleep EEG sequence segments of patients with impaired consciousness, that is, marking them once at a specified time;
[0010] The data preprocessing module uses re-referencing, band-pass filtering and independent component analysis to preprocess the data collected by the sleep EEG data acquisition module;
[0011] A feature extraction module is used to input the preprocessed data into the sleep staging network model to obtain the sleep staging results of patients with consciousness disorders, and summarize the sleep staging results as a feature matrix of the sleep staging results;
[0012] The consciousness disorder classification module is used to take the feature matrix of the sleep staging results as input and input it into the adaptive classification network model to make the final auxiliary diagnosis for patients with consciousness disorders.
[0013] Furthermore, the sleep EEG data acquisition module includes a polysomnography acquisition module for acquiring sleep data of patients with impaired consciousness using a polysomnography device and a sleep marking module for marking data of sleep EEG sequence segments of patients with impaired consciousness, wherein:
[0014] The polysomnography acquisition module uses a polysomnography to collect clinical data of multiple sleep EEG channels, and the storage formats include EDF, CSV, and XML formats. The collected sleep EEG includes 10 channels: electrooculogram channels: EOG1 and EOG2; mastoid reference electrodes: A1 and A2; and EEG channels: F3, F4, C3, C4, O1, and O2. During the experiment, test electrodes are placed at the test points according to the international 10-5 system standard. The data is uniformly sampled at 256 Hz, and the sampling time range is greater than 6 hours. EEG data consistent with patients with impaired consciousness is collected, including the removal of bad electrodes.
[0015] The sleep marking module uses 30 as the basic time unit for the collected sleep data of patients with impaired consciousness throughout the night, evaluates the data records collected by the polysomnography according to the international AASM standard, and gives sleep marks corresponding to the serial segments of sleep EEG signals every 30 seconds. It also conducts expert evaluation on the disputed segments to obtain a consistent result, and sets the result as the expert score.
[0016] Furthermore, the data preprocessing module performs the following operations:
[0017] a. Re-reference:
[0018] Re-referencing is to convert the reference of the recording electrode signal from a unipolar reference to a multipolar reference to reduce the correlation between signals; the average reference is used, that is, the average value of all electrode signals is used as the reference signal, and the formula is as follows:
[0019]
[0020] Where R i is the i-th sample value of the reference signal, N is the number of electrodes, S ij is the sample value of the jth electrode at the i-th moment; before averaging the reference, the DC component of the original signal needs to be removed;
[0021] b. Bandpass filtering:
[0022] Bandpass filtering refers to retaining the components within a specific frequency range in the signal while filtering out components at other frequencies. In sleep EEG signal processing, EEG data is bandpass filtered from 0.5 to 35 Hz. The bandpass filter used is a second-order Butterworth filter, and the formula is as follows:
[0023] y n =a0x n +a1x n-1 +a2x n-2 -b1y n-1 -b2y n-2
[0024] Where x n is the nth sample value of the original signal, y n is the nth sample value of the filtered signal, y n-1 is the n-1th sample value of the filtered signal, y n-2 is the n-2th sample value of the filtered signal, a0, a1, a2 are the filter coefficients, b1, b2 are the filter coefficients;
[0025] c. Independent Component Analysis:
[0026] Independent component analysis is a signal processing method that can be used to separate and reduce the dimensionality of multi-channel EEG signals to extract potential independent components. Its basic idea is to regard multi-channel signals as multiple linear mixed components and decompose the mixed signals into multiple independent components by solving a system of linear equations. The formula is:
[0027] X=AS
[0028] Where X is the mixed signal matrix, A is the mixing matrix, and S is the source signal matrix. By solving matrices A and S, independent component signals can be obtained, thereby performing signal analysis and feature extraction.
[0029] Furthermore, in the feature extraction module, the input data is downsampled to 100 Hz using a downsampling method. According to the sampling rule, the 30-second sleep EEG signal corresponding to each sleep marker contains 3000 sampling points;
[0030] The sleep staging network model includes an improved adaptive time-frequency domain feature selection module and an improved intra-frame and inter-frame long short-term memory neural network LSTM. The details are as follows:
[0031] The improved adaptive time-frequency domain feature selection module has a dual-branch structure, which includes time-domain feature extraction and frequency-domain feature extraction. Furthermore, a channel attention mechanism module is added to the dual-branch structure, enabling the structure to quickly converge to effective time-frequency domain features during model training and prediction.
[0032] The time domain feature extraction and frequency domain feature extraction are performed by using a small convolution kernel of Fs / 2 with a step size of Fs / 16 to extract the time domain features in each sequence segment Input_signal representing a sleep EEG signal, and using a large convolution kernel of Fs×4 with a step size of Fs / 2 to extract the frequency domain features in the sequence segment, where Fs represents the sampling rate of the EEG signal; then, a regularization technique, a Dropout layer, is used to randomly inactivate neurons in the neural network at a set ratio to reduce the risk of overfitting of the neural network; the extracted time domain and frequency domain features are again subjected to a convolution layer to extract more feature combinations, and a maximum pooling layer, Maxpooling, is used to extract the most significant features, thereby reducing the dimension of the feature map and reducing the amount of computation;
[0033] The channel attention mechanism module consists of a channel attention module and a feature rescaling module. The channel attention module is a mechanism based on global pooling. It uses a global average pooling layer to calculate the data in the input format of (B×L×C). The output result is used to calculate the importance of each channel, where B represents the number of input data per batch during the neural network training process, L represents the length of the data in the matrix form during the neural network calculation process, and C represents the number of features during the neural network calculation process. For each channel, a global feature descriptor is obtained by globally pooling the feature map of the channel. Then, the global feature descriptor is input into a network containing two global features. In the multi-layer perceptron of the connection layer, in order to obtain a channel weight, the first fully connected layer uses dimensionality reduction to compress the representation of the feature descriptor. The degree of compression is expressed as: (C / ratio), where C represents the number of features in the neural network calculation process, and ratio represents the degree of compression of the fully connected layer, and its value needs to be divisible by C; the second fully connected layer uses dimensionality reduction to restore the compressed representation in dimension. The restored dimension is the dimension of the input data, and its size should be consistent with the number of features C in the above neural network calculation process; finally, the weight is multiplied by each channel in the feature map to obtain a weighted feature map, which is expressed as follows:
[0034] X SE =FC(GAP(x))
[0035] In the formula, x represents the input feature map, GAP represents global average pooling, FC represents the fully connected layer, and X SE represents the obtained weighted feature map;
[0036] The feature rescaling module is used to rescale the feature response of each channel in the feature map; it uses the learned channel weights to adjust the feature response of each channel to enhance useful information and suppress useless information. The formula is expressed as:
[0037] y=σ(W2δ(W1X SE ))
[0038] Where y represents the feature map obtained after the channel attention module and the feature rescaling module; δ represents the activation function ReLU, W1 and W2 represent the weights of the fully connected layer, and σ represents the sigmoid function;
[0039] The improved intra-frame and inter-frame long short-term memory (LSTM) neural network comprises: an intra-frame and inter-frame cascaded LSTM network structure and an inter-frame temporal attention layer; LSTM is a recurrent neural network whose basic principle is to allow the network to learn long-term dependencies based on the input and the previous state of the network by selectively retaining or forgetting information at each time step;
[0040] The LSTM network structure consists of three gates:
[0041] ① Forget gate: determines how much of the previous state to forget;
[0042] ② Input gate: determines how much new input to retain;
[0043] ③ Output gate: determines how many unit states to output;
[0044] The calculation formula is as follows:
[0045] Calculate the forget gate activation:
[0046] f t =σ(W f [h t-1 ,x t ]+b f )
[0047] Where, f t is the calculation result of the forget gate, σ is the sigmoid function, W f and b f is the weight matrix and bias vector of the forget gate, h t-1 and x t is the previous hidden state and the current input;
[0048] Compute input gate activation:
[0049] i t =σ(W i [h t-1 ,xt ]+b i )
[0050] Where i t is the result of the input gate calculation, σ is the sigmoid function, W i and b i is the weight matrix and bias vector of the input gate, h t-1 and x t is the previous hidden state and the current input;
[0051] Compute candidate activations:
[0052]
[0053] Where, is the candidate activation calculation result, tanh is the tanh function, W c and b c is the weight matrix and bias vector of the candidate activation, h t-1 and x t is the previous hidden state and the current input;
[0054] Update unit status:
[0055]
[0056] Where C t To update the unit status result, C t-1 is the previous update unit state, f t is the calculation result of the forget gate, i t is the result of the input gate calculation, is the candidate activation calculation result;
[0057] Compute the output gate activation:
[0058] o t =σ(W o [h t-1 ,x t ])+b o
[0059] In the formula, o t is the output gate activation result, σ is the sigmoid function, W o and b o is the weight matrix and bias vector of the output gate, h t-1 and x t is the previous hidden state and the current input;
[0060] Update hidden state:
[0061] h t =o ttanh(C t )
[0062] Where h t is the output at time step t, o t is the output gate activation result, C t To update the unit state result, tanh is the tanh activation function;
[0063] The inter-frame temporal attention layer introduces an attention mechanism into the inter-frame temporal network, thereby improving the model's attention to the input sequence and modeling capabilities, thereby better capturing the key information in the input sequence. Adding an inter-frame temporal attention layer at each time step enables the model to adaptively focus on different input elements based on the input of the current time step. The following is the formula of the attention mechanism:
[0064] ⅰ、Define the attention score e t,i , its formula is expressed as:
[0065] e t,i =score(h t ,x i )
[0066] Where score is the scaled dot product similarity function, x i represents the i-th element in the input sequence, h t is the result of updating the hidden state at the current time step t;
[0067] ⅱ、Calculate attention weight α t,i , indicating that the model needs to pay attention to the i-th element x in the input sequence at the current time step t i The degree of, the formula is:
[0068]
[0069] Where n is the length of the input sequence, e t,i is the attention score of the i-th element in the input sequence at time step t, exp(e t,i ) is expressed as e t,i Take the exponential form, e t,j is the attention score of the jth element in the input sequence at time step t, exp(e t,j ) is expressed as e t,j Take the exponential form;
[0070] iii. Set the attention weight α t,i The input element x at time step t needs to focus on the i-th element in the input sequence i Weighted summation to obtain the weighted input c of the current time step t t :
[0071]
[0072] ⅳ. In the intra-frame and inter-frame cascade LSTM network structure, the output h of the current time step t is converted to t After the tanh activation function, the output of the complete temporal network with attention mechanism is obtained The formula is:
[0073]
[0074] Where W h is the weight matrix, b is the bias term, tanh is the tanh activation function, is the output of the temporal network with attention mechanism.
[0075] Furthermore, in the consciousness disorder classification module, the characteristic matrix of the sleep staging result of the sleep staging network model is the temporal representation data matrix of the inter-frame temporal attention layer, that is,
[0076] The adaptive classification network model includes a fully connected layer and a Softmax classification layer; the fully connected layer uses the upper layer time series representation data matrix As input, Combine them to form a higher-level feature representation, and pass it to the Softmax classification layer for classification. The formula is as follows:
[0077]
[0078] In the formula, softmax is the Softmax function, FC represents the fully connected layer, is the output of the temporal network with attention mechanism, y t The final probability distribution is used to determine which category the input sample belongs to.
[0079] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0080] 1. The present invention uses a channel attention mechanism module, which can effectively and quickly learn the importance of each feature channel, improve the model's expressiveness and characterization capabilities, and significantly improve the network's performance without increasing the network's complexity.
[0081] 2. Based on an improved intra-frame and inter-frame long short-term memory neural network (LSTM) structure, the present invention simulates sleep experts to perform automatic sleep staging, which not only enhances the accuracy of the sleep staging network model but also enhances the interpretability of the model.
[0082] 3. Conduct auxiliary diagnostic research on patients with impaired consciousness from the perspective of sleep patterns. By observing the sleep patterns of patients with impaired consciousness, medical personnel can discover the pathological causes of the patients and provide reference directions for the patients' prognosis. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] Figure 1 Schematic diagram of the relationship between multiple modules of the system of the present invention.
[0084] Figure 2 Schematic diagram of the channel attention of the system of the present invention; in the figure, B represents the number of input data in each batch during the neural network training process, L represents the length of the data in matrix form during the neural network calculation process, C represents the number of features during the neural network calculation process, GAP represents global average pooling, FC represents the fully connected layer, ratio represents the degree of compression of the fully connected layer, and its value needs to be divisible by C, ReLU is the ReLU function, and sigmoid is the sigmoid function.
[0085] Figure 3 This is a structural schematic diagram of the automatic sleep staging network model of the system of the present invention based on the temporal attention mechanism, and its application in auxiliary diagnosis of patients with consciousness disorders; in the figure, Sequence_length represents the number of sleep EEG signal sequence fragments, Input_signal represents each sleep EEG signal sequence fragment, i is the sequence fragment order number, Conv represents the convolution operation of the convolutional neural network, Fs represents the sampling rate of the EEG signal, Dropout represents the Dropout layer in the neural network, a regularization technique for preventing overfitting, Maxpooling represents the maximum pooling layer in the neural network, SE_Block is the channel attention mechanism module, LSTM represents a long short-term memory neural network, and its connection form represents the effects on intra-frame signals and inter-frame signals respectively, and Softmax represents the softmax layer in the neural network. DETAILED DESCRIPTION
[0086] The present invention will be further described below with reference to specific embodiments.
[0087] This embodiment discloses an auxiliary diagnosis system for patients with consciousness disorders based on automatic sleep staging. It is an auxiliary diagnosis system for sequential attention developed in Python and can be run on Windows devices. The relationship between the various modules of the system is as follows: Figure 1 As shown, the framework of the network structure is as follows Figure 2 As shown, it includes:
[0088] The sleep EEG data acquisition module uses a polysomnogram to collect the original sleep EEG data of patients with impaired consciousness, and marks the sleep EEG sequence segments of patients with impaired consciousness every 30 seconds.
[0089] The data preprocessing module uses re-referencing, band-pass filtering and independent component analysis to preprocess the data collected by the sleep EEG data acquisition module;
[0090] A feature extraction module is used to input the preprocessed data into the sleep staging network model to obtain the sleep staging results of patients with consciousness disorders, and summarize the sleep staging results as a feature matrix of the sleep staging results;
[0091] The consciousness disorder classification module is used to take the feature matrix of the sleep staging results as input and input it into the adaptive classification network model to make the final auxiliary diagnosis for patients with consciousness disorders.
[0092] Specifically, the sleep EEG data acquisition module includes a polysomnography acquisition module for collecting sleep data of patients with impaired consciousness using a polysomnography device and a sleep marking module for marking data of sleep EEG sequence segments of patients with impaired consciousness, wherein:
[0093] The polysomnography acquisition module uses a polysomnography to collect clinical data of multiple sleep EEG channels, and the storage formats include EDF, CSV, and XML formats. The collected sleep EEG includes 10 channels: electrooculogram channels: EOG1 and EOG2; mastoid reference electrodes: A1 and A2; and EEG channels: F3, F4, C3, C4, O1, and O2. During the experiment, test electrodes are placed at the test points according to the international 10-5 system standard. The data is uniformly sampled at 256 Hz, and the sampling time range is greater than 6 hours. EEG data consistent with patients with impaired consciousness is collected, including the removal of bad electrodes.
[0094] The sleep marking module uses 30 as the basic time unit for the collected sleep data of patients with impaired consciousness throughout the night, evaluates the data records collected by the polysomnography according to the international AASM standard, and gives sleep marks corresponding to the serial segments of sleep EEG signals every 30 seconds. It also conducts expert evaluation on the disputed segments to obtain a consistent result, and sets the result as the expert score.
[0095] Specifically, the data preprocessing module performs the following operations:
[0096] a. Re-reference:
[0097] Re-referencing is the process of converting the reference of the recording electrode signal from a unipolar reference, such as the earlobe reference, to a multipolar reference to reduce the correlation between signals. A common method is average reference, which uses the average of all electrode signals as the reference signal. The formula is as follows:
[0098]
[0099] Among them, R iis the i-th sample value of the reference signal, N is the number of electrodes, S ij is the sample value of the jth electrode at the i-th moment; before averaging the reference, the DC component of the original signal needs to be removed;
[0100] b. Bandpass filtering:
[0101] Bandpass filtering refers to retaining the components within a specific frequency range in the signal and filtering out components of other frequencies. In sleep EEG signal processing, EEG data is bandpass filtered from 0.5 to 35 Hz. The bandpass filter used is a second-order Butterworth filter, and the formula is as follows:
[0102] y n =a0x n +a1x n-1 +a2x n-2 -b1y n-1 -b2y n-2
[0103] Among them, x n is the nth sample value of the original signal, y n is the nth sample value of the filtered signal, y n-1 is the n-1th sample value of the filtered signal, y n-2 is the n-2th sample value of the filtered signal, a0, a1, a2 are the filter coefficients, b1, b2 are the filter coefficients;
[0104] c. Independent Component Analysis:
[0105] Independent component analysis is a signal processing method that can be used to separate and reduce the dimensionality of multi-channel EEG signals to extract potential independent components. Its basic idea is to regard multi-channel signals as multiple linear mixed components and decompose the mixed signals into multiple independent components by solving a system of linear equations. The formula for independent component analysis is:
[0106] X=AS
[0107] Among them, X is the mixed signal matrix, A is the mixing matrix, and S is the source signal matrix. By solving matrices A and S, independent component signals can be obtained, thereby performing signal analysis and feature extraction.
[0108] Specifically, in the feature extraction module, the input data is downsampled to 100 Hz using a downsampling method. According to the sampling rule, the 30-second sleep EEG signal corresponding to each sleep mark contains 3000 sampling points;
[0109] like Figure 3As shown, the sleep staging network model includes: an improved adaptive time-frequency domain feature selection module and an improved intra-frame and inter-frame long short-term memory neural network LSTM, the details of which are as follows:
[0110] The improved adaptive time-frequency domain feature selection module has a dual-branch structure, which includes time-domain feature extraction and frequency-domain feature extraction. Furthermore, a channel attention mechanism module is added to the dual-branch structure, enabling the structure to quickly converge to effective time-frequency domain features during model training and prediction.
[0111] The time domain feature extraction and frequency domain feature extraction are performed by using a small convolution kernel of Fs / 2 with a step size of Fs / 16 to extract the time domain features in each sequence segment representing a sleep EEG signal sequence segment Input_signal, and using a large convolution kernel of Fs×4 with a step size of Fs / 2 to extract the frequency domain features in the sequence segment, where Fs represents the sampling rate of the EEG signal; then, a regularization technique, a Dropout layer, is used to randomly inactivate neurons in the neural network at a ratio of 0.2 to reduce the risk of overfitting of the neural network; the extracted time domain and frequency domain features are again subjected to a convolution layer to extract more feature combinations, and a maximum pooling layer, Maxpooling, is used to extract the most significant features, thereby reducing the dimension of the feature map and reducing the amount of computation;
[0112] The channel attention mechanism module corresponds to Figure 3 The SE_Block module in , which consists of a channel attention module and a feature rescaling module, the specific details are as follows Figure 2 As shown, the channel attention module is a mechanism based on global pooling, which uses the global average pooling layer to calculate the data with the input format of (B×L×C), where B represents the number of input data per batch during the neural network training process, L represents the length of the matrix form of the data during the neural network calculation process, and C represents the number of features during the neural network calculation process. The global average pooling layer is Figure 2 The output of the GAP module in the representation is used to calculate the importance of each channel; for each channel, a global feature descriptor is obtained by global pooling the feature map of the channel; then, the global feature descriptor is input into a multi-layer perceptron containing two fully connected layers to obtain a channel weight, where the fully connected layer is Figure 2The FC module in the first fully connected layer uses dimensionality reduction to compress the representation of the feature descriptor. The main compression degree is expressed as: (C / ratio), where C represents the number of features in the neural network calculation process, and ratio represents the compression degree of the fully connected layer, and its value needs to be divisible by C. The second fully connected layer uses dimensionality reduction to restore the compressed representation in terms of dimension. The restored dimension is the input data, and its size should be consistent with the number C of features in the above neural network calculation process. Finally, the weight is multiplied by each channel in the feature map to obtain a weighted feature map, which is expressed as follows:
[0113] X SE =FC(GAP(x))
[0114] In the formula, x represents the input feature map, GAP represents global average pooling, FC represents the fully connected layer, and X SE represents the obtained weighted feature map;
[0115] The feature rescaling module is used to rescale the feature response of each channel in the feature map; it uses the learned channel weights to adjust the feature response of each channel to enhance useful information and suppress useless information. The formula is expressed as:
[0116] y=σ(W2δ(W1X SE ))
[0117] Where y represents the feature map obtained after the channel attention module and the feature rescaling module; δ represents the activation function ReLU, W1 and W2 represent the weights of the fully connected layer, and σ represents the sigmoid function;
[0118] like Figure 3 As shown, the improved intra-frame and inter-frame long short-term memory neural network LSTM includes: an intra-frame and inter-frame cascaded LSTM network structure and an inter-frame temporal attention layer; LSTM is a recurrent neural network whose basic principle is to allow the network to learn long-term dependencies based on the input and the previous state of the network by selectively retaining or forgetting information at each time step;
[0119] The LSTM network structure consists of three gates:
[0120] ① Forget gate: determines how much of the previous state to forget;
[0121] ② Input gate: determines how much new input to retain;
[0122] ③ Output gate: determines how many unit states to output;
[0123] The calculation formula is as follows:
[0124] Calculate the forget gate activation:
[0125] f t =σ(W f [h t-1 ,x t ]+b f )
[0126] Where, f t is the calculation result of the forget gate, σ is the sigmoid function, W f and b f is the weight matrix and bias vector of the forget gate, h t-1 and x t is the previous hidden state and the current input;
[0127] Compute input gate activation:
[0128] i t =σ(W i [h t-1 ,x t ]+b i )
[0129] Where i t is the result of the input gate calculation, σ is the sigmoid function, W i and b i is the weight matrix and bias vector of the input gate, h t-1 and x t is the previous hidden state and the current input;
[0130] Compute candidate activations:
[0131]
[0132] Where, is the candidate activation calculation result, tanh is the tanh function, W c and b c is the weight matrix and bias vector of the candidate activation, h t-1 and x t is the previous hidden state and the current input;
[0133] Update unit status:
[0134]
[0135] Where C t To update the unit status result, C t-1 is the previous update unit state, f t is the calculation result of the forget gate, i t is the result of the input gate calculation, is the candidate activation calculation result;
[0136] Compute the output gate activation:
[0137] o t =σ(W o [h t-1 ,x t ])+b o
[0138] In the formula, o t is the output gate activation result, σ is the sigmoid function, W o and b o is the weight matrix and bias vector of the output gate, h t-1 and x t is the previous hidden state and the current input;
[0139] Update hidden state:
[0140] h t =o t tanh(C t )
[0141] Where h t is the output at time step t, o t is the output gate activation result, C t To update the unit state result, tanh is the tanh activation function;
[0142] like Figure 3 As shown in the figure, the inter-frame temporal attention layer introduces an attention mechanism into the inter-frame temporal network, thereby improving the model's attention to the input sequence and modeling ability, so as to better capture the key information in the input sequence; adding an inter-frame temporal attention layer at each time step enables the model to adaptively focus on different input elements according to the input of the current time step; the following is the formula of the attention mechanism:
[0143] ⅰ、Define the attention score e t,i , its formula is expressed as:
[0144] e t,i =score(h t ,x i )
[0145] Where score is the scaled dot product similarity function, x i represents the i-th element in the input sequence, h t is the result of updating the hidden state at the current time step t;
[0146] ⅱ、Calculate attention weight α t,i , indicating that the model needs to pay attention to the i-th element x in the input sequence at the current time step ti The degree of, the formula is:
[0147]
[0148] Where n is the length of the input sequence, e t,i is the attention score of the i-th element in the input sequence at time step t, exp(e t,i ) is expressed as e t,i Take the exponential form, e t,j is the attention score of the jth element in the input sequence at time step t, exp(e t,j ) is expressed as e t,j Take the exponential form;
[0149] iii. Set the attention weight α t,i The input element x at time step t needs to focus on the i-th element in the input sequence i Weighted summation to obtain the weighted input c of the current time step t t :
[0150]
[0151] ⅳ. In the intra-frame and inter-frame cascade LSTM network structure, the output h of the current time step t is converted to t After the tanh activation function, the output of the complete temporal network with attention mechanism is obtained The formula is:
[0152]
[0153] Where W h is the weight matrix, b is the bias term, tanh is the tanh activation function, is the output of the temporal network with attention mechanism.
[0154] Specifically, in the consciousness disorder classification module, the characteristic matrix of the sleep staging result of the sleep staging network model is the temporal representation data matrix of the inter-frame temporal attention layer, that is,
[0155] like Figure 3 As shown, the adaptive classification network model includes a fully connected layer and a Softmax classification layer; the fully connected layer uses the upper layer time series representation data matrix As input, Combine them to form a higher-level feature representation, and pass it to the Softmax classification layer for classification. The formula is as follows:
[0156]
[0157] In the formula, softmax is the Softmax function, FC represents the fully connected layer, is the output of the temporal network with attention mechanism, y t The final probability distribution is used to determine which category the input sample belongs to.
[0158] The above-described embodiments are only preferred embodiments of the present invention and are not intended to limit the scope of implementation of the present invention. Therefore, any changes made based on the shape and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. An auxiliary diagnosis system for patients with consciousness disorders based on automatic sleep staging, characterized in that: include: The sleep EEG data acquisition module uses polysomnography to collect raw sleep EEG data from patients with impaired consciousness and labels the sleep EEG sequence segments of patients with impaired consciousness; The data preprocessing module uses re-referencing, band-pass filtering and independent component analysis to preprocess the data collected by the sleep EEG data acquisition module; A feature extraction module is used to input the preprocessed data into the sleep staging network model to obtain the sleep staging results of patients with consciousness disorders, and summarize the sleep staging results as a feature matrix of the sleep staging results; The consciousness disorder classification module is used to input the feature matrix of the sleep staging results into the adaptive classification network model to make the final auxiliary diagnosis for patients with consciousness disorders; The sleep staging network model includes an improved adaptive time-frequency domain feature selection module and an improved intra-frame and inter-frame long short-term memory neural network LSTM, as follows: The improved adaptive time-frequency domain feature selection module is a dual-branch structure, which includes time domain feature extraction and frequency domain feature extraction. At the same time, a channel attention mechanism module is added to the dual-branch structure. The time domain feature extraction and frequency domain feature extraction are performed by each segment representing a sleep EEG signal sequence. ,use The small convolution kernel is The step size is used to extract the time domain features in the sequence fragments. The large convolution kernel is The step size of extracts the frequency domain features in the sequence fragment, where represents the sampling rate of the EEG signal; then, a regularization technique is used Layer, randomly inactivates neurons in the neural network in a set ratio; for the extracted time domain and frequency domain features, the convolution layer is used again to extract more feature combinations, and the maximum pooling layer is used Extract the most significant features; The channel attention mechanism module consists of a channel attention module and a feature rescaling module; for each channel, a global feature descriptor is obtained by globally pooling the feature map of the channel; Then, the global feature descriptor is input into a multi-layer perceptron consisting of two fully connected layers to obtain a channel weight. The first fully connected layer compresses the feature descriptor using dimensionality reduction. The degree of compression is expressed as follows: ,in Indicates the number of features in the neural network calculation process, Indicates the degree of compression of the fully connected layer, and its value can be The second fully connected layer uses the method of restoring the dimension to restore the compressed representation to the dimension of the input data, and its size should be the same as the number of features in the above neural network calculation process. Keep it consistent; finally, multiply the weight by each channel in the feature map to get the weighted feature map, which is expressed as: ; Where, represents the input feature map, represents global average pooling, represents the fully connected layer, represents the obtained weighted feature map; The feature rescaling module is used to rescale the feature response of each channel in the feature map; the learned channel weights are used to adjust the feature response of each channel to enhance useful information and suppress useless information. The formula is expressed as: ; Where, Represents the feature map obtained after the channel attention module and feature rescaling module; represents the activation function ReLU, and represents the weight of the fully connected layer, Represents the sigmoid function; The improved intra-frame and inter-frame long short-term memory neural network LSTM comprises: an intra-frame and inter-frame cascaded LSTM network structure and an inter-frame temporal attention layer; The inter-frame temporal attention layer introduces an attention mechanism into the inter-frame temporal network; Adding an inter-frame temporal attention layer at each time step enables the model to adaptively focus on different input elements based on the input of the current time step; The following is the formula for the attention mechanism: i. Define Attention Score , its formula is expressed as: ; Where, is the scaled dot product similarity function, Indicates the first elements, is the current time step The result of updating the hidden state; ii. Calculate attention weights , indicating that the model is at the current time step Pay attention to the first Elements The degree of, the formula is: ; Where, is the length of the input sequence, is the time step Pay attention to the first The attention score of each element, Expressed as a pair Take the exponential form, is the time step Pay attention to the first The attention score of each element, Expressed as a pair Take the exponential form; ⅲ、Attention weight With time steps Pay attention to the first Input elements of elements Weighted sum to get the current time step The weighted input : ; ⅳ、In the intra-frame and inter-frame cascade LSTM network structure, the current time step Output After the tanh activation function, the output of the complete temporal network with attention mechanism is obtained , the formula is: ; Where, is the weight matrix, is the bias term, is the tanh activation function, is the output of the temporal network with attention mechanism.
2. The auxiliary diagnosis system for patients with consciousness disorders based on automatic sleep staging according to claim 1, characterized in that: The sleep EEG data acquisition module includes a polysomnography acquisition module for collecting sleep data of patients with impaired consciousness using a polysomnography device and a sleep marking module for marking data of sleep EEG sequence segments of patients with impaired consciousness, wherein: The polysomnography acquisition module uses a polysomnography to collect clinical data of multiple sleep EEG channels, and the storage formats include EDF, CSV, and XML formats. The collected sleep EEG includes 10 channels: electrooculogram channels: EOG1 and EOG2; mastoid reference electrodes: A1 and A2; and EEG channels: F3, F4, C3, C4, O1, and O2. During the experiment, test electrodes are placed at the test points according to the international 10-5 system standard. The data is uniformly sampled at 256 Hz, and the sampling time range is greater than 6 hours. EEG data consistent with patients with impaired consciousness is collected, including the removal of bad electrodes. The sleep marking module uses 30 as the basic time unit for the collected sleep data of patients with impaired consciousness throughout the night, evaluates the data records collected by the polysomnography according to the international AASM standard, and gives sleep marks corresponding to the serial segments of sleep EEG signals every 30 seconds. It also conducts expert evaluation on the disputed segments to obtain a consistent result, and sets the result as the expert score.
3. The auxiliary diagnosis system for patients with consciousness disorders based on automatic sleep staging according to claim 2, characterized in that: The data preprocessing module performs the following operations: a. Re-reference: The average reference is used, that is, the average value of all electrode signals is used as the reference signal. The formula is as follows: ; Where, is the reference signal Sample values, is the number of electrodes, It is The moment The sample value of each electrode; before making an average reference, the DC component of the original signal needs to be removed; b. Bandpass filtering: In the sleep EEG signal processing, the EEG data is band-pass filtered from 0.5 to 35 Hz. The band-pass filter used is a second-order Butterworth filter, and the formula is as follows: ; Where, is the original signal Sample values, is the filtered signal Sample values, is the first Sample values, is the first Sample values, 、 、 are the filter coefficients, 、 are the filter coefficients; c. Independent Component Analysis: The formula is: ; Where, is a mixed signal matrix, is the mixing matrix, is the source signal matrix; by solving the matrix and , independent component signals can be obtained, thereby performing signal analysis and feature extraction.
4. The auxiliary diagnosis system for patients with consciousness disorders based on automatic sleep staging according to claim 3 is characterized in that: In the consciousness disorder classification module, the characteristic matrix of the sleep staging result of the sleep staging network model is the temporal representation data matrix of the inter-frame temporal attention layer, that is, ; The adaptive classification network model includes a fully connected layer and a Softmax classification layer; the fully connected layer uses the upper layer time series representation data matrix As input, Combine them to form a higher-level feature representation, and pass it to the Softmax classification layer for classification. The formula is as follows: ; Where, is the Softmax function, represents the fully connected layer, is the output of the temporal network with attention mechanism, The final probability distribution is used to determine which category the input sample belongs to.
Citation Information
Patent Citations
Automatic sleep staging method based on time sequence multi-scale mixed attention model
CN114129138A
Modulating wakefulness and arousal
GB202104315D0