Sleep staging method based on multi-view gating interactive attention fusion

By employing a multi-view gated interactive attention fusion method, which combines convolutional attention and cross-attention mechanisms, the problems of insufficient fusion of viewpoint features and inadequate single-modal representation capabilities in existing technologies are solved, achieving more efficient sleep staging accuracy and robustness.

CN121154087APending Publication Date: 2025-12-19GUANGDONG UNIV OF TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511272614.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-08
Publication Date
2025-12-19

AI Technical Summary

Technical Problem

Existing automatic sleep staging methods suffer from insufficient fusion of features from different perspectives, inadequate single-modal feature representation capabilities, and limited model generalization ability. This makes it difficult to effectively coordinate information from multiple perspectives, affecting the accuracy and robustness of the model.

Method used

A multi-view gated interactive attention fusion method is adopted, which models features within a single modality through convolutional attention and cross-attention mechanisms, and dynamically adjusts the contribution of multi-view features through gating mechanisms and expert hybrid systems to achieve deep alignment and complementary fusion of features from different perspectives.

Benefits of technology

It significantly improves the accuracy, robustness, and generalization ability of automatic sleep staging, fully explores cross-modal complementary information, reduces computational complexity, and is suitable for large-scale EEG sequence processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121154087A_ABST
    Figure CN121154087A_ABST
Patent Text Reader

Abstract

The invention discloses a sleep staging method based on multi-view gating interactive attention fusion. The sleep staging method comprises the steps that a single-channel electroencephalogram signal is preprocessed; an original electroencephalogram sequence and a time-frequency graph obtained through continuous wavelet transform are generated and serve as multi-view-angle input; time sequence features are extracted from the original electroencephalogram sequence through a feature extraction module, and time-frequency features are extracted from the time-frequency graph; fusing the time sequence features and the time frequency features through a feature fusion module, including respectively applying convolution attention to highlight internal key features at an electroencephalogram view angle and a time frequency graph view angle, and performing interaction between view angles through cross attention; convolutional attention output and cross attention output are adaptively fused through a hierarchical expert hybrid mechanism; and outputting a sleep stage classification result through the time convolution network. According to the invention, more comprehensive feature representation is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of artificial intelligence, and particularly relates to a sleep staging method based on multi-view gated interactive attention fusion. BACKGROUND

[0002] Polysomnography (PSG) is an accurate and comprehensive sleep evaluation tool that has been widely used in clinical practice and is an important basis for sleep staging research. Although traditional manual sleep staging methods have been used in clinical practice for a long time, they have obvious shortcomings such as strong subjectivity, time-consuming and laborious, and easy to be disturbed, and are difficult to meet the efficient and stable sleep analysis requirements. Therefore, in recent years, a large number of researches have focused on computer-aided diagnosis and automatic sleep staging technology to improve the analysis efficiency and result consistency.

[0003] At present, automatic sleep staging methods are mainly divided into two categories: multi-modal sleep staging and single-modal sleep staging. The multi-modal method refers to comprehensively utilizing multi-lead data (such as electroencephalogram (EEG), electrooculogram (EOG), electromyogram (EMG), electrocardiogram (ECG), etc.) from different physiological signal modalities in the sleep stage determination process, so as to obtain more comprehensive sleep state representation and higher classification accuracy. For example, in 2021, Jia et al. of Beijing Jiaotong University designed two independent U 2Structural flow, respectively, can directly extract significant waves (such as sleep spindle, K complex, etc.) from the original signal and capture the sleep stage transition rule. In 2022, Li et al. of South China Normal University selected EEG, EMG, EOG and ECG as four modalities, respectively, constructed time-frequency graphs and graph learning graphs, and fused multi-modal and multi-view context information. In 2024, Pradeepkumar et al. of Moratuwa University used a lightweight multi-scale one-dimensional convolutional neural network to extract local and global features from EEG and EOG, and combined a self-attention mechanism to model the attention relationship within and between modalities and across time periods. However, this type of method usually requires placing different types of electrodes or sensors on multiple parts of the subject's body, not only increasing discomfort during sleep, but also affecting sleep quality. In contrast, single-modal sleep staging only relies on lead data from a single physiological signal modality for feature extraction and classification, with a simple device structure, high comfort level, and is more suitable for rapid deployment in clinical settings and promotion in home environments. For example, in 2020, Cai et al. of Tianjin University fused limited visibility graphs and convolutional neural networks as dual input data to extract topological and temporal features of single-channel electroencephalogram signals. In 2024, Bao et al. of Xi'an Jiaotong University proposed a sleep staging method combining one-dimensional and two-dimensional convolutional neural networks. This method first extracts temporal features from the original EEG signal, and simultaneously extracts time-frequency features using the time-frequency spectrogram generated by continuous wavelet transform. After simply concatenating the two types of features, they are passed through a temporal convolution network, which fails to deeply explore the complementarity and correlation between EEG signals and time-frequency spectrograms, making it difficult to effectively coordinate multi-view information.

[0004] In 2020, Cai et al. of Tianjin University fused limited visibility graphs and convolutional neural networks as dual input data to extract topological and temporal features of single-channel electroencephalogram signals. In 2024, Bao et al. of Xi'an Jiaotong University proposed a sleep staging method combining one-dimensional and two-dimensional convolutional neural networks. This method first extracts temporal features from the original EEG signal, and simultaneously extracts time-frequency features using the time-frequency spectrogram generated by continuous wavelet transform. After simply concatenating the two types of features, they are passed through a temporal convolution network, which fails to deeply explore the complementarity and correlation between EEG signals and time-frequency spectrograms, making it difficult to effectively coordinate multi-view information.

[0005] Existing automatic sleep staging methods have the following shortcomings:

[0006] First, the different view feature fusion is insufficient. Most methods only use simple splicing, weighted average and other strategies when processing multi-view features, and fail to deeply explore the complementarity and correlation between different views, making it difficult to effectively coordinate multi-view information. Second, the single modal feature expression ability is insufficient. Some methods rely too much on cross-modal features and ignore the fine pattern modeling of single modal itself, resulting in important temporal or local structural information that cannot be fully utilized. Third, the model generalization ability is limited. Existing methods fail to dynamically adjust the contribution of each view according to the differences of different samples, which may cause some modal noise amplification or key modal weakening, thereby limiting the robustness and generalization performance of the model in practical applications. SUMMARY

[0007] To solve the above technical problems, the present application provides a sleep staging method based on multi-view gated interactive attention fusion, which retains the internal fine feature modeling capability of single modal, introduces cross-modal interactive attention mechanism, realizes deep alignment and complementary fusion of different view features, and dynamically regulates the contribution of multi-view features through gating mechanism and expert hybrid system, thereby significantly improving the accuracy, robustness and generalization ability of automatic sleep staging.

[0008] To achieve the above purpose, the present application provides a sleep staging method based on multi-view gated interactive attention fusion, comprising:

[0009] Pretreating the single-channel electroencephalogram signal;

[0010] Generating the original electroencephalogram sequence and the time-frequency graph obtained by continuous wavelet transform as multi-view input;

[0011] Extracting time sequence features from the original electroencephalogram sequence and time-frequency features from the time-frequency graph through a feature extraction module;

[0012] Fusing the time sequence features and time-frequency features through a feature fusion module, including applying convolution attention to highlight internal key features in the electroencephalogram view and time-frequency graph view, and performing inter-view interaction through cross-attention;

[0013] Adaptively fusing the convolution attention output and cross-attention output through a hierarchical expert hybrid mechanism;

[0014] Outputting sleep stage classification results through a temporal convolution network.

[0015] Optionally, the pretreatment process comprises:

[0016] Using the Fpz-Cz channel electroencephalogram signal of the Sleep-EDF data set;

[0017] Segmenting the electroencephalogram signal at intervals of 30 seconds, corresponding to the sleep stage label;

[0018] cleaning the labels, merging the S3 and S4 stages into an N3 stage, and removing the wake-up period of no more than 30 minutes at the beginning and end of each record;

[0019] generate a time-frequency graph through continuous wavelet transform.

[0020] Optionally, the feature extraction module implementation process includes:

[0021] processing the original electroencephalogram sequence using a time sequence feature extraction branch, applying a one-dimensional convolutional neural network to extract time sequence features, the network including four convolutional blocks and two maximum pooling blocks, each convolutional block including a convolutional layer, a batch normalization layer, and an activation function;

[0022] processing the time-frequency graph using a time-frequency feature extraction branch, applying a two-dimensional convolutional neural network to extract time-frequency features, the network including four convolution-pooling blocks and an additional convolution-pooling block, each block including two convolution operations and one pooling operation;

[0023] resampling the extracted time sequence features and time-frequency features into a feature sequence.

[0024] Optionally, the convolutional attention implementation process includes:

[0025] dividing the input features into an attention modeling part and an instance feature part by channel;

[0026] generating weights through a dynamic convolution kernel, which acts on the attention modeling part to simulate long-range dependencies;

[0027] splicing the processed attention modeling part and the instance feature part, and outputting through one-dimensional convolution fusion.

[0028] Optionally, the cross-attention implementation process includes:

[0029] under the electroencephalogram perspective, taking the time sequence features as the query and the time-frequency features as the key value, calculating the similarity weight and weighting the output;

[0030] under the time-frequency graph perspective, taking the time-frequency features as the query and the time sequence features as the key value, calculating the similarity weight and weighting the output.

[0031] Optionally, the hierarchical expert hybrid mechanism implementation process includes:

[0032] performing perspective-level gating, calculating the weights of the electroencephalogram perspective and the time-frequency graph perspective through a multi-layer perceptron and a soft activation function, and weighting the features of each perspective;

[0033] performing pathway-level gating, calculating the weights of the internal pathways of each perspective through a multi-layer perceptron and a soft activation function, including the convolutional attention pathway and the cross-attention pathway;

[0034] The fusion output is the product of the perspective level weight and the channel level weight.

[0035] Optionally, the time convolution network implementation process comprises:

[0036] The input is the fusion feature sequence output by the hierarchical expert mixing mechanism;

[0037] The time convolution network is applied to model the context dependence of the continuous time period.

[0038] The soft activation function is used to output the probability distribution of the five sleep stages.

[0039] Optionally, in the feature fusion module, the convolution attention output and the cross attention output of the electroencephalogram perspective, and the convolution attention output and the cross attention output of the time-frequency graph perspective, are used as the input of the hierarchical expert mixing mechanism.

[0040] Technical effects of the present application: The present application discloses a sleep staging method based on multi-perspective gated interactive attention fusion. By combining convolution attention and cross attention, the discriminability of single-modal internal features is ensured, and the complementary information of cross-modal is fully mined, so that more comprehensive feature representation is realized. The convolution attention module can significantly reduce the computational complexity while maintaining the self-attention representation capability, and is more lightweight compared with the traditional self-attention model, and is suitable for large-scale EEG sequence processing. The MoE mechanism is introduced, and the weights of each channel are dynamically adjusted according to the sample characteristics. For samples with high EEG contribution, the model can automatically favor the EEG channel; for samples with significant frequency domain features, the time-frequency graph channel features are emphasized, so as to improve the overall robustness and generalization ability. BRIEF DESCRIPTION OF DRAWINGS

[0041] The accompanying drawings, which form a part of this application, are included to provide a further understanding of the application and are incorporated in and constitute a part of this application. The embodiments of this application and of the related description are used to explain the application, and do not constitute an improper limitation on the application. In the drawings:

[0042] Figure 1 FIG. 1 is a flowchart of a sleep staging method based on multi-perspective gated interactive attention fusion according to an embodiment of the present application;

[0043] Figure 2 FIG. 2 is a schematic diagram of the overall architecture of the sleep staging method based on multi-perspective gated interactive attention fusion according to an embodiment of the present application;

[0044] Figure 3 FIG. 3 is a structure diagram of the convolution attention module according to an embodiment of the present application;

[0045] Figure 4 FIG. 4 is a structure diagram of the MoE system according to an embodiment of the present application. DETAILED DESCRIPTION

[0046] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0047] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.

[0048] In this embodiment, a sleep staging method based on multi-view gated interactive attention fusion is provided, which comprises: preprocessing a single-channel electroencephalogram signal;

[0049] Generating an original electroencephalogram sequence and a time-frequency graph obtained by continuous wavelet transform as multi-view input;

[0050] Extracting time sequence features from the original electroencephalogram sequence and extracting time-frequency features from the time-frequency graph through a feature extraction module;

[0051] Fusing the time sequence features and the time-frequency features through a feature fusion module, including applying convolution attention to highlight internal key features in the electroencephalogram view and the time-frequency graph view, and performing inter-view interaction through cross-attention;

[0052] Adaptively fusing the convolution attention output and the cross-attention output through a hierarchical expert mixing mechanism;

[0053] Outputting a sleep stage classification result through a temporal convolution network.

[0054] Further, the preprocessing process comprises:

[0055] Using the Fpz-Cz channel electroencephalogram signal of the Sleep-EDF data set;

[0056] Segmenting the electroencephalogram signal at intervals of 30 seconds, corresponding to the sleep stage label;

[0057] Cleaning the label, merging S3 and S4 stages into N3 stage, and removing the wake-up period of no more than 30 minutes at the beginning and end of each record;

[0058] Generating a time-frequency graph through continuous wavelet transform.

[0059] Further, the feature extraction module implementation process comprises:

[0060] Processing the original electroencephalogram sequence using a time sequence feature extraction branch, applying a one-dimensional convolutional neural network to extract time sequence features, the network including four convolutional blocks and two maximum pooling blocks, each convolutional block including a convolutional layer, a batch normalization layer and an activation function;

[0061] The time-frequency feature extraction branch processes the time-frequency map, and a two-dimensional convolutional neural network is applied to extract time-frequency features, which includes four convolution-pooling blocks and an additional convolution-pooling block, each block including two convolution operations and one pooling operation;

[0062] The extracted time sequence features and time-frequency features are reshaped into a feature sequence.

[0063] Further, the convolutional attention implementation process includes:

[0064] The input features are divided into attention modeling parts and instance feature parts by channel;

[0065] The weights are generated by a dynamic convolution kernel, which acts on the attention modeling part to simulate long-range dependencies;

[0066] The processed attention modeling part and the instance feature part are spliced and output by one-dimensional convolution fusion.

[0067] Further, the cross-attention implementation process includes:

[0068] In the electroencephalogram perspective, the time sequence features are used as queries, and the time-frequency features are used as key values, to calculate similarity weights and weighted output;

[0069] In the time-frequency map perspective, the time-frequency features are used as queries, and the time sequence features are used as key values, to calculate similarity weights and weighted output.

[0070] Further, the hierarchical expert hybrid mechanism implementation process includes:

[0071] Perform perspective-level gating to calculate the weights of the electroencephalogram perspective and the time-frequency map perspective by multi-layer perceptron and soft activation function, and weight the features of each perspective;

[0072] Perform pathway-level gating to calculate the weights of each perspective internal pathway by multi-layer perceptron and soft activation function, including convolutional attention pathway and cross-attention pathway;

[0073] The fusion output is the product sum of the perspective-level weights and the pathway-level weights.

[0074] Further, the time convolution network implementation process includes:

[0075] The input is the fusion feature sequence output by the hierarchical expert hybrid mechanism;

[0076] The time convolution network is applied to model the context dependence of consecutive time periods;

[0077] The probability distribution of the five sleep stages is output by the soft activation function.

[0078] Further, in the feature fusion module, the convolutional attention output and the cross-attention output of the electroencephalogram perspective, and the convolutional attention output and the cross-attention output of the time-frequency graph perspective are taken as inputs of the hierarchical expert mixing mechanism.

[0079] Specifically, the implementation process of the embodiment includes the following steps:

[0080] Step 1: Data preparation

[0081] Step 1.1: Prepare the data set

[0082] In this embodiment, the Sleep-EDF data set is used as the experimental data set. The data set contains 197 whole-night PSG records, which come from the Sleep Cassette Study and the Sleep Telemetry Study. Among them, the Sleep Cassette Study subset (Sleep-EDF-153) contains 153 PSG data records. Sleep-EDF-153 contains 2 electroencephalogram (EEG) channels, 1 electromyogram (EMG) channel, and 1 electrooculogram (EOG) channel. The sampling rate of the EEG signal is 100 Hz, and the sleep staging annotation follows the R&K manual.

[0083] Step 1.2: Data preprocessing

[0084] In this embodiment, only the Fpz-Cz channel EEG of Sleep-EDF-153 is used. According to the AASM standard, S3 and S4 stages are merged into N3. At the same time, only the W (wake) period of each record is kept for not more than 30 minutes at the beginning and end to ensure label consistency and data quality.

[0085] Step 1.3: Obtain multi-perspective data

[0086] In order to fully represent the time sequence and time-frequency features of the EEG signal, this method constructs input data from two perspectives. First, the time domain perspective directly uses the original EEG sequence to preserve the dynamic change process of the signal; second, the time-frequency domain perspective generates a two-dimensional time-frequency graph through continuous wavelet transform. Continuous wavelet transform maps the EEG signal to the time-frequency domain through translation and scaling of the wavelet basis function, which can capture both time-varying features and multi-scale information, and has stronger adaptability than the fixed window short-time Fourier transform. Through the above processing, this embodiment constructs multi-perspective input data to provide rich feature representation for subsequent model learning.

[0087] Step 2: Build a classification model framework

[0088] The overall structure of the sleep staging model proposed by the method is shown in Figure 2 The model includes two main branches: one is the EEG sequence branch, which takes the original EEG signal as input for extracting time sequence features; the other is the time-frequency graph branch, which takes the time-frequency graph generated by continuous wavelet transform as input for extracting frequency-time sequence features. The two branches model the physiological signal characteristics from different perspectives of time domain and time-frequency domain, and finally realize multi-modal information integration through feature fusion, and output sleep stage prediction results.

[0089] Step 3: Model structure design

[0090] Step 3.1: Feature extraction module

[0091] 1D-CNN (one-dimensional convolutional neural network) uses hierarchical structure to perform convolution operation on the original EEG signal. In the process of error back propagation, the parameters of the convolution kernel are constantly updated, so that the convolution kernel can automatically extract time-invariant features related to sleep stages, thereby avoiding complex feature engineering. In addition, different sizes of convolution kernels are applied in different convolution layers, which can extract features of different time scales from the original signal, which is a very effective method for analyzing sleep EEG. In this embodiment, a 1D-CNN structure is used to extract time features from the original EEG signal at the epoch level. The 1D-CNN mainly consists of 4 convolution blocks and 2 max-pooling blocks. Each convolution block contains a convolution layer, a batch normalization layer, and uses a rectified linear unit activation function. For a 30-second epoch input of the original EEG signal X i ∈R 1 ×3000 , let F(x) represent the overall operation of all convolution and pooling blocks, then the time feature of the i-th epoch is defined as:

[0092]

[0093] Then, the TN is spliced to obtain the time feature sequence F raw ∈R TN×d1 :

[0094]

[0095] where d1 represents the feature dimension.

[0096] In combination with 2D-CNN (two-dimensional convolutional neural network) and time-frequency analysis, features can be automatically extracted from time-frequency diagrams to effectively model sleep characteristic waves. The present application uses a 2D-CNN structure to extract time-frequency features from wavelet diagrams at the epoch level. The 2D-CNN is composed of 4 convolution-pooling blocks, each block containing 2 convolution operations and 1 pooling operation. In addition, an additional convolution-pooling block is added to further reduce the feature dimension. For the input compressed wavelet diagram Let G(x) represent the overall operation of all convolution-activation-pooling operations, then the wavelet feature F wavelet ∈R 1 ×d2 defined as:

[0097]

[0098] Subsequently, TN are spliced together to obtain the wavelet feature sequence F wavelet ∈R TN×d2 :

[0099]

[0100] where d2 represents the feature dimension.

[0101] Step 3.2: Feature fusion module

[0102] In the EEG view, the input signal is sent into two paths, one of which is the convolution attention module, and the other is the cross-attention interaction with the time-frequency diagram features. The convolution attention module is a lightweight self-attention alternative structure that effectively simulates the long-range dependency modeling ability and instance adaptive weighting mechanism of self-attention through channel division and dynamic convolution kernel, and its structure is as shown in Figure 3 Specifically, for any view input feature F, it is divided into F att ∈R T×s , F idt ∈R T×(d-s) by channel division hyperparameter s. Where F att is used for long-range interaction modeling, and F idt retains instance-related features. Then, a dynamic convolution kernel DK is generated through 1x1 convolution and error linear unit activation function, and acts on F att :

[0103] F res =F att *DK(F att )(5);

[0104] Subsequently, F res and F idtIn the channel dimension splicing, and through the 1x1 convolution fusion, the output of the convolution attention is obtained:

[0105] F fuse =Conv 1×1 (Concat(F res , F idt ))(6);

[0106] Compared with the standard self-attention, the module significantly reduces the computational cost while maintaining similar representation capabilities. With the help of convolution attention, the model can highlight the key timing fragments in the EEG and suppress redundant signals, thereby improving the discriminability of the intra-modal features. The cross-attention module enables the EEG features to be aligned and fused with the time-frequency graph features, capturing complementary information across modalities. To facilitate fusion, the time feature sequence F raw and the wavelet feature sequence F wavelet are mapped to a uniform dimension d. Let C(x) represent the convolution attention operation, then the output H1 of the EEG sequence after passing through the convolution attention module can be represented as:

[0107] H1=C(F raw )(7);

[0108] Taking the EEG sequence as the query and the time-frequency graph as the key-value, we can get:

[0109] Q raw =F raw W Q1 , K wavelet =F wavelet W K1 , V wavelet =F wavelet W V1 (8);

[0110] Then the output H2 of the cross-attention interaction between the EEG sequence and the time-frequency graph features can be represented as:

[0111]

[0112] In the time-frequency graph perspective, the input is also divided into two paths, one of which passes through the convolution attention module to highlight the local time-frequency pattern and maintain the fine-grained representation of frequency band energy distribution, and the other interacts with the EEG features through cross-attention to obtain accurate time-domain complementary information. The output of the time-frequency graph after passing through the convolution attention module is represented as:

[0113] H3=C(F wavelet )(10);

[0114] Taking the time-frequency graph as the query and the EEG sequence as the key-value, we can get:

[0115] Q wavelet = F wavelet W Q2 , K raw = F raw W K2 , V raw = F raw W K2 (11);

[0116] The output H4 obtained by cross-attention interaction between the time-frequency graph feature and the EEG sequence can be represented as:

[0117]

[0118] After obtaining four path outputs from the two perspectives of EEG and time-frequency graph, the model realizes adaptive fusion by introducing a hierarchical MoE (Mixture of Experts) mechanism. The core idea of hierarchical MoE is to perform gating in two layers: first, perspective-level gating, which allocates weights between the EEG and time-frequency graph perspectives to determine the overall perspective contribution. Then, path-level gating, which allocates weights to the two paths in each perspective. The overall structure is shown in Figure 4 raw wavelet raw wavelet

[0119] Perspective-level weights:

[0120] g V = softmax(MLP(V)) (13);

[0121] where g V = {g V1 , g V2} represents the weights of the EEG and time-frequency graph perspectives. At this time, the feature after perspective-level gating is:

[0122] H′ raw = g V1 V raw (14);

[0123] H′ wavelet = g V2 V wavelet (15);

[0124] H′ = {H′ raw , H′ wavelet} (16);

[0125] where H' raw ​​​​​perspective-level feature representing the EEG, H' wawvelet perspective-level feature representing the time-frequency map.

[0126] Channel-level weights:

[0127] g P = softmax(MLP(H')) (17);

[0128] where {g P1 , g P2} represent the weights of the two channels in the EEG perspective, and {g P3 , g P4} represent the weights of the two channels in the time-frequency map perspective. The final MoE fusion output is obtained as:

[0129] H fuse = g V1 (g p1 V P2 H1+ g V2 H2) + g P3 (g P4 H3+ g fuse H4) (18);

[0130] The introduction of the hierarchical MoE mechanism enables the model to adaptively allocate the contribution weights of each channel according to the characteristics of the sample. In this way, for some samples dominated by EEG information, the model can prefer to use EEG channel features; while for samples that perform more significantly in the frequency domain, the time-frequency map channel features can be automatically emphasized, thereby improving the overall robustness and generalization ability.

[0131] It is worth noting that for the EEG perspective and the time-frequency map perspective, if only convolutional attention is used, the model can capture the local and long-range dependencies within each modality, but it may ignore the corresponding relationship between modalities; if only cross-attention is used, it may rely too much on the interaction between modalities and lose the fine-grained representation within a single modality. The present application combines convolutional attention and cross-attention, which not only ensures the integrity and discriminability of single-modality features, but also fully explores the complementary information across modalities. The hierarchical MoE mechanism further realizes adaptive fusion at the sample level, enabling the model to dynamically emphasize the optimal modality channel in different sample scenarios, thereby obtaining more robust and generalized feature representations.

[0132] Step 3.3: TCN module

[0133] After obtaining the EEG time series features and the time-frequency map fusion features H fuseAfter that, in order to further integrate multi-modal features and mine the time transition rule of sleep stages to complete sleep state classification, a sequence modeling method needs to be used. The sleep stage of certain epoch cannot be determined only by the information of the segment, but needs to combine the context information of the adjacent segments. Therefore, TN consecutive epochs are used as input to predict TN consecutive sleep stages, which is better than the epoch-by-epoch classification method. The final predicted five-class sleep stage probability distribution can be expressed as:

[0134] Y = softmax(TCN(H fuse ))(19).

[0135] The application discloses a sleep staging method based on multi-view gated interactive attention fusion, which combines convolutional attention and cross-attention to ensure the discriminability of single-modal internal features and fully mine cross-modal complementary information, realizing more comprehensive feature representation. The convolutional attention module can significantly reduce the computational complexity while maintaining the self-attention representation capability, and is more lightweight compared with the traditional self-attention model, being suitable for large-scale EEG sequence processing. The MoE mechanism is introduced to dynamically adjust the weights of each path according to the sample characteristics. For samples with prominent EEG contribution, the model can automatically favor the EEG path; for samples with significant frequency domain features, the model emphasizes the time-frequency graph path features, thereby improving the overall robustness and generalization ability.

[0136] The above is only a preferred specific embodiment of the application, but the protection scope of the application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the application, which should be covered in the protection scope of the application. Therefore, the protection scope of the application should be subject to the protection scope of the claims.

Claims

1. A sleep staging method based on multi-view gated interactive attention fusion, characterized in that, include: Preprocessing of single-channel EEG signals; The original EEG sequence and the time-frequency plot obtained through continuous wavelet transform are used as multi-view inputs; Temporal features are extracted from the original EEG sequence using a feature extraction module, and time-frequency features are extracted from the time-frequency graph. The temporal and time-frequency features are fused by a feature fusion module, including applying convolutional attention to highlight key internal features from both the EEG and time-frequency map perspectives, and performing inter-perspective interaction through cross-attention. Adaptively fuse convolutional attention output and cross-attention output through a hierarchical expert hybrid mechanism; The sleep stage classification results are output through a temporal convolutional network.

2. The sleep staging method based on multi-view gated interactive attention fusion as described in claim 1, characterized in that, The preprocessing process includes: Electroencephalogram (EEG) signals from the Fpz-Cz channels of the Sleep-EDF dataset were used. EEG signals were segmented at 30-second intervals and labeled with sleep stages. Clean the tags, merge stages S3 and S4 into stage N3, and remove the awake period of no more than 30 minutes at the beginning and end of each record; Time-frequency diagrams are generated using continuous wavelet transform.

3. The sleep staging method based on multi-view gated interactive attention fusion as described in claim 1, characterized in that, The feature extraction module implementation process includes: The original EEG sequence is processed using a temporal feature extraction branch, and a one-dimensional convolutional neural network is applied to extract temporal features. The network contains four convolutional blocks and two max pooling blocks. Each convolutional block includes a convolutional layer, a batch normalization layer, and an activation function. The time-frequency graph is processed using a time-frequency feature extraction branch, and a two-dimensional convolutional neural network is applied to extract time-frequency features. The network contains four convolution-pooling blocks and one additional convolution-pooling block. Each block includes two convolution operations and one pooling operation. The extracted time-series and time-frequency features are reshaped into feature sequences.

4. The sleep staging method based on multi-view gated interactive attention fusion as described in claim 1, characterized in that, The implementation process of convolutional attention includes: The input features are divided into an attention modeling part and an instance feature part according to channels; Weights are generated using dynamic convolutional kernels and applied to the attention modeling part to simulate long-range dependencies; The processed attention modeling part is concatenated with the instance feature part, and then fused and output through one-dimensional convolution.

5. The sleep staging method based on multi-view gated interactive attention fusion as described in claim 1, characterized in that, The process of implementing cross-attention includes: From the perspective of electroencephalography (EEG), time-series features are used as queries and time-frequency features are used as keys. Similarity weights are calculated and weighted outputs are performed. From the perspective of time-frequency graphs, time-frequency features are used as queries and time-series features are used as keys. Similarity weights are calculated and output in a weighted manner.

6. The sleep staging method based on multi-view gated interactive attention fusion as described in claim 1, characterized in that, The implementation process of the hierarchical expert hybrid mechanism includes: Perform viewpoint-level gating, calculate the weights of EEG viewpoints and time-frequency plot viewpoints through multilayer perceptron and soft activation function, and weight the features of each viewpoint; Path-level gating is performed, and the weights of internal pathways in each viewpoint are calculated through a multilayer perceptron and soft activation functions, including convolutional attention pathways and cross-attention pathways. The fusion output is the sum of the product of the view-level weights and the path-level weights.

7. The sleep staging method based on multi-view gated interactive attention fusion as described in claim 1, characterized in that, The implementation process of temporal convolutional networks includes: The input is the fused feature sequence output by the hierarchical expert hybrid mechanism; Applying temporal convolutional networks to model contextual dependencies over consecutive time periods; The probability distribution of five sleep stages is output using a soft activation function.

8. The sleep staging method based on multi-view gated interactive attention fusion as described in claim 1, characterized in that, In the feature fusion module, the convolutional attention output and cross-attention output from the EEG perspective, as well as the convolutional attention output and cross-attention output from the time-frequency graph perspective, serve as inputs to the hierarchical expert hybrid mechanism.

Citation Information

Cited By

  • Sleep detection method and device based on electroencephalogram, program product and electronic equipment

    CN122004791A