A sleep stage identification system that fuses cross-prediction and discriminative tasks

By using a self-supervised learning framework for cross-prediction and discrimination tasks, the problem of dependence on label data in existing technologies is solved, improving the accuracy and efficiency of sleep stage detection and reducing costs.

CN117942038BActive Publication Date: 2026-06-23SOUTH CHINA UNIV OF TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SOUTH CHINA UNIV OF TECH
Filing Date
2024-01-31
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing sleep staging identification systems rely on labeled data samples, and the staging effect is heavily dependent on the amount of data, resulting in high costs and an inability to effectively utilize unlabeled samples.

Method used

By employing self-supervised techniques and designing a multi-task learning framework for cross-prediction and discrimination tasks, we can leverage the latent features of unlabeled samples to reduce reliance on labeled data and improve the accuracy and efficiency of sleep staging detection.

Benefits of technology

This approach improves the accuracy of sleep staging detection and the system's generalization ability while reducing reliance on label data, and lowers data collection and processing costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117942038B_ABST
    Figure CN117942038B_ABST
Patent Text Reader

Abstract

The application discloses a sleep stage recognition system combining cross prediction and discrimination tasks, comprising: a data import module for extracting electroencephalogram sleep data and preprocessing; a self-supervised pre-training module for constructing a multi-task pre-training framework and training an encoder model with sample information; a supervised fine-tuning module for combining the encoder model and an autoregressive model to construct a fine-tuning framework, using sample data for network fine-tuning, and obtaining an optimal sleep stage model with good classification effect; and a sleep stage recognition module for recognizing sleep stages according to electroencephalogram data, using the optimal sleep stage model to judge sleep stages, and deeply understanding and evaluating the sleep state of a subject. The application combines self-supervised learning and multi-task learning, fully excavates potential features of unlabeled samples, reduces the dependence of the training process on sample labels, and provides a high-accuracy sleep stage recognition result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of deep learning and biomedical engineering, and in particular to a sleep staging recognition system that integrates cross-prediction and discrimination tasks. Background Technology

[0002] Sleep staging, as a crucial component of sleep research, is essential for understanding the physiological processes of sleep, diagnosing sleep disorders, and assessing sleep quality. Sleep is a complex physiological state that can be divided into multiple stages, including REM and non-REM stages, each with unique physiological characteristics and functions, and different stages have varying impacts on the body's recovery and health. Therefore, accurately identifying sleep states is vital for researching sleep disorders, diagnosing related diseases, and managing individual health.

[0003] Currently, commonly used sleep staging identification methods are mainly based on the analysis of physiological signals, such as electroencephalography (EEG), electrooculography (EOG), and electromyography (EMG). Among these, EEG signals reflect the brain's activity state during sleep and are the most commonly used signals for determining sleep stages. Sleep staging identification systems based on EEG signals are mainly divided into three categories: 1) Manual staging: Experts manually analyze EEG signals based on their characteristics and trends, according to certain sleep staging criteria. 2) Systems based on machine learning methods: These systems select EEG signal features suitable for sleep staging and use methods such as Bayesian models, ensemble learning, and support vector machines to model the data and make staging judgments. 3) Deep learning systems based on supervised learning methods: These systems utilize various deep learning networks to extract local features and structural information of signals, capturing the temporal dependence of signals to identify sleep states. Manual labeling is time-consuming and subjective. The feature extraction process of traditional machine learning methods heavily relies on domain-specific knowledge, while fully supervised deep learning methods require a large number of labeled samples. However, manually labeling samples is costly and cannot utilize a large number of unlabeled samples. Overall, existing staging systems mostly require labeled data samples, and the staging effect heavily depends on the amount of labeled data. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings and deficiencies of the prior art and propose a sleep staging identification system that integrates cross-prediction and discrimination tasks. This system utilizes self-supervised technology and designs multiple auxiliary tasks for cross-prediction and discrimination to fully explore the potential features of unlabeled samples. This improves the accuracy of sleep staging detection while reducing the dependence on labeled data, bringing a more efficient and economical solution to sleep detection technology.

[0005] To achieve the above objectives, the technical solution provided by this invention is: a sleep staging identification system that integrates cross-prediction and discrimination tasks, comprising:

[0006] The data import module is used to import EEG sleep data, which includes sleep signals and corresponding sleep stage labels. The EEG sleep data is divided into training, validation, and test sets according to a certain ratio. The sleep signals in the training, validation, and test sets are preprocessed to obtain data that conforms to the American Academy of Sleep Medicine scoring criteria, which is called the preprocessed signal. Then, the preprocessed signal is enhanced by two methods to obtain two transformed signals, which are called the first EEG signal and the second EEG signal, respectively. The preprocessed signal is then processed by sample serialization to obtain the third EEG signal. The label corresponding to the third EEG signal is called the third signal sleep label.

[0007] The self-supervised pre-training module is used to construct a multi-task pre-training framework. This framework contains two pre-training networks with identical structures and parameters. These two pre-training networks receive the first and second EEG signals respectively and obtain two signal sequence features, referred to as sequence feature one and sequence feature two. At a fixed time, sequence feature one and sequence feature two are divided into two parts, resulting in past features, future features, and past and future features of sequence feature one. The past features of sequence feature one are used to predict the future features of sequence feature two, and the past features of sequence feature two are used to predict the future features of sequence feature one, forming a cross-prediction task. Sequence feature one and sequence feature two are feature-mapped and combined with contrastive learning to form a discrimination task. The entire process uses a training set, and the total loss is the weighted sum of the losses of the cross-prediction task and the discrimination task. Pre-training is performed by minimizing the total loss, and the parameters of the pre-training network are updated. The final multi-task pre-training framework contains an encoder model with sample information.

[0008] The supervised fine-tuning module is used to construct the fine-tuning framework and further adjust the model parameters. It uses an encoder model with sample information and an autoregressive model with time-series feature classification capabilities to form the fine-tuning framework. The training set and validation set are used to fine-tune the fine-tuning framework to obtain a fine-tuning framework with good classification performance, which is called the optimal sleep staging model.

[0009] The sleep stage identification module is used to identify sleep stages based on the third EEG signal in the test set, and to use the obtained optimal sleep stage model to determine the sleep stage, so as to gain a deeper understanding and assessment of the subject's sleep state.

[0010] Furthermore, the data import module includes a dataset partitioning module and a data preprocessing module, wherein:

[0011] The dataset partitioning module is used to construct training set, validation set and test set. The training set, validation set and test set are obtained by dividing the dataset according to the number of subjects. The training set, validation set and test set all contain pre-training data samples and fine-tuning data samples. The pre-training data samples include the first EEG signal and the second EEG signal. The fine-tuning data samples include the third EEG signal and the third signal sleep label.

[0012] The data preprocessing module reads EEG sleep data locally, obtains sleep signals and corresponding sleep stage labels, divides the sleep signals into fixed-length segments on a per-subject basis, removes data with unknown label information, and processes the sleep data to conform to the American Academy of Sleep Medicine scoring criteria, resulting in a preprocessed signal X = {x1, x2, ..., x...}. i ,…,x N} and signal phase labels Y = {y1, y2, ..., y i ,…,y N}, where x i Let y represent the i-th sample. i Let X represent the sleep stage label of the i-th sample, and N be the total number of samples. Pre-training data samples are obtained by enhancing the preprocessed signal X in two ways, including the first EEG signal. Second EEG signal in and The first and second EEG signals are obtained from the Nth sample after undergoing two enhancement methods, respectively. To further extract sample serialization information while maximizing the retention of data labels, a sliding window of fixed window length k is used to sample from the preprocessed signal X. Each time a sample is taken, the starting point of the window is moved one position to the right, forming a new sample set, namely the third EEG signal. Where the total number of samples N′=N-k+1, and the i-th sample The label is taken from the last row of elements of each new sample, i.e., the third signal sleep label. in The sleep label corresponding to the i-th sample is used to obtain the fine-tuned data sample.

[0013] Furthermore, the self-supervised pre-training module performs the following operations:

[0014] 1) Construct two pre-trained networks with identical structures and parameters. The pre-trained networks consist of a feature encoder, a recurrent residual network, a linear mapping network, and a nonlinear projection network. The feature encoder is composed of a one-dimensional convolutional network and a one-dimensional convolutional residual block. The recurrent residual network is composed of multiple long short-term memory networks with residual connections. The linear mapping network consists of multiple linear classifiers. The nonlinear projection network consists of a linear classifier and a nonlinear mapping function.

[0015] 2) The pre-training data samples include a first EEG signal and a second EEG signal. The first EEG signal X in the training set is used as the training data sample. 1 Second EEG signal X 2 As input to the feature encoder, sequence feature z is obtained. 1 and sequence feature two z 2 Randomly select time q, and z 1 and z 2 Temporal information less than time q is fed into a recurrent residual network to obtain temporal features. and

[0016] 3) Cross-prediction task: Temporal features Contains sequence feature z 1 Partial timing information, To obtain z by performing T linear mappings 2 Prediction vector at the next T time points Temporal characteristics Contains sequence feature two z 2 Part of the timing information in it will To obtain z by performing T linear mappings 1 Prediction vector at the next T time points The cross-prediction task loss is obtained using the contrastive learning loss function:

[0017]

[0018]

[0019] L cp =L1+L2

[0020] In the formula, exp(·) is used to perform exponentiation. and Let be the vector predicted from time q to the t-th time step under both transformations. and N represents the true feature vector from time q to the t-th time after the two transformations. q,t This represents the set of all samples in this batch from time q to the t-th time. and Let L1 be the feature vector of each sample in the set at time q+t, and L1 be the feature vector used to solve the problem. Predict z 2 The loss sum of features at the next T time steps, L2 is the loss using the feature vectors. Predict z 1 The sum of losses for features at the next T time steps, and the cross-prediction task loss function L. cp It is the sum of the two losses;

[0021] 4) Discriminative task: Discriminating temporal features and The discriminant feature d is obtained through a nonlinear projection network. 1 and d 2 Two samples from the same preprocessed signal after enhancement are considered as positive sample pairs, and samples from different preprocessed signals in a batch after enhancement are considered as negative sample pairs. The similarity between positive and negative sample pairs is calculated, and the discriminative task loss function L is constructed by combining it with the contrastive loss. d :

[0022]

[0023]

[0024] In the formula, csim(·) is the formula for calculating cosine similarity, and d i d represents the discriminative feature of a sample. i+ To form a discriminative feature that constitutes a positive sample pair with the sample, f(·) is a binary function. When the value of m is not equal to i, the value of f(m) is 1, otherwise it is 0.

[0025] 5) The cross-prediction task loss function L cp and the discriminant task loss function L d We obtain the total self-supervised pre-training loss, L, by performing a weighted summation. ssl :

[0026] L ssl =λ1×L cp +λ2×L d

[0027] In the formula, λ1 is the weight of the cross-prediction task loss function, and λ2 is the weight of the discriminative task loss function. The pre-trained network parameters are updated by gradient backpropagation based on the pre-trained network. The weights λ1 and λ2 are continuously updated according to the DWA algorithm, and finally a pre-trained network with sample information is obtained. The feature encoder is the encoder model with sample information.

[0028] Furthermore, the supervised fine-tuning module constructs a fine-tuning framework and further adjusts the model parameters to obtain an optimal sleep staging model suitable for sleep staging identification, including a feature representation module and a feature classification module, wherein:

[0029] The feature representation module is used to represent the features of the samples. Its input is the fine-tuned data samples in the training set and the validation set. It uses the pre-trained encoder model with sample information to represent the fine-tuned data samples as feature vectors.

[0030]

[0031] In the formula, To fine-tune the data sample, The feature vector is obtained after the encoder model. The feature encoder Encoder(·) consists of an input layer, a representation layer and an output layer. The input layer and the output layer are both composed of one-dimensional convolutional networks, and the representation layer is composed of multiple stacked one-dimensional convolutional residual blocks.

[0032] The feature classification module is used for sample information integration and classification. This module consists of an autoregressive model and a linear classifier. The autoregressive model uses a long short-term memory network and converts the feature vector output by the feature representation module into a linear classifier. The input is passed into the feature classification module to obtain the final prediction vector and the supervised loss:

[0033]

[0034]

[0035]

[0036] In the formula, TSNet(·) is a Long Short-Term Memory network. Let mlp(·) be the sequence feature vector obtained after passing through a Long Short-Term Memory network, and mlp(·) be a linear classifier. The sample prediction vector obtained after passing through a linear classifier is further maximized by taking the index to obtain the sleep stage predicted based on the EEG sample. The supervised loss function is the cross-entropy loss function. The supervised loss L can be obtained based on the real sleep labels of the fine-tuned data samples and the prediction vector obtained after the supervised fine-tuning module. sup ,in Let θ be the cross-entropy loss function, and θ(·) be the normalized exponential function.

[0037] Furthermore, the sleep stage recognition module performs the following operations:

[0038] 1) Load the subject's EEG sleep data using the data preprocessing module in the data import module, and use the preprocessing method to preprocess the EEG signals to obtain the third EEG signal and the third signal sleep label;

[0039] 2) Input the third EEG signal processed in step 1) into the optimal sleep stage model trained by the supervised fine-tuning module to obtain the sleep stage judgment results for each time period. Based on the duration and frequency of each sleep stage in the judgment results and combined with relevant medical knowledge, the sleep state of the subject is thoroughly understood and evaluated.

[0040] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0041] 1. The system of this invention realizes automatic sleep staging by building a deep neural network to mine signal features. Compared with other methods, the system of this invention can improve the efficiency of sleep detection while automatically capturing sleep features.

[0042] 2. By introducing the concept of self-supervised learning, the system of this invention reduces the dependence of the training process on data labels and lowers the cost of data collection and processing.

[0043] 3. The system of the present invention designs cross-prediction and discrimination tasks to mine the potential features of unlabeled samples from multiple perspectives, thereby improving the accuracy of sleep stage detection and further enhancing the system's generalization ability and robustness. Attached Figure Description

[0044] Figure 1 This is a schematic diagram showing the relationship between the various modules of the system of the present invention.

[0045] Figure 2 This is a flowchart illustrating the pre-training, fine-tuning, and prediction processes of the system of this invention.

[0046] Figure 3 This is a schematic diagram of the structure of a self-supervised pre-training module.

[0047] Figure 4 This is a structural diagram of the monitoring and fine-tuning module. Detailed Implementation

[0048] The present invention will be further described below with reference to specific embodiments.

[0049] This embodiment provides a sleep stage recognition system that integrates cross-prediction and discrimination tasks. It is a sleep stage recognition system developed using Python and capable of running on Windows devices. The relationships between the system modules are as follows: Figure 1 As shown, the process flow of system pre-training, fine-tuning, and prediction is as follows: Figure 2 As shown. It includes:

[0050] The data import module is used to import EEG sleep data, which includes sleep signals and corresponding sleep stage labels. The EEG sleep data is divided into training, validation, and test sets according to a certain ratio. The sleep signals in the training, validation, and test sets are preprocessed to obtain data that conforms to the American Academy of Sleep Medicine scoring criteria, which is called the preprocessed signal. Then, the preprocessed signal is enhanced by two methods to obtain two transformed signals, which are called the first EEG signal and the second EEG signal, respectively. The preprocessed signal is then processed by sample serialization to obtain the third EEG signal. The label corresponding to the third EEG signal is called the third signal sleep label.

[0051] A self-supervised pre-training module is used to construct a multi-task pre-training framework. This framework includes two pre-training networks with identical structures and parameters. These two pre-training networks receive a first EEG signal and a second EEG signal, respectively, and obtain two signal sequence features, referred to as sequence feature one and sequence feature two. At a fixed time, sequence feature one and sequence feature two are divided into two parts, resulting in past features of sequence feature one, future features of sequence feature one, past features of sequence feature two, and future features of sequence feature two. The past features of sequence feature one are used to predict the future features of sequence feature two, while the past features of sequence feature two are used to predict the future features of sequence feature one, forming a cross-prediction task. Furthermore, sequence feature one and sequence feature two are feature-mapped and combined with contrastive learning to form a discrimination task. The entire process uses a training set, and the total loss is the weighted sum of the losses of the cross-prediction task and the discrimination task. Pre-training is performed by minimizing the total loss, and the parameters of the pre-training network are updated. The final multi-task pre-training framework contains an encoder model with sample information.

[0052] The supervised fine-tuning module is used to construct the fine-tuning framework and further adjust the model parameters. It uses an encoder model with sample information and an autoregressive model with time-series feature classification capabilities to form the fine-tuning framework. The training set and validation set are used to fine-tune the fine-tuning framework to obtain a fine-tuning framework with good classification performance, which is called the optimal sleep staging model.

[0053] The sleep stage identification module is used to identify sleep stages based on the third EEG signal in the test set, and to use the obtained optimal sleep stage model to determine the sleep stage, so as to gain a deeper understanding and assessment of the subject's sleep state.

[0054] Specifically, the data import module includes a dataset partitioning module and a data preprocessing module, wherein:

[0055] The dataset partitioning module is used to construct training set, validation set and test set. The training set, validation set and test set are obtained by dividing the dataset according to the number of subjects. The training set, validation set and test set all contain pre-training data samples and fine-tuning data samples. The pre-training data samples include the first EEG signal and the second EEG signal. The fine-tuning data samples include the third EEG signal and the third signal sleep label.

[0056] The data preprocessing module reads EEG sleep data locally, obtains sleep signals and corresponding sleep stage labels, divides the sleep signals into fixed-length segments on a per-subject basis, removes data with unknown label information, and processes the sleep data to conform to the American Academy of Sleep Medicine scoring criteria, resulting in a preprocessed signal X = {x1, x2, ..., x...}. i ,…,x N} and signal phase labels Y = {y1, y2, ..., y i ,…,y N}, where x i Let y represent the i-th sample. i Let X represent the sleep stage label of the i-th sample, and N be the total number of samples. Pre-training data samples are obtained by enhancing the preprocessed signal X in two ways, including the first EEG signal. Second EEG signal in and The first and second EEG signals are obtained from the Nth sample after undergoing two enhancement methods, respectively. To further extract sample serialization information while maximizing the retention of data labels, a sliding window of fixed window length k is used to sample from the preprocessed signal X. Each time a sample is taken, the starting point of the window is moved one position to the right, forming a new sample set, namely the third EEG signal. Where the total number of samples N′=N-k+1, and the i-th sample The label is taken from the last row of elements of each new sample, i.e., the third signal sleep label. in The sleep label corresponding to the i-th sample is used to obtain the fine-tuned data sample.

[0057] Specifically, the structure of the self-supervised pre-training module is as follows: Figure 3 As shown, it specifically performs the following operations:

[0058] 1) Construct two pre-trained networks with identical structures and parameters. The pre-trained networks consist of a feature encoder, a recurrent residual network, a linear mapping network, and a nonlinear projection network. The feature encoder is composed of a one-dimensional convolutional network and a one-dimensional convolutional residual block. The recurrent residual network is composed of multiple long short-term memory networks with residual connections. The linear mapping network consists of multiple linear classifiers. The nonlinear projection network consists of a linear classifier and a nonlinear mapping function.

[0059] 2) The pre-training data samples include a first EEG signal and a second EEG signal. The first EEG signal X in the training set is used as the training data sample. 1 Second EEG signal X 2 As input to the feature encoder, sequence feature z is obtained. 1 and sequence feature two z 2 Randomly select time q, and z 1 and z 2 Temporal information less than time q is fed into a recurrent residual network to obtain temporal features. and

[0060] 3) Cross-prediction task: Temporal features Contains sequence feature z 1 Partial timing information, To obtain z by performing T linear mappings 2 Prediction vector at the next T time points Temporal characteristics Contains sequence feature two z 2 Part of the timing information in it will To obtain z by performing T linear mappings 1 Prediction vector at the next T time points The cross-prediction task loss is obtained using the contrastive learning loss function:

[0061]

[0062]

[0063] L cp =L1+L2

[0064] In the formula, exp(·) is used to perform exponentiation. and Let be the vector predicted from time q to the t-th time step under both transformations. and N represents the true feature vector from time q to the t-th time after the two transformations. q,t This represents the set of all samples in this batch from time q to the t-th time. and Let L1 be the feature vector of each sample in the set at time q+t, and L1 be the feature vector used to solve the problem. Predict z 2 The loss sum of features at the next T time steps, L2 is the loss using the feature vectors. Predict z 1 The sum of losses for features at the next T time steps, and the cross-prediction task loss function L. cp It is the sum of the two losses;

[0065] 4) Discriminative task: Discriminating temporal features and The discriminant feature d is obtained through a nonlinear projection network. 1 and d 2 Two samples from the same preprocessed signal after enhancement are considered as positive sample pairs, and samples from different preprocessed signals in a batch after enhancement are considered as negative sample pairs. The similarity between positive and negative sample pairs is calculated, and the discriminative task loss function L is constructed by combining it with the contrastive loss. d :

[0066]

[0067]

[0068] In the formula, csim(·) is the formula for calculating cosine similarity, and d i d represents the discriminative feature of a sample. i+ To form a discriminative feature that constitutes a positive sample pair with the sample, f(·) is a binary function. When the value of m is not equal to i, the value of f(m) is 1, otherwise it is 0.

[0069] 5) The cross-prediction task loss function L cp and the discriminant task loss function L d We obtain the total self-supervised pre-training loss, L, by performing a weighted summation. ssl :

[0070] L ssl =λ1×L cp +λ2×L d

[0071] In the formula, λ1 is the weight of the cross-prediction task loss function, and λ2 is the weight of the discriminative task loss function. The pre-trained network parameters are updated by gradient backpropagation based on the pre-trained network. The weights λ1 and λ2 are continuously updated according to the DWA algorithm, and finally a pre-trained network with sample information is obtained. The feature encoder is the encoder model with sample information.

[0072] Specifically, the supervised fine-tuning module constructs a fine-tuning framework and further adjusts the model parameters to obtain an optimal sleep staging model suitable for sleep staging identification, the structure of which is as follows: Figure 4 As shown, it includes a feature representation module and a feature classification module. Based on the function of each module, Figure 4 It is divided into a feature representation layer, a feature classification layer, and a prediction layer, wherein:

[0073] The feature representation module is used to represent the features of the samples. Its input is the fine-tuned data samples in the training set and the validation set. It uses the pre-trained encoder model with sample information to represent the fine-tuned data samples as feature vectors.

[0074]

[0075] In the formula, To fine-tune the data sample, The feature vector is obtained after the encoder model. The feature encoder Encoder(·) consists of an input layer, a representation layer and an output layer. The input layer and the output layer are both composed of one-dimensional convolutional networks, and the representation layer is composed of multiple stacked one-dimensional convolutional residual blocks.

[0076] The feature classification module is used for sample information integration and classification. This module consists of an autoregressive model and a linear classifier. The autoregressive model uses a long short-term memory network and converts the feature vector output by the feature representation module into a linear classifier. The input is passed into the feature classification module to obtain the final prediction vector and the supervised loss:

[0077]

[0078]

[0079]

[0080] In the formula, TSNet(·) is a Long Short-Term Memory network. Let mlp(·) be the sequence feature vector obtained after passing through a Long Short-Term Memory network, and mlp(·) be a linear classifier. The sample prediction vector obtained after passing through a linear classifier is further maximized by taking the index to obtain the sleep stage recognition result based on the EEG sample. The supervised loss function is the cross-entropy loss function. The supervised loss L can be obtained based on the real sleep labels of the fine-tuned data samples and the prediction vector obtained after the supervised fine-tuning module. sup ,in Let θ be the cross-entropy loss function, and θ(·) be the normalized exponential function.

[0081] Specifically, the sleep stage recognition module performs the following operations:

[0082] 1) Load the subject's EEG sleep data using the data preprocessing module in the data import module, and use the preprocessing method to preprocess the EEG signals to obtain the third EEG signal and the third signal sleep label;

[0083] 2) Input the third EEG signal processed in step 1) into the optimal sleep stage model trained by the supervised fine-tuning module to obtain the sleep stage judgment results for each time period. Based on the information such as the duration and frequency of each sleep stage in the judgment results and combined with relevant knowledge in the medical field, we can gain a deeper understanding and assessment of the subject's sleep state.

[0084] The above-described embodiments are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Therefore, any changes made in accordance with the shape and principle of the present invention should be covered within the protection scope of the present invention.

Claims

1. A sleep staging identification system integrating cross-prediction and discrimination tasks, characterized in that, include: The data import module is used to import EEG sleep data, which includes sleep signals and corresponding sleep stage labels. The EEG sleep data is divided into training, validation, and test sets according to a certain ratio. The sleep signals in the training, validation, and test sets are preprocessed to obtain data that conforms to the American Academy of Sleep Medicine scoring criteria, which is called the preprocessed signal. Then, the preprocessed signal is enhanced by two methods to obtain two transformed signals, which are called the first EEG signal and the second EEG signal, respectively. The preprocessed signal is then processed by sample serialization to obtain the third EEG signal. The label corresponding to the third EEG signal is called the third signal sleep label. The self-supervised pre-training module is used to construct a multi-task pre-training framework. This framework contains two pre-training networks with identical structures and parameters. These two pre-training networks receive the first and second EEG signals respectively and obtain two signal sequence features, referred to as sequence feature one and sequence feature two. At a fixed time, sequence feature one and sequence feature two are divided into two parts, resulting in past features, future features, and past and future features of sequence feature one. The past features of sequence feature one are used to predict the future features of sequence feature two, and the past features of sequence feature two are used to predict the future features of sequence feature one, forming a cross-prediction task. Sequence feature one and sequence feature two are feature-mapped and combined with contrastive learning to form a discrimination task. The entire process uses a training set, and the total loss is the weighted sum of the losses of the cross-prediction task and the discrimination task. Pre-training is performed by minimizing the total loss, and the parameters of the pre-training network are updated. The final multi-task pre-training framework contains an encoder model with sample information. The supervised fine-tuning module is used to construct the fine-tuning framework and further adjust the model parameters. It uses an encoder model with sample information and an autoregressive model with time-series feature classification capabilities to form the fine-tuning framework. The training set and validation set are used to fine-tune the fine-tuning framework to obtain a fine-tuning framework with good classification performance, which is called the optimal sleep staging model. The sleep stage identification module is used to identify sleep stages based on the third EEG signal in the test set, and to use the obtained optimal sleep stage model to determine the sleep stage, so as to gain a deeper understanding and assessment of the subject's sleep state. The self-supervised pre-training module performs the following operations: 1) Construct two pre-trained networks with identical structures and parameters. The pre-trained networks consist of a feature encoder, a recurrent residual network, a linear mapping network, and a nonlinear projection network. The feature encoder is composed of a one-dimensional convolutional network and a one-dimensional convolutional residual block. The recurrent residual network is composed of multiple long short-term memory networks with residual connections. The linear mapping network consists of multiple linear classifiers. The nonlinear projection network consists of a linear classifier and a nonlinear mapping function. 2) The pre-training data samples include first and second EEG signals. The first EEG signal in the training set will be used... Second EEG signal As input to the feature encoder, sequence features are obtained. and sequence feature two Randomly selected time ,Will and Medium and small time The temporal information is fed into the recurrent residual network to obtain temporal features. and ; 3) Cross-prediction task: temporal features Contains sequence features Partial timing information, Perform T linear mappings to obtain Prediction vector at the next T time points Temporal characteristics Contains sequence feature two Part of the timing information in it will Perform T linear mappings to obtain Prediction vector at the next T time points The cross-prediction task loss is obtained using the contrastive learning loss function: ; ; ; In the formula, Used to perform exponentiation. and For two transformations from Predicting the next time step The vector at each moment, and Indicates the two transformations from The time after the first The true feature vector at each time step Indicates all samples in the batch From the moment onwards A set of samples at each time point. and For each sample in the set The feature vector at time step, To utilize feature vectors predict future The loss sum of features at each time point, To utilize feature vectors predict future The loss sum of features at each time step, and the cross-prediction task loss function. It is the sum of the two losses; 4) Discriminative task: Discriminating temporal features and Discriminant features are obtained through a nonlinear projection network. and Two samples from the same preprocessed signal after enhancement are considered as positive sample pairs, and samples from different preprocessed signals in a batch after enhancement are considered as negative sample pairs. The similarity between positive and negative sample pairs is calculated, and the result is combined with contrast loss to form the loss function for the discrimination task. : ; ; In the formula, Here is the formula for calculating cosine similarity. For the discriminative features of a certain sample, To form a discriminative feature that constitutes a positive sample pair with this sample, For a binary function, when The value is not equal to hour The value is 1, otherwise it is 0; 5) The cross-prediction task loss function and the discriminant task loss function The total loss of self-supervised pre-training is obtained by performing a weighted summation, which is the self-supervised loss. : ; In the formula, The weights of the cross-prediction task loss function, To determine the weights of the task loss function, gradient backpropagation is performed based on the pre-trained network to update the pre-trained network parameters and weights. and The weights are continuously updated using the DWA algorithm, resulting in a pre-trained network with sample information. The feature encoder in this network is the encoder model with sample information.

2. The sleep staging identification system integrating cross-prediction and discrimination tasks according to claim 1, characterized in that, The data import module includes a dataset partitioning module and a data preprocessing module, wherein: The dataset partitioning module is used to construct training set, validation set and test set. The training set, validation set and test set are obtained by dividing the dataset according to the number of subjects. The training set, validation set and test set all contain pre-training data samples and fine-tuning data samples. The pre-training data samples include the first EEG signal and the second EEG signal. The fine-tuning data samples include the third EEG signal and the third signal sleep label. The data preprocessing module reads EEG sleep data locally, obtains sleep signals and corresponding sleep stage labels, divides the sleep signals into fixed-length segments on a per-subject basis, removes data with unknown label information, and processes the sleep data to conform to the American Academy of Sleep Medicine scoring criteria, resulting in preprocessed signals. and signal phase labels ,in Indicates the first One sample, Indicates the first Sleep stage labels for each sample, The total number of samples will be used to preprocess the signal. Two enhancement methods were used to obtain pre-training data samples, including the first EEG signal. Second EEG signal ,in and These are the first and second EEG signals obtained from the Nth sample after undergoing two enhancement methods, respectively. To further extract sample serialization information while maximizing the retention of data labels, the preprocessed signals... In order to fix the window length as The sliding window sampling method moves the starting point of the window one position to the right each time it is sampled, forming a new sample set, namely the third EEG signal. The total number of samples , No. Sample The label is taken from the label of the last row of each new sample, i.e., the third signal sleep label. ,in For the first The sleep labels corresponding to each sample are used to obtain fine-tuned data samples.

3. The sleep staging identification system integrating cross-prediction and discrimination tasks according to claim 2, characterized in that, The supervised fine-tuning module constructs a fine-tuning framework and further adjusts the model parameters to obtain an optimal sleep staging model suitable for sleep staging identification, including a feature representation module and a feature classification module, wherein: The feature representation module is used to represent the features of the samples. Its input is the fine-tuned data samples in the training set and the validation set. It uses the pre-trained encoder model with sample information to represent the fine-tuned data samples as feature vectors. ; In the formula, To fine-tune the data sample, The feature vector is obtained after the encoder model; the feature encoder is... It consists of an input layer, a representation layer, and an output layer. The input and output layers are both composed of one-dimensional convolutional networks, and the representation layer is composed of multiple stacked one-dimensional convolutional residual blocks. The feature classification module is used for sample information integration and classification. This module consists of an autoregressive model and a linear classifier. The autoregressive model uses a long short-term memory network and converts the feature vector output by the feature representation module into a linear classifier. The input is passed into the feature classification module to obtain the final prediction vector and the supervised loss: ; ; ; In the formula, For Long Short-Term Memory (LSTM) networks, This is the sequence feature vector obtained after passing through a Long Short-Term Memory network. For linear classifiers, The sample prediction vector obtained after passing through a linear classifier is further maximized by taking the index to obtain the sleep stage predicted based on the EEG sample. The supervised loss function is the cross-entropy loss function. The supervised loss can be obtained based on the real sleep labels of the fine-tuned data samples and the prediction vector obtained after the supervised fine-tuning module. ,in Let cross-entropy be the loss function. It is a normalized exponential function.

4. The sleep staging identification system integrating cross-prediction and discrimination tasks according to claim 3, characterized in that, The sleep stage recognition module performs the following operations: 1) Load the subject's EEG sleep data using the data preprocessing module in the data import module, and use the preprocessing method to preprocess the EEG signals to obtain the third EEG signal and the third signal sleep label; 2) Input the third EEG signal processed in step 1) into the optimal sleep stage model trained by the supervised fine-tuning module to obtain the sleep stage judgment results for each time period. Based on the duration and frequency of each sleep stage in the judgment results and combined with relevant knowledge in the medical field, the sleep state of the subject is thoroughly understood and evaluated.