Sleep staging system for single-channel eeg based on multi-scale convolution and attention mechanism

The single-channel EEG sleep staging system, which utilizes multi-scale convolution and attention mechanisms, addresses the issues of neglecting frequency features and insufficient contextual modeling in existing technologies. It achieves high-precision sleep staging and portable monitoring, while reducing device complexity and cost.

CN122123647APending Publication Date: 2026-06-02SHENZHEN KUKAI BRAIN MACHINE INTELLIGENT TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN KUKAI BRAIN MACHINE INTELLIGENT TECHNOLOGY CO LTD
Filing Date
2026-02-26
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing deep learning algorithms for sleep staging ignore frequency features, lack physiological knowledge support, have insufficient ability to model context, and rely on multi-channel EEG, which increases the complexity and cost of the equipment.

Method used

Employing multi-scale convolution and attention mechanisms, specific frequency features of EEG signals are extracted through multi-resolution convolution branches. Combined with neurophysiological priors, a gating mechanism and Transformer coding layer are introduced for contextual modeling. FocalLoss is used to handle class imbalance, and single-channel EEG data is used for end-to-end sleep state recognition.

Benefits of technology

It improves the targeting and accuracy of feature extraction, enhances the model's feature representation and context modeling capabilities, reduces equipment costs, and achieves higher-precision sleep staging and portable monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122123647A_ABST
    Figure CN122123647A_ABST
Patent Text Reader

Abstract

This invention discloses a sleep staging model based on single-channel EEG using multi-scale convolution and attention mechanisms, belonging to the interdisciplinary field of biomedical information processing, deep learning, and automatic sleep staging. Addressing the shortcomings of existing sleep staging algorithms, such as ignoring EEG frequency features, insufficient contextual modeling capabilities, lack of physiological priors, and reliance on multi-channel devices, this invention uses a single-channel Fpz-Cz EEG signal as input. First, it extracts specific frequency waveform features related to sleep staging through four multi-resolution convolutional branches. Then, it uses a gating mechanism to selectively activate features in each frequency band. Next, it combines positional encoding and Transformer encoding layers to enhance contextual modeling capabilities. Finally, it uses the FocalLoss loss function to optimize the class imbalance problem, achieving a five-category sleep state output based on the AASM standard: W, N1, N2, N3, and REM. The features extracted by this invention have clear physiological significance, improving the accuracy and interpretability of sleep staging while reducing the requirements for acquisition equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the interdisciplinary field of biomedical information processing, deep learning and automatic sleep staging, and specifically relates to a sleep staging system based on single-channel EEG using multi-scale convolution and attention mechanisms. Background Technology

[0002] In the current field of deep learning algorithms for sleep staging, existing technologies mainly suffer from the following shortcomings: Ignoring frequency features: Current deep learning algorithms used in automatic sleep staging mostly employ a series of deep convolutions in the shallow feature extraction stage to extract deep information for a final fit. However, EEG signals, especially in sleep staging, naturally possess well-separable and extractable frequency characteristics. Therefore, branched convolutions can be used to design window functions of specific sizes based on physiological characteristics, such as the frequency of beta waves during sleep, to obtain responses at specific frequencies, thus extracting features more efficiently and accurately.

[0003] Insufficient context modeling capability: Traditional deep learning models often use unidirectional long short-term memory models to model the context, which results in poor modeling ability. However, for sequence tasks, especially for tasks with strong contextual correlation such as sleep staging, strong context modeling capability is particularly important.

[0004] Lack of physiological prior knowledge: Current methods mostly extract directly from convolution, allowing the model to learn whether to respond to the state, which lacks the support of neurological knowledge.

[0005] Multi-channel EEG: While multi-channel EEG can improve performance, its algorithms are more complex and it places higher demands on signal acquisition equipment.

[0006] In summary, existing modeling methods are difficult to achieve physiological interpretability and portability, and their modeling capabilities are somewhat insufficient. This patent aims to solve these problems. Summary of the Invention

[0007] To address the aforementioned issues, this invention discloses a sleep staging system based on multi-scale convolution and attention mechanisms using single-channel EEG, comprising a data preprocessing module, a dataset segmentation module, a model building module, and a classification output module. The data preprocessing module extracts EEG signals from the fpz-cz channels of the Cassette portion of the Sleep-EDFDatabaseExpanded dataset and extracts sleep data from half an hour before sleep to half an hour after wakefulness. The dataset segmentation module divides the dataset into training, validation, and test sets according to the principle of subject independence. The model building module performs feature extraction and contextual modeling on 30-second single-channel EEG data. The classification output module outputs a 5-category sleep state result based on the AASM standard.

[0008] Preferably, the model building module includes four multi-resolution convolutional branches, which are used to extract waveform features of different frequencies in the EEG signal. The kernel size and stride of each convolutional branch are calculated using a formula related to the data sampling rate.

[0009] Preferably, the model building module further includes a gating unit. The workflow of the gating unit is as follows: each feature extracted by the multi-resolution convolution branch is averaged, the averaged features are concatenated, and then gating weights are generated by 1D convolution and sigmoid activation function. The gating weights are multiplied by the features extracted by the multi-resolution convolution to obtain gated multi-scale features.

[0010] Preferably, the gating weight ranges from 0 to 1, and is used to control the activation level of each frequency feature.

[0011] Preferably, the model building module further includes a position encoding submodule and a Transformer encoding layer. The position encoding submodule is used to add position information to the gated multi-scale features, and the Transformer encoding layer is used to perform contextual modeling on the features after adding position information.

[0012] Preferably, the classification output module uses a Dense layer to implement 5 categories, and the sleep states corresponding to the 5 categories are W, N1, N2, N3 and REM.

[0013] Preferably, the system uses FocalLoss as the loss function to solve the problem of imbalance in the proportion of different categories of samples in sleep data. The FocalLoss formula satisfies the following: when the parameter γ takes the value of 0, FocalLoss is equivalent to the cross-entropy loss function.

[0014] Preferably, the frequency features extracted by the multi-resolution convolutional branch include specific frequency band waveforms based on physiological characteristics, and the waveforms correspond to neurological prior information related to sleep stages.

[0015] Preferably, the dataset segmentation module follows the subject independence principle, that is, the EEG data of the same subject only appears in one set of the training set, validation set, or test set.

[0016] Preferably, the system is suitable for end-to-end sleep state identification of single-channel EEG signals, without relying on multi-channel EEG acquisition equipment.

[0017] Compared with the prior art, the beneficial effects of the present invention are as follows: To enhance the targeting and effectiveness of feature extraction, this invention employs a four-multi-resolution convolutional branch to extract specific frequency waveform features in EEG signals that are strongly correlated with sleep stages. This design incorporates prior neurological physiological knowledge, avoiding the problem of traditional deep convolution neglecting frequency characteristics. This approach can more efficiently and accurately capture key physiologically significant features, providing more reliable data support for sleep state classification.

[0018] To enhance the model's feature selection and representation capabilities, this invention introduces a gating mechanism. By averaging, concatenating, performing 1D convolution, and applying sigmoid activation to the features extracted through multi-resolution convolution, gating weights in the 0-1 range are generated. These weights allow for selective activation of features across different frequency bands, enabling the model to focus on features that contribute more to sleep stage differentiation. This mechanism effectively improves the model's feature representation capabilities and classification accuracy.

[0019] To enhance context modeling capabilities for sequence tasks, this invention employs a Transformer encoding layer for context modeling, replacing the traditional unidirectional long short-term memory model. The Transformer encoding layer can better capture the sequential correlation characteristics of sleep state sequences, adapting to the context-dependent task of sleep staging and further improving the model's staging accuracy.

[0020] To optimize the handling of class imbalance, this invention uses FocalLoss as the loss function, which effectively focuses on difficult-to-classify classes such as N1 and REM, which have a smaller sample size. This choice reduces the interference of the dominant class on model training, improves the model's ability to identify minority classes, and achieves a more balanced 5-class classification result.

[0021] This invention reduces application barriers and hardware dependencies by requiring only Fpz-Cz single-channel EEG data for sleep staging, eliminating the need for complex multi-channel EEG acquisition equipment. This feature lowers equipment costs and usage barriers, facilitating the integration and practical application of portable sleep monitoring devices.

[0022] To ensure the reliability and generalization ability of model training, this invention employs a subject-independent dataset partitioning principle, ensuring that data from the same subject appears only in one of the training, validation, or test sets. This partitioning method avoids data leakage issues, improves the reliability of model training, and enhances the model's generalization ability across different subject groups. Attached Figure Description

[0023] Figure 1 This is a schematic diagram of the model design framework of the present invention; Figure 2 This is a schematic diagram of the gating mechanism framework for multi-scale rate convolution of the present invention. Detailed Implementation

[0024] Reference Figures 1 to 2 This invention provides a sleep staging system based on multi-scale convolution and attention mechanisms for single-channel EEG. By designing specific window functions, it extracts features of different frequencies from the EEG signal; gating is applied to the features, ensuring that specific channels respond only to features in certain frequency bands; the system includes the following implementation steps: (1) Training data preprocessing Dataset selection: The Cassette portion of the “Sleep-EDFDatabaseExpanded” dataset was selected, which contains 153 overnight polygraph records.

[0025] Data preprocessing: First, the data from the FPZ-CZ channels is extracted. Then, all sleep data from the half hour before sleep to the half hour after waking up, excluding the detected sleep stages, is extracted. This period of data represents the highest quality data of the entire night.

[0026] (2) Dataset splitting Because human EEG data is specific, the dataset needs to be divided independently for each subject, meaning that data from the same person can only appear in one of the training, validation, or test sets.

[0027] (3) Model design like Figure 1 As shown, after inputting 30s of Fpz-Cz single-channel EEG data, multi-resolution convolution is first performed, i.e., entering four convolution branches with different parameters to extract four different frequencies of waves. The extracted features are concatenated into a string and multiplied with a gate of the same dimension as the concatenated features to obtain multi-resolution features with a gating mechanism. Then, positional encoding is performed on the features, and the features and encodings are added together before entering the transformer encoding layer. Finally, a Dense layer is used to perform 5-class classification output. The gating mechanism of multi-resolution convolution is an important aspect of this patent.

[0028] (4) Loss function design Because N1 and REM sleep data have a lower proportion of N1 and REM sleep, while N2 and N3 sleep data have a higher proportion, FocalLoss is used to focus on the difficult-to-classify categories and reduce the impact of class imbalance on the results. The formula is as follows:

[0029] in:

[0030] γ is a constant greater than 0. When it is 0, FocalLoss becomes cross-entropy.

[0031] The gating mechanism for multi-scale rate convolution is implemented as follows: Figure 2 As shown. The formulas for the kernel size and stride for the features are:

[0032]

[0033]

[0034]

[0035] in, This indicates the sampling rate of the data.

[0036] The formula for the sigmoid function is: .

[0037] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0038] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A sleep staging system based on multi-scale convolution and attention mechanisms in single-channel EEG, characterized in that, The system includes a data preprocessing module, a dataset segmentation module, a model building module, and a classification output module. The data preprocessing module extracts EEG signals from the fpz-cz channels of the Cassette portion of the Sleep-EDFDatabaseExpanded dataset and extracts sleep data from half an hour before sleep to half an hour after wakefulness. The dataset segmentation module divides the dataset into training, validation, and test sets according to the principle of subject independence. The model building module performs feature extraction and contextual modeling on 30-second single-channel EEG data. The classification output module outputs a 5-category sleep state result based on the AASM standard.

2. The sleep staging system according to claim 1, characterized in that, The model building module includes four multi-resolution convolution branches, which are used to extract waveform features of different frequencies in the EEG signal. The kernel size and stride of each convolution branch are calculated using a formula related to the data sampling rate.

3. The sleep staging system according to claim 2, characterized in that, The model building module also includes a gating unit. The workflow of the gating unit is as follows: each feature extracted by the multi-resolution convolution branch is averaged, the averaged features are concatenated, and then gating weights are generated by 1D convolution and sigmoid activation function. The gating weights are multiplied by the features extracted by the multi-resolution convolution to obtain gated multi-scale features.

4. The sleep staging system according to claim 3, characterized in that, The gating weights range from 0 to 1 and are used to control the activation level of each frequency feature.

5. The sleep staging system according to claim 1, characterized in that, The model building module also includes a position encoding submodule and a Transformer encoding layer. The position encoding submodule is used to add position information to the gated multi-scale features, and the Transformer encoding layer is used to perform context modeling on the features after adding position information.

6. The sleep staging system according to claim 1, characterized in that, The classification output module uses a Dense layer to implement 5 categories, and the sleep states corresponding to the 5 categories are W, N1, N2, N3 and REM.

7. The sleep staging system according to claim 1, characterized in that, The system uses FocalLoss as the loss function to address the imbalance in the proportion of different categories of samples in sleep data. The FocalLoss formula satisfies the following: when the parameter γ is 0, FocalLoss is equivalent to the cross-entropy loss function.

8. The sleep staging system according to claim 2, characterized in that, The frequency features extracted by the multi-resolution convolutional branch include specific frequency band waveforms based on physiological characteristics, and the waveforms correspond to neurological prior information related to sleep stages.

9. The sleep staging system according to claim 1, characterized in that, The dataset segmentation module follows the subject independence principle, meaning that the EEG data of the same subject only appears in one set of the training set, validation set, or test set.

10. The sleep staging system according to any one of claims 1-9, characterized in that, The system is suitable for end-to-end sleep state identification of single-channel EEG signals, without relying on multi-channel EEG acquisition equipment.