Sleep staging method research based on EEG signal
By introducing the spatiotemporal graph construction unit STOT and the U-shaped network USleepNet, combined with the optimal transmission algorithm OT, the limitations of spatiotemporal modeling in EEG signal analysis are overcome, achieving more efficient sleep staging and improving accuracy and robustness.
Patent Information
- Application Number
- CN202511264346.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-05
- Publication Date
- 2025-12-12
AI Technical Summary
Existing technologies struggle to effectively uncover complex nonlinear spatiotemporal patterns in EEG signal analysis, neglecting the spatial dependencies between multi-channel signals, resulting in low accuracy in sleep staging. Furthermore, existing models lack physiological interpretability and dynamic modeling capabilities.
A dynamic spatiotemporal graph is constructed by using the spatiotemporal graph construction unit STOT and the U-shaped network USleepNet, combined with the optimal transmission algorithm OT. By adaptively allocating cross-channel signal correlation weights, feature extraction is performed by combining a two-branch U-shaped network, and a convolutional attention mechanism CBAM is embedded at the skip connection to achieve multi-scale feature fusion.
It significantly improves the accuracy and robustness of sleep staging, achieving 82.8% and 84.7% accuracy on the ISRUC-S1/S3 datasets, respectively, and F1-scores of 80.4% and 82.9%, respectively, outperforming existing models and improving by 1.5%-9.4% and 0.8%-9.2%.
Smart Images

Figure CN121101595A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of biomedical signal processing and artificial intelligence, specifically to an automatic sleep staging method based on multi-channel electroencephalogram (EEG) signals, and more particularly to a sleep staging model that integrates a spatiotemporal graph construction unit of the Optimal Transport (OT) algorithm and a U-shaped network (USleepNet) to dynamically model the spatiotemporal correlation of EEG signals and capture the temporal transition patterns of sleep stages. Background Technology
[0002] Early research relied on traditional machine learning methods, such as Support Vector Machines (SVM) and decision trees, combined with manually extracted frequency and time domain features for EEG signal analysis. However, these methods are highly dependent on the quality of feature extraction and cannot effectively uncover complex nonlinear spatiotemporal patterns in EEG signals, resulting in poor generalization ability and accuracy generally below 75%. Methods based on SVM and Random Forest (RF) achieved only around 70.0% accuracy in some experiments, and even using ensemble methods such as Bagging and Boosting, the highest accuracy reached was only 74.0%. While these traditional methods can provide some accuracy in certain situations, they are still insufficient for complex EEG signal analysis tasks.
[0003] In recent years, deep learning techniques, such as convolutional neural networks (CNNs) and recurrent neural networks (RNNs), have been widely applied to sleep staging tasks. Thanks to the unique architectures of these models, the ability to automatically learn deep features from raw EEG signals has been enhanced. TinySleepNet and DeepSleepNet network models, which incorporate LSTM and Bi-LSTM layers respectively, achieved accuracies of 71.9% and 75.3%. U²-Net, with its nested U-shaped unit structure, performed even better, achieving an accuracy of 80.7%. However, most existing methods focus on modeling in the temporal dimension, neglecting the spatial dependencies between multi-channel EEG signals, leaving room for improvement in spatiotemporal feature extraction and generalization capabilities.
[0004] With the development of graph neural network (GCN) technology, researchers have begun to apply it to EEG signal analysis, using graph structures to model spatial dependencies between channels and extract spatial features. Models such as STGCN, MSTGCN, and JK-STGCN improve classification accuracy by combining graph convolutions and standard convolutional layers to capture spatial and temporal features, respectively, achieving accuracies of 78.6%, 81.8%, and 83.1%. Although GCN extracts spatial features by modeling connections between channels, its static graph structure lacks physiological interpretability and struggles to capture the dynamic transitions during sleep, failing to truly reflect the dynamic changes in the brain's functional networks.
[0005] Therefore, to address the above problems, this invention proposes an automatic sleep staging method, STOT-USleepNet, which integrates the spatiotemporal graph construction unit of the OT algorithm with a U-shaped network structure. The aim is to achieve comprehensive modeling of key spatiotemporal information in EEG signals through dynamic graph construction and multi-scale feature fusion mechanism, thereby improving the accuracy and robustness of the model in the discrimination of complex sleep stages. Summary of the Invention
[0006] This invention proposes a U-shaped fusion network based on EEG signals, STOT-USleepNet. This method, through a designed Spatial-Temporal Optimal Transport (STOT) unit, introduces the Time-of-Temporal (OT) algorithm into the sleep domain for the first time. By adaptively allocating correlation weights between cross-channel signals, it constructs a physically interpretable spatiotemporal dynamic map to quantify the strength of functional connectivity in brain regions and the temporal transition costs of sleep stages. Based on this, an improved dual-branch U-shaped network (USleepNet) captures EEG time-varying waveforms and brain topological features through a spatiotemporal feature extraction network. A multi-scale interaction strategy is designed to achieve cross-data fusion, and a Convolutional Attention (CBAM) mechanism is embedded at skip connections to simultaneously enhance multi-scale context transfer efficiency and classification performance. Comparative experiments on the ISRUC-S1 / S3 datasets show that the model of this invention outperforms existing benchmark models in key metrics: ACC reaches 82.8% and 84.7% on ISRUC-S1 and ISRUC-S3, respectively; F1-score reaches 80.4% and 82.9%, respectively. The coefficients reached 0.772 and 0.802 respectively.
[0007] This method can be implemented by the following steps:
[0008] Step 1: Extract multi-channel EEG signals from the ISRUC-S1 / S3 dataset, perform denoising and normalization processing to ensure signal quality.
[0009] Step 2: Use the STOT module to construct a spatiotemporal map of EEG signals, quantify spatial correlations, and capture the transition patterns of sleep stages.
[0010] Step 3: Use a two-branch U-shaped network for feature extraction. Temporal features are extracted from time-varying waveform features in EEG signals to capture changes in sleep stages. Spatial features are extracted from brain region topological features. Skip connections are used to transmit multi-scale information.
[0011] Step 4: Fuse spatiotemporal features and embed an attention mechanism to optimize key information. Embed CBAM at the skip connections to optimize the fusion effect of spatiotemporal features. Output the sleep stage prediction results through a classifier.
[0012] Step 5: Optimize network parameters using a dynamic training strategy, evaluate model performance based on metrics such as classification accuracy (ACC) and F1-score, and verify the effectiveness of the core modules through ablation experiments.
[0013] The advantages and beneficial effects of this invention are as follows:
[0014] 1. This invention overcomes the limitations of traditional methods in spatiotemporal modeling of EEG signals by introducing the spatiotemporal graph construction unit STOT and the optimal transmission algorithm, and achieves a more accurate sleep staging technology.
[0015] 2. This invention proposes an improved U-shaped network, USleepNet, which features a dual-branch network structure. The temporal feature extraction network extracts EEG time-varying waveforms through 2D convolution, while the spatial feature extraction network models brain region topology based on GCN to collaboratively capture spatiotemporal dynamics. Skip connections are embedded with CBAM, which focuses on key frequency bands through channel attention and enhances brain region interaction through spatial attention, thereby optimizing feature fusion efficiency.
[0016] 3. Experimental results show that the model of this invention achieves ACC of 82.8% and 84.7% on the ISRUC-S1 / S3 datasets, and F1-scores of 80.4% and 82.9%, respectively, outperforming existing models. The ACC of this invention is improved by 1.5%-9.4% and the F1-score is improved by 0.8%-9.2% compared with state-of-the-art models. Ablation analysis further verifies the necessity of the core module. Removing the OT algorithm leads to a 4.8% decrease in accuracy. Through systematic ablation experiments, it is verified that the 4-layer U-shaped network structure can achieve the best performance. At the same time, the multi-scale feature extraction strategy of first expanding and then shrinking improves the ACC by 1.0%-6.4% compared with other variant schemes. This proves the superiority of the model of this invention and has broad application prospects and practical value. Attached Figure Description
[0017] Figure 1This is a flowchart of the STOT-USleepNet sleep staging method.
[0018] Figure 2 This is a diagram of the USleepNet network model structure.
[0019] Figure 3 This is a confusion matrix diagram of the STOT-USleepNet model on the ISRUC-S1 / S3 dataset.
[0020] Figure 4 This is a comparison chart of the actual and predicted stages of the subjects in the STOT-USleepNet model.
[0021] Figure 5 The figure shows the results of an ablation experiment performed on STOT using the STOT-USleepNet model.
[0022] Figure 6 This is a graph showing the impact of the number of layers in the U-shaped network on the performance of the STOT-USleepNet model.
[0023] Figure 7 The graph shows the impact of kernel size and hidden dimension on the performance of the STOT-USleepNet model. Detailed Implementation
[0024] The specific usage process of this invention is achieved through the following steps:
[0025] Step 1: Data Preprocessing and Acquisition. Subsets S1 and S3 of the ISRUC-Sleep database were used, containing overnight PSG recordings from 100 and 10 subjects, respectively. Six bipolar EEG channels (F3-A2, C3-A2, O1-A2, F4-A1, C4-A1, and O2-A1) were selected, covering the frontal, central, and occipital regions, with a sampling rate of 200 Hz. Preprocessing employed a multi-stage cascaded process. First, a narrowband notch filter with a center frequency of 50 Hz and a bandwidth of ±2 Hz was used to eliminate power frequency interference, achieving in-band attenuation exceeding 40 dB. Subsequently, a Butterworth bandpass filter (0.3-35 Hz) was used to retain effective physiological components, a low-frequency (0.3 Hz) threshold was applied to eliminate baseline drift, and a high-frequency (35 Hz) cutoff was used to suppress EMG noise. All signals were divided into 30-second epochs and independently Z-score normalized to control for motion artifacts. The last 30 epochs of data from each channel were systematically truncated, ultimately retaining 98.2%-99.6% of the effective sleep segments. This preprocessing procedure ensured signal quality while maintaining the dynamic characteristics of the sleep stage, providing reliable input for subsequent analysis.
[0026] Step 2: Spatiotemporal Map Construction Unit (STOT). The main task of STOT is to convert EEG signals into a spatiotemporal map to capture spatiotemporal interaction patterns in sleep segments. Given multichannel physiological signal data... First, the raw multi-channel EEG signal is divided into standard time segments (epochs) with a fixed duration of 30 seconds. Overnight sleep records can typically be divided into 800-900 epochs, resulting in a new data matrix. ,in Number of signal channels Sampling frequency, Let the signal length be denoted as . Then, construct the spatiotemporal graph. for:
[0027] (1)
[0028] in Represents a set of nodes. It is an adjacency matrix. These are the characteristics of nodes. (Figure) The nodes are composed of various slices of data: nodes Corresponding to channel At a certain point in time To reflect the similarity between different nodes, we first calculate the cosine similarity between node features. The formula is:
[0029] (2)
[0030] To reduce redundancy and noise, a similarity threshold is set. =0.3, keep By connecting the π and π, a sparsed similarity matrix is obtained. Next, to capture the potential optimal matching relationships between nodes, the OT algorithm is further introduced. The core idea of this algorithm is to optimize the connections between nodes by minimizing the transmission cost. The initial cost matrix... for:
[0031] (3)
[0032] The optimal transfer matrix is then solved using the Kantorovich relaxation form. Its goal is to minimize transmission costs:
[0033] (4)
[0034] The marginal distribution is taken as a uniform distribution. ,in Let the number of nodes be [node number], ensuring all nodes participate in transmission equally. To improve stability and computational efficiency, an entropy regularization term is added:
[0035] (5)
[0036] Entropy regularization coefficients are taken =0.1, balancing computational efficiency and connection sparsity. Furthermore, to further incorporate prior knowledge, a temporal weight mask is constructed. and positional weight mask Through hyperparameters and Controlling their effects, among which A value of 0.8 controls the time decay coefficient and the position weight hyperparameter. A value of 0.9 is used to adjust the channel spacing penalty intensity. Finally, the adjacency matrix of the spatiotemporal graph... Constructed from the following formula:
[0037] (6)
[0038] in," "" indicates element-wise multiplication. The resulting spatiotemporal graph integrates local similarity, global transport weights, and physiological constraints, providing an accurate spatiotemporal structure representation and rich information for sleep dynamic modeling.
[0039] Step 3: Feature extraction using a dual-branch U-shaped network. The multi-channel spatiotemporal feature signal with dynamically correlated weights obtained after constructing the spatiotemporal graph is used as input and transmitted to the USleepNet network for deep feature extraction and sleep staging analysis. USleepNet employs a dual-branch structure, including a temporal feature extraction network and a spatial feature extraction network. Each branch network consists of multiple encoder and decoder modules, and feature extraction is performed through a multi-scale feature fusion strategy.
[0040] The temporal feature extraction network consists of a temporal encoder, a temporal decoder, and a segmentation classifier. The input to the temporal encoder is the feature matrix. The system extracts multi-scale temporal features through two layers of 2D convolutions. Each convolutional layer is followed by batch normalization (BN) and dropout. The second layer has a simpler channel count to capture complex features, and max pooling is used to progressively compress the feature dimensionality. After output, a CBAM module can be directly inserted to adaptively weight the extracted temporal features. The temporal decoder block uses transposed convolutions and inverse pooling to progressively restore the low-dimensional features transmitted by the encoder to a higher resolution. Features are fused with the corresponding temporal encoder output through skip connections. A CBAM module is embedded at the skip connections, and channel-space dual attention weighting is applied to the fused features based on the electrode spatial topology to enhance the temporal feature representation of key brain regions. Further detailed information is recovered through two convolutions. The segment classifier aggregates the point-by-point labels from the temporal decoder output into segment labels, mainly through fully connected layers and Softmax classification.
[0041] The spatial feature extraction network consists of a spatial encoder and a spatial decoder. The input to the spatial encoder block is the adjacency matrix. and characteristic matrix The spacetime diagram described jointly ,in For the number of nodes, The feature dimension is denoted as . Local spatial relationships between nodes are extracted through two consecutive GCN layers, as shown in the following formula:
[0042] (7)
[0043] in The normalized adjacency matrix, and For trainable parameters, The activation function is ELU. A 2D graph pooling layer (2D gPool) is used to downsample the nodes, selecting the most representative nodes to form a subgraph. After continuous graph convolution and gPool, a CBAM module is inserted at the skip connections to perform channel and spatial weighting on the features after graph convolution, further enhancing key spatial structures.
[0044] Step 4: Convolutional Attention Mechanism (CBAM) Feature Fusion. This aims to adaptively calibrate feature importance through dual-path (channel and spatial) attention. The overall structure consists of two sub-modules: a channel attention module and a spatial attention module, which are connected in series to refine the features. The channel attention module processes the input feature map... Performing global average pooling and global max pooling, we get:
[0045] (8)
[0046] Both are fed into a shared multilayer perceptron neural network (MLP), then added together and activated by the sigmoid function. Obtain the channel attention map :
[0047] (9)
[0048] Weighting the original features:
[0049] (10)
[0050] Spatial attention module We perform average pooling and max pooling along the channel dimension to obtain two two-dimensional feature maps:
[0051] (11)
[0052] After concatenation, a spatial attention map is generated using 7×7 convolution and sigmoid activation. :
[0053] (12)
[0054] The final output features are spatially weighted:
[0055] (13)
[0056] Step 5: Model Performance Validation and Final Optimization. Classification experiments were conducted on the ISRUC-S1 / S3 datasets to evaluate the classification performance on both datasets. Evaluation metrics included accuracy (ACC), precision (Precision), recall, F1-score (F1), and Cohen's kappa score. The definition is as follows:
[0057] Accuracy (ACC):
[0058] (14)
[0059] F1 score:
[0060] (15)
[0061] in:
[0062] (16)
[0063] (17)
[0064] Kappa ):
[0065] (18)
[0066] in, This represents the number of true positive examples that were correctly classified. This represents the number of negative examples that were incorrectly classified as positive. This represents the number of positive examples that were incorrectly classified as negative. This indicates the number of negative examples that were correctly classified. Precision represents the proportion of samples that the model predicted as positive but were actually positive, and Recall represents the proportion of samples that were actually positive but were correctly predicted as positive by the model. For relative consistency among observers, This is based on random consistency according to probability distribution. These metrics allow for a comprehensive evaluation of the STOT-USleepNet network's staging performance across different sleep stages.
[0067] In this invention, a dynamic training strategy is employed to optimize network parameters, and the optimal solution is selected through multiple experiments. The initial learning rate is set to 0.001, and a strategy of decaying by 20% every 10 epochs is adopted to avoid instability or slow training caused by an excessively large or small learning rate. Multiple experiments were also conducted on batch size, and 16 was ultimately selected as the optimal value to balance training speed and the risk of overfitting. In addition, an early stopping strategy is introduced to stop training early when the verification accuracy no longer improves, thereby avoiding overfitting.
[0068] This invention conducted three sets of ablation experiments to systematically verify the effectiveness of the model's key design. Removing any module from temporal feature extraction, spatial feature extraction, spatiotemporal feature extraction, or the OT algorithm resulted in performance degradation, confirming that the dynamic correlation modeling between spatiotemporal feature coupling and the OT algorithm is crucial for sleep staging. Experiments with U-shaped network depth showed that a 4-layer structure achieved optimal performance on the ISRUC-S1 / S3 dataset, with deeper layers leading to saturation. In the multi-scale strategy, a "expand first, shrink later" design for convolutional kernels and hidden layer dimensions—capturing global context initially and focusing on local details later—outperformed the fixed-scale approach. These ablation experiments ultimately determined the model structure used in this invention, achieving efficient capture of the spatiotemporal coupling characteristics of EEG signals through collaborative optimization.
[0069] 10-fold cross-validation was performed on the ISRUC-S3, with an overall ACC of 84.7% and an F1-score of 82.9%. The coefficient is 0.802. Experiments were conducted on ISRUC-S1, with an overall ACC of 0.828 and an F1-score of 0.804. The coefficient is 0.772. The experimental results of the STOT-USleepNet model are a significant improvement over existing methods.
Claims
1. An automatic sleep staging method based on EEG signals, characterized by: The method includes the following steps: Step 1: Extract multi-channel EEG signals from the ISRUC-S1 / S3 dataset, perform denoising and normalization processing to ensure signal quality. Step 2: Construct a spatiotemporal map of the EEG signal using the Spatiotemporal Graph Construction Unit (STOT) module to quantify spatial correlations and capture sleep stage transition patterns. Step 3: Use a two-branch U-shaped network for feature extraction. Temporal features are extracted from time-varying waveform features in EEG signals to capture changes in sleep stages. Spatial features are extracted from brain region topological features. Skip connections are used to transmit multi-scale information. Step 4: Fuse spatiotemporal features and embed an attention mechanism to optimize key information. Embed a convolutional attention mechanism (CBAM) at the skip connection to optimize the fusion effect of spatiotemporal features. Output the sleep stage prediction results through a classifier. Step 5: Optimize network parameters using a dynamic training strategy, evaluate model performance based on metrics such as classification accuracy (ACC) and F1-score, and verify the effectiveness of the core modules through ablation experiments.
2. The automatic sleep staging method based on EEG signals according to claim 1, characterized in that: In step one, subsets S1 and S3 of the ISRUC-Sleep database were used, containing overnight PSG recordings from 100 and 10 subjects, respectively. Six bipolar EEG channels (F3-A2, C3-A2, O1-A2, F4-A1, C4-A1, and O2-A1) were selected, covering the frontal, central, and occipital regions, with a sampling rate of 200 Hz. Preprocessing employed a multi-stage cascaded process. First, a narrowband notch filter with a center frequency of 50 Hz and a bandwidth of ±2 Hz was used to eliminate power frequency interference, achieving in-band attenuation of over 40 dB. Subsequently, a Butterworth bandpass filter (0.3–35 Hz) was used to retain effective physiological components, a low-frequency (0.3 Hz) threshold was applied to eliminate baseline drift, and a high-frequency (35 Hz) cutoff was used to suppress EMG noise. All signals were divided into 30-second epochs and independently Z-score normalized to control for motion artifacts. The last 30 epochs of data from each channel were systematically truncated, ultimately retaining 98.2%-99.6% of the effective sleep segments. This preprocessing procedure ensured signal quality while maintaining the dynamic characteristics of the sleep stage, providing reliable input for subsequent analysis.
3. The automatic sleep staging method based on EEG signals according to claim 1, characterized in that: In step two, STOT's main task is to convert EEG signals into a spatiotemporal map to capture spatiotemporal interaction patterns in sleep segments. This is given by multi-channel physiological signal data. First, the raw multi-channel EEG signal is divided into standard time segments (epochs) with a fixed duration of 30 seconds. Overnight sleep records can typically be divided into 800-900 epochs, resulting in a new data matrix. ,in Number of signal channels Sampling frequency, Let the signal length be denoted as . Then, construct the spatiotemporal graph. for: (1) in Represents a set of nodes. It is an adjacency matrix. These are the characteristics of nodes. (Figure) The nodes are composed of various slices of data: nodes Corresponding to channel At a certain point in time To reflect the similarity between different nodes, we first calculate the cosine similarity between node features. The formula is: (2) To reduce redundancy and noise, a similarity threshold is set. =0.3, keep By connecting the π and π, a sparsed similarity matrix is obtained. Next, to capture the potential optimal matching relationships between nodes, the OT algorithm is further introduced. The core idea of this algorithm is to optimize the connections between nodes by minimizing the transmission cost. The initial cost matrix... for: (3) The optimal transfer matrix is then solved using the Kantorovich relaxation form. Its goal is to minimize transmission costs: (4) The marginal distribution is taken as a uniform distribution. ,in Let the number of nodes be [node number], ensuring all nodes participate in transmission equally. To improve stability and computational efficiency, an entropy regularization term is added: (5) Entropy regularization coefficients are taken =0.1, balancing computational efficiency and connection sparsity. Furthermore, to further incorporate prior knowledge, a temporal weight mask is constructed. and positional weight mask Through hyperparameters and Controlling their effects, among which A value of 0.8 controls the time decay coefficient and the position weight hyperparameter. A value of 0.9 is used to adjust the channel spacing penalty intensity. Finally, the adjacency matrix of the spatiotemporal graph... Constructed from the following formula: (6) in," "" indicates element-wise multiplication. The resulting spatiotemporal graph integrates local similarity, global transport weights, and physiological constraints, providing an accurate spatiotemporal structure representation and rich information for sleep dynamic modeling.
4. The automatic sleep staging method based on EEG signals according to claim 1, characterized in that: In step three, a dual-branch U-shaped network is used for feature extraction. The multi-channel spatiotemporal feature signal with dynamically correlated weights obtained after constructing the spatiotemporal graph is used as input and transmitted to the USleepNet network for deep feature extraction and sleep staging analysis. USleepNet adopts a dual-branch structure, including a temporal feature extraction network and a spatial feature extraction network. Each branch network consists of multiple encoder and decoder modules, and feature extraction is performed through a multi-scale feature fusion strategy. The temporal feature extraction network consists of a temporal encoder, a temporal decoder, and a segmentation classifier. The input to the temporal encoder is the feature matrix. The system extracts multi-scale temporal features through two layers of 2D convolutions. Each convolutional layer is followed by batch normalization (BN) and dropout. The second layer has a simpler channel count to capture complex features, and max pooling is used to progressively compress the feature dimensionality. After output, a CBAM module can be directly inserted to adaptively weight the extracted temporal features. The temporal decoder block uses transposed convolutions and inverse pooling to progressively restore the low-dimensional features transmitted by the encoder to a higher resolution. Features are fused with the corresponding temporal encoder output through skip connections. A CBAM module is embedded at the skip connections, and channel-space dual attention weighting is applied to the fused features based on the electrode spatial topology to enhance the temporal feature representation of key brain regions. Further detailed information is recovered through two convolutions. The segment classifier aggregates the point-by-point labels from the temporal decoder output into segment labels, mainly through fully connected layers and Softmax classification. The spatial feature extraction network consists of a spatial encoder and a spatial decoder. The input to the spatial encoder block is the adjacency matrix. and characteristic matrix The spacetime diagram described jointly ,in For the number of nodes, The feature dimension is denoted as . Local spatial relationships between nodes are extracted through two consecutive GCN layers, as shown in the following formula: (7) in The normalized adjacency matrix, and For trainable parameters, The activation function is ELU. A 2D graph pooling layer (2D gPool) is used to downsample the nodes, selecting the most representative nodes to form a subgraph. After continuous graph convolution and gPool, a CBAM module is inserted at the skip connections to perform channel and spatial weighting on the features after graph convolution, further enhancing key spatial structures.
5. The automatic sleep staging method based on EEG signals according to claim 1, characterized in that: In step four, convolutional attention (CBAM) is used for feature fusion. Its aim is to adaptively calibrate feature importance through dual-path (channel and spatial) attention. The overall structure consists of two sub-modules: a channel attention module and a spatial attention module, which are connected in series to refine the features. The channel attention module processes the input feature map... Performing global average pooling and global max pooling, we get: (8) Both are fed into a shared multilayer perceptron neural network (MLP), then added together and activated by the sigmoid function. Obtain the channel attention map : (9) Weighting the original features: (10) Spatial attention module We perform average pooling and max pooling along the channel dimension to obtain two two-dimensional feature maps: (11) After concatenation, a spatial attention map is generated using 7×7 convolution and sigmoid activation. : (12) The final output features are spatially weighted: (13) 6. The automatic sleep staging method based on EEG signals according to claim 1, characterized in that: In step five, classification experiments are conducted on the ISRUC-S1 / S3 datasets to evaluate the classification performance on both datasets. Evaluation metrics include accuracy (ACC), precision, recall, F1-score (F1), and Cohen's kappa score. The definition is as follows: Accuracy (ACC): (14) F1 score: (15) in: (16) (17) Kappa( ): (18) in, This represents the number of true positive examples that were correctly classified. This represents the number of negative examples that were incorrectly classified as positive. This represents the number of positive examples that were incorrectly classified as negative. This indicates the number of negative examples that were correctly classified. Precision represents the proportion of samples that the model predicted as positive but were actually positive, and Recall represents the proportion of samples that were actually positive but were correctly predicted as positive by the model. For relative consistency among observers, This is based on random consistency according to probability distribution. These metrics allow for a comprehensive evaluation of the STOT-USleepNet network's staging performance across different sleep stages. In this invention, a dynamic training strategy is employed to optimize network parameters, and the optimal solution is selected through multiple experiments. The initial learning rate is set to 0.001, and a strategy of decaying by 20% every 10 epochs is adopted to avoid instability or slow training caused by an excessively large or small learning rate. Multiple experiments were also conducted on batch size, and 16 was ultimately selected as the optimal value to balance training speed and the risk of overfitting. In addition, an early stopping strategy is introduced to stop training early when the verification accuracy no longer improves, thereby avoiding overfitting. This invention conducted three sets of ablation experiments to systematically verify the effectiveness of the model's key design. Removing any module from temporal feature extraction, spatial feature extraction, spatiotemporal feature extraction, or the OT algorithm resulted in performance degradation, confirming that the dynamic correlation modeling between spatiotemporal feature coupling and the OT algorithm is crucial for sleep staging. Experiments with U-shaped network depth showed that a 4-layer structure achieved optimal performance on the ISRUC-S1 / S3 dataset, with deeper layers leading to saturation of gains. In the multi-scale strategy, a "expand-shrink" design of convolutional kernels and hidden layer dimensions—capturing global context initially and focusing on local details later—outperformed the fixed-scale approach. These ablation experiments ultimately determined the model structure used in this invention, achieving efficient capture of the spatiotemporal coupling characteristics of EEG signals through collaborative optimization. 10-fold cross-validation was performed on the ISRUC-S3, with an overall ACC of 84.7% and an F1-score of 82.9%. The coefficient is 0.
802. Experiments were conducted on ISRUC-S1, with an overall ACC of 0.828 and an F1-score of 0.
804. The coefficient is 0.
772. The experimental results of the STOT-USleepNet model are a significant improvement over existing methods.