A Sleep Staging Method Based on Attention Mechanism and Ensemble Learning
By adopting a dual-branch convolutional neural network based on attention mechanism and integrated learning in the sleep staging method, the features of EEG signals and time-frequency signals are extracted, and the problems of insufficient signal feature extraction and imbalance in the data set category in the prior art are solved, and more accurate sleep staging is achieved.
Patent Information
- Application Number
- CN202210054298.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-18
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2042-01-18
AI Technical Summary
The existing sleep staging methods have problems such as insufficient signal feature extraction and imbalance in data set categories.
Using an attention mechanism and integrated learning method, the characteristics of one-dimensional original EEG signals and two-dimensional time-frequency signals are extracted through a dual-branch convolutional neural network, and combined with an integrated learning algorithm to enhance sample weights and reduce category imbalance problems.
It enriches signal feature extraction, improves the accuracy of sleep staging, and effectively reduces the problem of data set category imbalance.
Smart Images

Figure CN114398932B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of signal processing, and particularly relates to a sleep staging method based on an attention mechanism and ensemble learning. Background Art
[0002] Humans spend about one-third of their time sleeping. Sleep is closely related to human physical and mental health and is a very important vital activity. It has important clinical significance and practical application value for clinical medicine in monitoring and evaluating sleep quality.
[0003] Sleep staging is the basis for studying sleep and related diseases and is a prerequisite for completing sleep quality assessment. For the study of sleep staging, generally, the collected EEG (Electroencephalogram) is segmented into 30s segments, and each segment is classified into 5 stages of sleep by professional physicians according to the sleep staging rules of the American Academy of Sleep Medicine (AASM). However, the existing sleep staging methods have problems such as insufficient signal feature extraction and unbalanced dataset categories. Summary of the Invention
[0004] The purpose of the embodiments of the present invention is to provide a sleep staging method based on an attention mechanism and ensemble learning, which enriches the extracted signal features and reduces the problem of unbalanced dataset categories.
[0005] The specific technical solutions are as follows:
[0006] A sleep staging method based on an attention mechanism and ensemble learning is provided in the embodiments of the present invention. The method includes:
[0007] Obtain a one-dimensional raw electroencephalogram (EEG) signal, and preprocess the one-dimensional raw EEG signal to obtain a corresponding two-dimensional time-frequency signal;
[0008] Input the one-dimensional raw EEG signal and the two-dimensional time-frequency signal into a pre-trained dual-branch convolutional neural network to obtain first features in different preset frequency ranges of the one-dimensional raw EEG signal, and multi-scale refined features of the two-dimensional time-frequency signal; the dual-branch convolutional neural network is trained using an ensemble learning algorithm; the ensemble learning algorithm is used to increase the weight of samples with fewer samples during the process of training the network model;
[0009] Fuse the first features and the multi-scale refined features, and input the fused features into a classifier to obtain the sleep staging result of the one-dimensional raw EEG signal.
[0010] Optionally, obtain a one-dimensional raw electroencephalogram (EEG) signal, and preprocess the one-dimensional raw EEG signal to obtain a corresponding two-dimensional time-frequency signal, including:
[0011] Obtain a one-dimensional raw EEG signal;
[0012] Obtain a corresponding two-dimensional signal by performing continuous wavelet transform (CWT) on the one-dimensional raw EEG signal;
[0013] Perform principal component analysis dimensionality reduction on the two-dimensional signal to obtain a two-dimensional time-frequency signal of a preset size.
[0014] Optionally, the dual-branch convolutional neural network includes a one-dimensional network and a two-dimensional network;
[0015] Input the one-dimensional raw EEG signal and the two-dimensional time-frequency signal into a pre-trained dual-branch convolutional neural network to obtain first features of different preset frequency ranges of the one-dimensional raw EEG signal and multi-scale refined features of the two-dimensional time-frequency signal, including:
[0016] Obtain features of the one-dimensional raw EEG signal in different preset frequency ranges through the one-dimensional network;
[0017] Obtain multi-scale refined features of the two-dimensional time-frequency signal through the two-dimensional network.
[0018] Optionally, the one-dimensional network includes two parallel convolutional neural networks with different convolutional kernel sizes, and is used to obtain signal features of different frequency ranges corresponding to different sleep periods.
[0019] Optionally, the two-dimensional network is a ResNet50 network including a multi-scale attention mechanism module; the multi-scale attention mechanism module includes an SPC sub-module, an SEWeight sub-module, a Softmax sub-module, and an element-wise product sub-module;
[0020] Obtain multi-scale refined features of the two-dimensional time-frequency signal through the two-dimensional network, including:
[0021] Input the two-dimensional time-frequency signal into the SPC sub-module to obtain features of different scales on multiple branches of the two-dimensional time-frequency signal as multi-scale features;
[0022] For the multi-scale features of each branch, input the multi-scale features into the SEWeight sub-module to obtain a first weight of the branch;
[0023] For the first weight of each branch, recalibrate the first weight through the Softmax sub-module to obtain a second recalibrated weight of the branch;
[0024] For each branch, the second weight of the branch and the multi-scale features of the branch are combined through an element-wise product sub-module to obtain the multi-scale refined features of the two-dimensional time-frequency signal.
[0025] Optionally, input the two-dimensional time-frequency signal into the SPC sub-module to obtain the features of the two-dimensional time-frequency signal at different scales on multiple branches as multi-scale features, including:
[0026] Input the two-dimensional time-frequency signal into the SPC sub-module;
[0027] The SPC module, according to the formula
[0028] F i = conv(k i × k i , G i )(X)
[0029]
[0030] Obtain the multi-scale features F on each branch of the two-dimensional time-frequency signal i ; where the value range of i is from 0 to S - 1, where conv() represents the convolution operation, k i represents the convolution kernel size on the i-th branch, G i represents the convolution group size on the i-th branch, and S represents the total number of branches.
[0031] Optionally, for the multi-scale features of each branch, input the multi-scale features into the SEWeight sub-module to obtain the first weight of the branch, including:
[0032] For the multi-scale features of each branch, the SEWeight sub-module performs global average pooling on the multi-scale features to obtain the features of the channel dimension of the branch;
[0033] Pass the features of the channel dimension of the branch through the sigmoid activation function to obtain the first weight of the branch.
[0034] Optionally, for the first weight of each branch, recalibrate the first weight through the Softmax module to obtain the recalibrated second weight of the branch, including:
[0035] For the first weight of each branch, the Softmax sub-module recalibrates the first weight according to the formula
[0036]
[0037] Recalibrate the first weight to obtain the second weight of the branch; where att i represents the second weight, zi represents the first weight of the i-th branch, and Softmax() represents the normalized exponential function.
[0038] Optionally, for each branch, the second weight of the branch and the multi-scale features of the branch are combined through the element-wise product module to obtain the multi-scale refined features of the two-dimensional time-frequency signal, including:
[0039] For each branch, the element-wise product sub-module calculates according to the formula Y i = F i · att i to obtain the multi-scale refined features Y i of the two-dimensional time-frequency signal; where the value range of i is from 0 to S - 1.
[0040] Based on the sleep staging method based on attention mechanism and ensemble learning provided by the embodiments of the present invention, a one-dimensional original electroencephalogram (EEG) signal is obtained, and the one-dimensional original EEG signal is preprocessed to obtain a corresponding two-dimensional time-frequency signal; the one-dimensional original EEG signal and the two-dimensional time-frequency signal are input into a pre-trained dual-branch convolutional neural network to obtain the first features of different preset frequency ranges of the one-dimensional original EEG signal and the multi-scale refined features of the two-dimensional time-frequency signal; the dual-branch convolutional neural network is trained using an ensemble learning algorithm; the ensemble learning algorithm is used to increase the weights of samples with fewer samples during the process of training the network model; the first features and the multi-scale refined features are fused, and the fused features are input into a classifier to obtain the sleep staging result of the one-dimensional original EEG signal. Through the dual-branch convolutional neural network, the features of one-dimensional signals and two-dimensional signals can be extracted simultaneously, and the dual-branch convolutional neural network is trained using an ensemble learning algorithm, which not only enriches the extracted signal features but also reduces the problem of class imbalance in the data set. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The present invention will be further described below with reference to the accompanying drawings.
[0042] Figure 1 is a flowchart of a sleep staging method based on attention mechanism and ensemble learning provided by an embodiment of the present invention;
[0043] Figure 2 is a flowchart of an ensemble model provided by an embodiment of the present invention;
[0044] Figure 3 is a flowchart of another sleep staging method based on attention mechanism and ensemble learning provided by an embodiment of the present invention;
[0045] Figure 4 is a schematic diagram of a dual-branch convolutional neural network provided by an embodiment of the present invention;
[0046] Figure 5 Schematic diagram of a one-dimensional network provided by an embodiment of the present invention;
[0047] Figure 6 Schematic diagram of a two-dimensional network provided by an embodiment of the present invention;
[0048] Figure 7 Schematic diagram of using a PSA Module to replace the convolutional layer in ResNet50 provided by an embodiment of the present invention;
[0049] Figure 8 Flowchart of another sleep staging method based on an attention mechanism and ensemble learning provided by an embodiment of the present invention;
[0050] Figure 9 Schematic diagram of the network structure of an attention mechanism module provided by an embodiment of the present invention;
[0051] Figure 10 Structural diagram of the SPC sub-module provided by an embodiment of the present invention;
[0052] Figure 11 Structural diagram of the SEWeight sub-module provided by an embodiment of the present invention. Detailed implementation manners
[0053] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0054] The embodiments of the present invention provide a sleep staging method based on an attention mechanism and ensemble learning. Refer to Figure 1 , Figure 1 For the flowchart of a sleep staging method based on an attention mechanism and ensemble learning provided by an embodiment of the present invention, the method may include the following steps:
[0055] S101, obtain a one-dimensional raw electroencephalogram (EEG) signal, preprocess the one-dimensional raw EEG signal to obtain a corresponding two-dimensional time-frequency signal.
[0056] S102, input the one-dimensional raw EEG signal and the two-dimensional time-frequency signal into a pre-trained dual-branch convolutional neural network to obtain first features of different preset frequency ranges of the one-dimensional raw EEG signal and multi-scale refined features of the two-dimensional time-frequency signal.
[0057] S103. Integrate the first feature and the multi-scale refined feature, and input the integrated feature into a classifier to obtain the sleep stage classification result of the one-dimensional original EEG signal.
[0058] The dual-branch convolutional neural network is trained using an ensemble learning algorithm; the ensemble learning algorithm is used to increase the weight of samples with fewer samples during the process of training the network model.
[0059] Based on the sleep stage classification method based on the attention mechanism and ensemble learning provided by the embodiments of the present invention, the dual-branch convolutional neural network can extract the features of one-dimensional signals and two-dimensional signals simultaneously, and the dual-branch convolutional neural network is trained using an ensemble learning algorithm, which not only enriches the extracted signal features but also reduces the problem of class imbalance in the dataset.
[0060] In one implementation, the one-dimensional original EEG signal and the two-dimensional time-frequency signal need to be first divided into a training set and a test set, and then input into a pre-trained dual-branch convolutional neural network.
[0061] In one implementation, according to the sleep stage classification rules of the American Academy of Sleep Medicine (AASM), the sleep can be divided into 5 stages, namely the wake stage (W), non-rapid eye movement stage 1 (N1), non-rapid eye movement stage 2 (N2), non-rapid eye movement stage 3 (N3), and rapid eye movement stage (REM).
[0062] In one implementation, a 20-fold cross-validation can be used to train the network structure of the dual-branch convolutional neural network.
[0063] The specific steps of the 20-fold cross-validation are as follows:
[0064] (1) First, merge the sample training set and the sample test set, and then divide them into 20 mutually exclusive subsets of the same size. Each subset tries to ensure the consistency of data distribution.
[0065] (2) Each time, use the union of 19 subsets as the training subset, and the remaining one subset as the test subset. Repeat this operation 20 times to obtain 20 sets of experimental results.
[0066] (3) Take the average of the 20 sets of experimental results obtained by the 20-fold cross-validation to get the final result. Use this result as the experimental result of the 20-fold cross-validation.
[0067] During the training process, an ensemble model including multiple weak classifiers can be used for training. For example, the AdaBoost algorithm in Boosting is selected. Before training, first assign the same weight to each sample, and then train the first weak classifier. After the training of the first weak classifier is completed, update the sample weights according to the classification results of the current weak classifier, that is, increase the weights of the samples with classification errors and decrease the weights of the samples with correct classifications, so that the next classifier pays more attention to the misclassified samples. For subsequent weak classifiers, transfer the learning parameters of the weak classifier obtained after the previous training to the subsequent weak classifier, and then retrain on the dataset with updated sample weights. In this way, multiple weak classifiers can be obtained, and then these weak classifiers are integrated into a strong classifier through ensemble strategies such as averaging or voting for classification.
[0068] See Figure 2 , Figure 2 is the flowchart of the ensemble learning algorithm provided by the embodiment of the present invention.
[0069] Figure 2 Train the 1 st CNN:(C 1 (x)), Train the 2 st CNN:(C 2 (x))...Train theM st CNN:(C M (x)) are the first classifier, the second classifier... the Mth classifier respectively. D 1 is the sample weight of n samples in the dataset of the first weak classifier, and the sample weight d i of each sample is all 1 / n, where n is the total number of samples in the dataset.
[0070] After the training of the first weak classifier is completed, update the sample weights according to the classification results of the first weak classifier to obtain the sample weights D 2 of n samples in the dataset of the second weak classifier, and transfer the learning parameters of the first weak classifier obtained after the first training to the second weak classifier for the second training. Repeat the above steps until the training of the Mth classifier is completed.
[0071] In one embodiment, step S101 includes:
[0072] Step 1, obtain the one-dimensional original EEG signal.
[0073] Step 2, obtain the corresponding two-dimensional signal by performing continuous wavelet transform CWT on the one-dimensional original EEG signal.
[0074] Step 3: Perform principal component analysis dimensionality reduction on the two-dimensional signal to obtain a two-dimensional time-frequency signal of a preset size.
[0075] In one implementation, the preset size of the two-dimensional time-frequency signal can be set to 128*128.
[0076] In one embodiment, the dual-branch convolutional neural network includes a one-dimensional network and a two-dimensional network. Refer to Figure 3 , in Figure 1 On this basis, step S102 includes:
[0077] S1021: Obtain the features of the one-dimensional original EEG signal in different preset frequency ranges through the one-dimensional network.
[0078] S1022: Obtain the multi-scale refined features of the two-dimensional time-frequency signal through the two-dimensional network.
[0079] Refer to Figure 4 , Figure 4 which is a schematic diagram of the dual-branch convolutional neural network provided by the embodiment of the present invention.
[0080] First, convert the one-dimensional original EEG signal into a two-dimensional time-frequency signal through CWT. Then, extract one-dimensional features and two-dimensional features through the one-dimensional network and the two-dimensional network provided by the embodiment of the present invention respectively. Secondly, fuse the extracted features, and finally input them into the classifier to obtain the sleep staging result.
[0081] In one embodiment, the one-dimensional network includes two parallel convolutional neural networks with different convolutional kernel sizes, which are used to obtain the signal features in different frequency ranges corresponding to different sleep periods.
[0082] In one implementation, research shows that as shown in Table 1 below, different sleep stages have different frequency ranges. Therefore, the one-dimensional network can use a parallel convolutional neural network structure with different convolutional kernel sizes to capture different ranges of time steps, so as to obtain the features from different sleep-related frequency bands.
[0083] Table 1
[0084]
[0085] Refer to Figure 5 , Figure 5 which is a schematic diagram of the one-dimensional network provided by the embodiment of the present invention.
[0086] The one-dimensional network includes two parallel convolutional neural network structures, and two convolutional layers with different convolutional kernel sizes (the convolutional kernel sizes are 50 and 400 respectively) are used to extract the features of the original EEG signals in different frequency ranges. The one-dimensional convolutional parameter Conv1D(a, b, c) represents Conv1D(filters = a, kernel_size = b, strides = c). After the original signal passes through one convolutional layer, the obtained features are respectively passed through two pooling layers and a Dropout layer. Then the output data of the Dropout layer is input into three convolutional layers with different convolutional kernel sizes (the convolutional kernel sizes are 8 and 6 respectively). The features obtained by these three convolutional layers are passed through a pooling layer and then through a Flatten layer to fuse the two parallelly extracted features, obtaining the features of the one-dimensional original EEG signal.
[0087] See Figure 6 , Figure 6 which is a schematic diagram of the two-dimensional network provided by the embodiment of the present invention.
[0088] The backbone network of the two-dimensional network is the classic network ResNet50. The ResNet50 network structure is implemented in five stages. In the first stage, one convolutional layer (including convolution (Conv)(7×7), batch normalization layer (BN), and ReLU as the activation function) and one pooling layer are respectively used. The following four stages are all composed of convolutional blocks and identity blocks. Both the convolutional block and the identity block are composed of three repeated convolutional layers and a shortcut module. The shortcut module is used to add the incoming unchanged input array to the output of the convolutional layer. In the convolutional block, different from the identity block, the input array participates in the addition step after passing through the Conv and BN layers in the shortcut module. In the convolutional block and the identity block, the convolutional layers have kernel sizes of 1×1, 3×3, and 1×1 respectively. The shortcut module is used to prevent the deep network from overfitting and also to reduce and optimize the computational complexity.
[0089] However, the features that ResNet50 can extract are limited. Therefore, the PSA Module can be used to replace one of the three convolutional layers (3×3) in the convolutional block and the identity block. See Figure 7 , Figure 7 which is a schematic diagram of using the PSA Module to replace the convolutional layer in ResNet50 provided by the embodiment of the present invention. Using the PSA Module can better extract context features.
[0090] In one embodiment, the two-dimensional network is a ResNet50 network including a multi-scale attention mechanism module; the multi-scale attention mechanism module includes an SPC sub-module, an SEWeight sub-module, a Softmax sub-module, and an element-wise product sub-module. Refer to Figure 8 , on the basis of Figure 3 , step S1022 includes:
[0091] S10221, input the two-dimensional time-frequency signal into the SPC sub-module to obtain the features of different scales on multiple branches of the two-dimensional time-frequency signal as multi-scale features.
[0092] S10222, for the multi-scale features of each branch, input the multi-scale features into the SEWeight sub-module to obtain the first weight of this branch.
[0093] S10223, for the first weight of each branch, recalibrate the first weight through the Softmax sub-module to obtain the recalibrated second weight of this branch.
[0094] S10224, for each branch, combine the second weight of this branch and the multi-scale features of this branch through the element-wise product sub-module to obtain the multi-scale refined features of the two-dimensional time-frequency signal.
[0095] Refer to Figure 9 , Figure 9 which is a schematic diagram of the network structure of the attention mechanism module provided by the embodiment of the present invention.
[0096] In one embodiment, step S10221 includes:
[0097] Step 1, input the two-dimensional time-frequency signal into the SPC sub-module.
[0098] Step 2, the SPC sub-module, according to the formula
[0099] F i = conv(k i ×k i , G i )(X)
[0100]
[0101] obtain the multi-scale features F i on each branch of the two-dimensional time-frequency signal; where the value range of i is from 0 to S - 1, where conv() represents the convolution operation, k i represents the convolution kernel size on the i-th branch, G i represents the convolution group size on the i-th branch, and S represents the total number of branches.
[0102] In one implementation, the SPC sub-module can extract multi-scale spatial features of the input signal in a multi-branch manner, and the input channel dimension of each branch is C. Therefore, more abundant position information of the input information can be obtained, and parallel processing can be performed at multiple scales, and a feature map containing a single type of kernel can be obtained. Correspondingly, using multi-scale convolutional kernels in the pyramid structure can generate different spatial resolutions and depths. By compressing the channel dimension of the input tensor, the spatial information with different scales on each channel-level feature map can be effectively extracted. Finally, each feature map with different scales F i has a common channel dimension
[0103] See Figure 10 , Figure 10 which is the structural diagram of the SPC sub-module provided by the embodiment of the present invention.
[0104] In one implementation, the entire multi-scale pre-processed feature map F can be obtained through formula (2).
[0105] F = Cat([F 0 , F 1 , …, F S-1 ) (2)
[0106] In one embodiment, step S10222 includes:
[0107] Step 1, for the multi-scale features of each branch, the SEWeight sub-module performs global average pooling on the multi-scale features to obtain the features of the channel dimension of the branch.
[0108] Step 2, passing the features of the channel dimension of the branch through the sigmoid activation function to obtain the first weight of the branch.
[0109] In one implementation, the operation of the SEWeight sub-module can be expressed as
[0110] Z i = SEWeight(F i ) (3)
[0111] where the value range of i is from 0 to S - 1.
[0112] In one implementation, the entire multi-scale channel first weight vector Z can be calculated using formula (4).
[0113]
[0114] where z i represents the first weight of the i-th branch
[0115] SeeFigure 11 , Figure 11 This is the structural diagram of the SEWeight sub-module provided by the embodiment of the present invention.
[0116] In one embodiment, step S10223 includes:
[0117] For the first weight of each branch, the Softmax sub-module re-calibrates the first weight according to the formula
[0118]
[0119] to obtain the second weight of the branch; where att i represents the second weight, z i represents the first weight of the i-th branch, and Softmax() represents the normalization exponential function.
[0120] In one implementation, the entire multi-scale channel second weight vector att can be calculated using formula (6).
[0121]
[0122] In one embodiment, step S10224 includes:
[0123] For each branch, the element-wise product sub-module obtains the multi-scale refined feature Y of the two-dimensional time-frequency signal according to the formula Y i = F i · att i ; where the value range of i is from 0 to S - 1. i It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.
[0124]
[0125] Each embodiment in this specification is described in a related manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for electronic devices and storage media, since they are basically similar to the method embodiments, the description is relatively simple, and reference can be made to the relevant parts of the method embodiments for the relevant content.
[0126] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention are all included in the protection scope of the present invention.
Claims
1. A sleep staging method based on attention mechanism and ensemble learning, characterized in that, the method includes: Obtain a one-dimensional original EEG signal, preprocess the one-dimensional original EEG signal to obtain a corresponding two-dimensional time-frequency signal; Input the one-dimensional original EEG signal and the two-dimensional time-frequency signal into a pre-trained dual-branch convolutional neural network to obtain the first features of different preset frequency ranges of the one-dimensional original EEG signal, and the multi-scale refined features of the two-dimensional time-frequency signal; the dual-branch convolutional neural network is trained using an ensemble learning algorithm; the ensemble learning algorithm is used to increase the weight of samples with fewer samples during the process of training the network model; Fuse the first features and the multi-scale refined features, and input the fused features into a classifier to obtain the sleep staging result of the one-dimensional original EEG signal; The dual-branch convolutional neural network includes a one-dimensional network and a two-dimensional network; Input the one-dimensional original EEG signal and the two-dimensional time-frequency signal into a pre-trained dual-branch convolutional neural network to obtain the first features of different preset frequency ranges of the one-dimensional original EEG signal, and the multi-scale refined features of the two-dimensional time-frequency signal, including: Obtain the features of the one-dimensional original EEG signal in different preset frequency ranges through the one-dimensional network; Obtain the multi-scale refined features of the two-dimensional time-frequency signal through the two-dimensional network; The two-dimensional network is a ResNet50 network including a multi-scale attention mechanism module; the multi-scale attention mechanism module includes an SPC sub-module, an SEWeight sub-module, a Softmax sub-module, and an element-wise product sub-module; Obtain the multi-scale refined features of the two-dimensional time-frequency signal through the two-dimensional network, including: Input the two-dimensional time-frequency signal into the SPC sub-module to obtain the features of different scales of the two-dimensional time-frequency signal on multiple branches as multi-scale features; For the multi-scale features of each branch, input the multi-scale features into the SEWeight sub-module to obtain the first weight of the branch; For the first weight of each branch, recalibrate the first weight through the Softmax sub-module to obtain the recalibrated second weight of the branch; For each branch, combine the second weight of the branch and the multi-scale features of the branch through the element-wise product sub-module to obtain the multi-scale refined features of the two-dimensional time-frequency signal; Input the two-dimensional time-frequency signal into the SPC sub-module to obtain the features of different scales of the two-dimensional time-frequency signal on multiple branches as multi-scale features, including: Input the two-dimensional time-frequency signal into the SPC sub-module; The SPC sub-module, according to the formula F i = conv(k i × k i , G i )(X) Obtain the multi-scale features F on each branch of the two-dimensional time-frequency signal i ; where the value range of i is from 0 to S-1, where conv() represents the convolution operation, and k i represents the convolution kernel size on the i-th branch, and G i represents the convolution group size on the i-th branch, and S represents the total number of branches.
2. The sleep staging method based on attention mechanism and ensemble learning according to claim 1, characterized in that, Obtain a one-dimensional original EEG signal, preprocess the one-dimensional original EEG signal to obtain a corresponding two-dimensional time-frequency signal, including: Obtain a one-dimensional original EEG signal; Obtain a corresponding two-dimensional signal by performing continuous wavelet transform CWT on the one-dimensional original EEG signal; Perform principal component analysis dimensionality reduction on the two-dimensional signal to obtain a two-dimensional time-frequency signal of a preset size.
3. A sleep staging method based on an attention mechanism and ensemble learning according to claim 1, wherein, the one-dimensional network includes two parallel convolutional neural networks with different convolutional kernel sizes for obtaining signal features in different frequency ranges corresponding to different sleep stages.
4. A sleep staging method based on an attention mechanism and ensemble learning according to claim 1, wherein, for the multi-scale features of each branch, input the multi-scale features into the SEWeight sub-module to obtain the first weight of the branch, including: for the multi-scale features of each branch, the SEWeight sub-module performs global average pooling on the multi-scale features to obtain the features of the channel dimension of the branch; Pass the features of the channel dimension of the branch through the sigmoid activation function to obtain the first weight of the branch.
5. A sleep staging method based on an attention mechanism and ensemble learning according to claim 4, wherein, for the first weight of each branch, recalibrate the first weight through the Softmax sub-module to obtain the recalibrated second weight of the branch, including: for the first weight of each branch, the Softmax sub-module is based on the formula Recalibrate the first weight to obtain the second weight of the branch; where, att i represents the second weight, z i represents the first weight of the i-th branch, and Softmax() represents the normalization exponential function.
6. A sleep staging method based on an attention mechanism and ensemble learning according to claim 5, wherein, for each branch, combine the second weight of the branch and the multi-scale features of the branch through the element product module to obtain the multi-scale refined features of the two-dimensional time-frequency signal, including: For each branch, the element-wise product sub-module obtains the multi-scale refined feature Y of the two-dimensional time-frequency signal according to the formula Y i = F i · att i ; where the value range of i is from 0 to S-1. i