Cross-subject eeg emotion recognition method and system based on decoupled hybrid meta-learning
By decoupling the hybrid learning method, a backbone network is constructed for the cross-subject invariant feature encoding module and the sparse dynamic graph topology adaptation module. This resolves the conflict between general feature extraction and personalized topology adaptation in cross-subject EEG emotion recognition, and achieves higher accuracy and robustness in emotion recognition.
Patent Information
- Application Number
- CN202610987515.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2026-06-15
- Filing Date
- 2026-07-03
- Publication Date
- 2026-08-04
AI Technical Summary
Existing cross-subject EEG emotion recognition technologies have insufficient generalization performance when faced with new subjects they have never met before, and it is difficult to effectively decouple general emotion feature extraction from personalized topology adaptation, resulting in insufficient model recognition accuracy and robustness.
We adopt a decoupled hybrid learning approach, which constructs a backbone network that decouples and connects a cross-subject invariant feature encoding module and a sparse dynamic graph topology adaptation module. We then pre-train the network using supervised contrastive loss and adversarial loss to achieve synergistic optimization of general feature extraction and personalized topology adaptation.
It improves the accuracy and robustness of cross-subject EEG emotion recognition, achieves more generalized feature extraction and personalized topology adaptation, and solves the performance trade-off problem in traditional methods.
Smart Images

Figure CN122508345A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of EEG emotion recognition technology, specifically to a cross-subject EEG emotion recognition method and system based on decoupled hybrid meta-learning. Background Technology
[0002] Electroencephalogram (EEG), as a physiological indicator that can intuitively represent the activity state of the nervous system, has been widely used in human-computer interaction and affective computing due to its advantages such as being difficult to fake, convenient, and non-invasive. Utilizing deep learning technology to analyze EEG signals to identify users' emotional states has become a current research hotspot.
[0003] However, in practical applications, EEG signals exhibit significant cross-subject variability. When faced with new, unseen subjects, models optimized solely on the training set often fail to generalize effectively. Therefore, cross-subject EEG emotion recognition methods have garnered increasing attention.
[0004] Existing cross-subject EEG emotion recognition technologies mainly suffer from the following problems:
[0005] (1) Most existing domain adaptation or domain generalization methods are committed to minimizing the marginal distribution difference between the source domain and the target domain, while ignoring the conditional distribution shift related to semantic categories. Even though some studies have introduced contrastive learning to perform cross-subject semantic alignment based on induced incentives, they lack explicit stripping based on individual identity differences, resulting in a lack of anchoring for the extracted emotional features and limiting the upper limit of the model's recognition accuracy.
[0006] (2) Existing methods, when dealing with individual differences, usually only focus on the data distribution alignment at the feature level, while ignoring the individual heterogeneity at the EEG topology level. The EEG topology also exhibits "double variability" composed of individual physiological connectivity fingerprints and memory-driven cognitive differences. Existing graph neural network methods with fixed parameters after training are difficult to effectively characterize the aforementioned double variability of the EEG topology.
[0007] (3) To improve the model's ability to quickly adapt to new subjects, some studies have begun to introduce meta-learning frameworks. However, current meta-learning-based EEG emotion recognition methods generally adopt an end-to-end full-parameter meta-training strategy. Due to the high-dimensionality and high-noise background of EEG signals, starting with random initialization and optimizing the entire network may result in an excessively large search space in the meta-learning process. This not only makes the model training extremely unstable and prone to getting stuck in local optima, but also incurs huge computational costs, making it difficult to achieve efficient personalized calibration in practical applications.
[0008] (4) More importantly, since there is an inherent conflict between the optimization directions of "extracting cross-subject invariant features" and "personalized topological adaptation", attempting to achieve both optimization goals simultaneously in a single end-to-end architecture will inevitably be subject to performance trade-offs. Existing technical solutions have failed to effectively decouple general emotional representation learning from personalized topological cognitive adaptation, and lack a computational paradigm for collaborative optimization. Summary of the Invention
[0009] The technical problem to be solved by this invention is how to overcome the above-mentioned deficiencies and improve the accuracy and robustness of cross-subject EEG emotion recognition by synergistic extraction of general representations of EEG emotional features and personalized adaptive calibration of EEG topology.
[0010] The present invention solves the above-mentioned technical problems through the following technical means: This invention provides a cross-subject EEG emotion recognition method based on decoupled hybrid meta-learning, comprising the following steps: S1. Collect EEG signals from several subjects, including emotional labels, induced motivation labels, and subject identity labels; S2. Preprocess the EEG signal and extract feature sequences to construct feature samples. Based on the meta-learning strategy, each subject is regarded as an independent meta-task. All meta-tasks are divided into meta-training task set and meta-test task set. Each meta-task is internally divided into support set and query set. S3. Construct a backbone network consisting of a decoupled and cascaded cross-subject invariant feature encoding module and a sparse dynamic graph topology adaptation module. This backbone network is used to obtain graph-level structured feature vectors based on support sets from the meta-training task set data. and query representation vector based on query set ; S4. Based on the supervised contrast loss constructed from induced motivation labels and the adversarial loss constructed from the subject identity labels, the pre-training of the cross-subject invariant feature encoding module is completed and its network parameters are fixed. S5. After pre-training is completed, construct global meta-parameters shared across meta-tasks. Including task-specific adaptation parameters Learnable global semantic matrix and learnable fusion coefficient This completes the random initialization of global meta-parameters; among which, The total number of emotion categories, This is the preset semantic embedding dimension; S6. Before each iteration of meta-training, randomly select several meta-tasks from the meta-training task set to construct a meta-training batch, and then set the network parameters... Instantiate task-specific adaptation parameters for each meta-task ; S7. In the inner loop of meta-training, first use graph-level structured feature vectors. As input, the classifier outputs the emotion recognition result and calculates the cross-entropy loss, updating the task-specific adaptation parameters. Based on updated task-specific adaptation parameters Output graph-level structured feature vectors and global semantic matrix Generate a personalized emotional prototype matrix for the meta-task. ; S8. In the outer loop stage of meta-training, query the representation vector. As input, adapt parameters based on updated task-specific parameters. The classifier outputs the first prediction result. Based on query representation vector With Personalized Emotional Archetype Matrix Dot product similarity, retrieve global semantic matrix Output the second prediction result Learnable fusion coefficients based on meta-training Weighted fusion first prediction result Second prediction results ; S9. After the outer loop of meta-training ends, aggregate the meta-loss of all meta-tasks in the meta-training batch and update the global meta-parameters; repeat steps S6-S9 until the model converges.
[0011] Further, step S2, which involves extracting feature sequences to construct feature samples, specifically includes: The original EEG signal was downsampled, bandpass filtered to remove power frequency and physiological artifacts, decomposed into frequency bands, and segmented into non-overlapping time windows. Differential entropy features were extracted from the standard frequency bands Delta, Theta, Alpha, Beta, and Gamma bands, respectively. ; then the sequentially consecutive Each differential entropy feature Concatenate sequentially to construct feature samples with three dimensions. ,in , , These are the preset time, channel, and frequency band dimensions, respectively.
[0012] Furthermore, the cross-subject invariant feature encoding module described in step S3 specifically includes: The parameterized channel gating units, multi-scale temporal convolutional units, and temporal pooling layers are cascaded in sequence. The parameterized channel gating unit is used for feature samples. Adaptive attention weighting is applied to channels and frequency bands to output enhanced features. As shown in the following formula:
[0013] in, For feature samples The feature matrix after flattening the channel and frequency band dimensions. and These are the learnable parameter matrix and the bias, respectively. This indicates element-wise multiplication. For activation function, This indicates that the flattened dimensions will be restored; The multi-scale temporal convolutional unit consists of multiple cascaded dilated residual convolutional blocks, enhancing features. First, the initial hidden layer representation is obtained through one-dimensional convolutional layer mapping. Then, input the dilated residual convolutional block for feature transformation, as shown in the following formula:
[0014]
[0015] in, , , They represent the first Output features, parameter matrix, and hole rate of a layered dilated residual convolutional block. , This represents the total number of convolutional layers. This represents a one-dimensional convolution operation. It is an activation function. To extract multi-scale time-frequency dynamic features by increasing the number of network layers; The temporal pooling layer is connected to the output of the multi-scale temporal convolutional unit and is used to process the output features after convolution. Folding the time dimension, the final output is a general node feature. ,in For feature dimensions.
[0016] Furthermore, the sparse dynamic graph topology adaptation module described in step S3 specifically includes: Sparse dynamic graph construction unit, multi-head graph attention aggregation unit, and one-dimensional convolutional layer; The sparse dynamic graph construction unit calculates the distance between electrodes based on the physical spatial coordinates of the electrode distribution in the international standard 10-20 system to construct a static spatial prior matrix. And introduce a learnable adjacency parameter matrix. The weighted fusion yields the original adjacency matrix. Subsequently, a sparsified activation function, Sparsemax, is introduced to adaptively truncate the weights of non-critical electrode connections, generating a sparse dynamic adjacency matrix with end-to-end differentiability. As shown in the following formula:
[0017]
[0018] in These are the preset adjacency matrix fusion coefficients; The multi-head graph attention aggregation unit is based on a sparse dynamic adjacency matrix. Define channel nodes The directed incoming neighbor set is , express The element value corresponding to the index in the middle is based on general node features. Define channel nodes , The corresponding node embedding is , Set up parallel attention heads and compute nodes. To the node Feature attention score With feature attention weights As shown in the following formula:
[0019]
[0020] in , They represent the first Each attention head can learn a parameter matrix and a weight vector. , For the total number of attention heads; For the feature dimension of the attention head, The representation features are concatenated; then a sparse dynamic adjacency matrix is used. element value For structural weights, combined with feature attention weights Update node embedding as follows:
[0021] in For nodes The updated node embeddings, together with all the updated node embeddings, constitute the updated node features, which, along with the general node features... Perform residual connections as the output of the multi-head graph attention aggregation unit; The one-dimensional convolutional layer is used to compress the spatial channel dimension of the output of the multi-head graph attention aggregation unit, and finally outputs the graph-level structured feature vector based on the support set. Output the query representation vector based on the query set. .
[0022] Further, step S4 includes the following steps: S41. Construct a parallel projection head and discriminator, wherein both the projection head and discriminator employ an embedded... A two-layer fully connected layer architecture for activation functions; S42. In each training iteration, randomly select... Each triggering stimulus is then randomly selected. For each subject, subject-motivation data pairs are constructed; then, random sampling is performed from each subject-motivation data pair. _ ... The training batches, among which , , All of these are preset hyperparameters; S43, General node features The projection head maps the features to a contrast feature. Using any sample within the current training batch as the anchor sample, samples with the same evoked stimulus label are considered positive samples, and samples with different evoked stimulus labels are considered negative samples. The supervised contrastive loss is then calculated. As shown in the following formula:
[0023] in, This is the index set of samples within the current training batch. For set Anchored sample index in To anchor the sample A set of sample indexes with the same evoked stimulus labels. For set Positive sample index in For samples outside the anchoring batch All other sample index sets, For set The sample index in The cosine similarity function is used. For temperature control parameters exceeding the limit, , , Anchored samples Positive samples and samples The contrast features; S44. A gradient inversion layer is connected between the cross-subject invariant feature encoding module and the discriminator to transfer the general node features. The discriminator outputs the predicted subject identity, and the adversarial loss is calculated by combining this prediction with the actual subject identity labels. As shown in the following formula:
[0024] in , Samples The predicted participant identities and the actual participant identity labels For the sample Corresponding general node characteristics, Represents a probability distribution; S45. The total pre-training loss is obtained by weighted summing of the supervised contrastive loss and the adversarial loss, as shown in the following formula:
[0025] in, The preset loss balancing coefficient is based on the total pre-training loss. Optimize the network parameters of the subject-invariant feature encoding module.
[0026] Furthermore, the update of the task-specific adaptation parameters in step S7 is as follows:
[0027] in, Representing meta-tasks Corresponding task-specific adaptation parameters, The preset learning rate for the inner loop. For cross-entropy loss, This represents the gradient operator used for partial derivative calculations. The personalized emotional prototype matrix As shown in the following formula:
[0028] in, , This represents the total number of feature samples in the support set of the meta-task. for n The graph-level structured feature vector corresponding to each feature sample. Represents the global semantic matrix The middle corresponds to Semantic embedding of sentiment tags T This indicates transpose.
[0029] Furthermore, the second prediction result described in step S8 As shown in the following formula:
[0030]
[0031] in, For query representation vector With Personalized Emotional Archetype Matrix dot product, T Indicates transpose; The weighted fusion first prediction result Second prediction results As shown in the following formula:
[0032] in, This indicates the final prediction result.
[0033] Furthermore, the meta-loss mentioned in step S9 specifically refers to: Based on the final prediction results Calculate the current meta-task using real sentiment tags. Cross-entropy loss as meta-loss ; The update of global meta-parameters includes: A first-order learning optimization algorithm that omits the second derivative is used to aggregate training batches. All meta-task meta-losses within the scope of global meta-parameters Perform gradient updates as follows:
[0034] in, The preset global meta-parameter learning rate.
[0035] This invention also provides a cross-subject EEG emotion recognition system based on decoupled hybrid meta-learning. The system executes the above-described method during runtime and includes the following modules: The signal acquisition module is used to acquire EEG signals from several subjects, including emotional labels, evoked motivation labels, and subject identity labels. The meta-task construction module is used to preprocess EEG signals and extract feature sequences to construct feature samples. Based on the meta-learning strategy, each subject is regarded as an independent meta-task. All meta-tasks are divided into meta-training task sets and meta-test task sets. Each meta-task is internally divided into a support set and a query set. The backbone network module is used to construct a backbone network consisting of a decoupled and cascaded cross-subject invariant feature encoding module and a sparse dynamic graph topology adaptation module. This backbone network is used to obtain graph-level structured feature vectors based on the support set after passing the meta-training task set data through it. and query representation vector based on query set ; The pre-training module is used to pre-train the subject-invariant feature encoding module and fix its network parameters by constructing a supervised contrastive loss based on evoked motivation labels and an adversarial loss based on subject identity labels. The global meta-parameter building module is used to construct global meta-parameters shared across meta-tasks after pre-training. Including task-specific adaptation parameters Learnable global semantic matrix and learnable fusion coefficient This completes the random initialization of global meta-parameters; among which, The total number of emotion categories, This is the preset semantic embedding dimension; The instantiation module, before each iteration of meta-training, randomly selects several meta-tasks from the meta-training task set to construct a meta-training batch, and sets the network parameters... Instantiate task-specific adaptation parameters for each meta-task ; The inner loop module is used to first structure the feature vectors at the graph level during the inner loop phase of meta-training. As input, the classifier outputs the emotion recognition result and calculates the cross-entropy loss, updating the task-specific adaptation parameters. Based on updated task-specific adaptation parameters Output graph-level structured feature vectors and global semantic matrix Generate a personalized emotional prototype matrix for the meta-task. ; The outer loop module is used to query the representation vector during the outer loop phase of meta-training. As input, adapt parameters based on updated task-specific parameters. The classifier outputs the first prediction result. Based on query representation vector With Personalized Emotional Archetype Matrix Dot product similarity, retrieve global semantic matrix Output the second prediction result Learnable fusion coefficients based on meta-training Weighted fusion first prediction result Second prediction results ; The global update module is used to aggregate the meta-loss of all meta-tasks in the meta-training batch and update the global meta-parameters after the outer loop of meta-training ends; repeat steps S6-S9 until the model converges.
[0036] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method.
[0037] The advantages of this invention are: (1) This invention achieves more generalizable cross-subject universal feature extraction. Compared with traditional single edge distribution alignment methods or conditional alignment methods, this invention optimizes the cross-subject invariant feature encoding module by constructing supervised contrast loss and adversarial loss in pre-training, which alleviates the response interference caused by individual identity features, and aligns the sentiment semantics under homogeneous stimulation. Thus, after the parameters are fixed, it provides more discriminative universal node features for downstream tasks.
[0038] (2) This invention effectively characterizes the "dual variability" of EEG topology. Based on the sparse dynamic graph topology adaptation module, a dual-path hybrid learning architecture is constructed to achieve topology parameter adaptation for individual physiological connectivity fingerprints and personalized emotional prototype matrix generation for memory-driven cognitive differences. This dual-path collaborative design of parameter optimization path and memory-cognitive path comprehensively captures the individual-specific evolutionary patterns of the brain in the process of emotional cognitive processing.
[0039] (3) This invention overcomes the computational and optimization bottlenecks of traditional end-to-end meta-optimization by constructing a backbone network structure consisting of a cross-test invariant feature encoding module and a sparse dynamic graph topology adaptation module, and solves the conflicting target performance trade-off problem between cross-test invariant feature extraction and personalized topology adaptation. It significantly improves the stability of meta-parameter updates and the performance and efficiency of target calibration. Attached Figure Description
[0040] Figure 1 This is a flowchart illustrating the cross-subject EEG emotion recognition method based on decoupled hybrid meta-learning according to an embodiment of the present invention. Figure 2 This is a schematic diagram of the decoupled serial backbone network according to an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating the pre-training and hybrid learning process in an embodiment of the present invention. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0042] Example 1 This embodiment provides a cross-subject EEG emotion recognition method based on decoupled hybrid meta-learning, aiming to address technical bottlenecks in existing methods, such as the lack of fine-grained semantic feature alignment, difficulty in effectively characterizing the dual variability of EEG topology, optimization bottlenecks in end-to-end meta-learning, and performance trade-offs between general feature extraction and personalized topology adaptation. It achieves accurate extraction of general emotion features across subjects and personalized adaptive calibration of EEG topology through collaboration. The specific implementation process of the method is as follows: Figure 1 As shown, it includes the following steps: S1. Collect EEG signals from several subjects, including emotional labels, evoked motivation labels, and subject identity labels; for each EEG signal sample in the dataset, explicitly define and assign a supervision label in three dimensions: emotional label. ( (Representing the total number of sentiment categories), used to supervise sentiment classification tasks; eliciting incentive labels. ( (representing the total emotional stimulus), used as an anchor point for feature semantic alignment in supervised contrastive loss; subject identity label. ( (representing the total number of subjects), used to identify and extract individual-specific information from features in adversarial loss.
[0043] This embodiment uses the publicly available SEED and SEED-IV datasets. The SEED dataset contains continuous EEG signals from 15 subjects viewing 15 emotionally evoked stimuli, corresponding to three emotional labels: positive, neutral, and negative. The SEED-IV dataset contains continuous EEG signals from 15 subjects viewing 24 emotionally evoked stimuli, corresponding to four emotional labels: happy, sad, fearful, and neutral. A 62-channel EEG device was used for recording the EEG signals.
[0044] S2. Preprocess the EEG signal and extract feature sequences to construct feature samples. Based on the meta-learning strategy, each subject is considered an independent meta-task. All meta-tasks are divided into a meta-training task set and a meta-test task set. Each meta-task is internally divided into a support set and a query set. The extraction of feature sequences to construct feature samples specifically includes: The original EEG signal was downsampled to 200Hz, and bandpass filtering from 0.3Hz to 50Hz was performed to remove power frequency and physiological artifacts. Frequency band decomposition and 1s non-overlapping time window segmentation were also applied. Differential entropy features were extracted from the standard frequency bands Delta, Theta, Alpha, Beta, and Gamma bands, respectively. ; then the sequentially consecutive Each differential entropy feature Concatenate sequentially to construct feature samples with three dimensions. ,in , , These are the preset time, channel, and frequency band dimensions, respectively. In this embodiment... , , After completing the feature sequence extraction described above, based on the Leave-One-Subject-Out (LOSO) strategy and the meta-learning paradigm, each subject is treated as an independent meta-task: for subjects containing... A dataset of subjects is used, and data from one unseen target subject is selected each time as the meta-test task. and further the remaining The data from the subjects were divided into a meta-training task set. Simultaneously, each task is internally divided into a support set and a query set: for any meta-task Based on the induced incentive labels, they are divided into support sets. and query set ,Right now Among them, the induced stimulus set Divided into disjoint support incentive subsets With query incentive subset .
[0045] S3, such as Figure 2 As shown, a backbone network is constructed, consisting of a decoupled and cascaded cross-subject invariant feature encoding module and a sparse dynamic graph topology adaptation module. This backbone network is used to obtain graph-level structured feature vectors based on support sets from the meta-training task set data. and query representation vector based on query set ; The cross-subject invariant feature encoding module specifically includes: The parameterized channel gating units, multi-scale temporal convolutional units, and temporal pooling layers are cascaded in sequence. The parameterized channel gating unit is used for feature samples. Adaptive attention weighting is applied to channels and frequency bands to output enhanced features. As shown in the following formula:
[0046] in, For feature samples The feature matrix after flattening the channel and frequency band dimensions. and These are the learnable parameter matrix and the bias, respectively. This indicates element-wise multiplication. For activation function, This indicates that the flattened dimensions will be restored; the parameterized gating unit described in this embodiment is based on the existing literature "Plug-and-Play Domain Adaptation for Cross-Subject EEG-based Emotion Recognition" (Li-Ming Zhao et al., The Thirty-Fifth AAAI Conference on Artificial Intelligence (AAAI-21), 2021: 863-870, Section 3, Paragraph 2), and is an improved application for feature samples with three dimensions.
[0047] The multi-scale temporal convolutional unit consists of multiple cascaded dilated residual convolutional blocks, enhancing features. First, the initial hidden layer representation is obtained through one-dimensional convolutional layer mapping. Then, input the dilated residual convolutional block for feature transformation, as shown in the following formula:
[0048]
[0049] in, , , They represent the first Output features, parameter matrix, and hole rate of a layered dilated residual convolutional block. , This represents the total number of convolutional layers. This represents a one-dimensional convolution operation. It is an activation function. The number of network layers increases to extract multi-scale time-frequency dynamic features; in this embodiment, let , .
[0050] The temporal pooling layer is connected to the output of the multi-scale temporal convolutional unit and is used to process the output features after convolution. Folding the time dimension, the final output is a general node feature. ,in is the feature dimension. In this embodiment, let be the feature dimension. .
[0051] The sparse dynamic graph topology adaptation module takes general node features as its input. Specifically, it includes: Sparse dynamic graph construction unit, multi-head graph attention aggregation unit, and one-dimensional convolutional layer; The sparse dynamic graph construction unit calculates the distance between electrodes based on the physical spatial coordinates of the electrode distribution in the international standard 10-20 system to construct a static spatial prior matrix. And introduce a learnable adjacency parameter matrix. The weighted fusion yields the original adjacency matrix. Subsequently, a sparsified activation function, Sparsemax, is introduced to adaptively truncate the weights of non-critical electrode connections, generating a sparse dynamic adjacency matrix with end-to-end differentiability. As shown in the following formula:
[0052]
[0053] in These are the preset adjacency matrix fusion coefficients; the calculation process of the Sparsemax activation function has been disclosed in the existing technical literature "From Softmax to Sparsemax: A Sparse Model of Attention and Multi-Label Classification" (André FT Martins, Ramón F. Astudillo, Proceedings of the 33rd International Conference on Machine Learning, 2016: 863-870, Section 2); in this embodiment, let ; The multi-head graph attention aggregation unit is based on a sparse dynamic adjacency matrix. Define channel nodes The directed incoming neighbor set is , express The element value corresponding to the index in the middle is based on general node features. Define channel nodes , The corresponding node embedding is , Set up parallel attention heads and compute nodes. To the node Feature attention score With feature attention weights As shown in the following formula:
[0054]
[0055] in , They represent the first Each attention head can learn a parameter matrix and a weight vector. , For the total number of attention heads; For the feature dimension of the attention head, The representation features are concatenated; then a sparse dynamic adjacency matrix is used. element value For structural weights, combined with feature attention weights Update node embedding as follows:
[0056] in For nodes The updated node embeddings, together with all the updated node embeddings, constitute the updated node features, which, along with the general node features... Perform residual connections, which serve as the output of the multi-head graph attention aggregation unit; in this embodiment, let... , .
[0057] The one-dimensional convolutional layer is used to compress the spatial channel dimension of the output of the multi-head graph attention aggregation unit, and finally outputs the graph-level structured feature vector based on the support set. Output the query representation vector based on the query set. .
[0058] S4. As shown in the figure, the pre-training of the cross-subject invariant feature encoding module is completed and its network parameters are fixed based on the supervised contrast loss constructed based on the induced motivation label and the adversarial loss constructed based on the subject identity label; the specific implementation includes the following steps: S41. Construct a parallel projection head and discriminator, wherein both the projection head and discriminator employ an embedded... A two-layer fully connected layer architecture for activation functions; S42. In each training iteration, randomly select... Each triggering stimulus is then randomly selected. For each subject, subject-motivation data pairs are constructed; then, random sampling is performed from each subject-motivation data pair. _ ... The training batches, among which , , All are preset hyperparameters; in this embodiment, let , , ; S43, General node features The projection head maps the features to a contrast feature. Using any sample within the current training batch as the anchor sample, samples with the same evoked stimulus label are considered positive samples, and samples with different evoked stimulus labels are considered negative samples. The supervised contrastive loss is then calculated. As shown in the following formula:
[0059] in, This is the index set of samples within the current training batch. For set Anchored sample index in To anchor the sample A set of sample indexes with the same evoked stimulus labels. For set Positive sample index in For samples outside the anchoring batch All other sample index sets, For set The sample index in The cosine similarity function is used. For temperature control parameters exceeding the limit, , , Anchored samples Positive samples and samples The contrast features; S44. A gradient inversion layer is connected between the cross-subject invariant feature encoding module and the discriminator to transfer the general node features. The discriminator outputs the predicted subject identity, and the adversarial loss is calculated by combining this prediction with the actual subject identity labels. As shown in the following formula:
[0060] in , Samples The predicted participant identities and the actual participant identity labels For the sample Corresponding general node characteristics, Represents a probability distribution; S45. The total pre-training loss is obtained by weighted summing of the supervised contrastive loss and the adversarial loss, as shown in the following formula:
[0061] in, The preset loss balancing coefficient is based on the total pre-training loss. Optimize the network parameters of the subject-invariant feature encoding module.
[0062] S5. After pre-training is completed, construct global meta-parameters shared across meta-tasks. Including task-specific adaptation parameters Learnable global semantic matrix and learnable fusion coefficient This completes the random initialization of global meta-parameters; among which, The total number of emotion categories, As a preset semantic embedding dimension; in this embodiment, let .
[0063] S6. Before each iteration of meta-training, randomly select several meta-tasks from the meta-training task set to construct a meta-training batch, and then set the network parameters... Instantiate task-specific adaptation parameters for each meta-task ; Based on the cross-subject invariant feature encoding module with fixed parameters, a dual-path hybrid meta-learning architecture is constructed, comprising a parameter optimization path for accessing the classifier and a memory-cognitive path for accessing the contextual semantic memory reasoning module. This architecture is used for the second-stage meta-training, which includes two sequentially executed stages: an inner loop and an outer loop. The dual paths include: (1) Parameter optimization path: Input general node features The data is processed through the sparse dynamic graph topology adaptation module and then fed into the classifier. The classifier has a single fully connected layer architecture, which is used in the inner loop stage to map and obtain the emotion recognition result, and in the outer loop stage to output the first prediction result. ; (2) Memory and cognitive path: Input general node features After passing through the sparse dynamic graph topology adaptation module, it is then connected to the context semantic memory reasoning module; the specific architecture of the context semantic memory reasoning module includes: an individual context cache that is dynamically reset with the meta-task. ( The number of support set feature samples for a single meta-task, and a learnable global semantic matrix shared across meta-tasks. ( The total number of emotion categories, (For the preset semantic embedding dimension), build individual context caches in the inner loop phase. In the outer loop phase, based on the global semantic matrix Output the second prediction result ; The main architecture of the contextual semantic memory reasoning module adopts the technical solution disclosed in the existing literature "Generalized Key-Value Memory to Flexibly Adjust Redundancy in Memory-Augmented Networks" (Denis Kleyko et al., IEEE Transactions on Neural Networks and Learning Systems, 2023: 10993-10998, Section 3). In this embodiment, it is embedded into the memory cognitive path so that it can adapt to the reasoning requirements of EEG emotion recognition.
[0064] S7. In the inner loop of meta-training, first use graph-level structured feature vectors. As input, the classifier outputs the emotion recognition result and calculates the cross-entropy loss, updating the task-specific adaptation parameters. Based on updated task-specific adaptation parameters Output graph-level structured feature vectors and global semantic matrix Generate a personalized emotional prototype matrix for the meta-task. ; The updated task-specific adaptation parameters are as follows:
[0065] in, Representing meta-tasks Corresponding task-specific adaptation parameters, The preset learning rate for the inner loop. For cross-entropy loss, This represents the gradient operator used for partial derivative calculations. The personalized emotional prototype matrix As shown in the following formula:
[0066] in, , This represents the total number of feature samples in the support set of the meta-task. for n The graph-level structured feature vector corresponding to each feature sample. Represents the global semantic matrix The middle corresponds to Semantic embedding of sentiment tags T This indicates transpose.
[0067] S8. In the outer loop stage of meta-training, query the representation vector. As input, adapt parameters based on updated task-specific parameters. The classifier outputs the first prediction result. Based on query representation vector With Personalized Emotional Archetype Matrix Dot product similarity, retrieve global semantic matrix Output the second prediction result Learnable fusion coefficients based on meta-training Weighted fusion first prediction result Second prediction results ; The second prediction result As shown in the following formula:
[0068]
[0069] in, For query representation vector With Personalized Emotional Archetype Matrix dot product, T Indicates transpose; The weighted fusion first prediction result Second prediction results As shown in the following formula:
[0070] in, This indicates the final prediction result.
[0071] S9. After the outer loop of meta-training ends, aggregate the meta-loss of all meta-tasks in the meta-training batch and update the global meta-parameters; repeat steps S6-S9 until the model converges.
[0072] The aforementioned meta-loss is specifically: Based on the final prediction results Calculate the current meta-task using real sentiment tags. Cross-entropy loss as meta-loss ; The update of global meta-parameters includes: A first-order learning optimization algorithm that omits the second derivative is used to aggregate training batches. All meta-task meta-losses within the scope of global meta-parameters Perform gradient updates as follows:
[0073] in, The preset global meta-parameter learning rate.
[0074] In this embodiment, the trained cross-subject EEG sentiment recognition model is used to perform sentiment prediction on the meta-test task query set according to the leave-one-out cross-validation strategy. The average classification accuracy (ACC) and standard deviation (STD) of the prediction are calculated, and the average of all results is statistically analyzed and compared with other existing methods. The comparison results are shown in Table 1.
[0075] Table 1
[0076] Example 2 It should be further explained that, based on the same inventive concept, this embodiment also provides a cross-subject EEG emotion recognition system based on decoupled hybrid meta-learning. The system executes the method described in Embodiment 1 during operation, including the following modules: The signal acquisition module is used to acquire EEG signals from several subjects, including emotional labels, evoked motivation labels, and subject identity labels. The meta-task construction module is used to preprocess EEG signals and extract feature sequences to construct feature samples. Based on the meta-learning strategy, each subject is regarded as an independent meta-task. All meta-tasks are divided into meta-training task sets and meta-test task sets. Each meta-task is internally divided into a support set and a query set. The backbone network module is used to construct a backbone network consisting of a decoupled and cascaded cross-subject invariant feature encoding module and a sparse dynamic graph topology adaptation module. This backbone network is used to obtain graph-level structured feature vectors based on the support set after passing the meta-training task set data through it. and query representation vector based on query set ; The pre-training module is used to pre-train the subject-invariant feature encoding module and fix its network parameters by constructing a supervised contrastive loss based on evoked motivation labels and an adversarial loss based on subject identity labels. The global meta-parameter building module is used to construct global meta-parameters shared across meta-tasks after pre-training. Including task-specific adaptation parameters Learnable global semantic matrix and learnable fusion coefficient This completes the random initialization of global meta-parameters; among which, The total number of emotion categories, This is the preset semantic embedding dimension; The instantiation module, before each iteration of meta-training, randomly selects several meta-tasks from the meta-training task set to construct a meta-training batch, and sets the network parameters... Instantiate task-specific adaptation parameters for each meta-task ; The inner loop module is used to first structure the feature vectors at the graph level during the inner loop phase of meta-training. As input, the classifier outputs the emotion recognition result and calculates the cross-entropy loss, updating the task-specific adaptation parameters. Based on updated task-specific adaptation parameters Output graph-level structured feature vectors and global semantic matrix Generate a personalized emotional prototype matrix for the meta-task. ; The outer loop module is used to query the representation vector during the outer loop phase of meta-training. As input, adapt parameters based on updated task-specific parameters. The classifier outputs the first prediction result. Based on query representation vector With Personalized Emotional Archetype Matrix Dot product similarity, retrieve global semantic matrix Output the second prediction result Learnable fusion coefficients based on meta-training Weighted fusion first prediction result Second prediction results ; The global iteration module is used to aggregate the meta-loss of all meta-tasks in the meta-training batch after the outer loop of meta-training is completed, and update the global meta-parameters; repeat steps S6-S9 until the model converges.
[0077] This embodiment also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in Embodiment 1.
[0078] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A cross-subject EEG emotion recognition method based on decoupled hybrid meta-learning, characterized in that, Includes the following steps: S1. Collect EEG signals from several subjects, including emotional labels, induced motivation labels, and subject identity labels; S2. Preprocess the EEG signal and extract feature sequences to construct feature samples. Based on the meta-learning strategy, each subject is regarded as an independent meta-task. All meta-tasks are divided into meta-training task set and meta-test task set. Each meta-task is internally divided into support set and query set. S3. Construct a backbone network consisting of a decoupled and cascaded cross-subject invariant feature encoding module and a sparse dynamic graph topology adaptation module. This backbone network is used to obtain graph-level structured feature vectors based on support sets from the meta-training task set data. and query representation vector based on query set ; S4. Based on the supervised contrast loss constructed from induced motivation labels and the adversarial loss constructed from the subject identity labels, the pre-training of the cross-subject invariant feature encoding module is completed and its network parameters are fixed. S5. After pre-training is completed, construct global meta-parameters shared across meta-tasks. Including task-specific adaptation parameters Learnable global semantic matrix and learnable fusion coefficient This completes the random initialization of global meta-parameters; among which, The total number of emotion categories, This is the preset semantic embedding dimension; S6. Before each iteration of meta-training, randomly select several meta-tasks from the meta-training task set to construct a meta-training batch, and then set the network parameters... Instantiate task-specific adaptation parameters for each meta-task ; S7. In the inner loop of meta-training, first use graph-level structured feature vectors. As input, the classifier outputs the emotion recognition result and calculates the cross-entropy loss, updating the task-specific adaptation parameters. Based on updated task-specific adaptation parameters Output graph-level structured feature vectors and global semantic matrix Generate a personalized emotional prototype matrix for the meta-task. ; S8. In the outer loop stage of meta-training, query the representation vector. As input, adapt parameters based on updated task-specific parameters. The classifier outputs the first prediction result. Based on query representation vector With Personalized Emotional Archetype Matrix Dot product similarity, retrieve global semantic matrix Output the second prediction result Learnable fusion coefficients based on meta-training Weighted fusion first prediction result Second prediction results ; S9. After the outer loop of meta-training ends, aggregate the meta-loss of all meta-tasks in the meta-training batch and update the global meta-parameters; repeat steps S6-S9 until the model converges.
2. The cross-subject EEG emotion recognition method based on decoupled hybrid meta-learning according to claim 1, characterized in that, Step S2, which involves extracting feature sequences to construct feature samples, specifically includes: The original EEG signal was downsampled, bandpass filtered to remove power frequency and physiological artifacts, decomposed into frequency bands, and segmented into non-overlapping time windows. Differential entropy features were extracted from the standard frequency bands Delta, Theta, Alpha, Beta, and Gamma bands, respectively. ; then the sequentially consecutive Each differential entropy feature Concatenate sequentially to construct feature samples with three dimensions. ,in , , These are the preset time, channel, and frequency band dimensions, respectively.
3. The cross-subject EEG emotion recognition method based on decoupled hybrid meta-learning according to claim 2, characterized in that, The cross-subject invariant feature encoding module mentioned in step S3 specifically includes: The parameterized channel gating units, multi-scale temporal convolutional units, and temporal pooling layers are cascaded in sequence. The parameterized channel gating unit is used for feature samples. Adaptive attention weighting is applied to channels and frequency bands to output enhanced features. As shown in the following formula: in, For feature samples The feature matrix after flattening the channel and frequency band dimensions. and These are the learnable parameter matrix and the bias, respectively. This indicates element-wise multiplication. For activation function, This indicates that the flattened dimensions will be restored; The multi-scale temporal convolutional unit consists of multiple cascaded dilated residual convolutional blocks, enhancing features. First, the initial hidden layer representation is obtained through one-dimensional convolutional layer mapping. Then, input the dilated residual convolutional block for feature transformation, as shown in the following formula: in, , , They represent the first Output features, parameter matrix, and hole rate of a layered dilated residual convolutional block. , This represents the total number of convolutional layers. This represents a one-dimensional convolution operation. It is an activation function. To extract multi-scale time-frequency dynamic features by increasing the number of network layers; The temporal pooling layer is connected to the output of the multi-scale temporal convolutional unit and is used to process the output features after convolution. Folding the time dimension, the final output is a general node feature. ,in For feature dimensions.
4. The cross-subject EEG emotion recognition method based on decoupled hybrid meta-learning according to claim 3, characterized in that, The sparse dynamic graph topology adaptation module mentioned in step S3 specifically includes: Sparse dynamic graph construction unit, multi-head graph attention aggregation unit, and one-dimensional convolutional layer; The sparse dynamic graph construction unit calculates the distance between electrodes based on the physical spatial coordinates of the electrode distribution in the international standard 10-20 system to construct a static spatial prior matrix. And introduce a learnable adjacency parameter matrix. The weighted fusion yields the original adjacency matrix. Subsequently, a sparsified activation function, Sparsemax, is introduced to adaptively truncate the weights of non-critical electrode connections, generating a sparse dynamic adjacency matrix with end-to-end differentiability. As shown in the following formula: in These are the preset adjacency matrix fusion coefficients; The multi-head graph attention aggregation unit is based on a sparse dynamic adjacency matrix. Define channel nodes The directed incoming neighbor set is , express The element value corresponding to the index in the middle is based on general node features. Define channel nodes , The corresponding node embedding is , Set up parallel attention heads and compute nodes. To the node Feature attention score With feature attention weights As shown in the following formula: in , They represent the first Each attention head can learn a parameter matrix and a weight vector. , For the total number of attention heads; For the feature dimension of the attention head, The representation features are concatenated; then a sparse dynamic adjacency matrix is used. element value The structural weights are combined with the feature attention weights. Update node embedding as follows: in For nodes The updated node embeddings, together with all the updated node embeddings, constitute the updated node features, which, along with the general node features... Perform residual connections as the output of the multi-head graph attention aggregation unit; The one-dimensional convolutional layer is used to compress the spatial channel dimension of the output of the multi-head graph attention aggregation unit, and finally outputs the graph-level structured feature vector based on the support set. Output the query representation vector based on the query set. .
5. The cross-subject EEG emotion recognition method based on decoupled hybrid meta-learning according to claim 3, characterized in that, Step S4 includes the following steps: S41. Construct a parallel projection head and discriminator, wherein both the projection head and discriminator employ an embedded... A two-layer fully connected layer architecture for activation functions; S42. In each training iteration, randomly select... Each triggering stimulus is then randomly selected. For each subject, subject-motivation data pairs are constructed; then, random sampling is performed from each subject-motivation data pair. _ ... The training batches, among which , , All of these are preset hyperparameters; S43, General node features The projection head maps the features to a contrast feature. Using any sample within the current training batch as the anchor sample, samples with the same evoked stimulus label are considered positive samples, and samples with different evoked stimulus labels are considered negative samples. The supervised contrastive loss is then calculated. As shown in the following formula: in, This is the index set of samples within the current training batch. For set Anchored sample index in To anchor the sample A set of sample indexes with the same evoked stimulus labels. For set Positive sample index in For samples outside the anchoring batch All other sample index sets, For set The sample index in The cosine similarity function is used. For temperature control parameters exceeding the limit, , , Anchored samples Positive samples and samples The contrast features; S44. A gradient inversion layer is connected between the cross-subject invariant feature encoding module and the discriminator to transfer the general node features. The discriminator outputs the predicted subject identity, and the adversarial loss is calculated by combining this prediction with the actual subject identity labels. As shown in the following formula: in , Samples The predicted participant identities and the actual participant identity labels For the sample Corresponding general node characteristics, Represents a probability distribution; S45. The total pre-training loss is obtained by weighted summing of the supervised contrastive loss and the adversarial loss, as shown in the following formula: in, The preset loss balancing coefficient is based on the total pre-training loss. Optimize the network parameters of the subject-invariant feature encoding module.
6. The cross-subject EEG emotion recognition method based on decoupled hybrid meta-learning according to claim 1, characterized in that, The updated task-specific adaptation parameters described in step S7 are as follows: in, Representing meta-tasks Corresponding task-specific adaptation parameters, The preset learning rate for the inner loop. For cross-entropy loss, This represents the gradient operator used for partial derivative calculations. The Personalized Emotional Prototype Matrix As shown in the following formula: in, , This represents the total number of feature samples in the support set of the meta-task. for n The graph-level structured feature vector corresponding to each feature sample. Represents the global semantic matrix The middle corresponds to Semantic embedding of sentiment tags T This indicates transpose.
7. The cross-subject EEG emotion recognition method based on decoupled hybrid meta-learning according to claim 1, characterized in that, The second prediction result described in step S8 As shown in the following formula: in, For query representation vector With Personalized Emotional Archetype Matrix dot product, T Indicates transpose; The weighted fusion first prediction result Second prediction results As shown in the following formula: in, This indicates the final prediction result.
8. The cross-subject EEG emotion recognition method based on decoupled hybrid meta-learning according to claim 1, characterized in that, The meta-loss mentioned in step S9 is specifically as follows: Based on the final prediction results Calculate the current meta-task using real sentiment tags. Cross-entropy loss as meta-loss ; The update of global meta-parameters includes: A first-order learning optimization algorithm that omits the second derivative is used to aggregate training batches. All meta-task meta-losses within the scope of global meta-parameters Perform gradient updates as follows: in, The preset global meta-parameter learning rate.
9. A cross-subject EEG emotion recognition system based on decoupled hybrid meta-learning, characterized in that, Includes the following modules: The signal acquisition module is used to acquire EEG signals from several subjects, including emotional labels, evoked motivation labels, and subject identity labels. The meta-task construction module is used to preprocess EEG signals and extract feature sequences to construct feature samples. Based on the meta-learning strategy, each subject is regarded as an independent meta-task. All meta-tasks are divided into meta-training task sets and meta-test task sets. Each meta-task is internally divided into a support set and a query set. The backbone network module is used to construct a backbone network consisting of a decoupled and cascaded cross-subject invariant feature encoding module and a sparse dynamic graph topology adaptation module. This backbone network is used to obtain graph-level structured feature vectors based on the support set after passing the meta-training task set data through it. and query representation vector based on query set ; The pre-training module is used to pre-train the subject-invariant feature encoding module and fix its network parameters by constructing a supervised contrastive loss based on evoked motivation labels and an adversarial loss based on subject identity labels. The global meta-parameter building module is used to construct global meta-parameters shared across meta-tasks after pre-training. Including task-specific adaptation parameters Learnable global semantic matrix and learnable fusion coefficient This completes the random initialization of global meta-parameters; among which, The total number of emotion categories, This is the preset semantic embedding dimension; The instantiation module, before each iteration of meta-training, randomly selects several meta-tasks from the meta-training task set to construct a meta-training batch, and sets the network parameters... Instantiate task-specific adaptation parameters for each meta-task ; The inner loop module is used to first structure the feature vectors at the graph level during the inner loop phase of meta-training. As input, the classifier outputs the emotion recognition result and calculates the cross-entropy loss, updating the task-specific adaptation parameters. Based on updated task-specific adaptation parameters Output graph-level structured feature vectors and global semantic matrix Generate a personalized emotional prototype matrix for the meta-task. ; The outer loop module is used to query the representation vector during the outer loop phase of meta-training. As input, adapt parameters based on updated task-specific parameters. The classifier outputs the first prediction result. Based on query representation vector With Personalized Emotional Archetype Matrix Dot product similarity, retrieve global semantic matrix Output the second prediction result Learnable fusion coefficients based on meta-training Weighted fusion first prediction result Second prediction results ; The global iteration module is used to aggregate the meta-loss of all meta-tasks in the meta-training batch after the outer loop of meta-training is completed, and update the global meta-parameters; repeat steps S6-S9 until the model converges.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-8.
