Multi-scale time-frequency network sleep stage classification method based on single-channel electroencephalogram

By employing a multi-scale time-frequency network sleep stage classification method, utilizing a dual-branch parallel architecture and sequence learning module, the problems of insufficient feature extraction and long-term time dependence in single-channel EEG monitoring are solved, achieving efficient sleep stage classification and improved accuracy.

CN121009422APending Publication Date: 2025-11-25SHANXI UNIV
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202511226614.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2025-11-25

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively capture multi-scale time-frequency features, handle inter-subject variability, and model long-term time dependence in single-channel EEG sleep monitoring, resulting in insufficient classification accuracy and reliability.

Method used

A multi-scale time-frequency network sleep stage classification method based on single-channel EEG is adopted. Through a feature extraction module and a sequence learning module with a dual-branch parallel architecture, combined with time-domain and frequency-domain features, the feature attention is dynamically adjusted by using a multi-scale Inception module, a phase-amplitude coupling module and a self-attention mechanism to achieve modeling of long-term time dependencies.

Benefits of technology

It significantly improves the integrity and discriminative power of single-channel EEG signal feature representation, enhances the model's generalization ability and clinical applicability, accurately captures the continuity features and transition patterns of the sleep process, and solves the limitations of existing methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121009422A_ABST
    Figure CN121009422A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-scale time-frequency network sleep stage classification method based on single-channel electroencephalogram, and belongs to the technical field of medical signal processing. Aiming at the problems of capturing multi-scale time-frequency characteristics, processing variability among subjects and modeling long-range time dependence of a sleep staging method, the method comprises the following steps: firstly, acquiring electroencephalogram signal data, and performing time sequence segmentation, sleep stage category label determination and standardized preprocessing by taking a single-channel electroencephalogram signal as an analysis object; performing data set division by adopting nested cross validation, and constructing a multi-scale time-frequency network model; the model comprises a feature extraction module and a sequence learning module, wherein the feature extraction module comprises a time domain branch and a frequency domain branch; a subject adaptive feature calibration module is proposed to dynamically compensate the influence brought by individual difference and signal quality fluctuation; respectively training a feature extraction module and a sequence learning module by adopting a component type training strategy; and inputting to-be-classified electroencephalogram signal data into the trained model, and outputting a corresponding sleep stage classification result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of medical signal processing technology, specifically relating to a multi-scale time-frequency network sleep stage classification method based on single-channel EEG. Background Technology

[0002] Sleep is a vital physiological process for maintaining life, profoundly impacting cognitive function, work efficiency, and overall health. According to the World Health Organization, approximately 27% of the global population suffers from sleep disorders. Based on the American Academy of Sleep Medicine (AASM) standards, the sleep cycle includes wakefulness (W), rapid eye movement (REM) sleep, and non-rapid eye movement (NREM) sleep. NREM is further subdivided into three sub-stages: N1, N2, and N3. N1 is the light sleep stage transitioning from wakefulness to sleep, accounting for approximately 5%–10%, during which individuals are easily awakened and often experience hypnic jerks. N2 is the most significant sleep stage, accounting for 40%–50%, during which sensitivity to external stimuli decreases, body temperature and heart rate further decline, and it is associated with memory consolidation. N3 is deep sleep or slow-wave sleep, accounting for approximately 15%–25%, and is the most difficult stage to awaken. Interruption often leads to sleep inertia, and it is closely related to physical recovery, immune regulation, and growth hormone secretion. REM sleep is characterized by rapid eye movements, low-voltage fast waves on EEG similar to wakefulness, and decreased muscle tone. It accounts for 20%–25% of total sleep time and is closely related to dreams, mood regulation, and learning and memory processes. Accurate classification of sleep stages is crucial for understanding sleep structure and diagnosing sleep disorders.

[0003] Currently, polysomnography (PSG) is the gold standard for assessing sleep structure and diagnosing sleep disorders. It records various physiological signals throughout the night, such as electroencephalogram (EEG), electrooculogram (EOG), electromyogram (EMG), electrocardiogram (ECG), respiratory signals, and blood oxygen saturation, to comprehensively analyze the sleep process and classify sleep stages. However, the complex data acquisition process not only increases monitoring costs but also limits the practicality of sleep monitoring in the home environment. Although existing sleep stage classification methods based on multichannel EEG rely solely on EEG, these methods still have limitations in the everyday home environment, such as susceptibility to interference, limited wearing comfort, and unstable signal quality. To address these challenges, single-channel EEG sleep monitoring is particularly important, as its convenience and portability provide a feasible solution for sleep monitoring in the home environment. Furthermore, sleep monitoring based on single-channel EEG signals relies on advanced and efficient sleep stage classification methods to ensure the accuracy and reliability of the classification. Currently, existing deep learning methods based on single-channel EEG still have limitations in sleep stage classification. Convolutional neural network (CNN) methods have evolved into multi-scale architectures and deeper networks, but these methods may have limitations in capturing long-term temporal dependencies, which are crucial for sleep stage transitions and modeling complex cross-period relationships. Long short-term memory (LSTM) methods address the temporal dependency problem through complex architectures, but their sequence processing architecture may create computational bottlenecks, hindering parallelization and increasing training time. Attention-based methods combine Transformer architectures to better capture temporal dependencies, but still face challenges in computational efficiency and cross-population generalization.

[0004] Therefore, there is an urgent need to develop a single-channel EEG sleep stage classification technology that can simultaneously utilize time-domain and frequency-domain features, effectively capture temporal dependencies, adapt to individual differences, and achieve efficient feature fusion, in order to meet the accuracy and reliability requirements of single-channel sleep monitoring. Summary of the Invention

[0005] To address the shortcomings of existing sleep staging methods in capturing multi-scale time-frequency features, handling inter-subject variability, and modeling long-term time dependence, this invention provides a sleep stage classification method based on a multi-scale time-frequency network using single-channel EEG. To solve the aforementioned technical problems, this invention employs the following technical solution:

[0006] A sleep stage classification method based on a multi-scale time-frequency network using single-channel EEG includes the following steps:

[0007] Step 1: Collect EEG signals from the subject during the entire night's sleep, and select single-channel EEG signals at the Fpz-Cz channel location as the analysis object;

[0008] Step 2: Perform time-series segmentation, sleep stage category labeling, and standardized preprocessing on the collected continuous single-channel EEG signals;

[0009] Step 3: Use nested cross-validation to partition the dataset. In the outer cross-validation, the dataset is divided into different training and test sets. In the inner cross-validation, each training set is further divided into an inner training set and a validation set. Hyperparameters are optimized to ensure the unbiasedness and reliability of the training process. A grid search strategy is used to determine the hyperparameters. In the inner cross-validation, the classification accuracy of different hyperparameter combinations on the validation set is evaluated, and the best-performing hyperparameter configuration is selected for model training in the outer cross-validation.

[0010] Step 4: For each training dataset, construct a multi-scale time-frequency network model and train it.

[0011] The multi-scale time-frequency network model includes two core components: a feature extraction module and a sequence learning module.

[0012] The feature extraction module adopts a dual-branch parallel architecture with time-domain and frequency-domain branches. The time-domain branch integrates local extremum analysis into the multi-scale Inception module to adaptively capture time-domain features at different time scales. The frequency-domain branch uses wavelet packet transform through the phase-amplitude coupling module to extract features for cross-frequency interactions that are crucial for sleep staging.

[0013] The sequence learning module uses a bidirectional gated recurrent unit network to process the calibrated feature sequence, and combines a temporal attention mechanism to dynamically select the period in the sequence that is most relevant to the current target period classification.

[0014] The model was trained in two stages using a component-based training strategy: In the first stage, the feature extraction module was trained independently using data from a single EEG period, with the loss function being weighted cross-entropy. The weights were set according to the distribution of each sleep stage in the dataset, with higher weights assigned to the N1 stage, which was not representative enough. In the second stage, the parameters of the feature extraction module were frozen, and the sequence learning module was trained using continuous time-series data.

[0015] Step 5: Input the single-channel EEG signal sequence from each test set into the corresponding trained multi-scale time-frequency network model;

[0016] First, the feature extraction module extracts features from the EEG signals after each time series segmentation. Then, the sequence learning module models the temporal dependency relationship and outputs the classification label of the sleep stage corresponding to that period: wakefulness (W), N1, N2, N3 or REM sleep.

[0017] Multiple evaluation metrics were used to comprehensively evaluate the model performance, including classification accuracy, macro-average F1 score, precision, recall and F1 score for each sleep stage, and Cohen's Kappa coefficient to quantify classification consistency.

[0018] Step 6: Select the model with the highest overall classification accuracy on the corresponding test dataset from the training models obtained from different training datasets as the best model, output and save the trained model, and use it to classify the sleep stages of newly collected single-channel EEG data.

[0019] Furthermore, the temporal branch in step 4 employs a multi-scale feature extraction architecture, specifically including:

[0020] Initial feature extraction of the original single-channel EEG signal is performed using a one-dimensional convolutional layer:

[0021]

[0022] in, This represents the initial feature representation extracted from the raw input EEG signal; The parameter is One-dimensional convolutional layer, This includes kernel size, stride, padding, and output channels; Indicates a time window; Indicates batch normalization, This indicates a modified linear unit activation function. Indicates max pooling;

[0023] A multi-scale Inception module is used to extract sleep features at multiple time scales using parallel convolutional filters with different kernel sizes. Small kernels are suitable for detecting rapid transients and high-frequency oscillations, medium kernels are suitable for identifying sleep spindles, and large kernels are used to extract slow wave phenomena of K-complex waves and delta waves.

[0024] The integrated statistical behavior local extremum module detects local maxima and minima through adaptive thresholding, and is particularly effective in detecting sleep spindle patterns characterized by clustered extrema and slow wave patterns characterized by significant peaks and troughs. The detection conditions are expressed as follows:

[0025]

[0026]

[0027] in, This represents the local mean of the sliding window. The adaptive threshold parameter learned during training; Indicates the current time point The amplitude of the EEG signal at that location; Indicates a point in time The amplitude of the EEG signal at that location; Indicates a point in time The amplitude of the EEG signal at that location;

[0028] A self-attention mechanism is introduced to selectively focus on the time-domain patterns most relevant to sleep stage classifications and dynamically adjust the attention given to different time patterns.

[0029] Furthermore, the frequency domain branch in step 4 focuses on analyzing the frequency domain characteristics of the EEG signal, specifically including:

[0030] A detailed time-frequency representation is constructed using wavelet packet transform, which has superior time-frequency localization capabilities compared to traditional Fourier transform. It is suitable for analyzing non-stationary sleep EEG signals. The transform formula is as follows:

[0031]

[0032] in, Indicates a point in time The amplitude of the EEG signal at that location, Indicates the first Wavelet functions for layer decomposition and These are the scale parameter and the translation parameter, respectively.

[0033] Clinically relevant sleep rhythms are emphasized through an adaptive frequency band weighting mechanism, including delta, theta, alpha, sigma, and beta bands. The weights of each band are adaptively optimized during training to emphasize the frequency components most relevant to sleep stage discrimination.

[0034] A phase-amplitude coupling module is introduced to model the cross-frequency interaction between different frequency bands. The phase information of low-frequency components and the amplitude information of high-frequency components are extracted through a special convolution operation, which effectively captures phenomena such as slow oscillation-spindle coupling during N2 sleep, delta-alpha coupling during light sleep transition, and theta-gamma coupling during REM sleep.

[0035] A specially designed SE-Block channel attention mechanism is applied to the frequency domain features for channel recalibration, adaptively emphasizing the most discriminative frequency domain feature channels.

[0036] Furthermore, step 4 also includes a subject-adaptive feature calibration module. This module performs real-time signal quality assessment and adaptive feature calibration based on six key indicators to dynamically compensate for differences in EEG signal characteristics and signal quality fluctuations between individuals. Specifically, it includes:

[0037] This module assesses the signal-to-noise ratio (SNR) by comparing signal power in the physiologically relevant frequency band (0.5–30 Hz) with high-frequency noise components above 30 Hz through spectral analysis; it uses the coefficient of variation to assess variance stability (VS) to measure signal consistency across time windows; amplitude anomaly detection (AAD) employs an interquartile range-based method to identify signal anomalies that may indicate artifacts or recording problems; flat line detection (FD) evaluates electrode contact quality by analyzing the signal derivative based on an adaptive threshold; and the system also monitors triangular band relative power (DRP) to capture low-frequency sleep-related activities. Band relative power (ARP) was used to assess neural oscillations associated with arousal.

[0038] These quality metrics are processed through a multilayer perceptron to generate subject-specific calibration factors, which are used to evaluate fused features. Perform adaptive adjustments:

[0039]

[0040]

[0041] in, Learnable parameters for controlling calibration intensity, The calibration vector generated for the quality assessment network. To represent element-wise multiplication, use This ensures that the calibration factor is bounded.

[0042] The calibrated features are then passed through the final classification layer to generate epoch-level predictions for each epoch in the first training phase.

[0043]

[0044] in, Indicates within a single epoch The probability distribution of each sleep stage.

[0045] Furthermore, in step 4, the sequence learning module uses a bidirectional gated recurrent unit network to process the calibrated feature sequence, and combines a temporal attention mechanism to dynamically select the period in the sequence that is most relevant to the current target period classification. Specifically:

[0046] A bidirectional gated recurrent unit (GRU) network is employed to process the calibrated feature sequences. Forward-gated GRUs capture past contextual information, while backward-gated GRUs capture future contextual information. This bidirectional processing enables the model to integrate comprehensive temporal context. A temporal attention mechanism is introduced to dynamically select the most relevant period in the sequence to the current target period classification, with attention weights... The calculation is as follows:

[0047]

[0048] in, Indicates the first Attention score at each time point Indicates the first Attention score at each time point The attention weights are adaptively adjusted based on the sleep stage and transition mode, given the sequence length.

[0049] By processing context vectors containing information about the entire sequence through a multi-layer classification network, the sleep stage of the central period is predicted. The context vectors encapsulate all relevant temporal dependency information in the sequence.

[0050] Furthermore, the component-based training strategy in step 4 is divided into two independent training phases:

[0051] The first stage is the feature extraction module training stage. The feature extraction module is trained independently using a single EEG signal data point, without considering sequence context. A weighted cross-entropy loss function is used to address the inherent class imbalance problem in the sleep dataset. The loss function for the feature extraction module training stage is... The calculation is as follows:

[0052]

[0053] in, Indicates assignment to category The weighting is adjusted, with higher weights assigned to categories that are not representative enough. =5 indicates the number of sleep stage categories; Indicates the number of training rounds; Used to identify the first The true class label of the training sample when the nth training sample Each sample belongs to category hour, The value is 1 if it is 1, otherwise it is 0. The feature extraction module represents the first... The epoch belongs to the th epoch. Predicted probabilities for each sleep stage category;

[0054] The second stage is the sequence learning module training stage. After the feature extraction module converges, its parameters are frozen to preserve the learned feature representations. Then, the sequence learning module is trained using continuous-time sequence data, employing the standard cross-entropy loss function. This enables the model to capture temporal dependencies and transition patterns between sleep stages. The loss function for the sequence learning module training stage is... The calculation is as follows:

[0055] .

[0056] Furthermore, the method also includes an SE-Block channel attention mechanism for channel-level adaptive recalibration of time-domain and frequency-domain features:

[0057] SE-Block compresses the spatial dimension of feature maps through global average pooling, generating channel-level global descriptions;

[0058] The inter-channel dependencies are learned through a sequence of fully connected layers involving dimensionality reduction and dimensionality increase operations. Dimensionality reduction decreases the number of parameters and increases nonlinearity, while dimensionality increase restores the original channel dimension. The activation operations are represented as follows:

[0059]

[0060] in, The feature vector after global pooling. and For learnable parameters, This represents the sigmoid activation function;

[0061] The generated channel attention weights are multiplied element-wise with the original feature map to enhance important feature channels and suppress unimportant channels.

[0062] Furthermore, the method maps continuous EEG sequences to sleep stage labels, supporting classification of five sleep stages.

[0063] By processing a length of The central period is classified by continuous period sequence, among which Indicates the number of consecutive periods used to provide classification context;

[0064] The model outputs a probability distribution for each sleep stage, and the softmax activation function ensures that the sum of the probabilities is 1. The final prediction result is the sleep stage with the highest probability.

[0065] The five sleep stages include wakefulness (W), light sleep (N1 stage of non-rapid eye movement sleep), moderate deep sleep (N2 stage), deep sleep (N3 stage), and rapid eye movement (REM) sleep, each with a unique EEG pattern.

[0066] Compared with the prior art, the present invention has the following advantages:

[0067] 1. This invention proposes an innovative dual-branch multi-scale feature extraction architecture. The time-domain branch integrates statistical behavioral local extremum analysis, and the frequency-domain branch introduces a phase-amplitude coupling mechanism. This enables collaborative deep mining of time-domain and frequency-domain information of single-channel EEG signals, significantly improving the completeness and discriminativeness of feature representation and overcoming the fundamental limitations of existing methods with single feature extraction strategies.

[0068] 2. This invention develops an adaptive calibration method based on signal quality assessment. By evaluating multi-dimensional signal quality indicators and generating individual-specific calibration factors, it dynamically compensates for differences in EEG signals between individuals and changes in recording conditions, significantly enhancing the model's generalization ability and clinical applicability, and solving the key problem of performance degradation in cross-individual applications of existing technologies.

[0069] 3. This invention designs a sequence learning module that combines a bidirectional gated loop unit with a temporal attention mechanism, which effectively models the long-range temporal dependencies between sleep stages and accurately captures the continuity features and transition patterns of the sleep process. Compared with existing simple temporal modeling methods, it has significant performance advantages.

[0070] 4. This invention adopts a component-based training strategy, which avoids the instability problem of training complex network structures by optimizing different components in stages, ensuring the convergence and reproducibility of model training, and providing reliable technical support for clinical applications. Attached Figure Description

[0071] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0072] Figure 1 A flowchart of a multi-scale time-frequency network sleep stage classification method;

[0073] Figure 2 This is a schematic diagram of the overall architecture of the multi-scale time-frequency network of the present invention;

[0074] Figure 3 This is a detailed schematic diagram of the temporal branch architecture of the present invention;

[0075] Figure 4 This is a comparison chart of the results of ablation experiments using different components. Detailed Implementation

[0076] To gain a deeper understanding of this invention, we will provide a comprehensive and detailed description. However, this invention has various implementations and is not limited to the specific examples listed herein. These examples are presented to enhance a full understanding of the disclosure of this invention.

[0077] This embodiment presents a sleep stage classification method based on a multi-scale time-frequency network, such as... Figure 1 As shown, it includes the following steps:

[0078] Step 1: Acquire EEG signal data and select channel location

[0079] Electroencephalogram (EEG) signals were collected from subjects throughout their sleep using standard polysomnography (PSG) equipment. Single-channel EEG signals from the Fpz-Cz channel were selected for analysis, as this channel has been proven to provide optimal discriminative information for sleep staging tasks. The EEG signal sampling frequency was set to 100Hz to ensure the capture of all sleep-related frequency components.

[0080] Step 2 involves time-series segmentation, sleep stage category labeling, and standardized preprocessing of the acquired continuous single-channel EEG signals. First, a fixed-length 30-second non-overlapping window is used to segment the continuous EEG recordings into different sleep time series. Each 30-second period contains 3000 data points at a sampling frequency of 100Hz. According to sleep medicine standards, each sleep time series is labeled as one of five standard stages: wakefulness (W), non-rapid eye movement (NREM) sleep stages N1, N2, and N3, and rapid eye movement (REM) sleep. To ensure the analysis focuses on relevant parts of sleep, data from the first 30 minutes of the non-wake stage to the last 30 minutes of the non-wake stage are selected as the effective sleep period for analysis. Bandpass filtering is applied to each 30-second segment, with a filtering frequency range of 0.5-30Hz, to remove DC drift and high-frequency noise. Finally, Z-score normalization is used to normalize the single-channel EEG signals of each period to eliminate the influence of inter-individual amplitude differences.

[0081] Step 3: Use nested cross-validation to partition the dataset. In the outer cross-validation, the dataset is divided into different training and test sets. In the inner cross-validation, each training set is further divided into an inner training set and a validation set. Hyperparameters are optimized to ensure the unbiasedness and reliability of the training process. A grid search strategy is used to determine the hyperparameters. In the inner cross-validation, the classification accuracy of different hyperparameter combinations on the validation set is evaluated. The best-performing hyperparameter configuration is selected for model training in the outer cross-validation.

[0082] Step 4: For each training dataset, construct and train a multi-scale time-frequency network model.

[0083] like Figure 2 As shown, the model comprises two core components: a feature extraction module and a sequence learning module. The feature extraction module adopts a dual-branch parallel architecture, with the temporal branch as follows: Figure 3 As shown, initial feature extraction of the original single-channel EEG signal is performed using a one-dimensional convolutional layer:

[0084]

[0085] in, This represents the initial feature representation extracted from the raw input EEG signal; The parameter is One-dimensional convolutional layer, This includes kernel size, stride, padding, and output channels; Indicates a time window; Indicates batch normalization, This indicates a modified linear unit activation function. Indicates max pooling;

[0086] A multi-scale Inception module is employed, using parallel convolutional filters and integrating a statistical behavior local extremum module to detect local maxima and minima through adaptive thresholding.

[0087]

[0088]

[0089] in, This represents the local mean of the sliding window. The adaptive threshold parameter learned during training; Indicates the current time point The amplitude of the EEG signal at that location; Indicates a point in time The amplitude of the EEG signal at that location; Indicates a point in time The amplitude of the EEG signal at that location;

[0090] A self-attention mechanism is introduced to selectively focus on the time-domain patterns most relevant to sleep stage classifications and dynamically adjust the attention given to different time patterns.

[0091] The frequency domain branch uses wavelet packet transform to construct the time-frequency representation:

[0092]

[0093] Decomposition was performed using Daubechies-4 wavelets. Learnable weights were assigned to the delta (0.5-4Hz), theta (4-8Hz), alpha (8-13Hz), sigma (12-16Hz), and beta (16-30Hz) frequency bands through an adaptive frequency band weighting mechanism. Indicates a point in time The amplitude of the EEG signal at that location, Indicates the first Wavelet functions for layer decomposition and These are the scale parameter and the translation parameter, respectively; the phase-amplitude coupling module processes phase and amplitude information through convolution operations.

[0094] Subject-based adaptive feature calibration performs real-time signal quality assessment and adaptive feature calibration based on six key indicators to dynamically compensate for inter-individual differences in EEG signal characteristics and signal quality fluctuations. Specifically, these include:

[0095] This module assesses the signal-to-noise ratio (SNR) by comparing signal power in the physiologically relevant frequency band (0.5–30 Hz) with high-frequency noise components above 30 Hz through spectral analysis; it uses the coefficient of variation to assess variance stability (VS) to measure signal consistency across time windows; amplitude anomaly detection (AAD) employs an interquartile range-based method to identify signal anomalies that may indicate artifacts or recording problems; flat line detection (FD) evaluates electrode contact quality by analyzing the signal derivative based on an adaptive threshold; and the system also monitors triangular band relative power (DRP) to capture low-frequency sleep-related activities. Band relative power (ARP) was used to assess neural oscillations associated with arousal.

[0096] These quality metrics are processed through a multilayer perceptron to generate subject-specific calibration factors, which are used to evaluate fused features. Perform adaptive adjustments:

[0097]

[0098]

[0099] in, Learnable parameters for controlling calibration intensity, The calibration vector generated for the quality assessment network. To represent element-wise multiplication, use This ensures that the calibration factor is bounded.

[0100] The calibrated features are then passed through the final classification layer to generate epoch-level predictions for each epoch in the first training phase.

[0101]

[0102] in, Indicates within a single epoch The probability distribution of each sleep stage.

[0103] The sequence learning module employs bidirectional gated recurrent units and a temporal attention mechanism to calculate attention weights. :

[0104]

[0105] in, Indicates the first Attention score at each time point Indicates the first Attention score at each time point For the sequence length, the attention weights are adaptively adjusted according to the sleep stage and transition mode. For example, during stable deep sleep, attention is focused on the immediate temporal neighborhood, while during transitions, broader temporal context information is integrated.

[0106] Model training is performed using a component-based training strategy:

[0107] The first stage of training the feature extraction module uses the Adam optimizer and a weighted cross-entropy loss function. The loss function during the feature extraction module training phase is... The calculation is as follows:

[0108]

[0109] in, Indicates assignment to category The weighting is adjusted, with higher weights assigned to categories that are not representative enough. =5 indicates the number of sleep stage categories; Indicates the number of training rounds; Used to identify the first The true class label of the training sample when the nth training sample Each sample belongs to category hour, The value is 1 if it is 1, otherwise it is 0. The feature extraction module represents the first... The epoch belongs to the th epoch. Predicted probabilities for each sleep stage category;

[0110] The second stage involves freezing the parameters of the feature extraction module, training the sequence learning module, and defining the loss function for the sequence learning module during its training phase. The calculation is as follows:

[0111]

[0112] Step 5: Input the single-channel EEG signal sequence from each test set into the corresponding trained multi-scale time-frequency network model for model performance evaluation.

[0113] First, the feature extraction module extracts features from the short-time series EEG signals. Then, the sequence learning module models the temporal dependency relationship and outputs the classification label of the sleep stage corresponding to this period: wakefulness (W), N1, N2, N3 or REM.

[0114] Multiple evaluation metrics were used to comprehensively evaluate the model performance, including classification accuracy, macro-average F1 score, precision, recall and F1 score for each sleep stage, and Cohen's Kappa coefficient to quantify classification consistency.

[0115] Step 6: Select the model with the highest overall classification accuracy on the corresponding test dataset from the training models obtained from different training datasets as the best model, output and save the trained model, and use it to classify the sleep stages of newly collected single-channel EEG data.

[0116] The proposed method was validated using two widely used public EEG datasets related to sleep. The two datasets are Sleep-EDF-20 and Sleep-EDF-78. Sleep-EDF-20 contains overnight polysomnography recordings from 20 healthy subjects, while Sleep-EDF-78 includes data from Sleep-EDF-20 plus data from an additional 58 subjects. All data were manually labeled by sleep experts according to the Rechtschaffen and Kales (R&K) standard, categorizing signals into five sleep stages: W, N1, N2, N3, and REM. These category labels will serve as the gold standard for evaluating the accuracy of the classification results of each method. This study extracted single-channel EEG signals using an Fpz-Cz electrode configuration, which were then used for the proposed method and related comparative methods.

[0117] Specifically, a nested cross-validation framework was employed on the Sleep-EDF-20 dataset, implementing a 20-fold subject-level cross-validation strategy to ensure unbiased model construction and performance evaluation. In the outer cross-validation layer, the data from the 20 subjects were divided by subject. In each fold, all sleep data from one subject was selected as the test set, while the sleep data from the remaining 19 subjects constituted the training set. This prevented data leakage and ensured generalization performance evaluation across subjects. In the inner cross-validation layer, the training data from the 19 subjects was further optimized using 5-fold cross-validation. Specifically, the 19 training subjects were randomly divided into 5 subsets. In each fold, 4 subsets (data from approximately 15-16 subjects) were selected as the inner training set, and 1 subset (data from approximately 3-4 subjects) was selected as the validation set for hyperparameter tuning during the grid search process. The hyperparameter search space includes three key parameters: (1) sequence length parameter, used for temporal context modeling, with a search range of [10, 15, 20, 25, 30] periods; (2) temporal convolution kernel size parameter, used for multi-scale feature extraction, with a search range of [3, 5, 7, 9]; and (3) class weight strategy parameter, used to address sleep stage imbalance, including three strategies: uniform weight, inverse frequency weight, and effective sample number weight. In the evaluation of each hyperparameter combination in the inner cross-validation, the macro-average F1 score is used as the model performance evaluation index. After determining the optimal hyperparameter configuration through inner cross-validation, the model is retrained using a complete training set of 19 subjects to obtain the final model for outer cross-validation testing. Based on the 20 models obtained from outer cross-validation, the optimal model is selected according to their performance on the corresponding test data. Subsequently, the optimal model trained on the Sleep-EDF-20 dataset was applied to 58 subject samples from the Sleep-EDF-78 dataset that were not part of Sleep-EDF-20, to test the model's generalization ability in cross-dataset scenarios.

[0118] Meanwhile, under the same data partitioning and evaluation strategies, a comparative analysis was conducted with eight current state-of-the-art sleep staging models. CNN-based methods included ASSC, SingleChannelNet, and FFTCN: ASSC extracts multi-scale temporal features through parallel convolutional branches and integrates conditional random fields to model temporal dependencies; SingleChannelNet employs an end-to-end framework, achieving multi-scale feature representation learning through parallel processing of multiple convolutional blocks; FFTCN utilizes temporal convolutional networks for feature fusion, effectively capturing temporal patterns without relying on recurrent structures. However, these methods may have limitations in capturing long-range temporal dependencies. LSTM-based methods include DeepSleepNet, TinySleepNet, and IITNet: DeepSleepNet combines CNN-based feature extraction with LSTM layers to capture temporal dependencies over continuous time periods; TinySleepNet maintains the temporal modeling capabilities of LSTM while optimizing computational efficiency; IITNet extracts sub-period-level features using ResNet-50 and uses bidirectional LSTM to simultaneously capture short-term intra-period patterns and long-term temporal dependencies. However, the sequential processing architecture of these methods may create computational bottlenecks, affecting parallel processing and training efficiency. Attention-based methods include AttnSleep and TSA-Net: AttnSleep combines multi-resolution CNNs with adaptive feature recalibration, using a multi-head attention mechanism to achieve temporal context encoding; TSA-Net uses dual-stream extraction to process temporal and frequency domain information separately, utilizing a multi-head self-attention mechanism to capture feature dependencies. Although these methods perform well in modeling temporal dependencies, they still face challenges in terms of computational efficiency and robust generalization across patient populations.

[0119] To evaluate the performance of the proposed method, we employed widely used evaluation metrics: overall classification performance via ACC (a measure of the proportion of correctly classified sleep periods out of all sleep periods) and MF1 (calculating the unweighted average of F1 scores to ensure equal consideration of a small number of sleep stages). The proposed method is evaluated using a coefficient (quantitative classification consistency). Additionally, an F1 score is calculated for each category to assess its performance in classifying individual sleep stages. Experiments ensure that the evaluation metrics and experimental configurations of the comparative methods are consistently consistent with those of the proposed method to guarantee rigorous and fair performance evaluation.

[0120] Table 1 Comparative Experimental Results

[0121]

[0122] Note: Bold text indicates the highest performance metric in each column, and underlined text indicates the second highest result.

[0123] As shown in Table 1, the proposed method achieves the highest overall accuracy of 85.8% on the Sleep-EDF-20 dataset, with a macro-average F1 score of 79.4%. On the Sleep-EDF-78 dataset, the accuracy of this method is 86.7%. The value is 0.81. The consistently high performance across different datasets indicates that this method effectively captures latent patterns in single-channel EEG signals while maintaining generalization performance across different subject populations.

[0124] To evaluate the contribution of each component in this method, we conducted ablation experiments by systematically removing the time-domain branch, frequency-domain branch, phase-amplitude coupling module, and main adaptive calibration module to assess their impact on performance. Figure 4 As shown, the ablation experiments verified the technical contributions of each core component: removing the time-domain branch resulted in a 1.98% decrease in accuracy, removing the frequency-domain branch resulted in a 1.9% decrease in accuracy, removing the phase-amplitude coupling module resulted in a 0.7% decrease in accuracy, and removing the main adaptive calibration module resulted in a 0.8% decrease in accuracy, demonstrating the necessity and synergistic effect of each component.

[0125] Contents not described in detail in this specification are prior art known to those skilled in the art. Although illustrative specific embodiments of the invention have been described above to facilitate understanding by those skilled in the art, it should be understood that the invention is not limited to the scope of the specific embodiments. Various modifications are readily apparent to those skilled in the art as long as they fall within the spirit and scope of the invention as defined and determined by the appended claims, and all inventions utilizing the concept of this invention are protected.

Claims

1. A sleep stage classification method based on a multi-scale time-frequency network using single-channel EEG, characterized in that, Includes the following steps: Step 1: Collect EEG signals from the subject during the entire night's sleep, and select single-channel EEG signals at the Fpz-Cz channel location as the analysis object; Step 2: Perform time-series segmentation, sleep stage category labeling, and standardized preprocessing on the collected continuous single-channel EEG signals; Step 3: Use nested cross-validation to partition the dataset. In the outer cross-validation, the dataset is divided into different training and test sets. In the inner cross-validation, each training set is further divided into an inner training set and a validation set. Hyperparameters are optimized to ensure the unbiasedness and reliability of the training process. A grid search strategy is used to determine the hyperparameters. In the inner cross-validation, the classification accuracy of different hyperparameter combinations on the validation set is evaluated, and the best-performing hyperparameter configuration is selected for model training in the outer cross-validation. Step 4: For each training dataset, construct a multi-scale time-frequency network model and train it. The multi-scale time-frequency network model includes two core components: a feature extraction module and a sequence learning module. The feature extraction module adopts a dual-branch parallel architecture with time-domain and frequency-domain branches. The time-domain branch integrates local extremum analysis into the multi-scale Inception module to adaptively capture time-domain features at different time scales. The frequency-domain branch uses wavelet packet transform through the phase-amplitude coupling module to extract features for cross-frequency interactions that are crucial for sleep staging. The sequence learning module uses a bidirectional gated recurrent unit network to process the calibrated feature sequence, and combines a temporal attention mechanism to dynamically select the period in the sequence that is most relevant to the current target period classification. The model was trained in two stages using a component-based training strategy: In the first stage, the feature extraction module was trained independently using data from a single EEG period. The loss function was weighted cross-entropy, and the weights were set according to the distribution of each sleep stage in the dataset. Higher weights were assigned to the N1 stage, which was not representative enough. The second stage involves freezing the parameters of the feature extraction module and training the sequence learning module using continuous-period sequence data. Step 5: Input the single-channel EEG signal sequence from each test set into the corresponding trained multi-scale time-frequency network model to evaluate the model performance; First, the feature extraction module extracts features from the short-time series EEG signals. Then, the sequence learning module models the temporal dependency relationship and outputs the classification label of the sleep stage corresponding to this period: wakefulness (W), N1, N2, N3 or REM sleep. Multiple evaluation metrics were used to comprehensively evaluate the model performance, including classification accuracy, macro-average F1 score, precision, recall and F1 score for each sleep stage, and Cohen's Kappa coefficient to quantify classification consistency. Step 6: Select the model with the highest overall classification accuracy on the corresponding test dataset from the training models obtained from different training datasets as the best model, output and save the trained model, and use it to classify the sleep stages of newly collected single-channel EEG data.

2. The sleep stage classification method based on a multi-scale time-frequency network using single-channel EEG as described in claim 1, characterized in that, The temporal branch in step 4 employs a multi-scale feature extraction architecture, specifically including: Initial feature extraction of the original single-channel EEG signal is performed using a one-dimensional convolutional layer: ; in, This represents the initial feature representation extracted from the raw input EEG signal; The parameter is One-dimensional convolutional layer, This includes kernel size, stride, padding, and output channels; Indicates a time window; Indicates batch normalization, This indicates a modified linear unit activation function. Indicates max pooling; A multi-scale Inception module is used to extract sleep features at multiple time scales using parallel convolutional filters with different kernel sizes. Small kernels are suitable for detecting rapid transients and high-frequency oscillations, medium kernels are suitable for identifying sleep spindles, and large kernels are used to extract slow wave phenomena of K-complex waves and delta waves. An integrated statistical behavior local extremum module is used to detect local maxima and minima through adaptive thresholding. This allows for the detection of sleep spindle patterns characterized by clustered extrema and slow wave patterns characterized by significant peaks and troughs. The detection conditions are expressed as follows: ; ; in, This represents the local mean of the sliding window. The adaptive threshold parameter learned during training; Indicates the current time point The amplitude of the EEG signal at that location; Indicates a point in time The amplitude of the EEG signal at that location; Indicates a point in time The amplitude of the EEG signal at that location; A self-attention mechanism is introduced to selectively focus on the time-domain patterns most relevant to sleep stage classifications and dynamically adjust the attention given to different time patterns.

3. The sleep stage classification method based on a multi-scale time-frequency network using single-channel EEG as described in claim 1, characterized in that, In step 4, the frequency domain branch focuses on analyzing the frequency domain characteristics of the EEG signal, specifically including: A detailed time-frequency representation is constructed using wavelet packet transform, which has superior time-frequency localization capabilities compared to the traditional Fourier transform. It is suitable for analyzing non-stationary sleep EEG signals. The transform formula is as follows: ; in, Indicates a point in time The amplitude of the EEG signal at that location, Indicates the first Wavelet functions for layer decomposition and These are the scale parameter and the translation parameter, respectively. Clinically relevant sleep rhythms are emphasized through an adaptive frequency band weighting mechanism, including delta, theta, alpha, sigma, and beta bands. The weights of each band are adaptively optimized during training to emphasize the frequency components most relevant to sleep stage discrimination. A phase-amplitude coupling module is introduced to model the cross-frequency interaction between different frequency bands. The phase information of low-frequency components and the amplitude information of high-frequency components are extracted through a special convolution operation, which effectively captures phenomena such as slow oscillation-spindle coupling during N2 sleep, delta-alpha coupling during light sleep transition, and theta-gamma coupling during REM sleep. A specially designed SE-Block channel attention mechanism is applied to the frequency domain features for channel recalibration, adaptively emphasizing the most discriminative frequency domain feature channels.

4. The sleep stage classification method based on a multi-scale time-frequency network using single-channel EEG as described in claim 1, characterized in that, Step 4 also includes a subject-adaptive feature calibration module. This module performs real-time signal quality assessment and adaptive feature calibration based on six key indicators to dynamically compensate for differences in EEG signal characteristics and signal quality fluctuations between individuals. Specifically, it includes: This module assesses the signal-to-noise ratio (SNR) by comparing signal power in the physiologically relevant frequency band (0.5–30 Hz) with high-frequency noise components above 30 Hz through spectral analysis; it uses the coefficient of variation to assess variance stability (VS) to measure signal consistency across time windows; amplitude anomaly detection (AAD) employs an interquartile range-based method to identify signal anomalies that may indicate artifacts or recording problems; flat line detection (FD) evaluates electrode contact quality by analyzing the signal derivative based on an adaptive threshold; and the system also monitors triangular band relative power (DRP) to capture low-frequency sleep-related activities. Band relative power (ARP) was used to assess neural oscillations associated with arousal; These quality metrics are processed through a multilayer perceptron to generate subject-specific calibration factors, which are used to evaluate fused features. Perform adaptive adjustments: ; ; in, Learnable parameters for controlling calibration intensity, The calibration vector generated for the quality assessment network. To represent element-wise multiplication, use This ensures that the calibration factor is bounded and adaptively adjusts the feature representation; The calibrated features are then passed through the final classification layer to generate epoch-level predictions for each epoch in the first training phase. ; in, Indicates within a single epoch The probability distribution of each sleep stage.

5. The sleep stage classification method based on a multi-scale time-frequency network using single-channel EEG according to claim 1, characterized in that, In step 4, the sequence learning module uses a bidirectional gated recurrent unit network to process the calibrated feature sequence, and combines a temporal attention mechanism to dynamically select the period in the sequence that is most relevant to the current target period classification. Specifically: A bidirectional gated recurrent unit network is used to process the calibrated feature sequence. The forward gated recurrent unit captures past context information, and the backward gated recurrent unit captures future context information. This bidirectional processing enables the model to integrate comprehensive temporal context. A temporal attention mechanism is introduced to dynamically select the period in the sequence that is most relevant to the current target period classification, and the attention weights are applied accordingly. The calculation is as follows: ; in, Indicates the first Attention score at each time point Indicates the first Attention scores at each time point The attention weights are adaptively adjusted based on the sleep stage and transition mode, given the sequence length. By processing context vectors containing information about the entire sequence through a multi-layer classification network, the sleep stage of the central period is predicted. The context vectors encapsulate all relevant temporal dependency information in the sequence.

6. The sleep stage classification method based on a multi-scale time-frequency network using single-channel EEG according to claim 1, characterized in that, The component-based training strategy in step 4 is divided into two independent training phases: The first stage is the feature extraction module training stage. The feature extraction module is trained independently using a single EEG data point, without considering sequence context. A weighted cross-entropy loss function is used to address the inherent class imbalance problem in the sleep dataset. The loss function for the feature extraction module training stage is... The calculation is as follows: ; in, Indicates assignment to category The weighting is adjusted, with higher weights assigned to categories that are not representative enough. =5 indicates the number of sleep stage categories; Indicates the number of training rounds; Used to identify the first The true class label of the training sample when the nth training sample Each sample belongs to category hour, The value is 1 if it is 1, otherwise it is 0. The feature extraction module represents the first... The epoch belongs to the th epoch. Predicted probabilities for each sleep stage category; The second stage is the sequence learning module training stage. After the feature extraction module converges, its parameters are frozen to preserve the learned feature representations. Then, the sequence learning module is trained using continuous-time sequence data, employing the standard cross-entropy loss function. This enables the model to capture temporal dependencies and transition patterns between sleep stages. The loss function for the sequence learning module training stage is... The calculation is as follows: 。 7. The sleep stage classification method based on a multi-scale time-frequency network using single-channel EEG according to claim 1, characterized in that, The method also includes an SE-Block channel attention mechanism for channel-level adaptive recalibration of time-domain and frequency-domain features: SE-Block compresses the spatial dimension of feature maps through global average pooling, generating channel-level global descriptions; The inter-channel dependencies are learned through a sequence of fully connected layers involving dimensionality reduction and dimensionality increase operations. Dimensionality reduction decreases the number of parameters and increases nonlinearity, while dimensionality increase restores the original channel dimension. The activation operations are represented as follows: ; in, The feature vector after global pooling. and For learnable parameters, This represents the sigmoid activation function; The generated channel attention weights are multiplied element-wise with the original feature map to enhance important feature channels and suppress unimportant channels.

8. The sleep stage classification method based on a multi-scale time-frequency network using single-channel EEG according to claim 1, characterized in that, The method maps continuous EEG sequences to sleep stage labels, supporting classification of five sleep stages. By processing a length of The central period is classified by continuous period sequence, among which Indicates the number of consecutive periods used to provide classification context; The model outputs a probability distribution for each sleep stage, and the softmax activation function ensures that the sum of the probabilities is 1. The final prediction result is the sleep stage with the highest probability. The five sleep stages include wakefulness (W), light sleep (N1 stage of non-rapid eye movement sleep), moderate deep sleep (N2 stage), deep sleep (N3 stage), and rapid eye movement (REM) sleep, each with a unique EEG pattern.

Citation Information

Cited By

  • Model architecture of time-frequency conjoint analysis and multi-scale feature reinforcement learning

    CN121388795A

  • Lightweight single-channel electroencephalogram sleep staging method and system based on multistage fusion

    CN121795931A

  • Single-channel electroencephalogram sleep analysis method and related equipment

    CN121971042A