A sleep staging method and system based on self-supervised learning and Mamba network
Through the combination of self-supervised learning and Mamba network, data dependence and computational complexity problems in sleep staging are solved, and efficient sleep staging classification under a small amount of labeled data is achieved, which improves accuracy and efficiency.
Patent Information
- Application Number
- CN202410953914.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-07-17
AI Technical Summary
The prior art relies on a large amount of labeled data in sleep staging and is susceptible to artificial bias, and deals with the computational complexity of long-sequence data, resulting in insufficient efficiency and accuracy.
Using a method based on self-supervised learning and Mamba network, high-quality sleep EEG signal characteristics are extracted through self-supervised training network, combined with time-frequency domain data enhancement and feature screening, and feature extraction and classification are used for separable convolution module and Mamba network.
The accuracy and efficiency of sleep staging are improved with a small amount of labeled data, the robustness and generalization ability of the model are enhanced, the computational complexity is reduced, and the breadth and depth of feature extraction are significantly improved.
Smart Images

Figure CN118490179B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a sleep staging method, in particular to a sleep staging method and system based on self-supervised learning and Mamba network, belonging to the technical field of health information processing and pattern recognition. Background Art
[0002] Statistics show that a large number of people around the world still suffer from sleep problems, and many people rely on drugs to improve their sleep quality. Although drugs can induce sleep quickly, long-term use may have serious negative effects, including damage to physical health and the risk of drug addiction. Therefore, it is particularly important to accurately assess sleep quality. Classifying sleep stages is the key to diagnosing sleep disorders and assessing sleep quality. Sleep stages are mainly divided into rapid eye movement and non-rapid eye movement. The sleep stages are divided into five categories, namely W (wakefulness), NREM-N1 (non-rapid eye movement-N1), NREM-N2 (non-rapid eye movement-N2), NREM-N3 (non-rapid eye movement-N3) and REM (rapid eye movement).
[0003] The traditional sleep stage scoring process relies on manual operations by clinicians, which is not only time-consuming and labor-intensive, but also susceptible to human bias. The latest deep learning technology has made significant progress in automated sleep stage classification, greatly improving efficiency and accuracy. However, automated classification still faces some challenges. First, large labeled datasets are required to train deep learning models, but obtaining these data is difficult and expensive; second, manually generated annotations inevitably carry inherent biases, which may affect the performance of the model; finally, the computational complexity of processing long sequence data also needs to be overcome to ensure that the model can efficiently process and analyze sleep data. Summary of the invention
[0004] The purpose of the present invention is to provide a sleep staging method based on self-supervised learning and Mamba network to address the deficiencies of the existing technology, which can achieve a more accurate sleep staging effect with a small amount of labeled data.
[0005] The technical solution adopted by the present invention is:
[0006] A sleep staging method based on self-supervised learning and Mamba network includes the following steps:
[0007] S1. Obtain sleep EEG signals and preprocess them to obtain a sample data set;
[0008] S2. Use a self-supervised training network to process data and extract high-quality sleep EEG signal features: The self-supervised training network includes a three-branch parallel network of feature enhancement, feature screening, and mask prediction. The feature enhancement branch first enhances the EEG signal based on the frequency domain and time domain respectively, and then sends the original EEG signal and the enhanced data into the encoder module to obtain the vector representation of each fragment element. The vector representation is randomly enhanced in the time series direction and the frequency domain direction to obtain the enhanced sample data vector, and the time series feature optimization loss, frequency feature optimization loss and total contrast loss are calculated; the feature screening branch first passes the input data through the embedding layer and then enters the clustering module, and obtains the cluster center vector representation of each class through the clustering algorithm, and calculates the clustering loss function of each point around the cluster center; the mask prediction branch randomly masks the EEG signal, and then performs preliminary context feature extraction, and then uses the back propagation derivative of the clustering loss function to obtain the gradient value of each dimension for feature dimension screening, and then performs mask prediction and calculates the mask prediction loss; the total loss of the three-branch network is calculated for multi-task training, and the trained network is used to extract high-quality sleep EEG signal features;
[0009] S3. Use the separable convolution module to extract time-frequency features of high-quality sleep EEG signal features;
[0010] S4. The features extracted in step S3 are input into the feature enhancement module based on the Mamba network to extract contextual features again;
[0011] S5. Use the classifier to classify the extracted feature information into sleep stages.
[0012] In the above method,
[0013] In step S2, the feature enhancement branch first enhances the EEG signal based on the frequency domain and time domain respectively. First, different sequence data are subjected to fast Fourier transform to obtain the frequency representation of the sequence, and the same frequency data segments of different sequences are randomly replaced to obtain a new frequency representation. Then, an inverse fast Fourier transform is performed to obtain the frequency domain enhanced sequence. Secondly, for a complete sequence sample, the beginning and end data are cropped to obtain EEG signal data with stronger usability.
[0014] The calculation formula for the time series feature optimization loss in step S2 is as follows:
[0015] ,
[0016] in, , The original data sequence i No. t The vector representation of the fragments, is the enhanced sequence after time-frequency domain data enhancement iNo. t The vector representation of the fragments, The original data is optimized in the time series direction. i No. t’ The vector representation of the fragments, To enhance the sequence data, the sequence is optimized in the time series direction. i No. t’ The vector representation of the fragments, t ’ For sequence i Remove t Time outside of segment time.
[0017] The frequency feature optimization loss calculation formula is as follows:
[0018] ,
[0019] in, , Indicates that on the jth sequence Fragment data with the same frequency, j To remove the sequence i Other sequences than j The maximum value of is the number of sequences in a batch of data. is the original data after frequency-direction feature optimization on the jth sequence A vector representation of fragment data with the same frequency, To enhance the sequence data, after optimizing in the frequency domain, the jth sequence is Vector representation of fragment data with the same frequency; The total contrast loss is obtained by calculating the sum of the losses of all sequence fragments:
[0020] ,
[0021] in, For the i The first t The temporal feature optimization loss of each segment, For the i The first t The frequency feature optimization loss of each segment.
[0022] The calculation formula of the clustering loss function in step S2 is:
[0023] ,
[0024] in, The same derivative for each Gaussian distribution, D For all sequence data, K i is the cluster center,K j is the vector representation of other cluster centers, d A vector representation of each point around the cluster center.
[0025] The feature dimension screening in step S2 is to rank the feature dimensions according to the size of the gradient value and retain the important dimensions with a given proportion.
[0026] The calculation formula for the mask prediction loss in step S2 is:
[0027] ,
[0028] in, D i , DS i is the vector representation of the original data and the enhanced data, , The vector representation generated for the prediction, is the regularization operation.
[0029] The total loss of the three-branch network in step S2 is:
[0030] ,in φ and ω is a hyperparameter.
[0031] The separable convolution module described in step S3 includes two convolution layers of different sizes and a separable convolution layer. The separable convolution layer consists of a depthwise convolution layer and a pointwise convolution layer. First, a convolution layer of size 1 is used. The convolutional layer of size 50 extracts high-frequency features in sleep EEG signals, using a convolutional layer of size 1 A convolutional layer of 100 extracts low-frequency extracts from sleep EEG signals, followed by a deep convolutional layer to learn the spatial information of specific frequencies and capture the inter-frequency information of each sleep stage, using a point-by-point convolutional layer to optimally mix each feature map.
[0032] The feature enhancement module based on the Mamba network described in step S4 includes a linear mapping layer, a one-dimensional convolution layer, a selective state space model layer and an activation function. The module first accepts classification tokens from multiple signal time periods through an encoder, and the number of tokens is the number of sequences of the signal input to obtain output data H. The output data H is linearly mapped to expand the input embedding, and then sent to a layer of one-dimensional convolution block to obtain output data V. The output data V is processed by the Silu activation function and then input into the selective state space model to perform context-related reasoning while linearly scaling the sequence length. Finally, a layer of linear mapping is performed to obtain the final output feature, and a jump connection is used between the input data and the output feature.
[0033] Another object of the present invention is to provide a sleep staging system based on self-supervised learning and Mamba network, comprising a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the sleep staging method based on self-supervised learning and Mamba network as described above is implemented.
[0034] The beneficial effects of the present invention are:
[0035] The present invention adopts a data enhancement method in the comprehensive time-frequency domain, strengthens the timing correlation and frequency characteristics of the signal, and effectively increases the diversity of the data; optimizes the model by improving the sample quality, solves the overfitting problem caused by increasing the amount of data in the traditional method, and the problem that simple samples are not able to improve the model performance in the later stage of training; effectively learns features through high-quality positive and negative samples, significantly improving the model's ability to recognize different features; the feature dimension screening module retains important features, screens out irrelevant features, and improves the efficiency of mask prediction; uses convolution blocks of different sizes and separable convolutions to extract features of EEG signals, and learns the physiological characteristics of sleep EEG signals; based on the Mamba network, effectively captures time series features or the relationship information between multiple EEG periods, enhances the feature extraction function of the model, and solves the low efficiency problem of long sequences.
[0036] The present invention improves the robustness and generalization ability of the model through the training and optimization of the self-supervised training network, so that downstream tasks can achieve better results with a small amount of labeled data. Through the rich feature learning at this stage, the model's understanding of the intrinsic structure and characteristics of the data is also improved, and the breadth and depth of feature extraction are enhanced, thereby achieving higher accuracy and efficiency in downstream tasks; the separable convolution module combines information from different channels using deep convolution and point-by-point convolution, and reduces the computational complexity. By analyzing the frequency characteristics of each time point, it can more accurately capture the important features in the sleep EEG signal, thereby providing more in-depth data analysis and interpretation for sleep research; the Mamba structure alleviates the modeling constraints of the convolutional neural network through global receptive field and dynamic weighting, and provides advanced modeling capabilities. The overall method of the present invention improves the efficiency, accuracy and adaptability of sleep stage classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A flowchart of a sleep staging method based on self-supervised learning and Mamba network according to the present invention;
[0038] Figure 2 A network structure diagram of a sleep staging method based on self-supervised learning and Mamba network according to the present invention;
[0039] Figure 3A structural diagram of a data processing network for self-supervised training according to the present invention;
[0040] Figure 4 Flow chart of the data processing network for self-supervised training according to the present invention. DETAILED DESCRIPTION
[0041] The present invention will be further described below in conjunction with the embodiments and drawings.
[0042] Example 1 A sleep staging method based on self-supervised learning and Mamba network, comprising the steps (see Figure 1 )as follows:
[0043] S1. Obtain sleep EEG signals and preprocess them to obtain a sample data set:
[0044] The sample data set is obtained by obtaining sleep EEG signal data samples through the device. The sample data is first processed at 100 sampling points per second, and each data is segmented using the sliding window method. The sliding window design moves a fixed-size frame at a fixed interval in the data, which is effectively used to identify specific patterns or events embedded therein.
[0045] S2. Use self-supervised training network to process data and extract high-quality sleep EEG signal features:
[0046] First, in the prior art, the demand for a large amount of labeled data is difficult to meet. Labeling sleep data requires a lot of time and expertise, and obtaining enough high-quality labeled data is a daunting task. Secondly, the accuracy of the labels is affected by the inconsistency in the assessment of sleep stages between raters. Different raters may make different interpretations of the same piece of sleep data, and this subjective difference reduces the reliability of the data. Finally, the model trained with data annotated by a single rater tends to be biased towards the rater's opinions and interpretations, resulting in poor generalization of the model and difficulty in functioning stably in different environments and conditions. Therefore, the use of self-supervised training becomes an effective solution. The self-supervised training method can be trained by utilizing the intrinsic structure and characteristics of the unlabeled data itself without a large amount of manually labeled data. The model learns useful representations from unlabeled data, which not only reduces the dependence on manually labeled data, but also significantly improves the generalization and robustness of the model.
[0047] The self-supervised training network in this embodiment includes a three-branch parallel network of feature enhancement, feature screening, and mask prediction (see Figure 3 , Figure 4). The feature enhancement branch first enhances the EEG signal based on the frequency domain and time domain respectively, and then sends the original EEG signal and the enhanced data into the encoder module to obtain the vector representation of each fragment element. The vector representation is randomly enhanced in the time direction and frequency domain direction to obtain the enhanced sample data vector, and the time feature optimization loss, frequency feature optimization loss and total contrast loss are calculated.
[0048] The specific feature enhancement process is as follows: for a period of sleep EEG signal data D i , first enter the data enhancement module to obtain enhanced data DS i , where the data enhancement module mainly includes enhancement methods based on the time domain and frequency domain. Since the valuable semantic information of EEG sleep signals mainly exists in time changes and dependencies, general methods such as flipping and permutation cannot capture the appropriate features required for effective general representation learning. Therefore, we perform data enhancement in both the time domain and the frequency domain. First, the different sequence data are subjected to fast Fourier transform to obtain the frequency representation of the sequence, and the same frequency data segments of different sequences are randomly replaced to obtain a new frequency representation. Then, an inverse fast Fourier transform is performed to obtain the frequency domain enhanced sequence. Exchanging frequency components between samples will not introduce unexpected noise or artificial periodicity, and can provide more reliable enhancement functions to retain the semantic characteristics of the data. Secondly, for a complete sequence sample, we crop the beginning and end data according to a certain ratio to obtain EEG signal data with stronger usability. Finally, after the data enhancement method in the time and frequency domains, the enhanced data is obtained. DS i , and then use the sliding window method to split the sequence to get , Then, the original EEG signal D i and augmented data DS i Send it to the encoder module to get the vector representation of each fragment element and .
[0049] Since each person's sleep EEG signals are different, a large amount of data sets are needed for training to obtain a model with good robustness. Previous methods mostly optimize the model by increasing the amount of data. We optimize the model by improving the quality of positive and negative samples, so that the network can learn a broader feature representation. In contrastive learning training, we mainly maximize the distance between positive and negative samples and minimize the distance between positive samples. However, after many rounds of training, we found that too much data can easily lead to overfitting and the contrast training of simple samples in the later stage of training has little effect on the improvement of model performance. Too simple positive and negative samples cannot produce sufficiently good feature extraction and model classification performance. Therefore, the model can be optimized by enhancing the quality of the samples.
[0050] First, in the time series direction, for the vector representation The data vector representation enhanced by random data combination is:
[0051] ,
[0052] in, t’ Represented as vectors of different fragment elements of the same sequence, that is, if t =2, t’ It can be 1, 3, 4, etc. γ is a random enhancement coefficient, whose value is less than 0.5. Similarly, for the enhanced data After the same operation, we get:
[0053] ,
[0054] In the frequency domain, different sequence data are used to select the same frequency data on different sequences for random combination to obtain frequency domain enhanced data:
[0055] ,
[0056] in, Indicates that on the jth sequence Fragment data with the same frequency, μ is a random enhancement coefficient, whose value is less than 0.5. Similarly, the enhanced data After the same operation, we get:
[0057]
[0058] Indicates the jth sequence in the enhanced data with Fragment data with the same frequency.
[0059] After the random combination of data, sample data with richer feature representations are obtained. For the same positive sample, some representations that are close to its position but belong to negative samples will be obtained. Therefore, when performing comparative training, in the early stage of training, sample points that are far away and discrete are used as feature vectors for simple classification, which provides significant parameter optimization for model training. However, in the later stage of training, simple sample comparison can no longer further improve model performance. At this time, the representation of the negative sample points after random combination is closer to that of the positive sample points in the feature space, and it becomes more difficult for the model to distinguish them. Therefore, these negative sample points can produce a larger gradient contribution, thereby providing more valuable discriminant information for model training. Through such a training process, the generalization ability and robustness of the model can be significantly enhanced. Through comparative learning training of positive and negative samples, the model parameters are continuously optimized, so that the network can better identify different and more difficult to identify sleep stage features.
[0060] Timing feature optimization loss calculation:
[0061] ,
[0062] in, , The original data sequence i No. t The vector representation of the fragments, is the enhanced sequence after time-frequency domain data enhancement i No. t The vector representation of the fragments, The original data is optimized in the time series direction. i No. t’ The vector representation of the fragments, To enhance the sequence data, the sequence is optimized in the time series direction. i No. t’ The vector representation of the fragments, t’ For sequence i Remove t Time outside of segment time.
[0063] Frequency feature optimization loss calculation:
[0064] ,
[0065] in, , Indicated in j On the sequence Fragment data with the same frequency, j To remove the sequence i Other sequences than j The maximum value of is the number of sequences in a batch of data. is the original data after frequency-direction feature optimization on the jth sequence A vector representation of fragment data with the same frequency, To enhance the sequence data, after optimizing in the frequency domain, the jth sequence is Vector representation of fragment data with the same frequency;
[0066] By calculating the sum of the losses of all sequence fragments, we get the final loss:
[0067] ,
[0068] in, For the i The first t The temporal feature optimization loss of each segment, For the i The first t The frequency feature optimization loss of each segment.
[0069] The feature screening branch first passes the input data through the embedding layer and then enters the clustering module. The clustering algorithm is used to obtain the cluster center vector representation of each class, and the clustering loss function of each point around the cluster center is calculated. For all input sequence data, it first passes through the embedding layer and then enters the clustering module. The clustering algorithm is used to obtain the cluster center vector representation of each class. The categories are set to five categories, corresponding to the five stages of sleep staging. Each cluster center is represented by a vector K i Indicates that the clustering loss function of each point can be obtained L D :
[0070] ,
[0071] in, The same derivative for each Gaussian distribution, D For all sequence data, K i is the cluster center, K j is the vector representation of other cluster centers, d A vector representation of each point around the cluster center.
[0072] The mask prediction branch randomly masks the EEG signal and then performs preliminary context feature extraction. It then uses the back propagation derivative of the clustering loss function to obtain the gradient value of each dimension for feature dimension screening, and then performs mask prediction and calculates the mask prediction loss.
[0073] Since the spatial position of a vector is determined by each dimension in spatial distribution, when the dominant feature dimension changes, the position distribution of the vector will change significantly, while changes in unimportant dimensions will have little impact on it. L D Back propagation is used to calculate the derivative and obtain the gradient value of each dimension. Since the gradient value represents the magnitude of the rate of change, when a dimension with a larger gradient changes, it will have a greater impact on the feature representation and spatial distribution of the vector. Therefore, the size of the gradient value is used here to represent the importance of the dimension.
[0074] The main idea of feature dimension screening is to use the importance of each dimension of the vector for screening, and to purify the feature vector by retaining important dimensions and randomly discarding unimportant dimensions. Here, the dropout method is used to screen feature dimensions, retain important features, and filter out irrelevant features. Feature dimensions are ranked according to the size of the gradient value, and important dimensions of a given proportion are retained. Low-importance dimensions are randomly discarded. If important features are lost during the random discarding process, the important features of the original data can be recovered by calculating the gradient value:
[0075] ,
[0076] in N is a binary mask that sets the dimension with gradient value greater than a given ratio to 1 and the others to 0. d con Represents the feature vector after context feature extraction, d dropout Represents the feature vector after random dropping.
[0077] In the mask prediction module, for a sleep EEG signal , by randomly masking a part of the elements of the sequence with a specific probability ρ, the sequence D is transformed into As input, it is sent to the encoder module to obtain the vector representation of each fragment element, and the encoded sequence matrix is sent to the context feature extraction module, which mainly includes position encoding, multi-head attention mechanism, feedforward network and normalization layer. In order to maintain the relative order of the input sequence, the position encoding matrix is introduced, and each fragment vector and the position encoding vector are added as the initial input of the model. Through the multi-head attention module, the dependency relationship between different parts of the input data and the interactive information between features are captured. Each element vector in the sequence will learn the sequence context information, and the output context information is obtained after the feedforward network and normalization layer operations. d conThe feature vector of the context information is learned, and the mask prediction output is obtained after the above feature dimension screening. The predicted mask feature vector is used to train with the original input vector to maximize the feature extraction ability of the model, and the cross entropy loss function is used to calculate the error of the prediction task. L pr :
[0078] ,
[0079] in, D i , DS i is the vector representation of the original data and the enhanced data, , The vector representation generated for the prediction, is the regularization operation.
[0080] S3. Use the separable convolution module to extract time-frequency features of high-quality sleep EEG signal features:
[0081] The separable convolution module mainly consists of two convolutional layers of different sizes and a separable convolutional layer. The separable convolution is a kernel with a size of 1. 6 deep convolutional layers and a kernel size of 1 1 point-by-point convolutional layer. First, use a size of 1 The convolutional layer of size 50 extracts high-frequency features in sleep EEG signals, using a convolutional layer of size 1 100 Two convolutional layers extract low-frequency extracts from sleep EEG signals, followed by deep convolutional layers to learn the spatial information of specific frequencies and capture the inter-frequency information of each sleep stage, using point-by-point convolutional layers to optimally mix each feature map.
[0082] S4. The features extracted in step S3 are input into the feature enhancement module based on the Mamba network to extract context features again (see Figure 2 ):
[0083] When classifying sleep stages, the American Academy of Sleep Medicine not only considers the local features of a single EEG, but also comprehensively considers the relationship between adjacent EEG times to determine the sleep stage. Therefore, a feature enhancement module based on the Mamba network is used to effectively capture the temporal features and correlations between multiple sleep signal segments. This module mainly includes a linear mapping layer, a one-dimensional convolution layer, a selective state space layer, and an activation function. First, the module accepts classification tokens from multiple signal periods through an encoder, where the number of tokens is the number of sequences of the signal input, and obtains the output data H, which is then linearly mapped to expand the input embedding and sent to a layer of one-dimensional convolutional blocks to prevent independent token calculations to obtain the output V. After passing through the Silu activation function, it is sent to the selective state-space model, which introduces a selection mechanism that allows them to perform context-related reasoning while linearly scaling the sequence length. The selection mechanism depends on the input parameters, unlike the state-space model that uses constant transformation parameters. This adaptive strategy enhances overall generalization and performance by selectively focusing on relevant information and ignoring noise or irrelevant data. Finally, a layer of linear mapping is performed to obtain the final output feature. At the same time, a jump connection is used between the input data and the output feature to avoid the disappearance of the gradient.
[0084] The Mamba structure alleviates the modeling constraints of convolutional neural networks and provides advanced modeling capabilities through global receptive fields and dynamic weighting. The module learns by decoding the complex temporal patterns inherent in sleep signals.
[0085] S5. Use the classifier to classify the extracted feature information into sleep stages:
[0086] The extracted feature vector is input into a fully connected layer with a softmax activation function to achieve sleep stage classification.
[0087] Embodiment 2 A sleep staging system based on self-supervised learning and Mamba network comprises a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the sleep staging method based on self-supervised learning and Mamba network as described in the above embodiment 1 is implemented.
[0088] The above description is only a specific implementation of the present application, and the protection scope of the present invention is not limited thereto.
Claims
1. A sleep staging method based on self-supervised learning and Mamba network, Its characteristics are: The steps include: S1. Obtain sleep EEG signals and preprocess them to obtain a sample data set; S2. Use a self-supervised training network to process data and extract high-quality sleep EEG signal features: The self-supervised training network includes a three-branch parallel network of feature enhancement, feature screening, and mask prediction. The feature enhancement branch first enhances the EEG signal based on the frequency domain and time domain respectively, and then sends the original EEG signal and the enhanced data into the encoder module to obtain the vector representation of each fragment element. The vector representation is randomly enhanced in the time series direction and the frequency domain direction to obtain the enhanced sample data vector, and the time series feature optimization loss, frequency feature optimization loss and total contrast loss are calculated; the feature screening branch first passes the input data through the embedding layer and then enters the clustering module, and obtains the cluster center vector representation of each class through the clustering algorithm, and calculates the clustering loss function of each point around the cluster center; the mask prediction branch randomly masks the EEG signal, and then performs preliminary context feature extraction, and then uses the back propagation derivative of the clustering loss function to obtain the gradient value of each dimension for feature dimension screening, and then performs mask prediction and calculates the mask prediction loss; the total loss of the three-branch network is calculated for multi-task training, and the trained network is used to extract high-quality sleep EEG signal features; The feature enhancement branch first enhances the EEG signal based on the frequency domain and time domain respectively. First, different sequence data are subjected to fast Fourier transform to obtain the frequency representation of the sequence, and the same frequency data segments of different sequences are randomly replaced to obtain a new frequency representation. Then, an inverse fast Fourier transform is performed to obtain a frequency domain enhanced sequence. Secondly, for a complete sequence sample, the beginning and end data are cropped to obtain EEG signal data with stronger usability. The feature dimension screening is to rank the feature dimensions according to the size of the gradient value and retain the important dimensions of a given proportion; S3. Use the separable convolution module to extract time-frequency features of high-quality sleep EEG signal features; The separable convolution module includes two convolution layers of different sizes and a separable convolution layer. The separable convolution layer consists of a depth convolution layer and a point-by-point convolution layer. First, a convolution layer of size 1 is used. The convolutional layer of size 50 extracts high-frequency features in sleep EEG signals, using a convolutional layer of size 1 A convolutional layer of 100 extracts low-frequency information from sleep EEG signals, which is then passed through a deep convolutional layer to learn the spatial information of specific frequencies and capture the inter-frequency information of each sleep stage. A point-by-point convolutional layer is used to optimally mix each feature map. S4. The features extracted in step S3 are input into the feature enhancement module based on the Mamba network to extract contextual features again; The feature enhancement module based on the Mamba network includes a linear mapping layer, a one-dimensional convolution layer, a selective state space model layer and an activation function. The module first receives classification tokens from multiple signal time periods through an encoder, and the number of tokens is the number of sequences of the signal input to obtain output data H. The output data H is linearly mapped to expand the input embedding, and then sent to a layer of one-dimensional convolution block to obtain output data V. The output data V is processed by the Silu activation function and then input into the selective state space model to perform context-related reasoning while linearly scaling the sequence length. Finally, a layer of linear mapping is performed to obtain the final output feature, and a jump connection is used between the input data and the output feature. S5. Use the classifier to classify the extracted feature information into sleep stages.
2. A sleep staging method based on self-supervised learning and Mamba network according to claim 1, Its characteristics are: The calculation formula for the time series feature optimization loss in step S2 is as follows: , in, , The original data sequence i No. t The vector representation of the fragments, is the enhanced sequence after time-frequency domain data enhancement i No. t The vector representation of the fragments, The original data is optimized in the time series direction. i No. t’ The vector representation of the fragments, To enhance the sequence data, the sequence is optimized in the time series direction. i No. t’ The vector representation of the fragments, t’ For sequence i Remove t Time outside of snippet time; The frequency feature optimization loss calculation formula is as follows: , in, , Indicated in j On the sequence Fragment data with the same frequency, j To remove the sequence i Other sequences than j The maximum value of is the number of sequences in a batch of data. is the original data after frequency-direction feature optimization on the jth sequence A vector representation of fragment data with the same frequency, To enhance the sequence data, after optimization in the frequency domain, the jth sequence is Vector representation of fragment data with the same frequency; the total contrast loss is obtained by calculating the sum of the losses of all sequence fragments: , in, For the i The first t The temporal feature optimization loss of each clip, No. i The first t The frequency feature optimization loss of each segment.
3. A sleep staging method based on self-supervised learning and Mamba network according to claim 1, Its characteristics are: The calculation formula of the clustering loss function in step S2 is: , in, The same derivative for each Gaussian distribution, D For all sequence data, K i is the cluster center, K j is the vector representation of other cluster centers, d A vector representation of each point around the cluster center.
4. A sleep staging method based on self-supervised learning and Mamba network according to claim 1, Its characteristics are: The calculation formula for the mask prediction loss in step S2 is: , in, D i , DS i is the vector representation of the original data and the enhanced data, , The vector representation generated for the prediction, is the regularization operation.
5. A sleep staging method based on self-supervised learning and Mamba network according to claim 1, Its characteristics are: The total loss of the three-branch network in step S2 is: , in φ and ω is a hyperparameter.
6. A sleep staging system based on self-supervised learning and Mamba network, comprising a processor and a memory storing computer program instructions; Its characteristics are: When the processor executes the computer program instructions, the sleep staging method based on self-supervised learning and Mamba network is implemented as described in any one of claims 1 to 5.
