EEG motion image classification modeling system based on self-supervised contrast learning and modeling method thereof
By using self-supervised contrast learning in EEG signal analysis combined with domain adaptive alignment and multi-view spatiotemporal attention module, the problems of large inter-individual differences and high data annotation cost in EEG signal analysis are solved, and EEG motion image classification with high accuracy and cross-domain adaptability are achieved.
Patent Information
- Application Number
- CN202510202184.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-05-27
AI Technical Summary
EEG signal analysis faces high noise, low signal-to-noise ratio, non-Gaussian distribution and highly dynamic characteristics, resulting in increased signal decoding difficulty, large differences between individuals, insufficient generalization ability of model, and high data labeling cost, which limits the performance improvement of deep learning models.
The EEG motion image classification modeling system based on self-supervised contrast learning is adopted, combined with domain adaptive alignment and multi-view spatiotemporal attention module, through the self-supervised learning framework, while maintaining the key features of the time series, it makes full use of unlabeled data to improve the accuracy of EEG signal classification and the generalization ability of the model.
Effectively process inter-individual variability of EEG signals, improve the accuracy of motion image classification and the cross-domain adaptability of the model, reduce data annotation costs, and improve model robustness and feature extraction capabilities.
Smart Images

Figure CN120046004A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of motor imagery EEG classification, and specifically relates to an EEG motor imagery classification modeling system and a modeling method based on self-supervised contrastive learning. Background Art
[0002] Brain-computer interface technology realizes functional integration and information interaction by establishing direct communication between the brain and external devices (such as computers and robots), and has shown broad application prospects in many fields such as medical rehabilitation, emotion recognition, and disability assistance. As the main means of obtaining BCI signals, electroencephalogram (EEG) has been widely used in motor imagery (MI) research due to its non-invasive, high temporal resolution, economic efficiency and other advantages. Motor imagery research helps to achieve efficient interaction between the brain and external devices by decoding the user's EEG signals, and has important clinical and practical application values.
[0003] However, EEG signal analysis faces many challenges. First, EEG data usually has high noise and low signal-to-noise ratio, and its signals have non-Gaussian distribution and highly dynamic characteristics, which increases the difficulty of signal decoding. Second, there are significant inter-individual differences in EEG signals, resulting in insufficient generalization ability of the model under different individuals or different experimental conditions. In addition, the annotation process of EEG data usually requires a large amount of manpower and time, the data annotation cost is high, and the amount of annotated data is limited, which restricts the performance improvement of deep learning models.
[0004] In recent years, self-supervised learning methods have gradually become an effective way to solve the above problems due to their advantages of being able to use a large amount of unlabeled data to improve model performance. Especially the masked modeling technology, by partially masking the input data, forces the model to learn the internal structure and features of the data, and has achieved remarkable results in the fields of natural language processing and computer vision. However, directly applying the masked modeling method to time series data, especially EEG signals, random masking may destroy the key time variations in the signals, affect the effective learning of features, and lead to a decline in model performance.
[0005] Therefore, there is an urgent need for a self-supervised learning framework specifically designed for the characteristics of EEG signals, which can maintain the key features of time series while making full use of unlabeled data to improve the accuracy of EEG signal classification and the generalization ability of the model. Summary of the Invention
[0006] The present invention is proposed to solve the above deficiencies, and aims to provide an EEG motor imagery classification modeling system and its modeling method based on self-supervised contrastive learning, which combines Domain Adaptive Alignment (DAA) and Multi-View Temporal-Spatial Attention (MTSA), aiming to effectively handle the inter-individual variability of EEG signals and improve the accuracy of motor imagery classification and the cross-domain adaptation ability of the model.
[0007] To achieve the above objectives, the present invention adopts the following solutions:
[0008] An EEG motor imagery classification modeling system based on self-supervised contrastive learning, including
[0009] An acquisition module for acquiring EEG data;
[0010] A domain adaptive alignment module for aligning EEG data in the source domain and the target domain;
[0011] A data augmentation module for performing augmentation operations on the unlabeled source domain EEG data;
[0012] A mask modeling module for masking partial time points of the augmented EEG data to generate a mask sequence, and extracting EEG feature representations through an encoder;
[0013] A multi-view temporal-spatial attention module for processing EEG features and generating EEG feature vectors;
[0014] A contrastive learning module for weighted aggregation by calculating the cosine similarity between sequences, reconstructing the original sequence through a reconstruction decoder, and performing contrastive learning and self-supervised pre-training;
[0015] A classification module that uses the labeled source domain data in the fine-tuning stage to optimize the model parameters through a classification loss and applies them to the target domain data to achieve cross-domain classification.
[0016] Furthermore, the domain adaptive alignment module adopts the Euclidean alignment method to align the EEG data in the source domain and the target domain, specifically including the following steps:
[0017] S101: Reference matrix calculation: Calculate the reference matrix from the EEG samples in the source domain and the target domain for unifying the feature spaces between different domains;
[0018] S102: Feature alignment: Align the EEG trials in the Euclidean space to improve the similarity of the source domain and target domain signals;
[0019] S103: Covariance matrix standardization: Standardize the covariance matrix of the EEG data.
[0020] Furthermore, the data augmentation module performs augmentation operations on the unlabeled source domain EEG data, specifically including time shift, noise addition, signal transposition, and data interpolation.
[0021] Furthermore, the masked modeling module masks partial time points of the augmented EEG data to generate a masked sequence, and extracts EEG feature representations through an encoder, specifically including the following steps:
[0022] S201: Masking
[0023] During the masked modeling process, for a mini-batch containing N time series Generate a masked sequence by masking partial time points where r is the masking ratio and M is the number of masked sequences;
[0024] S202: Representation learning
[0025] Generate point-level representation Z and sequence-level representation S through an encoder and a projector respectively:
[0026] Z = Encoder(X), S = Projector(Z)
[0027] In the formula, X is the masked sequence, Z is the point-level representation, and S is the sequence-level representation; the encoder is responsible for extracting the high-dimensional feature representation of the original EEG data, and the projector further maps the high-dimensional features into the feature space required for contrastive learning.
[0028] Furthermore, the multi-view spatio-temporal attention module includes multiple branches, and each branch contains a time filtering module, a spatial filtering module, a feature compression module, and a convolutional block attention module;
[0029] Furthermore, the time filtering module is used to filter the EEG data in the time dimension, extract time features of different frequency bands, and enhance the temporal information of the signal;
[0030] The spatial filtering module extracts the features of the EEG data in the spatial dimension through spatial filtering technology to capture the activity patterns of different brain regions;
[0031] The feature compression module compresses the filtered features to reduce the feature dimension;
[0032] The convolutional block attention module further strengthens important features and suppresses irrelevant features through an attention mechanism.
[0033] Furthermore, after the outputs of each branch are connected, the multi-view spatio-temporal attention module is processed by a dropout layer to generate a final EEG feature vector for the classification task.
[0034] Furthermore, the contrastive learning module performs weighted aggregation by calculating the cosine similarity between sequences and reconstructs the original sequence through a reconstruction decoder, which specifically includes the following steps:
[0035] S301: Similarity and Aggregation
[0036] Calculate the similarity matrix R between sequences using cosine similarity and perform weighted aggregation to achieve effective fusion of features:
[0037]
[0038] where τ is the temperature parameter used to control the smoothness of the similarity scores; s i is the i-th sequence in the sequence-level representation, represents the similarity between s i and s′; τ is the temperature parameter used to adjust the smoothness of the similarity distribution; z′ represents the representation of other selected sequences (or features) for aggregation calculation; represents the aggregated feature vector.
[0039] S302: Reconstruction
[0040] Reconstruct the aggregated features through the decoder back to the original sequence x i :
[0041]
[0042] where represents the reconstructed EEG sequence, which is used to measure the learning degree of the model for the masked information. Decoder is a multi-layer perceptron (MLP) or a convolutional structure that realizes the mapping from the feature vector to the time series.
[0043] S303: Contrastive Learning and Self-Supervised Pretraining Method
[0044] Masked modeling is performed with a reconstruction-based loss function, which is defined as follows:
[0045] 1) Reconstruction Loss
[0046]
[0047] where x i represents the original EEG sequence, represents the reconstructed sequence, and this loss is used to measure the ability of the model to recover the masked sequence.
[0048] 2) Constraint loss
[0049] The reconstruction process is based on the similarity between sequences. A constraint loss based on the manifold neighborhood hypothesis is introduced, and positive and negative sample pairs are defined as follows:
[0050] Positive sample pair:
[0051] Negative sample pair:
[0052] Wherein, and are respectively regarded as samples close to and far from s i The subset contains sequence representations closely related to s, and s is excluded from ;
[0053] The following constraints are introduced in the sequence feature space:
[0054]
[0055] Where s and s′ are samples in the sequence-level representation, R s,s′ represents the similarity between s and s′, and τ is the temperature parameter; represents a set of sequences closest to s, is the set of remaining sequences after removing s itself.
[0056] 3) The overall optimization objective is:
[0057]
[0058] Where Θ are the model parameters, including all learnable parameters such as the encoder, projector, decoder, and attention module; λ is the balance coefficient, which controls the weights of the reconstruction loss and the constraint loss in the overall optimization; is the reconstruction loss, is the constraint loss.
[0059] Furthermore, the classification module uses the labeled source domain data in the fine-tuning stage, optimizes the model parameters through the classification loss, and applies them to the target domain data to achieve cross-domain classification, which specifically includes the following steps:
[0060] S401: Introduce source domain labels
[0061] Use the labeled source domain EEG data to fine-tune the model parameters to further strengthen the mapping between features and categories;
[0062] S402: Optimization strategy
[0063] The Adam optimizer and the cosine annealing learning rate strategy are adopted to make the training process converge smoothly;
[0064] S403: Cross-domain application
[0065] Apply the fine-tuned model to the target domain EEG data to achieve EEG motor imagery recognition and classification.
[0066] The present invention also provides a method for modeling using the above-mentioned EEG motor imagery classification modeling system based on self-supervised contrast learning, including the following steps:
[0067] S1: Obtain EEG data, perform Euclidean registration and various random augmentation operations (such as time shift, noise addition, signal transposition, and data interpolation) on each sample to obtain augmented EEG data, and generate a multi-view EEG training set;
[0068] S2: Perform masked modeling on the augmented EEG data, and calculate the loss term using self-supervised contrast learning Mask some temporal points, and reconstruct through the encoder and decoder to obtain a self-supervised model that has initially learned temporal features;
[0069] S3: Fine-tune the self-supervised model using labeled data, and combine domain adaptive alignment (DAA) to reduce the cross-domain feature distribution difference, and obtain a model with initial cross-domain adaptation ability;
[0070] S4: On the basis of fine-tuning, introduce a multi-view spatio-temporal attention (MTSA) module to strengthen the target brain area and temporal features, and further fine-tune through self-supervised contrast learning to obtain a final model with better cross-domain motor imagery classification performance;
[0071] S5: Use the final model of cross-domain motor imagery classification to perform cross-domain classification on the EEG data of the target domain, output the motor imagery recognition result, improve the generalization ability and complete the application task.
[0072] Compared with the prior art, the present invention has the following beneficial effects:
[0073] First, the present invention improves the classification accuracy. By combining the multi-view spatio-temporal attention mechanism and domain adaptive alignment, the accuracy of EEG motor imagery classification is effectively improved, which is significantly better than the traditional method.
[0074] Second, the present invention enhances the cross-domain adaptation ability. Using self-supervised learning and contrast learning methods, the feature distribution difference between different domains is significantly reduced, and the generalization ability of the model under different experimental conditions is improved.
[0075] Thirdly, the present invention reduces the data annotation cost. Through self-supervised pre-training, it makes full use of a large amount of unlabeled EEG data, reduces the dependence on labeled data, and lowers the cost and workload of data annotation.
[0076] Fourthly, the present invention improves the model robustness. By combining multiple data augmentation strategies, it enhances the performance of the model in different noise environments and improves the stability and reliability of the model.
[0077] Fifthly, the present invention optimizes feature extraction. Through the multi-view spatio-temporal attention module, it realizes the effective extraction and fusion of multi-dimensional features of EEG data, and improves the richness and expressive ability of feature representation.
[0078] Sixthly, the present invention combines domain adaptation alignment, data augmentation, masked modeling, multi-view spatio-temporal attention, and contrast learning techniques, effectively improving the cross-domain classification performance of EEG, and has important application value in the field of brain-computer interfaces.
[0079] In summary, the present invention combines the domain adaptation alignment module and the multi-view spatio-temporal attention module to effectively cope with the inter-individual variability of EEG data, and improves the classification accuracy through the manifold-based masking method. Through experiments on multiple public datasets, the present invention performs better than existing methods, demonstrating its wide application potential in EEG classification and biomedical signal processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] Figure 1 It is a schematic structural diagram of an EEG motor imagery classification modeling system based on self-supervised contrast learning;
[0081] Figure 2 It is a schematic structural diagram of the multi-view spatio-temporal attention module. DETAILED DESCRIPTION OF THE INVENTION
[0082] The following will describe in detail the implementation of the present invention in combination with implementation cases, but they do not constitute a limitation to the present invention, and are only for illustration. At the same time, the advantages of the present invention will become clearer and easier to understand.
[0083] As Figure 1 shown, the EEG motor imagery classification modeling method based on self-supervised contrast learning of the present invention includes the following steps:
[0084] S1: Obtain EEG data (including unlabeled and a small amount of labeled EEG data), perform Euclidean registration and various random augmentation operations (such as time shift, noise addition, signal transposition, and data interpolation) on each sample to obtain augmented EEG data, and generate a multi-view EEG training set;
[0085] S2: Perform masked modeling on the enhanced EEG data, and calculate the loss term using self-supervised contrastive learning (where Θ is the model parameter, including all learnable parameters such as the encoder, projector, decoder, and attention module; λ is the balance coefficient, which controls the weights of the reconstruction loss and the constraint loss in the overall optimization; is the reconstruction loss, is the constraint loss), mask some time points, and reconstruct them through the encoder and decoder to obtain a self-supervised model that has initially learned the temporal features;
[0086] S3: Fine-tune the above self-supervised model using a small amount of labeled data, and combine domain adaptive alignment (DAA) to reduce the cross-domain feature distribution difference, and obtain a model with preliminary cross-domain adaptation ability;
[0087] S4: On the basis of fine-tuning, introduce a multi-view temporal-spatial attention (MTSA) module to strengthen the target brain region and temporal features (such as key brain regions and key temporal features), and further fine-tune through self-supervised contrastive learning to obtain a final model with better cross-domain motor imagery classification performance;
[0088] S5: Use the final model to perform cross-domain classification on the EEG data in the target domain, output the motor imagery recognition result, improve the generalization ability, and complete the application task.
[0089] An EEG motor imagery classification modeling system based on self-supervised contrastive learning of the present invention includes: a domain adaptive alignment module (Domain Adaptive Alignment, DAA), a data augmentation module, a masked modeling module, a multi-view temporal-spatial attention module (Multi-View Temporal-Spatial Attention, MTSA), a contrastive learning module, and a classification module.
[0090] An acquisition module, which is used to acquire EEG data, including unlabeled and a small amount of labeled EEG data;
[0091] The domain adaptive alignment module is used to align the EEG data in the source domain and the target domain; by adopting an advanced alignment method, the EEG data in the source domain and the target domain are aligned in the feature space, reducing the distribution difference between different domains, thereby improving the generalization ability of the model in cross-domain tasks.
[0092] To solve the significant differences in EEG data under different individuals and experimental conditions, the present invention adopts the Euclidean Alignment (EA) method to improve the similarity of signals between different domains. The specific steps include:
[0093] S101: Reference matrix calculation: Calculate the reference matrix from the EEG samples in the source domain and the target domain to unify the feature spaces between different domains.
[0094] S102: Feature alignment: Align the EEG trials in the Euclidean space to improve the similarity of the signals in the source domain and the target domain and reduce the cross-domain feature distribution differences.
[0095] S103: Covariance matrix normalization: Normalize the covariance matrix of the EEG data to further promote the effect of transfer learning and enhance the robustness of the classifier.
[0096] Through the above steps, the DAA module can effectively reduce the feature distribution differences between the source domain and the target domain and strengthen the adaptability of the model in cross-domain tasks.
[0097] The data augmentation module is used to perform augmentation operations on the unlabeled source domain EEG data; by using a variety of data augmentation techniques, such as time shift, noise addition, signal transposition, frequency domain mixing, and data interpolation, the unlabeled source domain EEG data is augmented to generate diverse training samples, enhancing the robustness and generalization ability of the model.
[0098] To improve the adaptability of the model to different noise environments and individual differences, the present invention first introduces data augmentation operations on the unlabeled source domain EEG data, including:
[0099] Time shift: Randomly move the time axis of the EEG data to simulate temporal variations.
[0100] Noise addition: Superimpose random noise of different intensities on the original signal to enhance the robustness to noise.
[0101] Signal transposition: Exchange or flip some channels to enrich the spatial distribution samples.
[0102] Data interpolation: Perform interpolation on key time segments to make up for local missing or uneven sampling.
[0103] Through diverse augmentation methods, the generalization and stability of the model can be significantly improved without increasing the annotation cost.
[0104] The masked modeling module is used to mask some time points of the augmented EEG data to generate a masked sequence, and extract the EEG feature representation through an encoder to ensure that the model retains key time information during the learning process. The specific steps are as follows:
[0105] S201: Masking
[0106] During the masked modeling process, for a mini-batch containing N time series Generate a masked sequence by masking some time points Where r is the masking ratio and M is the number of masking sequences. The manifold-based masking method is adopted to ensure that the masking operation does not destroy the key temporal variations in the time series and retains the important features of the signal.
[0107] S202: Feature learning
[0108] Generate the point-level representation Z and the sequence-level representation S through the encoder and the projector respectively:
[0109] Z = Encoder(X), S = Projector(Z)
[0110] In the formula, X is the masking sequence, Z is the point-level representation, and S is the sequence-level representation; the encoder is responsible for extracting the high-dimensional feature representation of the original EEG data, and the projector further maps these high-dimensional features into the feature space required for contrastive learning.
[0111] The multi-view spatio-temporal attention module is used to process EEG features and generate EEG feature vectors; by designing a multi-branch attention mechanism, each branch focuses on different temporal and spatial features, synthesizes multi-view information, generates rich feature vectors, and improves the accuracy and comprehensiveness of feature extraction. The multi-view spatio-temporal attention module realizes the in-depth extraction and fusion of multi-dimensional features of EEG data through the design of multiple independent branches, and enhances the richness and expressiveness of feature representation.
[0112] As Figure 2 shown, the MTSA module consists of four independent branches, and each branch contains the following four key modules for multi-view feature extraction and fusion:
[0113] (1) Temporal filtering module: Filter the EEG data in the temporal dimension, extract the temporal features of different frequency bands, and enhance the temporal information of the signal.
[0114] (2) Spatial filtering module: Extract the features of the EEG data in the spatial dimension through spatial filtering technology, and capture the activity patterns of different brain regions.
[0115] (3) Feature compression module: Compress the filtered features, reduce the feature dimension, reduce the computational complexity, and retain the key information at the same time.
[0116] (4) Convolutional block attention module (CBAM): Further strengthen the important features and suppress the irrelevant features through the attention mechanism to improve the quality of feature representation.
[0117] After the outputs of each branch are connected, they are processed through a dropout layer to generate the final EEG feature vector for subsequent classification tasks. The design of the multi-view spatio-temporal attention mechanism enables the model to deeply analyze EEG data from multiple perspectives and extract richer and more comprehensive features.
[0118] The contrastive learning module performs weighted aggregation by calculating the cosine similarity between sequences, and reconstructs the original sequence through a reconstruction decoder, and conducts contrastive learning and self-supervised pre-training to enhance the model's understanding of the internal structure of the data, specifically including:
[0119] S301: Similarity and Aggregation
[0120] Calculate the similarity matrix R between sequences using cosine similarity and perform weighted aggregation to achieve effective fusion of features:
[0121]
[0122] where s i is the i-th sequence in the sequence-level representation, represents the similarity between s i and s'. τ is the temperature parameter used to adjust the smoothness of the similarity distribution. z' represents the representation of other selected sequences (or features) for aggregation calculation. represents the aggregated feature vector.
[0123] S302: Reconstruction
[0124] Reconstruct the aggregated features back to the original sequence x i :
[0125]
[0126] where represents the reconstructed EEG sequence, which is used to measure the model's learning degree of the masked information. Decoder is a multi-layer perceptron (MLP) or convolutional structure that realizes the mapping from the feature vector to the time series.
[0127] S303: Contrastive Learning and Self-Supervised Pre-training Method
[0128] The present invention uses a reconstruction-based loss function for masked modeling, which is defined as follows:
[0129] 1) Reconstruction Loss
[0130]
[0131] where x i represents the original EEG sequence, Denote the reconstructed sequence, and this loss is used to measure the ability of the model to recover the masked sequence.
[0132] 2) Constraint loss
[0133] This reconstruction process is based on the similarity between sequences. However, to prevent the model from falling into a trivial solution, a constraint loss based on the manifold neighborhood assumption is introduced. Define positive and negative sample pairs as follows:
[0134] Positive sample pair:
[0135] Negative sample pair:
[0136] In the formula, and are regarded as samples close to and far from s respectively. The subset i contains sequence representations closely related to s, and s is excluded from ; outside;
[0137] This setting introduces the following constraints in the sequence feature space:
[0138]
[0139] In the formula, s and s′ are samples in the sequence-level representation, R s,s′ represents the similarity between s and s′, and τ is the temperature parameter. denotes a set of sequences closest to s, is the set of remaining sequences after removing s itself.
[0140] 3) The overall optimization objective is:
[0141]
[0142] In the formula, Θ is the model parameter, including all learnable parameters such as the encoder, projector, decoder, and attention module; λ is the balance coefficient, which controls the weights of the reconstruction loss and the constraint loss in the overall optimization; is the reconstruction loss, is the constraint loss.
[0143] The contrastive learning module constrains the sequence representation space by using the neighborhood assumption through the definition of positive and negative sample pairs, preventing the model from falling into a trivial solution.
[0144] The classification module, in the fine-tuning stage, uses the labeled source domain data to optimize the model parameters through the classification loss and applies them to the target domain data to achieve efficient cross-domain classification.
[0145] After completing self-supervised pre-training, the present invention fine-tunes the model under the guidance of a small amount of labeled data to adapt to specific cross-domain classification tasks. The main steps include:
[0146] S401: Introduce source domain labels
[0147] Use the labeled source domain EEG data to fine-tune the model parameters to further strengthen the mapping between features and categories.
[0148] S402: Optimization strategy
[0149] Adopt the Adam optimizer and the cosine annealing learning rate (Cosine Annealing) strategy to make the training process converge smoothly.
[0150] S403: Cross-domain application
[0151] Apply the fine-tuned model to the target domain EEG data to achieve high-precision motor imagery recognition and classification.
[0152] The present invention innovatively proposes a self-supervised contrastive learning framework system SSL-MEMI (Self-Supervised Contrastive Learning Framework for Masked EEG Motor Imagery Modeling). This system combines a domain adaptation alignment module and a multi-view spatio-temporal attention module to effectively address the inter-individual variability of EEG signals and improve the classification accuracy through a manifold-based masking method. Through experiments on multiple public datasets, it outperforms existing methods, demonstrating its wide application potential in EEG classification and biomedical signal processing.
[0153] The above is only the specific implementation manner of the present invention. It should be noted that any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention. The rest not detailed is the prior art.
Claims
1. An EEG motion image classification modeling system based on self-supervised contrastive learning, characterized by: include An acquisition module, used to acquire EEG data; Domain adaptive alignment module, used to align EEG data between source domain and target domain; The data enhancement module is used to enhance the unlabeled source domain EEG data; The mask modeling module is used to mask some time points of the enhanced EEG data, generate mask sequences, and extract EEG feature representations through the encoder; Multi-view spatiotemporal attention module to process EEG features and generate EEG feature vectors; The contrastive learning module calculates the cosine similarity between sequences for weighted aggregation, reconstructs the original sequence through the reconstruction decoder, and performs contrastive learning and self-supervised pre-training; The classification module uses labeled source domain data in the fine-tuning stage, optimizes model parameters through classification loss, and applies it to target domain data to achieve cross-domain classification.
2. The EEG motion image classification modeling system based on self-supervised contrastive learning according to claim 1, characterized in that: The domain adaptive alignment module uses the Euclidean alignment method to align the EEG data of the source domain and the target domain, and specifically includes the following steps: S101: Reference matrix calculation: Calculate the reference matrix from the EEG samples of the source and target domains to unify the feature spaces between different domains; S102: Feature alignment: Improve the similarity of source and target domain signals by aligning EEG trials in Euclidean space; S103: Covariance matrix standardization: standardize the covariance matrix of the EEG data.
3. The EEG motion image classification modeling system based on self-supervised contrastive learning according to claim 2, characterized in that: The data enhancement module performs enhancement operations on the unlabeled source domain EEG data, specifically including time shift, noise addition, signal transposition and data interpolation.
4. The EEG motion image classification modeling system based on self-supervised contrastive learning according to claim 3, characterized in that: The mask modeling module masks some time points of the enhanced EEG data to generate a mask sequence, and extracts EEG feature representation through an encoder, specifically including the following steps: S201: Mask During mask modeling, for a mini-batch containing N time series Generate a mask sequence by masking some time points Where r is the mask ratio and M is the number of mask sequences; S202: Representation Learning The encoder and projector generate point-level representation Z and sequence-level representation S respectively: Z=Encoder(X),S=Projector(Z) Where X is the mask sequence, Z is the point-level representation, and S is the sequence-level representation; the encoder is responsible for extracting the high-dimensional feature representation of the original EEG data, and the projector further maps the high-dimensional features into the feature space required for contrastive learning.
5. The EEG motion image classification modeling system based on self-supervised contrastive learning according to any one of claims 1 to 4, characterized in that: The multi-view spatiotemporal attention module includes multiple branches, each of which includes a temporal filtering module, a spatial filtering module, a feature compression module and a convolutional block attention module.
6. The EEG motion image classification modeling system based on self-supervised contrastive learning according to claim 5, characterized in that: The time filtering module is used to filter the EEG data in the time dimension, extract the time characteristics of different frequency bands, and enhance the timing information of the signal; The spatial filtering module extracts the features of EEG data in the spatial dimension and captures the activity patterns of different brain regions through spatial filtering technology; The feature compression module compresses the filtered features to reduce the feature dimension; The convolutional block attention module further strengthens important features and suppresses irrelevant features through the attention mechanism.
7. The EEG motion image classification modeling system based on self-supervised contrastive learning according to claim 6, characterized in that: The multi-view spatiotemporal attention module connects the outputs of each branch and processes them through a dropout layer to generate a final EEG feature vector for the classification task.
8. The EEG motion image classification modeling system based on self-supervised contrastive learning according to claim 7, characterized in that: The contrastive learning module performs weighted aggregation by calculating the cosine similarity between sequences and reconstructs the original sequence by reconstructing the decoder, which specifically includes the following steps: S301: Similarity and Aggregation The cosine similarity is used to calculate the similarity matrix R between sequences, and weighted aggregation is performed to achieve effective feature fusion: In the formula, s i is the i-th sequence in the sequence-level representation; Indicates i is similar to s′; τ is the temperature parameter; z′ represents the representation of other selected sequences or features; Represents the feature vector after aggregation; S302: Reconstruction The aggregated features are transformed into Reconstruct back to the original sequence x i : In the formula, Represents the reconstructed EEG sequence; Decoder is a multi-layer perceptron or convolutional structure; S303: Contrastive Learning and Self-Supervised Pre-Training Methods The loss function with reconstruction as the core is used for mask modeling, which is defined as follows: 1) Reconstruction loss In the formula, x i represents the original EEG sequence, represents the reconstruction sequence; 2) Constraint loss The reconstruction process is based on the similarity between sequences, introducing a constraint loss based on the manifold neighborhood assumption, and defining the positive and negative sample pairs as follows: Positive sample pairs: Negative sample pairs: In the formula, and are respectively regarded as i Close and distant samples, subsets Contains sequence representations that are closely related to s, s is excluded Besides; The following constraints are introduced in the sequence feature space: Where s, s′ are samples in the sequence level representation, R s,s′ represents the similarity between s and s′, τ is the temperature parameter, It is represented as a set of sequences that are closest to s. is the set of remaining sequences after removing s itself; 3) The overall optimization goal is: In the formula, Θ is the model parameter, λ is the balance coefficient, To rebuild the losses, is the constraint loss.
9. The EEG motion image classification modeling system based on self-supervised contrastive learning according to claim 8, characterized in that: The classification module uses labeled source domain data in the fine-tuning stage to optimize model parameters through classification loss and applies it to target domain data to achieve cross-domain classification. Specifically, the following steps are included: S401: Introducing source domain labels Use the labeled source domain EEG data to fine-tune the model parameters and further strengthen the mapping between features and categories; S402: Optimization Strategy The Adam optimizer and cosine annealing learning rate strategy are used to make the training process converge smoothly; S403: Cross-domain application The fine-tuned model is applied to the target domain EEG data to achieve EEG motion imagery recognition and classification.
10. A method for modeling using the system according to any one of claims 1 to 9, characterized in that: The steps include: S1: Obtain EEG data, perform Euclidean registration and multiple random enhancement operations on each sample to obtain enhanced EEG data and generate a multi-view EEG training set; S2: Perform mask modeling on the enhanced EEG data, use self-supervised contrastive learning to calculate the loss term, mask some time points, reconstruct through the encoder and decoder, and obtain a self-supervised model that initially learns the time features; S3: Use labeled data to fine-tune the self-supervised model, combined with domain adaptive alignment, to reduce the cross-domain feature distribution differences and obtain a model with preliminary cross-domain adaptation capabilities; S4: Based on fine-tuning, a multi-view spatiotemporal attention model is introduced to strengthen the target brain region and temporal features, and further fine-tuned through self-supervised contrastive learning to obtain the final model for cross-domain motion imagery classification; S5: Use the final model of cross-domain motion imagery classification to perform cross-domain classification on the EEG data of the target domain and output the motion imagery recognition results.
Citation Information
Cited By
Data set automatic annotation construction method and system
CN121597976A
Endometrial cancer classification method and system based on adaptive weighted ensemble learning
CN121790021A