A sleep staging method, system, device and medium

Sleep features are extracted in non-Euclidean space through graph convolution and attention mechanism convolutional neural network, which solves the problems of poor generalization ability and low accuracy of sleep staging in the existing technology, and achieves higher sleep staging. accuracy and stability.

CN115969329BActive Publication Date: 2024-08-30CHANGCHUN UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310094153.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-08
Publication Date
2024-08-30
Estimated Expiration
2043-02-08

AI Technical Summary

Technical Problem

The existing recurrent neural network (RNN) and convolutional neural network (CNN) have poor generalization ability in sleep staging, the accuracy of the algorithm for calculating sleep staging is low, and they can only extract the time domain and frequency domain in Euclidean space. The characteristics of EEG signals cannot accurately reflect the characteristics of the non-Euclidean space of the brain, and individual differences have a greater impact.

Method used

The graph convolutional neural network and the attention mechanism convolutional neural network are used for feature extraction. The graph convolutional network is used to construct an undirected graph to describe the EEG signal data structure. The attention mechanism convolutional network is used to extract global features, and the graph convolution and The attention mechanism outputs features to improve the accuracy of sleep staging.

Benefits of technology

It improves the accuracy and generalization ability of sleep staging, can extract deep information in non-Euclidean space, minimize the impact of individual differences, and achieve higher sleep staging accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115969329B
    Figure CN115969329B
Patent Text Reader

Abstract

The present application discloses a sleep staging method, system, device and medium, which are applied to the field of sleep staging. The method includes: obtaining physiological signals related to sleep; obtaining the first output feature of the physiological signal after feature extraction through a graph convolutional neural network; obtaining the second output feature of the physiological signal after feature extraction through an attention mechanism convolutional neural network; obtaining the feature fusion result after feature fusion of the first output feature and the second output feature; and obtaining the sleep staging result according to the feature fusion result. By adding a graph convolutional neural network for feature extraction, the problem that feature extraction can only be performed in Euclidean space is solved. At the same time, an attention mechanism convolutional neural network is added, and the global features are extracted using the attention mechanism, which minimizes the impact of local optimality caused by individual differences. Not only does it achieve the staging of sleep, but it also has a high accuracy rate for sleep staging.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of sleep staging, and in particular to a sleep staging method, system, device and medium. Background Art

[0002] With the improvement of living standards, more and more people pay attention to sleep quality, and the analysis of sleep quality has become more digital. Since EEG signals are essentially sequence signals, researchers currently use recurrent neural networks (RNN) to perform sleep staging by extracting time domain and frequency domain features, but RNN has the disadvantages of complex calculations and non-parallelism. Therefore, some researchers use convolutional neural networks (CNN) as the structure of autoencoders for sleep staging, which greatly reduces model parameters and improves performance.

[0003] The RNN and CNN currently used both extract EEG signal features in the time and frequency domains in Euclidean space. However, since the brain area is in non-Euclidean space, the sleep staging method described above is not accurate. In addition, the individual differences in sleep staging using RNN and CNN are greatly affected. These two neural networks rely on the feature space constructed by sleep experts. However, since different sleep classification systems require different sleep features, even the same sleep classification system has large differences in performance on different data sets and different channels, resulting in poor generalization ability and low accuracy of the sleep staging algorithm.

[0004] How to solve the problem that the current RNN and CNN used for sleep staging have poor generalization ability, the sleep staging algorithm has low accuracy and can only extract EEG signal features in the time domain and frequency domain in Euclidean space is an urgent problem to be solved by technicians in this field. Summary of the invention

[0005] The purpose of this application is to provide a sleep staging method, system, device and medium. By adding a graph convolutional neural network for feature extraction, the problem that feature extraction can only be performed in Euclidean space is solved. At the same time, an attention mechanism convolutional neural network is added, and the attention mechanism is used to extract global features, thereby minimizing the impact of local optimality caused by individual differences.

[0006] In order to solve the above technical problems, the present application provides a sleep staging method, comprising:

[0007] Obtain physiological signals related to sleep;

[0008] Calling the graph convolutional neural network and the attention mechanism convolutional neural network to obtain a first output feature corresponding to the graph convolutional neural network and a second output feature corresponding to the attention mechanism convolutional neural network;

[0009] Performing feature fusion on the first output feature and the second output feature to obtain a feature fusion result;

[0010] The sleep stage results are determined based on the feature fusion results.

[0011] Preferably, after obtaining the physiological signal related to sleep, the method further includes:

[0012] Perform sample enhancement processing on physiological signals.

[0013] Preferably, performing sample enhancement processing on the physiological signal includes:

[0014] Utilize d ni =d i +rand(0,1)×(d mi -d i ) synthesizing the physiological signals into a sample set;

[0015] where d ni is the i-th sample among the n samples in the sample set, d i For each individual sample, d mi is the i-th sample of the m nearest neighbors.

[0016] Preferably, calling the graph convolutional neural network to obtain a first output feature corresponding to the graph convolutional neural network includes:

[0017] Call the adjacency matrix and feature matrix;

[0018] The adjacency matrix and the feature matrix are used to extract the first graph convolution result through the first graph convolution layer;

[0019] The first graph convolution result is pooled through the graph pooling layer to obtain a pooling result;

[0020] Call the second graph convolution layer to extract the pooling result to obtain the second graph convolution result;

[0021] Obtain a readout result obtained by the readout layer reading out the second graph convolution result;

[0022] The readout result is perceived by a multi-layer perceptron to obtain a perception result;

[0023] Output the first output feature according to the perception result.

[0024] Preferably, calling the adjacency matrix includes:

[0025] use Construct the original adjacency matrix;

[0026] in is the constructed adjacency matrix, A is the original adjacency matrix, I is the unit matrix of the same dimension, and λ is a constant coefficient;

[0027] use Performing symmetric normalization processing on the constructed adjacency matrix;

[0028] in is the symmetric and normalized adjacency matrix, is the constructed adjacency matrix The degree matrix of .

[0029] Preferably, calling the attention mechanism convolutional neural network to obtain a second output feature corresponding to the attention mechanism convolutional neural network includes:

[0030] Obtaining a first sample set;

[0031] Calling the first convolution layer to extract the first sample set to obtain a first convolution result;

[0032] Using the first pooling layer to pool the first convolution result to obtain a first pooling result;

[0033] Obtain the processing result obtained by the discard layer on the first pooling result;

[0034] Call the second convolution layer to extract the processing result to obtain the second convolution result;

[0035] Convolving the second convolution result through the convolution attention module to obtain the attention convolution result;

[0036] Use the second pooling layer to pool the attention convolution result to obtain the second pooling result;

[0037] Output the second output feature according to the second pooling result.

[0038] Preferably, the convolution attention module includes: a channel attention function and a spatial attention function, calling the third convolution layer to process the second convolution result to obtain a third convolution result, including:

[0039] Use the channel attention function to perform one-dimensional convolution on the third convolution result to obtain the channel convolution result;

[0040] The spatial convolution result is obtained by performing two-dimensional convolution on the channel convolution result through the spatial attention function;

[0041] Output the attention convolution result based on the spatial convolution result.

[0042] Preferably, performing feature fusion on the first output feature and the second output feature to obtain a feature fusion result includes:

[0043] use

[0044] Performing feature fusion on the first output feature and the second output feature;

[0045] where y i is the final fusion feature, C is the number of categories of all training samples, and Softmax is the classification function.

[0046] In order to solve the above technical problems, the present application also provides a sleep staging system, including:

[0047] An acquisition module, used for acquiring physiological signals related to sleep;

[0048] A calling module, used to call the graph convolutional neural network and the attention mechanism convolutional neural network to obtain a first output feature corresponding to the graph convolutional neural network and a second output feature corresponding to the attention mechanism convolutional neural network;

[0049] A fusion module, used for performing feature fusion on the first output feature and the second output feature to obtain a feature fusion result;

[0050] The determination module is used to determine the sleep staging result according to the feature fusion result.

[0051] To solve the above technical problems, the present application also provides a sleep staging device, comprising a memory for storing a computer program;

[0052] The processor is used to implement the steps of the sleep staging method as described above when executing the computer program.

[0053] In order to solve the above technical problems, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the sleep staging method as described above are implemented.

[0054] The sleep staging method provided in the present application includes: obtaining physiological signals related to sleep; obtaining the first output feature of the physiological signal after feature extraction through a graph convolutional neural network; obtaining the second output feature of the physiological signal after feature extraction through an attention mechanism convolutional neural network; obtaining the feature fusion result after feature fusion of the first output feature and the second output feature; and obtaining the sleep staging result according to the feature fusion result. By adding a graph convolutional neural network for feature extraction, the problem that feature extraction can only be performed in Euclidean space is solved. At the same time, an attention mechanism convolutional neural network is added, and the global features are extracted using the attention mechanism, which minimizes the impact of local optimality caused by individual differences. Not only does it achieve the staging of sleep, but it also has a high accuracy rate for sleep staging. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0056] Figure 1 A flowchart of a sleep staging method provided in an embodiment of the present application;

[0057] Figure 2 A flowchart of the graph convolutional neural network provided in the embodiment of the present application;

[0058] Figure 3 A structural diagram of a graph convolutional neural network provided in an embodiment of the present application;

[0059] Figure 4 A flowchart of the attention mechanism convolutional neural network provided in the embodiment of the present application;

[0060] Figure 5 A structural diagram of the attention mechanism convolutional neural network provided in an embodiment of the present application;

[0061] Figure 6 A schematic diagram of the working of the convolutional attention module provided in the embodiment of the present application;

[0062] Figure 7 A schematic diagram of the working of the channel attention function provided in an embodiment of the present application;

[0063] Figure 8 A schematic diagram of the working of the spatial attention function provided in an embodiment of the present application;

[0064] Fig. 9 A structural diagram of a sleep staging system provided in an embodiment of the present application;

[0065] Fig.10 This is a structural diagram of the sleep staging device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0066] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0067] The core of this application is to provide a sleep staging method. By adding a graph convolutional neural network for feature extraction, it solves the problem that feature extraction can only be performed in Euclidean space. At the same time, an attention mechanism convolutional neural network is added, and the attention mechanism is used to extract global features, thereby minimizing the impact of local optimality caused by individual differences.

[0068] The operations of obtaining, calling, utilizing, and determining in the sleep staging method provided in the present application can be implemented by a controller in a host computer. For example, the controller can be a microcontroller unit (MCU). Of course, it can also be implemented by other controllers besides MCU, and the present application does not limit this.

[0069] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0070] Figure 1 A flowchart of the sleep staging method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0071] S10: Acquire physiological signals related to sleep.

[0072] Specifically, in this embodiment, the MCU collects and monitors the electroencephalogram (EEG) and electrooculogram (EOG) signals recorded during sleep. Both the EEG and EOG signals are sampled at 100 Hz, and then the sleep data for the whole night is divided into several data segments of 30 seconds per frame, and divided into: wakefulness (W), rapid eye movement (REM) and non-rapid eye movement (N) according to the sleep standards of the American Academy of Sleep Medicine (AASM). In the non-rapid eye movement period, as the sleep state goes from shallow to deep, it is further divided into three sleep stages, namely sleep stage I (N1), sleep stage II (N2), and sleep stage III (N3). It should be noted that the above sampling frequency and segmentation frequency can be set according to user needs, and are not specifically limited in this embodiment.

[0073] It can be seen that the MCU collects EEG signals and EOG signals related to sleep, and divides the collected physiological signals according to the AASM standard, thereby achieving an accurate division of the sleep process and enabling specific analysis of physiological signals at different periods.

[0074] S11: Call the graph convolutional neural network and the attention mechanism convolutional neural network to obtain a first output feature corresponding to the graph convolutional neural network and a second output feature corresponding to the attention mechanism convolutional neural network.

[0075] Specifically, since the currently used RNN and CNN both extract EEG signal features in the time domain and frequency domain in Euclidean space, but since the brain area is in non-Euclidean space, the sleep staging method is not accurate. In addition, the individual differences in sleep staging using RNN and CNN are greatly affected. These two neural networks rely on the feature space constructed by sleep experts. However, since the sleep features required by different sleep classification systems are not the same, even the same sleep classification system has large differences in performance in different data sets and different channels, resulting in poor generalization ability and low accuracy of the sleep staging algorithm. In this embodiment, a graph convolutional neural network and an attention mechanism convolutional neural network are used to convert the acquired physiological signals into the first output feature through the graph convolutional neural network and into the second output feature through the attention mechanism convolutional neural network. Among them, the graph convolutional neural network constructs the graph convolutional neural network structure by using an undirected graph. The undirected graph description formula is: G = (V, E), where G represents an undirected graph, V represents a node set, each node in the network represents an electrode channel, and E is a set of edges, which is used to represent the connection relationship between different nodes, where |V| = N, N is the number of nodes in the graph convolutional neural network (node), each node has a corresponding feature vector, and the features of N nodes constitute an N×D-dimensional feature matrix X, where D represents the number of features; A is used to represent the adjacency matrix of the graph convolutional neural network, which is an N×N-dimensional matrix formed based on the relationship between each node. X and A are the initial inputs of the model, and define the feature matrix X of each sample. i , determine the sleep stage y by X, where X represents X i The time background of y represents X i Sleep stage category label. The acquired physiological signals are feature extracted through the above graph convolutional neural network structure, and the extracted results are used as the first output feature. For the attention mechanism convolutional neural network, a convolutional neural network model based on the convolutional attention module (CBAM) is constructed. The convolutional block attention function is a lightweight attention algorithm for feedforward CNN. This function includes two sub-functions: channel attention function and spatial attention function. It generates attention maps from two different dimensions, channel and space, and multiplies the attention map with the input feature map bit by bit to perform adaptive feature optimization, and uses the optimized result as the second output feature.

[0076] It can be seen that by calling the graph convolutional neural network and the attention mechanism convolutional neural network, the first output feature corresponding to the graph convolutional neural network and the second output feature corresponding to the attention mechanism convolutional neural network are obtained. Since different areas of the brain are not in Euclidean space, the graph convolutional neural network is very suitable for describing the data structure of EEG signal characteristics and is used to extract deep information from physiological signal data. The attention mechanism convolutional neural network improves the influence of individual differences, adds channel attention functions and spatial attention functions, and optimizes the extracted features for output.

[0077] S12: Perform feature fusion on the first output feature and the second output feature to obtain a feature fusion result.

[0078] Specifically, in this embodiment, the first output feature and the second output feature are merged and connected, and then a Softmax classifier is used to perform sleep stage classification using the final sleep fusion feature as input.

[0079] S13: Determine a sleep staging result according to the feature fusion result.

[0080] Specifically, in this embodiment, the output feature fusion result is automatically judged by the MCU sleep staging, and indicators such as accuracy, precision, and recall are calculated until the model converges and the accuracy of the test set is stable.

[0081] It can be seen that the sleep staging method provided in this embodiment includes: obtaining physiological signals related to sleep; obtaining the first output feature of the physiological signal after feature extraction through a graph convolutional neural network; obtaining the second output feature of the physiological signal after feature extraction through an attention mechanism convolutional neural network; obtaining the feature fusion result after feature fusion of the first output feature and the second output feature; and obtaining the sleep staging result according to the feature fusion result. By adding a graph convolutional neural network for feature extraction, the problem that feature extraction can only be performed in Euclidean space is solved. At the same time, an attention mechanism convolutional neural network is added, and the global features are extracted using the attention mechanism, which minimizes the impact of local optimality caused by individual differences. Not only is the sleep staging achieved, but the accuracy of the sleep staging is also high.

[0082] Based on the above embodiment, as a preferred embodiment, after obtaining the physiological signal related to sleep, the method further includes:

[0083] Perform sample enhancement processing on physiological signals.

[0084] Specifically, in this embodiment, due to the large differences in the proportion of data duration in different sleep stages, and the data duration of different individuals in the same period also varies, when processing physiological signals, it is easy to cause sample imbalance and insufficient signal feature learning, which in turn leads to the problem of poor classification of sleep stages with few samples. Therefore, it is necessary to perform data enhancement processing on the physiological signal data and use the Borderline SMOTE algorithm for data enhancement to overcome the imbalance of sample data. The Borderline SMOTE algorithm is to combine the original minority sample set into a larger sample set so that the subsequent signal feature learning is more sufficient and effective.

[0085] It can be seen that the enhancement processing of physiological signals can expand the sample set of minority classes in physiological signals, ensure the balance of samples, and make signal feature learning more complete and effective.

[0086] Based on the above embodiment, as a preferred embodiment, performing sample enhancement processing on the physiological signal includes:

[0087] Utilize d ni =d i +rand(0,1)×(d mi -d i ) synthesizing the physiological signals into a sample set;

[0088] where d ni is the i-th sample among the n samples in the sample set, d i For each individual sample, d mi is the i-th sample of the m nearest neighbors.

[0089] Specifically, in this embodiment, for each minority class sample M i Use the K nearest neighbor algorithm to calculate the distance M from the entire data set i The distance calculation formula for the k nearest neighbor samples is:

[0090]

[0091] Where d(X,Y) is the Euclidean distance between two sample points, x i and iare two sample points in n-dimensional space. The samples are divided into safe samples, dangerous samples, and noise samples. More than 1 / 2 of the k nearest neighbor samples around the safe sample are minority class samples; more than 1 / 2 of the k nearest neighbor samples around the dangerous sample are majority class samples; and the k nearest neighbor samples around the noise sample are all majority class samples. Safe samples are samples in the minority class decision area and can be removed; dangerous samples may be near the decision boundary and will be retained; noise samples are very likely to be in the majority class decision area and need to be removed. For each dangerous sample d i , randomly select m nearest neighbors from its k nearest neighbors, randomly synthesize n new samples between these m nearest neighbor samples and the original dangerous samples, and incorporate the newly synthesized samples into the original samples to form a new sample set. ni =d i +rand(0,1)×(d mi -d i ) synthesizes physiological signals into sample sets; where d ni is the i-th sample among the n samples in the sample set, d i For each individual sample, d mi is the ith sample of the m nearest neighbors. Through the above processing, the minority class samples can be enhanced to provide better samples for the graph convolutional neural network and the attention mechanism convolutional neural network.

[0092] It can be seen that by enhancing the samples, the problem of large differences in the proportion of data duration in different sleep stages, which is easy to cause sample imbalance and insufficient signal feature learning, is overcome, providing better samples for graph convolutional neural networks and attention mechanism convolutional neural networks.

[0093] Based on the above embodiments, as a preferred embodiment, Figure 2 The structure diagram of the graph convolutional neural network provided in the embodiment of the present application is as follows: Figure 2 As shown, the graph convolutional neural network consists of 2 graph convolutional layers, 1 graph pooling layer, 1 readout layer and 1 multi-layer perceptron. The first output feature corresponding to the graph convolutional neural network obtained by calling the graph convolutional neural network includes:

[0094] S14: Call the adjacency matrix and feature matrix.

[0095] Specifically, in this embodiment, a feature matrix and an adjacency matrix are input as an input layer, and the input layer of a graph convolutional neural network is constructed by the feature matrix and the adjacency matrix.

[0096] S15: Use the adjacency matrix and the feature matrix to extract the first graph convolution result through the first graph convolution layer.

[0097] Specifically, in this embodiment, the convolution layer will perform three operations in sequence: convolution operation, batch normalization and function activation. The activation function uses ReLU function and Softmax function respectively, and the overall forward propagation formula is: Z = f(X, A), Z is the formula for forward propagation, X is the feature matrix, A is the adjacency matrix, is the constructed adjacency matrix, W (0) and W (1) are the weight matrices of each layer respectively, and ReLU is the ReLU function. The loss function is expressed using cross entropy. The loss function calculates the difference between the forward calculation result of each iteration of the neural network and the true value, thereby guiding the next step of training in the right direction. The loss function is calculated for all labeled nodes, and its expression is:

[0098]

[0099] L represents the loss function, y l is a set of node indices with labels, l represents the lth node, F represents the output feature, and Y lf Indicates the true state value of the label node, Z lf Indicates the predicted state value of the label node.

[0100] S16: Pooling the first graph convolution result through a graph pooling layer to obtain a pooling result.

[0101] Specifically, in this embodiment, the first graph convolution result is pooled by the graph pooling layer, which plays a role of downsampling, generating a deeper substructure, and the result after the pooling operation is smaller than its input. The introduction of the pooling layer is to reduce the dimension and abstract the visual input object in imitation of the human visual system, which can prevent overfitting to a certain extent.

[0102] S17: Call the second graph convolution layer to extract the pooling result to obtain the second graph convolution result.

[0103] Specifically, in this embodiment, a second graph convolution layer is used to convolve the pooling result to obtain a second graph convolution result.

[0104] S18: Obtain a readout result obtained by the readout layer from the second graph convolution result.

[0105] Specifically, the readout layer in this embodiment reads out the second graph convolution result to obtain a readout result, and the readout layer characterizes the final graph representation by reading the sum value of the hidden representation of the substructure.

[0106] S19: The readout result is perceived by a multilayer perceptron to obtain a perception result.

[0107] Specifically, in this embodiment, the multilayer perceptron perceives the readout result to obtain a perception result, and the graph data after a series of processing is converted into a feature vector by the multilayer perceptron as the final output feature of the graph convolutional neural network feature extraction module.

[0108] S20: Output a first output feature according to the perception result.

[0109] Specifically, in this embodiment, the first output feature is output according to the perception result as the output result of the graph convolutional neural network.

[0110] like Figure 3 As shown in the figure, the graph convolutional neural network includes a feature matrix X and an adjacency matrix A as an input layer, a first graph convolutional layer, a graph pooling layer, a second graph convolutional layer, a readout layer, and a multi-layer perceptron. The output result of each level enters the next level for processing, and the perception result obtained by the multi-layer perceptron outputs the first output feature as the output result of the graph convolutional neural network.

[0111] It can be seen that the graph convolutional neural network composed of 2 graph convolutional layers, 1 graph pooling layer, 1 readout layer and 1 multi-layer perceptron inputs the feature matrix and adjacency matrix in the input layer, extracts the high-level representation of the features through the graph convolutional layer, and performs downsampling operations through the graph pooling layer to generate a deeper substructure. The result is read through the readout layer to read the sum of the hidden representations of the substructure to characterize the final graph representation. Finally, the graph data after a series of processing is transformed into a feature vector through the multi-layer perceptron as the final output feature of the graph convolutional neural network feature extraction module.

[0112] Based on the above embodiment, as a preferred embodiment, calling the adjacency matrix includes:

[0113] use Construct the original adjacency matrix;

[0114] in is the constructed adjacency matrix, A is the original adjacency matrix, I is the identity matrix of the same dimension, and λ is a constant coefficient;

[0115] use Perform symmetric normalization on the constructed adjacency matrix;

[0116] in is a symmetric and normalized adjacency matrix, The constructed adjacency matrix The degree matrix of .

[0117] Specifically, in this embodiment, since the diagonal elements of the adjacency matrix are all 0, when it is multiplied with the feature matrix, it can only calculate the weighted sum of the features of each node and other adjacent nodes except itself, but the features of the node itself cannot participate in the calculation. In order to overcome the defect that the unit node features of the adjacency matrix cannot participate in the calculation, the reparameterization technique is used to add the unit matrix of the same dimension to construct the adjacency matrix Taking the λ value as 1, the importance of the node's own features is the same as the importance of its neighboring nodes. Unnormalized matrix Multiplying the feature matrix will change the original distribution of the features, so it is necessary to construct the adjacency matrix Standardization is performed. Using weighted average as a standardization strategy, giving lower-degree nodes a greater weight, weighted average will make lower-degree nodes have a greater impact on their neighboring nodes; while higher-degree nodes will have a smaller impact because their influence is dispersed to many neighboring nodes. First, construct the adjacency matrix The degree matrix The degree matrix is ​​a diagonal matrix. The elements on the diagonal are the degrees of each vertex, and the other elements are zero. The formula of the degree matrix is: in, represents the constructed degree matrix, i represents the i-th row, j represents the j-th column, Represents the adjacency matrix Each element in; By using the Chebyshev approximation, the first-order neighbor information is extracted for each node, and a symmetric and normalized matrix is ​​obtained Using H to represent the characteristics of each layer in the network structure, the expression of propagation between feature layers of the graph convolutional neural network is obtained as follows: Among them, H (l+1) is the feature of the l+1th layer, σ is the nonlinear activation function, H (l) is the feature of the lth layer, W (l) It is the lth layer in the weight coefficient matrix. At this time, for the input layer H, it is the feature matrix.

[0118] It can be seen that in this embodiment, by constructing the adjacency matrix This overcomes the defect that the unit node features of the adjacency matrix cannot participate in the calculation, but for the unnormalized matrix Multiplying the feature matrix will change the original distribution of the features, so it is necessary to construct the adjacency matrix Standardization is performed. After symmetric normalization, a relatively ideal adjacency matrix and feature matrix are output as input items of the input layer.

[0119] Based on the above embodiments, as a preferred embodiment, Figure 4 The workflow diagram of the attention mechanism convolutional neural network provided in the embodiment of the present application is as follows: Figure 4 As shown, calling the attention mechanism convolutional neural network to obtain the second output feature corresponding to the attention mechanism convolutional neural network includes:

[0120] S21: Obtain a first sample set.

[0121] Specifically, in this embodiment, a first sample set that has undergone sample enhancement processing is acquired.

[0122] S22: Call the first convolution layer to extract the first sample set to obtain a first convolution result.

[0123] Specifically, in this embodiment, the first convolution result is obtained by extracting the first sample set through the first convolution layer. Each convolution layer will perform three operations in sequence: convolution operation, batch normalization and function activation. The nonlinear function ReLU function is used in the function activation to increase the nonlinear fitting ability of the network. The expression of the ReLU activation function is: ReLU(x)=max(0,x). ReLU is the ReLU function and x is the input value.

[0124] S23: Using the first pooling layer to pool the first convolution result to obtain a first pooling result.

[0125] Specifically, in this embodiment, the first pooling layer is used to pool the first convolution result to obtain the first pooling result. The pooling layer plays a role of downsampling, generating a deeper substructure, and the result after the pooling operation is smaller than its input. The introduction of the pooling layer is to reduce the dimension and abstract the visual input object in imitation of the human visual system, which can prevent overfitting to a certain extent.

[0126] S24: Obtain a processing result obtained by the discard layer processing the first pooling result.

[0127] Specifically, in order to reduce network overfitting and reduce the time consumption of the network model in this embodiment, a dropout layer is set after the first maximum pooling layer. The Dropout function is set to zero a certain amount of information input to the dropout layer. The parameter p represents the probability of zeroing. Usually, p is taken as 0.5 to zero a certain amount of information.

[0128] S25: Call the second convolution layer to extract the processing result to obtain a second convolution result.

[0129] Specifically, in this embodiment, the second convolutional layer includes multiple sub-convolutional layers, which have the same function of extracting features from the results obtained at the previous level to obtain convolution results. Considering that the network structure does not overfit, within a certain range, the more sub-convolutional layers are included, the better the data processing effect is. Figure 5As shown, the second convolutional layer contains two sub-convolutional layers.

[0130] S26: Convolve the second convolution result through the convolution attention module to obtain an attention convolution result.

[0131] Specifically, the convolutional attention module in this embodiment includes: a channel attention function and a spatial attention function, and the attention convolution result is obtained by convolving the second convolution result with the above functions.

[0132] S27: Use the second pooling layer to pool the attention convolution result to obtain the second pooling result.

[0133] Specifically, in this embodiment, the second pooling layer is used to pool the attention convolution result to obtain the second pooling result. The pooling layer plays a sampling role, generates a deeper substructure, and the result after the pooling operation is smaller than its input. The introduction of the pooling layer is to reduce the dimension and abstract the visual input object in imitation of the human visual system, which can prevent overfitting to a certain extent.

[0134] S28: Output a second output feature according to the second pooling result.

[0135] Specifically, in this embodiment, the second pooling result is used as the output second output feature.

[0136] like Figure 5 As shown, the attention mechanism convolutional neural network includes a first convolutional layer, a first pooling layer, a discard layer, a first sub-convolutional layer, a second sub-convolutional layer, a convolutional attention module, and a second pooling layer. The first sample set after sample enhancement processing is used as input data, and the output result of each level enters the next level for processing. The second pooling result output by the second pooling layer is used as the output second output feature.

[0137] It can be seen that by using the attention mechanism to extract global features, the influence of local optimality caused by individual differences is minimized. Not only can the sleep stage be divided, but the accuracy of the sleep stage division is also high.

[0138] Based on the above embodiments, as a preferred embodiment, Figure 6 The convolutional attention module structure diagram provided in the embodiment of the present application is as follows: Figure 6 As shown, the convolution attention module includes: a channel attention function and a spatial attention function, and calling the second convolution layer to extract the processing result to obtain the second convolution result includes:

[0139] Use the channel attention function to perform one-dimensional convolution on the second convolution result to obtain the channel convolution result;

[0140] The spatial convolution result is obtained by performing two-dimensional convolution on the channel convolution result through the spatial attention function;

[0141] Output the attention convolution result based on the spatial convolution result.

[0142] Specifically, in this embodiment, first, the input feature F is convolved in one dimension through the channel attention function to obtain the channel attention map M C , the channel attention map M C Multiply it bitwise with the original input feature F to get the channel attention output feature F′. Take the output feature F′ of the channel attention function as the input of the spatial attention function, perform a two-dimensional convolution operation of the spatial attention function, and generate the spatial attention map M. S And multiply it bitwise with the spatial attention function input F′ to obtain the output feature F″ of the spatial attention function, which is also the final output feature. The channel attention output feature F′ and the spatial attention output feature F″ are expressed as: Where F′ is the output of the channel attention function, M C is the channel attention map, F is the input feature; F″ is the output of the spatial attention function, M S is the spatial attention map. Figure 7 A schematic diagram of the working of the channel attention function provided in the embodiment of the present application is shown as follows: Figure 7 As shown in Figure 1, a channel attention function is established, and the channel relationship between features is used to generate a channel attention map. First, the spatial information of the feature map is aggregated in parallel using the average pooling and maximum pooling methods to generate two different spatial descriptors, where is average pooling, is the maximum pooling, and then the two descriptors are sent to a shared network. Average pooling is used to calculate the average value of the image area as the pooled value of the area, and maximum pooling is used to select the maximum value of the image area as the pooled value of the area, and then the two descriptors are sent to a shared network. The shared network consists of a multi-layer perceptron and a hidden layer. In order to reduce parameter overhead, the number of channels is first compressed to the original 1 / r, where r is the compression factor, and then expanded to the original number of channels. After the ReLU activation function, two activated results are obtained, and the two results are added bit by bit to output a feature vector, which is then normalized by the sigmoid function to obtain the output result of the channel attention module. Channel attention map M C The expression is:

[0143]

[0144] Among them, M C (F) is the channel attention map M C The input is the channel attention map when the input feature F is used, σ is the nonlinear activation function, W1 is the weight coefficient of layer 1, and W0 is the weight coefficient of layer 0. Figure 8A schematic diagram of the working of the spatial attention function provided in the embodiment of the present application is shown in FIG. Figure 8 As shown in the figure, a spatial attention function is established to generate a spatial attention map using the spatial relationship between features. To calculate the spatial attention map, two pooling operations are first used along the channel axis to aggregate the channel information of the feature map to generate two two-dimensional maps: is the mapping corresponding to the average pooling, These feature information are concatenated and convoluted through a 7×7 convolution layer to generate a two-dimensional spatial attention map, and finally normalized by the sigmoid function to obtain the final attention map M. S The expression is:

[0145]

[0146] Among them, M S (F) is the spatial attention map M S The input is the spatial attention map when the input feature F is input, f 7×7 Indicates a 7×7 convolution operation.

[0147] It can be seen that by arranging the two attention functions in series, with the channel attention function in front and the spatial attention function in the back, an attention convolutional neural network structure is formed. The influence of local optimality caused by individual differences is solved. Not only does it achieve sleep staging, but it also has a high accuracy rate for sleep staging.

[0148] Based on the above embodiment, as a preferred embodiment, performing feature fusion on the first output feature and the second output feature to obtain a feature fusion result includes:

[0149] use

[0150] Performing feature fusion on the first output feature and the second output feature;

[0151] where y i is the final fusion feature, C is the number of categories of all training samples, and Softmax is the classification function.

[0152] Specifically, in this embodiment, the first output feature and the second output feature are fused to merge and connect the two features, and then the Softmax classifier is used to classify the sleep stages using the final sleep fusion feature as input. The automatic interpretation result of the sleep stage is output, and the accuracy, precision, recall and other indicators are calculated until the model converges and the accuracy of the test set is stable.

[0153] It can be seen that by fusing the features obtained through the graph convolutional neural network and the attention mechanism convolutional neural network, the final function of sleep staging is achieved.

[0154] In the above embodiments, the sleep staging method is described in detail, and the present application also provides an embodiment of the sleep staging system. It should be noted that the present application describes the embodiments of the system part from two perspectives, one is based on the functional module perspective, and the other is based on the hardware perspective.

[0155] From the perspective of functional modules, Fig. 9 The structure diagram of the sleep staging system provided in the embodiment of the present application is as follows: Fig. 9 As shown, the sleep staging system includes:

[0156] An acquisition module 10, used to acquire physiological signals related to sleep;

[0157] A calling module 11 is used to call the graph convolutional neural network and the attention mechanism convolutional neural network to obtain a first output feature corresponding to the graph convolutional neural network and a second output feature corresponding to the attention mechanism convolutional neural network;

[0158] A fusion module 12, used for performing feature fusion on the first output feature and the second output feature to obtain a feature fusion result;

[0159] The determination module 13 is used to determine the sleep staging result according to the feature fusion result.

[0160] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0161] The sleep staging system provided in this embodiment corresponds to the above method and thus has the same beneficial effects as the above method.

[0162] Fig.10 The structure diagram of the sleep staging device provided in the embodiment of the present application is as follows: Fig.10 As shown, the sleep staging device includes: a memory 20 for storing a computer program;

[0163] The processor 21 is used to implement the steps of the sleep staging method mentioned in the above embodiment when executing the computer program.

[0164] The sleep staging device provided in this embodiment may include but is not limited to a device capable of implementing a sleep staging method, etc.

[0165] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0166] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the sleep staging method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, data related to the sleep staging method, etc.

[0167] In some embodiments, the sleep staging device may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .

[0168] Those skilled in the art will understand that Fig.10 The structure shown in the figure does not constitute a limitation of the sleep staging device, and may include more or fewer components than shown.

[0169] The sleep staging device provided in the embodiment of the present application includes a memory and a processor. When the processor executes the program stored in the memory, the method as described above can be implemented.

[0170] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.

[0171] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the methods of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0172] The sleep staging method, system, device and medium provided by the present application are introduced in detail above. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

[0173] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A sleep staging method, characterized in that: include: Acquiring physiological signals related to sleep; wherein the physiological signals are electroencephalogram signals and electrooculogram signals; Calling a graph convolutional neural network and an attention mechanism convolutional neural network to obtain a first output feature corresponding to the graph convolutional neural network and a second output feature corresponding to the attention mechanism convolutional neural network; Performing feature fusion on the first output feature and the second output feature to obtain a feature fusion result; Determine a sleep staging result according to the feature fusion result; After obtaining the physiological signal related to sleep, the method further includes: Performing sample enhancement processing on the physiological signal to obtain a first sample set; The performing sample enhancement processing on the physiological signal comprises: Utilize d ni =d i +rand(0,1)×(d mi -d i ) synthesizing the physiological signals into a sample set; where d ni is the i-th sample among the n samples in the sample set, d i For each individual sample, d mi is the i-th sample of the m nearest neighbors; Calling the graph convolutional neural network to obtain the first output feature corresponding to the graph convolutional neural network includes: Call the adjacency matrix and feature matrix; Extracting a first graph convolution result by using the adjacency matrix and the feature matrix through a first graph convolution layer; Pooling the first graph convolution result through a graph pooling layer to obtain a pooling result; Calling the second graph convolution layer to extract the pooling result to obtain a second graph convolution result; Obtaining a readout result obtained by a readout layer reading out the second graph convolution result; The readout result is perceived by a multi-layer perceptron to obtain a perception result; Outputting the first output feature according to the perception result; The calling adjacency matrix comprises: use Construct the original adjacency matrix; in is the constructed adjacency matrix, A is the original adjacency matrix, I is the unit matrix of the same dimension, and λ is a constant coefficient; use Performing symmetric normalization processing on the constructed adjacency matrix; in is the symmetric and normalized adjacency matrix, is the constructed adjacency matrix The degree matrix of The calling of the attention mechanism convolutional neural network to obtain the second output feature corresponding to the attention mechanism convolutional neural network includes: Acquire the first sample set; Calling the first convolution layer to extract the first sample set to obtain a first convolution result; Using a first pooling layer to pool the first convolution result to obtain a first pooling result; Obtaining a processing result obtained by the discard layer on the first pooling result; Calling the second convolution layer to extract the processing result to obtain a second convolution result; Convolving the second convolution result through a convolution attention module to obtain an attention convolution result; Using a second pooling layer to pool the attention convolution result to obtain a second pooling result; Outputting the second output feature according to the second pooling result; The convolution attention module includes: a channel attention function and a spatial attention function, and the calling of the second convolution layer to extract the processing result to obtain the second convolution result includes: Performing a one-dimensional convolution on the second convolution result using the channel attention function to obtain a channel convolution result; Performing a two-dimensional convolution on the channel convolution result through the spatial attention function to obtain a spatial convolution result; Outputting the attention convolution result according to the spatial convolution result; The performing feature fusion on the first output feature and the second output feature to obtain a feature fusion result comprises: use Performing feature fusion on the first output feature and the second output feature; where y i is the final fusion feature, C is the number of categories of all training samples, and Softmax is the classification function.

2. A sleep staging system, characterized in that: include: An acquisition module, used to acquire physiological signals related to sleep; wherein the physiological signals are electroencephalogram signals and electrooculogram signals; A calling module, used to call a graph convolutional neural network and an attention mechanism convolutional neural network to obtain a first output feature corresponding to the graph convolutional neural network and a second output feature corresponding to the attention mechanism convolutional neural network; A fusion module, used for performing feature fusion on the first output feature and the second output feature to obtain a feature fusion result; A determination module, used to determine a sleep staging result according to the feature fusion result; After obtaining the physiological signal related to sleep, the method further includes: Performing sample enhancement processing on the physiological signal to obtain a first sample set; The performing sample enhancement processing on the physiological signal comprises: Utilize d ni =d i +rand(0,1)×(d mi -d i ) synthesizing the physiological signals into a sample set; where d ni is the i-th sample among the n samples in the sample set, d i For each individual sample, d mi is the i-th sample of the m nearest neighbors; Calling the graph convolutional neural network to obtain the first output feature corresponding to the graph convolutional neural network includes: Call the adjacency matrix and feature matrix; Extracting a first graph convolution result by using the adjacency matrix and the feature matrix through a first graph convolution layer; Pooling the first graph convolution result through a graph pooling layer to obtain a pooling result; Calling the second graph convolution layer to extract the pooling result to obtain a second graph convolution result; Obtaining a readout result obtained by a readout layer reading out the second graph convolution result; The readout result is perceived by a multi-layer perceptron to obtain a perception result; Outputting the first output feature according to the perception result; The calling adjacency matrix comprises: use Construct the original adjacency matrix; in is the constructed adjacency matrix, A is the original adjacency matrix, I is the unit matrix of the same dimension, and λ is a constant coefficient; use Performing symmetric normalization processing on the constructed adjacency matrix; in is the symmetric and normalized adjacency matrix, is the constructed adjacency matrix The degree matrix of The calling of the attention mechanism convolutional neural network to obtain the second output feature corresponding to the attention mechanism convolutional neural network includes: Acquire the first sample set; Calling the first convolution layer to extract the first sample set to obtain a first convolution result; Using a first pooling layer to pool the first convolution result to obtain a first pooling result; Obtaining a processing result obtained by the discard layer on the first pooling result; Calling the second convolution layer to extract the processing result to obtain a second convolution result; Convolving the second convolution result through a convolution attention module to obtain an attention convolution result; Using a second pooling layer to pool the attention convolution result to obtain a second pooling result; Outputting the second output feature according to the second pooling result; The convolution attention module includes: a channel attention function and a spatial attention function, and the calling of the second convolution layer to extract the processing result to obtain the second convolution result includes: Performing a one-dimensional convolution on the second convolution result using the channel attention function to obtain a channel convolution result; Performing a two-dimensional convolution on the channel convolution result through the spatial attention function to obtain a spatial convolution result; Outputting the attention convolution result according to the spatial convolution result; The performing feature fusion on the first output feature and the second output feature to obtain a feature fusion result comprises: use Performing feature fusion on the first output feature and the second output feature; where y i is the final fusion feature, C is the number of categories of all training samples, and Softmax is the classification function.

3. A sleep staging device, characterized in that: comprising a memory for storing a computer program; A processor is used to implement the steps of the sleep staging method as claimed in claim 1 when executing the computer program.

4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the sleep staging method according to claim 1 are implemented.

Citation Information

Patent Citations

  • Electroencephalogram signal automatic sleep staging method based on multi-scale attention

    CN115530847A