Lightweight deep learning model for sleep staging based on single-channel electroencephalogram
By designing a lightweight deep learning model based on single-channel EEG, including time domain encoder, time frequency encoder and scoring module, the problem of high computing resources consumption in existing models is solved, and the resource-constrained equipment is realized on the efficient sleep stage score.
Patent Information
- Application Number
- CN202411675363.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-02-18
AI Technical Summary
The existing deep learning models use numerous parameters and complex structures when processing EEG data, which limit their application on resource-constrained devices, especially on wearable devices.
A lightweight deep learning model based on single-channel EEG sleep staging is proposed, including a time domain encoder, a time frequency encoder and a scoring module. The time domain encoder processes one-dimensional EEG signals through the convolution layer, the time frequency encoder processes the time frequency graph through wavelet transformation and the convolution layer, and the scoring module generates classification results through threshold comparison and argmax function. The model reduces the complexity of the model and the computing resource requirements through multimodal joint training and comparative learning.
It realizes rapid processing of single-channel EEG signals, real-time or near-real-time sleep stage scores, effectively extracts EEG time and frequency domain modal information, reduces the demand for computing resources, and is suitable for devices with resource limitations.
Smart Images

Figure CN119475098A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of electroencephalogram (EEG) data analysis, and in particular to a lightweight deep learning model for sleep staging based on single-channel EEG. Background Art
[0002] Traditional PSG analysis relies on experts to manually parse large amounts of EEG, EOG, EMG, and ECG data, segmenting the data into epochs and classifying them according to standardized sleep stage scoring manuals. This process is labor-intensive, time-consuming, and susceptible to subjective judgment, which may lead to biased results.
[0003] In recent years, deep learning technology has been used to automatically extract features from raw PSG data and perform sleep stage scoring. Common models process EEG information through a single modality. These models are usually complex in structure, have many parameters, and require a large amount of data for training to avoid overfitting. In addition, the implementation of common time-domain RNNs requires additional computing resources and is limited in its application on wearable devices.
[0004] Many existing deep learning models require a lot of computing resources due to their numerous parameters and complex structures, which limits their application on resource-constrained devices.
[0005] Therefore, one or more methods are needed to solve the above problems.
[0006] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0007] The purpose of the present disclosure is to provide a lightweight deep learning model for sleep staging based on single-channel EEG, thereby overcoming one or more problems caused by limitations and defects of related technologies at least to a certain extent.
[0008] According to one aspect of the present disclosure, a lightweight deep learning model for sleep staging based on single-channel EEG is provided, comprising a time domain encoder, a time-frequency encoder, and a scoring module, wherein:
[0009] The time domain encoder is used to process the one-dimensional EEG signal to generate a first preset number of classification probabilities;
[0010] The time-frequency encoder is used to process the time-frequency graph generated by wavelet transforming the one-dimensional EEG signal to generate a second preset number of classification probabilities;
[0011] The scoring module is used to compare the classification probabilities of the first preset number and the second preset number with a preset threshold to generate a comparison result, and generate a classification result after processing the comparison result based on an argmax function.
[0012] In an exemplary embodiment of the present disclosure, the time domain encoder of the model further includes:
[0013] The time domain encoder is composed of a preset number of convolutional layers;
[0014] The initial convolution layer uses a convolution layer with a window size of [Fs / 2\] and a sampling rate of Fs; the number of channels is set to 128 and the step size is [Fs / 4\];
[0015] The maximum pooling layer uses a window and stride of 8 to reduce the dimension of the feature map;
[0016] Then it passes through two sets of 8-layer convolution, each layer contains 128 channels to further extract deep temporal features;
[0017] Finally, after a pooling layer with a window of 4 and a step size of 4, 5 classification probabilities are finally output.
[0018] In an exemplary embodiment of the present disclosure, the time-frequency encoder of the model further includes:
[0019] The time-frequency encoder is used to process the two-dimensional time-frequency graph generated by wavelet transforming the one-dimensional EEG signal;
[0020] The initial convolutional layer passes through two 3x3 convolutional layers, each containing 64 channels and a stride of 1;
[0021] Apply a pooling layer with a window size of 8 and a stride of 8;
[0022] The process of deep feature extraction is performed through three 3x3 convolutional layers, two of which have 128 channels and the last one has 256 channels, with a stride of 1, and 5 classification probabilities are output again.
[0023] In an exemplary embodiment of the present disclosure, the scoring module of the model further includes:
[0024] The scoring module is used to compare the classification probability of the first preset number and the classification probability of the second preset number with a preset threshold;
[0025] If the first preset number of classification probabilities and the preset category probabilities in the second preset number of classification probabilities both exceed the preset threshold, generating a comparison result;
[0026] The comparison result is processed based on the argmax function to generate a classification result.
[0027] In an exemplary embodiment of the present disclosure, the model further includes:
[0028] The model is trained separately for the time domain encoder and the time frequency encoder, and multimodal joint training based on contrastive learning is performed.
[0029] In an exemplary embodiment of the present disclosure, training the time domain encoder of the model further includes:
[0030] The one-dimensional time-domain EEG signal is processed and the parameters are optimized using the cross entropy loss function to extract the time series features.
[0031] In an exemplary embodiment of the present disclosure, training the frequency domain encoder of the model further includes:
[0032] The time-frequency diagram generated by wavelet transform is processed, and cross entropy is also used as the loss function to independently optimize the representation of frequency domain features.
[0033] In an exemplary embodiment of the present disclosure, performing multimodal joint training for contrastive learning on the model further includes:
[0034] Feature mapping training, the time domain encoder and the time-frequency encoder map features to the contrastive learning space through their respective projection heads;
[0035] Similarity calculation training, using cosine similarity to calculate the similarity of two modal features;
[0036] Contrastive learning training, the contrastive learning module optimizes the model by maximizing the similarity of positive sample pairs and minimizing the similarity of negative sample pairs, using a contrastive loss function for optimization;
[0037] Fine-tune parameter training, through the feedback of contrastive learning, adjust the parameters of the time domain and frequency domain encoders to make the representation of the two modalities in the shared feature space close to the same.
[0038] In an exemplary embodiment of the present disclosure, the data set acquisition and preprocessing for the model training further includes:
[0039] Collect public sleep datasets such as MASS and Sleep-EDF, which contain EEG signals annotated according to different sleep manuals;
[0040] The EEG signal is preprocessed by removing noise and filtering, and the time domain signal is converted into a time-frequency signal in image format through wavelet transformation.
[0041] In an exemplary embodiment of the present disclosure, the model evaluation and testing of the model further includes:
[0042] Use accuracy, F1 score, and Cohen's Kappa coefficient indicators to evaluate model performance;
[0043] A k-fold cross-validation scheme was used to divide the training set into multiple subsets, and each subset was used once as a test set.
[0044] A lightweight deep learning model for sleep staging based on single-channel EEG in an exemplary embodiment of the present disclosure includes: a time domain encoder, a time-frequency encoder, and a scoring module, wherein: the time domain encoder is used to process a one-dimensional EEG signal to generate a first preset number of classification probabilities; the time-frequency encoder is used to process the time-frequency graph generated by the one-dimensional EEG signal based on wavelet transform to generate a second preset number of classification probabilities; the scoring module is used to compare the first preset number of classification probabilities and the second preset number of classification probabilities with a preset threshold to generate a comparison result, and the comparison result is processed based on the argmax function to generate a classification result. The present disclosure can quickly process a single-channel EEG signal through convolution processing of two modes, realize real-time or near real-time sleep stage scoring, and effectively extract EEG time domain and frequency domain modal information, and realize feature extraction through a scoring mechanism.
[0045] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The above and other features and advantages of the present disclosure will become more apparent by describing in detail example embodiments thereof with reference to the attached drawings.
[0047] Figure 1 A schematic block diagram of a lightweight deep learning model for sleep staging based on single-channel EEG according to an exemplary embodiment of the present disclosure is shown;
[0048] Figure 2 A logic diagram of a lightweight deep learning model for sleep staging based on single-channel EEG according to an exemplary embodiment of the present disclosure is shown;
[0049] Figure 3 A schematic diagram of multimodal joint training of a lightweight deep learning model for sleep staging based on single-channel EEG according to an exemplary embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0050] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0051] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, materials, devices, steps, etc. may be adopted. In other cases, known structures, methods, devices, implementations, materials or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0052] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or these functional entities or parts of functional entities may be implemented in one or more software hardened modules, or these functional entities may be implemented in different networks and / or processor devices and / or microcontroller devices.
[0053] In this example embodiment, a lightweight deep learning model for sleep staging based on single-channel EEG is first provided; Figure 1 As shown in , the lightweight deep learning model for sleep staging based on single-channel EEG may include a time domain encoder, a time-frequency encoder, and a scoring module, wherein:
[0054] The time domain encoder is used to process the one-dimensional EEG signal to generate a first preset number of classification probabilities;
[0055] The time-frequency encoder is used to process the time-frequency graph generated by wavelet transforming the one-dimensional EEG signal to generate a second preset number of classification probabilities;
[0056] The scoring module is used to compare the classification probabilities of the first preset number and the second preset number with a preset threshold to generate a comparison result, and generate a classification result after processing the comparison result based on an argmax function.
[0057] A lightweight deep learning model for sleep staging based on single-channel EEG in an exemplary embodiment of the present disclosure includes: a time domain encoder, a time-frequency encoder, and a scoring module, wherein: the time domain encoder is used to process a one-dimensional EEG signal to generate a first preset number of classification probabilities; the time-frequency encoder is used to process the time-frequency graph generated by the one-dimensional EEG signal based on wavelet transform to generate a second preset number of classification probabilities; the scoring module is used to compare the first preset number of classification probabilities and the second preset number of classification probabilities with a preset threshold to generate a comparison result, and the comparison result is processed based on the argmax function to generate a classification result. The present disclosure can quickly process a single-channel EEG signal through convolution processing of two modes, realize real-time or near real-time sleep stage scoring, and effectively extract EEG time domain and frequency domain modal information, and realize feature extraction through a scoring mechanism.
[0058] Below, a lightweight deep learning model for sleep staging based on single-channel EEG in this example embodiment will be further described.
[0059] Embodiment 1:
[0060] The present invention discloses a lightweight deep learning model for sleep staging based on single-channel EEG, characterized in that the model includes a time domain encoder, a time-frequency encoder, and a scoring module, wherein:
[0061] The time domain encoder is used to process a one-dimensional electroencephalogram signal to generate a first preset number of classification probabilities.
[0062] In the embodiment of this example, the time domain encoder of the model further includes:
[0063] The time domain encoder is composed of a preset number of convolutional layers;
[0064] The initial convolution layer uses a convolution layer with a window size of [Fs / 2\] and a sampling rate of Fs; the number of channels is set to 128 and the step size is [Fs / 4\];
[0065] The maximum pooling layer uses a window and stride of 8 to reduce the dimension of the feature map;
[0066] Then it passes through two sets of 8-layer convolution, each layer contains 128 channels to further extract deep temporal features;
[0067] Finally, after a pooling layer with a window of 4 and a step size of 4, 5 classification probabilities are finally output.
[0068] The time-frequency encoder is used to process the time-frequency diagram generated by wavelet transforming the one-dimensional EEG signal to generate a second preset number of classification probabilities.
[0069] In the embodiment of this example, the time-frequency encoder of the model further includes:
[0070] The time-frequency encoder is used to process the two-dimensional time-frequency graph generated by wavelet transforming the one-dimensional EEG signal;
[0071] The initial convolutional layer passes through two 3x3 convolutional layers, each containing 64 channels and a stride of 1;
[0072] Apply a pooling layer with a window size of 8 and a stride of 8;
[0073] The process of deep feature extraction is performed through three 3x3 convolutional layers, two of which have 128 channels and the last one has 256 channels, with a stride of 1, and 5 classification probabilities are output again.
[0074] The scoring module is used to compare the classification probabilities of the first preset number and the second preset number with a preset threshold to generate a comparison result, and generate a classification result after processing the comparison result based on an argmax function.
[0075] In the embodiment of this example, the scoring module of the model also includes:
[0076] The scoring module is used to compare the classification probability of the first preset number and the classification probability of the second preset number with a preset threshold;
[0077] If the first preset number of classification probabilities and the preset category probabilities in the second preset number of classification probabilities both exceed the preset threshold, generating a comparison result;
[0078] The comparison result is processed based on the argmax function to generate a classification result.
[0079] In the embodiment of this example, the model also includes:
[0080] The model is trained separately for the time domain encoder and the time frequency encoder, and multimodal joint training based on contrastive learning is performed.
[0081] In the embodiment of this example, training the time domain encoder of the model further includes:
[0082] The one-dimensional time-domain EEG signal is processed and the parameters are optimized using the cross entropy loss function to extract the time series features.
[0083] In the embodiment of this example, training the frequency domain encoder of the model further includes:
[0084] The time-frequency diagram generated by wavelet transform is processed, and cross entropy is also used as the loss function to independently optimize the representation of frequency domain features.
[0085] In the embodiment of this example, the multimodal joint training of the model for contrastive learning further includes:
[0086] Feature mapping training, the time domain encoder and the time-frequency encoder map features to the contrastive learning space through their respective projection heads;
[0087] Similarity calculation training, using cosine similarity to calculate the similarity of two modal features;
[0088] Contrastive learning training, the contrastive learning module optimizes the model by maximizing the similarity of positive sample pairs and minimizing the similarity of negative sample pairs, using a contrastive loss function for optimization;
[0089] Fine-tune parameter training, through the feedback of contrastive learning, adjust the parameters of the time domain and frequency domain encoders to make the representation of the two modalities in the shared feature space close to the same.
[0090] In the embodiment of this example, the data set acquisition and preprocessing for the model training also includes:
[0091] Collect public sleep datasets such as MASS and Sleep-EDF, which contain EEG signals annotated according to different sleep manuals;
[0092] The EEG signal is preprocessed by removing noise and filtering, and the time domain signal is converted into a time-frequency signal in image format through wavelet transformation.
[0093] In the embodiment of this example, the model evaluation and testing of the model further includes:
[0094] Use accuracy, F1 score, and Cohen's Kappa coefficient indicators to evaluate model performance;
[0095] A k-fold cross-validation scheme was used to divide the training set into multiple subsets, and each subset was used once as a test set.
[0096] Embodiment 2:
[0097] like Figure 2 As shown, in the embodiment of this example, the model adopts a multimodal architecture to make full use of time domain and time-frequency information. Specifically, it includes two independent encoders, a time domain encoder and a time-frequency encoder.
[0098] First, the time domain signal encoder is responsible for processing the original one-dimensional EEG signal. This process consists of multiple convolutional layers, starting with a convolutional layer with a window size of [Fs / 2\] and a sampling rate of Fs; the number of channels is set to 128 and the step size is [Fs / 4\]. Next, a maximum pooling layer is applied with a window size and step size of 8 to reduce the dimension of the feature map. Then two sets of 8 convolution layers, each containing 128 channels, are used to further extract deep temporal features, and finally a pooling layer with a window size of 4 and a step size of 4 is used to output 5 classification probabilities.
[0099] On the other hand, the time-frequency signal encoder processes the time-frequency map generated after wavelet transformation, which is a two-dimensional input. First, it passes through two 3x3 convolutional layers, each with 64 channels and a stride of 1, followed by a pooling layer with a window of 8 and a stride of 1. Then, the process of deep feature extraction is carried out, passing through three 3x3 convolutional layers, two of which have 128 channels and the last one has 256 channels, all with a stride of 1. Once again, 5 classification probabilities are output.
[0100] In order to integrate the advantages of these two modes, the model introduces a scoring mechanism. Compare the classification probabilities output by each encoder and set a threshold of 0.6. If and only if the probability of a category of both encoders exceeds this threshold, the argmax function is entered to select the classification result with the highest probability as the final classification result.
[0101] Based on the multimodal scoring network design, the model can flexibly and effectively integrate information from the time domain and time frequency, thereby improving the accuracy of sleep stage classification. At the same time, this architecture also provides multiple ways to train and optimize the model, which helps to achieve better results on multimodal data.
[0102] Embodiment three:
[0103] like Figure 3 As shown, in this example embodiment, multimodal joint training first ensures the performance of the model on each modality signal through separate training, and then uses contrastive learning to achieve deep fusion of the two modality features. This multi-stage training method effectively improves the model's ability to classify complex EEG signals and enhances the integration effect of different modal information.
[0104] In this exemplary embodiment, the individual training phase includes:
[0105] Time Domain Encoder Training:
[0106] The one-dimensional time-domain EEG signal is processed and the parameters are optimized using the cross entropy loss function to extract the time series features.
[0107] Frequency domain encoder training:
[0108] The time-frequency diagram generated by wavelet transform is processed, and cross entropy is also used as the loss function to independently optimize the representation of frequency domain features.
[0109] At this stage, the two encoders are trained on data of different modalities to ensure good feature extraction capabilities for their respective input data.
[0110] In the embodiment of this example, the contrastive learning fine-tuning stage includes:
[0111] Feature Mapping:
[0112] The two encoders map features to the contrastive learning space through their respective projection heads (projector1 and projector2).
[0113] Similarity calculation:
[0114] The cosine similarity is used to calculate the similarity between the features of two modalities.
[0115] Contrastive learning:
[0116] The contrastive learning module optimizes the model by maximizing the similarity of positive sample pairs and minimizing the similarity of negative sample pairs.
[0117] The contrastive loss function (InfoNCE loss) is used for optimization.
[0118] Fine-tuning parameters:
[0119] Through the feedback of contrastive learning, the parameters of the time domain and frequency domain encoders are fine-tuned to make the representation of the two modalities in the shared feature space more consistent.
[0120] Embodiment 4:
[0121] In this example, the implementation environment is prepared
[0122] Hardware configuration: Choose a server or personal computer with sufficient computing power and equipped with a high-performance GPU for training and inference of deep learning models.
[0123] Software dependencies: Install a deep learning framework (such as TensorFlow or PyTorch), as well as other necessary data processing and analysis tools.
[0124] In the embodiment of this example, data collection and preprocessing include:
[0125] Dataset acquisition: Collect public sleep datasets, such as MASS and Sleep-EDF, which contain EEG signals annotated according to different sleep manuals.
[0126] Signal preprocessing: Perform necessary preprocessing on the EEG signal, including noise removal, filtering, etc., and then convert the time domain signal into a time-frequency signal in image format through wavelet transformation.
[0127] In the embodiment of this example, data training and fine-tuning include:
[0128] Time Domain Encoder Training:
[0129] The one-dimensional time-domain EEG signal is processed and the parameters are optimized using the cross entropy loss function to extract the time series features.
[0130] Frequency domain encoder training:
[0131] The time-frequency diagram generated by wavelet transform is processed, and cross entropy is also used as the loss function to independently optimize the representation of frequency domain features.
[0132] At this stage, the two encoders are trained on data of different modalities to ensure good feature extraction capabilities for their respective input data.
[0133] Feature Mapping:
[0134] The two encoders map features to the contrastive learning space through their respective projection heads (projector1 and projector2).
[0135] Similarity calculation:
[0136] The cosine similarity is used to calculate the similarity between the features of two modalities.
[0137] Contrastive learning:
[0138] The contrastive learning module optimizes the model by maximizing the similarity of positive sample pairs and minimizing the similarity of negative sample pairs.
[0139] The contrastive loss function (InfoNCE loss) is used for optimization.
[0140] Fine-tuning parameters:
[0141] Through the feedback of contrastive learning, the parameters of the time domain and frequency domain encoders are fine-tuned to make the representation of the two modalities in the shared feature space more consistent.
[0142] In the embodiment of this example, model evaluation and testing includes:
[0143] Evaluation metrics: Use metrics such as accuracy, F1 score, and Cohen's Kappa coefficient to evaluate model performance.
[0144] Cross-validation: A k-fold cross-validation scheme is used to divide the training set into multiple subsets, and each subset is used once as a test set.
[0145] It should be noted that although several modules or units of a lightweight deep learning model for sleep staging based on single-channel EEG are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0146] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0147] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0148] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A lightweight deep learning model for sleep staging based on single-channel EEG, characterized by: The model includes a time domain encoder, a time frequency encoder, and a scoring module, wherein: The time domain encoder is used to process the one-dimensional EEG signal to generate a first preset number of classification probabilities; The time-frequency encoder is used to process the time-frequency graph generated by wavelet transforming the one-dimensional EEG signal to generate a second preset number of classification probabilities; The scoring module is used to compare the classification probabilities of the first preset number and the second preset number with a preset threshold to generate a comparison result, and generate a classification result after processing the comparison result based on an argmax function.
2. The model according to claim 1, characterized in that The time domain encoder of the model also includes: The time domain encoder is composed of a preset number of convolutional layers; The initial convolution layer uses a convolution layer with a window size of [Fs / 2\] and a sampling rate of Fs; the number of channels is set to 128 and the step size is [Fs / 4\]; The maximum pooling layer uses a window and stride of 8 to reduce the dimension of the feature map; Then it passes through two sets of 8-layer convolution, each layer contains 128 channels to further extract deep temporal features; Finally, after a pooling layer with a window of 4 and a step size of 4, 5 classification probabilities are finally output.
3. The model according to claim 1, characterized in that The time-frequency encoder of the model also includes: The time-frequency encoder is used to process the two-dimensional time-frequency graph generated by wavelet transforming the one-dimensional EEG signal; The initial convolutional layer passes through two 3x3 convolutional layers, each containing 64 channels and a stride of 1; Apply a pooling layer with a window size of 8 and a stride of 8; The process of deep feature extraction is performed through three 3x3 convolutional layers, two of which have 128 channels and the last one has 256 channels, with a stride of 1, and 5 classification probabilities are output again.
4. The model according to claim 1, characterized in that The scoring module of the model also includes: The scoring module is used to compare the classification probability of the first preset number and the classification probability of the second preset number with a preset threshold; If the preset category probabilities in the first preset number of classification probabilities and the second preset number of classification probabilities both exceed the preset threshold, generating a comparison result; The comparison result is processed based on the argmax function to generate a classification result.
5. The model according to claim 1, characterized in that The model also includes: The model is trained separately for the time domain encoder and the time frequency encoder, and multimodal joint training based on contrastive learning is performed.
6. The model according to claim 5, characterized in that Training the time domain encoder of the model further includes: The one-dimensional time-domain EEG signal is processed and the parameters are optimized using the cross entropy loss function to extract the time series features.
7. The model according to claim 5, characterized in that Training the frequency domain encoder of the model further includes: The time-frequency diagram generated by wavelet transform is processed, and cross entropy is also used as the loss function to independently optimize the representation of frequency domain features.
8. The model according to claim 5, characterized in that The multimodal joint training of the model for contrastive learning also includes: Feature mapping training, the time domain encoder and the time-frequency encoder map features to the contrastive learning space through their respective projection heads; Similarity calculation training, using cosine similarity to calculate the similarity of two modal features; Contrastive learning training, the contrastive learning module optimizes the model by maximizing the similarity of positive sample pairs and minimizing the similarity of negative sample pairs, using a contrastive loss function for optimization; Fine-tune parameter training, through the feedback of contrastive learning, adjust the parameters of the time domain and frequency domain encoders to make the representation of the two modalities in the shared feature space close to the same.
9. The model according to claim 1, characterized in that The data set acquisition and preprocessing of the model training also includes: Collect public sleep datasets such as MASS and Sleep-EDF, which contain EEG signals annotated according to different sleep manuals; The EEG signal is preprocessed by removing noise and filtering, and the time domain signal is converted into a time-frequency signal in image format through wavelet transformation.
10. The model according to claim 1, characterized in that Model evaluation and testing of the model also includes: Use accuracy, F1 score, and Cohen's Kappa coefficient indicators to evaluate model performance; A k-fold cross-validation scheme was used to divide the training set into multiple subsets, and each subset was used once as a test set.