A cross-subject EEG decoding method and system integrating sample selection and graph adaptive learning

CN121542832BActive Publication Date: 2026-09-01HANGZHOU DIANZI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511634439.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-10
Publication Date
2026-09-01
Estimated Expiration
2045-11-10

AI Technical Summary

Technical Problem

[0007]本发明的目的在于针对现有跨被试情感识别脑电解码方法在隐私保护与泛化能力方面的不足,提出一种融合样本筛选与图自适应学习的跨被试脑电解码方法及系统

Benefits of technology

[0039]1、增强的泛化与抗干扰能力:在源域训练阶段,本发明综合运用噪声注入、时序翻转、幅值缩放与频带偏移等多种数据增强技术,显著扩充训练样本的分布多样性。进一步结合所提出的“置信边距–一致性”动态筛选机制,自动遴选高质量增强样本参与训练,有效抑制噪声干扰,从源头提升模型的鲁棒性与泛化性能,为后续跨被试迁移奠定坚实基础。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121542832B_ABST
    Figure CN121542832B_ABST
Patent Text Reader

Abstract

This invention discloses a cross-subject EEG decoding method and system that integrates sample selection and graph adaptive learning. The method first collects and preprocesses EEG data from subjects performing an emotion recognition task, constructing target domain data and source domain data, and training a source domain model consisting of a feature extractor, a bottleneck layer, and a classifier. Next, the trained source domain model is used to obtain target domain data features, resulting in a structured graph, and an objective function is constructed for graph adaptive learning. Then, the structured graph is combined with the target domain sample feature matrix to construct a graph structure loss function, which serves as the objective function to fine-tune the source domain model. Finally, the source domain model is optimized based on the two objective functions to obtain the target domain model, and the predicted labels for the target domain data are obtained using the target domain model as the EEG decoding result. This invention not only improves the accuracy and robustness of cross-subject EEG decoding but also achieves a balance between privacy protection and model performance at the technical level.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of EEG signal processing technology, specifically relating to a cross-subject EEG decoding method and system that integrates sample screening and graph adaptive learning. Background Technology

[0002] Emotion recognition and cross-subject decoding technologies based on electroencephalography (EEG) in brain-computer interfaces (BCIs) have significant application value in fields such as neural engineering, affective computing, and mental health monitoring. While EEG signals directly reflect brain neural activity, they suffer from low signal-to-noise ratios, strong non-stationarity, and are significantly influenced by individual physiological structures and psychological states. This leads to significant differences in data distribution among different subjects, and even among the same subject at different time periods, exhibiting a typical "non-independent identically distributed" (Non-IID) characteristic. This distribution shift severely restricts the generalization ability of traditional machine learning models on new subjects, and direct transfer often results in a significant performance degradation.

[0003] To mitigate the domain shift problem caused by distributional differences, Domain Adaptation (DA) methods have been widely adopted. However, most existing methods still require access to source domain data or rely on extensive annotation of the target domain, which poses serious limitations in practical applications. Furthermore, EEG data contains highly sensitive personal physiological and psychological information, and its collection, transmission, and sharing must strictly meet privacy protection requirements. Therefore, reducing direct dependence on source domain data is both technically and ethically necessary.

[0004] Source-free domain adaptation is an emerging paradigm for addressing the aforementioned challenges. It utilizes only a pre-trained source model (without requiring source data) to adapt to the target domain, effectively balancing model generalization and privacy protection. Existing source-free adaptation methods typically rely on strategies such as information maximization, self-training, or generative reconstruction. While avoiding exposure to source data, they still have the following limitations: 1. They rely solely on entropy constraints or pseudo-labels of the model's output probabilities, failing to explicitly utilize the geometric relationships between samples in the target domain; 2. They are susceptible to noise and anomalous samples, and the accumulation of pseudo-label errors can lead to misalignment; 3. They struggle to effectively handle complex scenarios such as class differentiation, and the model's discriminative power and robustness remain insufficient.

[0005] In recent years, adaptive methods based on graph learning have demonstrated the advantages of structured modeling. By constructing and optimizing the similarity relationships between samples, they can guide the feature space to form connected components consistent with the number of classes, thereby improving cross-domain discrimination performance. However, existing graph learning methods mostly rely on the participation of source domain data or require partial labeling in the target domain, and their application under strictly passive settings is not yet mature.

[0006] Therefore, there is an urgent need to develop a truly passive domain adaptation method that can effectively capture the data structure of the target domain, suppress the propagation of noise and pseudo-label errors, and improve the accuracy and robustness of cross-subject EEG emotion decoding while fully protecting the privacy of source domain data. Summary of the Invention

[0007] The purpose of this invention is to address the shortcomings of existing cross-subject emotion recognition EEG decoding methods in terms of privacy protection and generalization ability, and to propose a cross-subject EEG decoding method and system that integrates sample selection and graph adaptive learning. This method only outputs the trained model in the source domain without sharing any original source domain data. To improve the model's transferability and robustness, this invention proposes introducing four types of data augmentation methods applicable to EEG (noise perturbation, time series flipping, multiplicative amplitude perturbation, and frequency shift) during the source domain training phase, and employing confidence margin and consistency as sample quality selection criteria to suppress noise amplification and overfitting at the source, obtaining a more generalizable source domain model. Without accessing source domain data in the target domain, the source domain classifier is fixed, and the source domain feature encoder is optimized. This invention proposes a graph adaptive algorithm that focuses on the internal feature relationships of target domain samples, adaptively learns the similarity structure between samples, and applies structured constraints to enhance intra-class aggregation and inter-class separation, thereby achieving interpretable and high-precision cross-subject emotion recognition EEG decoding.

[0008] In one aspect, this invention provides a cross-subject EEG decoding method that integrates sample selection and graph adaptive learning, comprising the following steps:

[0009] Step 1: Collect EEG data from the subjects during the emotion recognition task.

[0010] Step 2: Preprocess the collected EEG data to construct target domain data and source domain data, and train the source domain model consisting of a feature extractor, a bottleneck layer, and a classifier.

[0011] Step 3: Utilize the trained source domain model to perform target domain feature extraction and graph adaptive learning. First, apply the trained source domain model to the target domain data for the first time, extracting features from the target domain data using the feature extractor in the source domain model (denoted as...). The structured graph is obtained, and the features of a single target domain sample are: , This represents the source domain feature extractor, where the features of all target domain samples constitute the feature matrix. ,in The number of samples in the target domain. (as feature dimension); then, the target domain feature matrix As the core input for graph adaptive learning, an objective function is constructed for graph adaptive learning. By optimizing the objective function, accurate modeling of the similarity relationships between samples in the target domain is achieved. The objective function of the graph adaptive learning process is shown below. Through optimization of this function, a structured graph with a clear clustering structure, i.e., the sample similarity matrix S, is finally obtained:

[0012] min (1)

[0013] In equation (1), the symbols are defined as follows: Similarity matrix The Row vectors are used to characterize the first row vector. Individual sample features The strength of association with other sample features. Its third... element Indicates: For the first Features of a sample Features of all samples In the middle, the first Features by The probability becomes The neighbors; n, the number of samples in the target domain; c, the number of categories in the emotion recognition task; ,That For the graph Laplace matrix, The degree matrix (its 1st degree) The diagonal elements are defined as , used to quantify the first (The total association strength between each sample feature and all its neighbors); This is the regularization parameter.

[0014] Step 4: Based on the structured graph (i.e., similarity matrix S) obtained in Step 3, combine it with the feature matrix of the mini-batch samples in the target domain. Construct a graph structure loss function Furthermore, using this loss function as the optimization objective, the trained source domain model is fine-tuned to enable the model to learn a more generalizable representation under the graph structure constraints of the target domain features. The objective function is as follows:

[0015] (2)

[0016] In equation (2), the symbols are defined as follows: B represents the batch size; , which is the feature matrix of a small batch of samples in the target domain.

[0017] Step 5: Iteratively optimize the source domain model based on the two objective functions to obtain the target domain model, and use the target domain model to obtain the predicted labels of the target domain data as the EEG decoding results.

[0018] As a preferred option, the specific process of training the source domain model in step 2 is as follows:

[0019] Step 2.1: Load the multi-subject, multi-trial EEG dataset, preprocess the raw signals, read the EEG data of all subjects, extract differential entropy (DE) features, and smooth them using a linear dynamic system. Use the leave-one-subject method, taking the data of one subject as the target domain data and the data of the remaining subjects as the source domain data; construct source domain and target domain samples.

[0020] Step 2.2: Construct a three-level cascaded model consisting of a feature extractor, a bottleneck layer, and a classifier. The feature extractor is a multilayer perceptron consisting of a fully connected layer, a batch normalization layer, and a ReLU activation function to extract EEG features. The bottleneck layer is a dimension reduction projection layer used to obtain domain-invariant features. The classifier uses a weighted normalized linear layer to directly output the classification result.

[0021] Step 2.3: In the first quarter of the total training rounds of the three-level cascaded model, supervised training is conducted using only source domain samples.

[0022] Step 2.4: In the last three-quarters of the stage, for each sample in the source domain, apply a variety of enhancement transformations, including noise injection, amplitude scaling, time reversal and frequency band shift, to generate multiple sets of enhanced samples in parallel.

[0023] Step 2.5: Repeat for each augmented sample The bottleneck space representation is extracted by forward propagation through the feature extractor and the bottleneck layer to obtain multiple sets of predicted probability distributions.

[0024] Step 2.6: Select high-quality augmented samples according to the following criteria: First, calculate the average probability distribution of multiple predictions for each augmented sample, and use the difference between the highest probability and the second highest probability as its confidence margin; Second, calculate the KL divergence between each prediction distribution and the average distribution, and construct its consistency score in the form of the negative exponential of the mean KL divergence; Finally, use a dynamic threshold mechanism based on quantiles to screen the comprehensive quality score, which is linearly weighted by the confidence margin and the consistency score, thereby adaptively controlling the size and overall quality of the augmented samples included in the training.

[0025] Step 2.7: Merge the selected enhanced samples with the original source domain samples to form the final training set. Perform standard supervised training on this mixed dataset to optimize all parameters of the three-level cascaded model and obtain the source domain model.

[0026] As a preferred option, the specific process of target domain feature extraction and graph adaptive learning in step 3 is as follows:

[0027] Step 3.1: Extract the feature matrix Z of the target domain data through the feature extractor in the source domain model, and then normalize the feature matrix Z.

[0028] Step 3.2: Based on the normalized feature matrix Z, calculate the Euclidean distance between sample features. and for each sample feature Select the k nearest samples as initial neighbors; then, perform Simplex projection (i.e., constraint) The weights of the initial nearest neighbors are normalized to obtain the initialized similarity matrix S.

[0029] Step 3.3: Based on the initialized similarity matrix S, calculate the corresponding graph Laplacian matrix. The Laplacian matrix is ​​subjected to eigenvalue decomposition, and the eigenvectors corresponding to its first c smallest eigenvalues ​​are extracted to form a graph embedding matrix. Finally, for Each column is normalized.

[0030] Step 3.4: In each iteration, combine the current graph embedding matrix... The structural information (i.e., the clustering trend of samples in low-dimensional space) is used to recalculate the sample features. and The system adaptively adjusts the nearest neighbor set of each sample based on the distance between them. For sample pairs that are more likely to belong to the same cluster in the clustering trend, the system retains or strengthens their neighbor relationship, and weakens it otherwise, thus achieving dynamic optimization of neighbor selection.

[0031] Step 3.5: Based on the updated neighbor set, calculate the value of the objective function (1), and minimize the function using gradient descent to optimize the similarity matrix S; simultaneously, extract the connected components in the current similarity matrix S and verify whether they satisfy the requirements. (That is, exactly c connected categories are formed). If this condition is met, the iteration stops and the final structured graph (similarity matrix S) is output; if not, return to step 3.3 and repeat the iteration until convergence.

[0032] In another aspect, the present invention provides a cross-subject EEG decoding system that integrates sample selection and graph adaptive learning, comprising the following modules:

[0033] The data acquisition module is used to collect EEG data from subjects during emotion recognition tasks.

[0034] The source domain model module is used to preprocess the acquired EEG data, construct target domain data and source domain data, and train the source domain model consisting of a feature extractor, a bottleneck layer and a classifier.

[0035] The adaptive learning module is used to first apply the trained source domain model to the target domain data, obtain the target domain data features, obtain a structured graph, construct an objective function, and perform graph adaptive learning.

[0036] The fine-tuning module is used to construct a graph structure loss function based on the obtained structured graph and the feature matrix of the target domain samples, and use this as the objective function to fine-tune the trained source domain model.

[0037] The output module is used to iteratively optimize the source domain model based on two objective functions to obtain the target domain model, and then use the target domain model to obtain the predicted labels of the target domain data as the EEG decoding results.

[0038] The present invention has the following beneficial effects:

[0039] 1. Enhanced generalization and robustness: During the source domain training phase, this invention comprehensively utilizes various data augmentation techniques, including noise injection, time-series flipping, amplitude scaling, and frequency band shifting, to significantly expand the distribution diversity of training samples. Furthermore, by combining the proposed "confidence margin-consistency" dynamic selection mechanism, high-quality augmented samples are automatically selected for training, effectively suppressing noise interference and improving the model's robustness and generalization performance from the source, laying a solid foundation for subsequent cross-subject transfer learning.

[0040] 2. Precise Target Domain Structure Learning and Alignment Capabilities: An innovative graph adaptive learning algorithm is introduced to explicitly capture and model the intrinsic relationship structure between target domain samples in a passive scenario completely independent of source domain data. Specifically, by dynamically optimizing the distance metric of samples in the feature space, a sparse similarity matrix is ​​adaptively generated (retaining only connections between strongly related samples). Simultaneously, a graph Laplacian regularization constraint is introduced to guide the model to learn feature representations with clear clustering boundaries—that is, making similar samples more closely clustered and dissimilar samples more distant in the feature space. This mechanism fundamentally alleviates the feature misalignment problem in cross-domain scenarios, significantly reduces classification bias caused by structure, and ultimately significantly improves the discrimination accuracy of target domain emotion recognition.

[0041] 3. Strict privacy protection and efficient cross-domain knowledge transfer: This invention follows a passive domain adaptive paradigm, transferring only the model parameters trained in the source domain to the target domain, completely eliminating the risk of leakage of original source domain data and meeting the compliance requirements for EEG data processing. By fusing augmentation filtering and graph adaptive learning, efficient and robust transfer of source domain knowledge to the target domain is achieved within a fully privacy-protected framework, solving the trade-off between privacy and decoding performance inherent in traditional methods.

[0042] In summary, this invention not only significantly improves the accuracy and robustness of cross-subject EEG decoding, but also achieves a balance between privacy protection and model performance at the technical level, providing a reliable and secure solution for the practical application of brain-computer interfaces. It has significant scientific research value and broad application prospects. Attached Figure Description

[0043] Figure 1 This is a cross-subject EEG decoding method that integrates sample selection and graph adaptive learning. Detailed Implementation

[0044] The present invention will be further described below with reference to the accompanying drawings.

[0045] In one aspect, this invention provides a cross-subject EEG decoding method that integrates sample screening and graph adaptive learning, for recognizing EEG samples with unknown EEG emotion recognition task labels.

[0046] In cross-subject EEG state recognition experiments, significant differences among subjects often lead to decreased recognition accuracy. To address this issue, this invention proposes a cross-subject EEG decoding method that integrates sample selection and graph adaptive learning. First, during source domain training, data augmentation methods (such as noise perturbation, time series reversal, amplitude perturbation, and frequency shift) are used to expand the source domain samples. Combined with a confidence margin + consistency selection strategy, augmented samples with high consistency with the source domain are selected, effectively reducing the impact of noise and false labels and improving the transferability of the source domain model. Second, during target domain training, this invention optimizes the similarity structure of target domain samples using a graph adaptive algorithm, further reducing the differences between the source and target domains, thereby improving the decoding accuracy of the target domain. Through these two innovations, this invention effectively solves the problem of inaccurate cross-subject EEG state recognition caused by individual differences.

[0047] like Figure 1 As shown, a cross-subject EEG decoding method integrating sample selection and graph adaptive learning specifically includes the following steps:

[0048] Step 1: Collect EEG data from multiple subjects under different emotion recognition tasks.

[0049] Step 2: Preprocess the EEG data acquired in Step 1 to construct source domain data and target domain data. For the source domain data, use data augmentation methods (noise perturbation, time series flipping, multiplicative amplitude perturbation, frequency shift) and confidence margin and consistency screening criteria to train the source domain model.

[0050] Step 2.1: Load the multi-subject, multi-trial EEG dataset, preprocess and extract features from the raw signals, read the EEG data of all subjects in the specified session, extract the differential entropy (DE) features, and smooth them using a linear dynamic system. Using the leave-one-subject method, the data of one subject is used as the target domain data and the data of the remaining subjects are used as the source domain data to construct source domain and target domain samples.

[0051] Step 2.2: Construct a three-level cascaded model architecture consisting of a feature extraction network, a bottleneck embedding layer, and a classifier, and initialize each module using a normalized parameter initialization strategy.

[0052] Step 2.3: To avoid noise interference and model oscillations that may be caused by introducing augmented samples in the early stages of training, supervised training is conducted using only source domain samples in the first quarter of the total training rounds of the three-level cascaded model. This strategy aims to prioritize the establishment of a stable and discriminative feature distribution space and decision boundary, laying a robust foundation for the subsequent introduction of augmented samples.

[0053] Step 2.4: In the last three-quarters of the stage, for each sample in the source domain, apply a variety of enhancement transformations, including noise injection, amplitude scaling, time reversal and frequency band shift, to generate multiple sets of enhanced samples in parallel, so as to increase the diversity of training data.

[0054] In the source domain training, the following data augmentation methods were used, and the specific formulas and implementation methods are as follows:

[0055] 1. Time Shift

[0056] This method enhances the temporal diversity of the data by cyclically shifting the input signal along the time dimension, simulating potential phase differences or minor timing misalignments during signal acquisition. Its mathematical expression is:

[0057] (1)

[0058] Where X represents the original sample, shift_amount is a randomly generated integer offset within a preset range, and roll represents a cyclic shift operation along the time dimension.

[0059] 2. Amplitude Scaling

[0060] This method enhances the diversity of data in the amplitude dimension by globally linearly scaling the signal amplitude to simulate differences in signal gain or variations in sensor sensitivity among different subjects. Its mathematical expression is:

[0061] (2)

[0062] Here, scale_factor is a magnitude scaling factor randomly selected within a set range.

[0063] 3. Gaussian noise

[0064] This method improves the robustness of the model by adding Gaussian-distributed random noise to the original signal, simulating thermal noise or environmental interference present in real-world data acquisition environments. Its mathematical expression is:

[0065] (3)

[0066] in, It is noise generated from a normal distribution, and the standard deviation is scaled based on the standard deviation of the original data.

[0067] 4. Frequency Masking

[0068] This method simulates the situation where information in a specific frequency band is missing or damaged by randomly selecting and suppressing signal energy in one or more specific frequency bands, thus forcing the model to learn robust characteristics across frequency bands. Its mathematical expression is:

[0069] (4)

[0070] Here, mask_bands is the frequency band index that needs to be masked, and the amplitude of the signal in that frequency band will be significantly reduced.

[0071] When these enhancement methods are applied to source domain data, they can effectively increase the diversity of samples, thereby improving the robustness and generalization ability of the trained model.

[0072] Step 2.5: Repeat for each augmented sample The bottleneck space representation is extracted by the feature extractor and the bottleneck layer forward propagation to obtain multiple sets of predicted probability distributions.

[0073] Step 2.6: Select high-quality augmented samples according to the following criteria: First, calculate the average probability distribution of multiple predictions for each augmented sample, and use the difference between the highest probability and the second highest probability as its confidence margin; Second, calculate the KL divergence between each prediction distribution and the average distribution, and construct its consistency score in the form of the negative exponential of the mean KL divergence; Finally, use a dynamic threshold mechanism based on quantiles to screen the comprehensive quality score, which is linearly weighted by the confidence margin and the consistency score, thereby adaptively controlling the size and overall quality of the augmented samples included in the training.

[0074] The specific screening process includes the following formulas:

[0075] 1. Confidence Margin

[0076] Calculate the confidence margin for each augmented sample, representing the difference in the predicted probability distribution. The formula is:

[0077] (5)

[0078] in, It is the largest category probability in the predicted probability. This is the probability of the second largest category. The confidence margin reflects the model's confidence in predicting the sample; the larger the margin, the more certain the model's prediction for that sample.

[0079] 2. Consistency Measure

[0080] Consistency metrics filter samples by calculating the consistency of predictions under different enhancement methods. Specifically, the KL divergence can be used to measure the difference between multiple predictions.

[0081] (6)

[0082] Here, p and q are the probability distributions from different augmentation methods. The smaller the KL divergence, the higher the predictive consistency of the augmented samples under different methods.

[0083] Step 2.7: Merge the selected high-quality augmented samples with the original source domain samples to form the final training set. Perform standard supervised training on this mixed dataset to optimize all parameters of the three-level network model and obtain the source domain model.

[0084] Step 3: Using the trained source domain model, apply it for the first time to the target domain data to obtain target domain data features, and then apply them to graph adaptive learning. This is determined by the Laplacian matrix in the objective function. and Also depends on the similarity matrix Therefore, the constraints This is difficult to handle. Therefore, the following methods can be adopted:

[0085] set up for The i-th smallest eigenvalue; due to It is a positive semi-definite matrix, therefore we have It can be seen that when... When taken to be sufficiently large:

[0086] (7)

[0087] When it is large enough, notice that for any i, ,in For matrix If the i-th singular value is obtained, then the optimal solution of (7) will make the second term... The value is zero, thus satisfying the constraint. c.

[0088] The Tulaplatz matrix The sum of the first c smallest eigenvalues ​​is transformed into a quadratic form with orthogonal constraints. Minimum value problem

[0089] (8)

[0090] Therefore, problem (7) is further equivalent to

[0091] (9)

[0092] Compared with the original problem, (11) is easier to solve; an alternating optimization method can be used.

[0093] When S is fixed, equation (9) becomes:

[0094] (10)

[0095] The optimal solution to this problem is... The eigenvectors corresponding to the lowest c eigenvalues ​​form a matrix F.

[0096] When F is fixed, (9) becomes:

[0097] (11)

[0098] The similarity matrix S obtained during the neighbor assignment process can be viewed as a graph similarity matrix with n data points as nodes, assuming that each node is assigned a function value. Then we can verify that the following equation holds true:

[0099] (12)

[0100] Equation (12) can be used to rewrite (11) as follows:

[0101] (13)

[0102] Note that (15) is independent for different i, because each i can be solved separately:

[0103] (14)

[0104] remember , And denote the vector The j-th component is .

[0105] Then (14) can be written in vector form:

[0106] (15)

[0107] Step 3.1: Extract the feature matrix Z of the target domain data through the feature extractor in the source domain model, and then normalize the feature matrix Z.

[0108] Step 3.2: Based on the preprocessed feature matrix Z, calculate the Euclidean distance between sample features. and for each sample feature Select the k nearest samples as initial neighbors; then, perform Simplex projection (i.e., constraint) The weights of the initial nearest neighbors are normalized to obtain the initialized similarity matrix S.

[0109] Step 3.3: Based on the initialized similarity matrix S, calculate the corresponding graph Laplacian matrix. The Laplacian matrix is ​​subjected to eigenvalue decomposition, and the eigenvectors corresponding to its first c smallest eigenvalues ​​are extracted to form a graph embedding matrix. Finally, for Each column is normalized.

[0110] Step 3.4: In each iteration, combine the current graph embedding matrix... The structural information (i.e., the clustering trend of samples in low-dimensional space) is used to recalculate the sample features. and The system adaptively adjusts the nearest neighbor set of each sample based on the distance between them. For sample pairs that are more likely to belong to the same cluster in the clustering trend, the system retains or strengthens their neighbor relationship, and weakens it otherwise, thus achieving dynamic optimization of neighbor selection.

[0111] Step 3.5: Based on the updated neighbor set, calculate the value of the objective function (1), and minimize the function using gradient descent to optimize the similarity matrix S; simultaneously, extract the connected components in the current similarity matrix S and verify whether they satisfy the requirements. (That is, exactly c connected categories are formed). If this condition is met, the iteration stops and the final structured graph (similarity matrix S) is output; if not, return to step 3.3 and repeat the iteration until convergence.

[0112] Step 4: Based on the structured graph (i.e., similarity matrix S) obtained in Step 3, combine it with the feature matrix of the mini-batch samples in the target domain. Construct a graph structure loss function Furthermore, using this loss function as the optimization objective, the trained source domain model is fine-tuned so that the model learns a more generalizable representation under the graph structure constraints of the target domain features.

[0113] Step 5: Iteratively optimize the source domain model based on the two objective functions to obtain the target domain model, and use the target domain model to obtain the predicted labels of the target domain data as the EEG decoding results.

[0114] The algorithm flow is as follows:

[0115] Input: Source domain training set Target domain dataset ,in EEG samples from the source domain subjects; Label the corresponding emotion category; augment the sample set A; number of augmentations. Number of predictions Number of target categories c; Number of training rounds in the source domain Consistency weight Confidence weight Source domain training times Number of training iterations in the target domain .

[0116] Output: The trained source domain feature extractor Source Domain Classifier .

[0117] 1. Model Construction and Initialization: Construct and initialize a feature extraction network. With classifier networks An emotion recognition model composed of these components.

[0118] 2. Stability warm-up training: In the first Es / 4 stages of the total training rounds, only source domain data is used. The model is trained in a supervised manner with the goal of minimizing the cross-entropy loss.

[0119] 3. Enhancement and Selection Training: Multiple sets of enhanced data are generated in parallel for each sample, and a comprehensive quality score is constructed based on their confidence margin and prediction consistency. The most effective enhanced samples are selected and incorporated into the training set through dynamic thresholding.

[0120] 4. Hybrid training: Based on the performance of the reserved validation set, the model parameters with the best generalization performance are selected as the output.

[0121] Target domain training phase:

[0122] Input: Data feature matrix Z ∈ Rn×d, number of categories c, parameter γ, parameter λ (sufficiently large parameter λ).

[0123] Output: The similarity matrix S ∈ Rn×n has exactly c connected components.

[0124] Initialization: Initialize S to the optimal solution of problem (4) and loop until convergence:

[0125] 1. Update F; let F is formed by selecting the eigenvectors corresponding to the first c smallest eigenvalues ​​from Ls.

[0126] 2. Update S; For each sample i, update the i-th row of the similarity matrix S as follows: Construct vector Its j-th element is: The optimal value is obtained by solving problem (12).

[0127] This method mines feature relationships between samples by optimizing the problem-solving approach. In this process, it combines source domain data augmentation and sample selection strategies with a graph adaptation algorithm for the target domain to ensure the model can better adapt to the target domain features. Simultaneously, by optimizing model parameters and inferring target domain labels, it ensures that optimal target domain label predictions are obtained through iterative optimization while controlling model complexity and label smoothness, thereby improving the accuracy and robustness of cross-subject EEG decoding tasks.

[0128] In another aspect, the present invention provides a cross-subject EEG decoding system that integrates sample selection and graph adaptive learning, comprising the following modules:

[0129] The data acquisition module is used to collect EEG data from subjects during emotion recognition tasks.

[0130] The source domain model module is used to preprocess the acquired EEG data, construct target domain data and source domain data, and train the source domain model consisting of a feature extractor, a bottleneck layer and a classifier.

[0131] The adaptive learning module is used to first apply the trained source domain model to the target domain data, obtain the target domain data features, obtain a structured graph, construct an objective function, and perform graph adaptive learning.

[0132] The fine-tuning module is used to construct a graph structure loss function based on the obtained structured graph and the feature matrix of the target domain samples, and use this as the objective function to fine-tune the trained source domain model.

[0133] The output module is used to iteratively optimize the source domain model based on two objective functions to obtain the target domain model, and then use the target domain model to obtain the predicted labels of the target domain data as the EEG decoding results.

[0134] Example:

[0135] The experimental results are shown in Table 1. Compared with the traditional random sampling method, the method proposed in this invention can significantly improve the accuracy of emotion classification.

[0136] Table 1: Accuracy of Emotion Recognition Classification by Various Methods

[0137]

[0138] As can be seen from the experimental results listed in the table, the method of this invention achieved an average classification accuracy of 68.81% ± 10.5% on 15 subjects, significantly outperforming the comparative methods SHOT_IM (62.55% ± 10.62%) and GNTSFDA (67.35% ± 15.4%). This invention achieved optimal performance on the vast majority of subjects (such as S01, S03, S04, S05, S07, S09, and S13), especially showing an accuracy improvement of over 15% on subjects such as S06 and S07, demonstrating its stable and robust decoding capabilities.

[0139] This result fully demonstrates that the dynamic enhancement screening and graph adaptive learning mechanism proposed in this invention can more effectively extract discriminative features from cross-subject EEG signals, suppress individual differences and noise interference, and improve the model's generalization and robustness. By explicitly modeling the geometric structure between target domain samples and achieving precise alignment, this invention significantly alleviates the distribution offset problem, thereby achieving superior cross-subject emotion decoding performance while protecting the privacy of source domain data. This achievement provides strong support for the reliability, adaptability, and privacy security of brain-computer interface systems in practical applications.

Claims

1. A cross-subject EEG decoding method integrating sample selection and graph adaptive learning, characterized in that, Includes the following steps: Step 1: Collect EEG data from subjects during the emotion recognition task; Step 2: Preprocess the collected EEG data to construct target domain data and source domain data, and train the source domain model consisting of a feature extractor, a bottleneck layer and a classifier. The training process of the source domain model is as follows: Step 2.1: Load the multi-subject, multi-trial EEG dataset, preprocess the raw signals, read the EEG data of all subjects, extract differential entropy (DE) features, and smooth them using a linear dynamic system. Use the leave-one-out method, taking the data of one subject as the target domain data and the data of the remaining subjects as the source domain data; construct source domain and target domain samples. Step 2.2: Construct a three-stage cascaded model consisting of a feature extractor, a bottleneck layer, and a classifier. The feature extractor is a multilayer perceptron consisting of a fully connected layer, a batch normalization layer, and a ReLU activation function to extract EEG features. The bottleneck layer is a dimension reduction projection layer used to obtain domain-invariant features. The classifier uses a weighted normalized linear layer to directly output the classification result. Step 2.3: In the first quarter of the total training rounds of the three-level cascaded model, supervised training is conducted using only source domain samples; In step 2.4, the last three-quarters stage, for each sample in the source domain, multiple enhancement transformations, including noise injection, amplitude scaling, time reversal and frequency band shift, are applied to generate multiple sets of enhanced samples in parallel. Step 2.5: Repeat for each augmented sample The bottleneck space representation is extracted by the feature extractor and the bottleneck layer forward propagation to obtain multiple sets of predicted probability distributions. Step 2.6: Select augmented samples according to the following criteria: First, calculate the average probability distribution of multiple predictions for each augmented sample, and use the difference between the highest probability and the second highest probability as its confidence margin; Second, calculate the KL divergence between each prediction distribution and the average distribution, and construct its consistency score in the negative exponential form of the mean KL divergence; Finally, use a dynamic threshold mechanism based on quantiles to screen the comprehensive quality score, which is linearly weighted by the confidence margin and the consistency score. Step 2.7: Merge the selected enhanced samples with the original source domain samples to form the final training set. Perform standard supervised training on this mixed dataset to optimize all parameters of the three-level cascaded model and obtain the source domain model. Step 3: Using the trained source domain model, apply it to the target domain data for the first time to obtain the target domain data features, obtain a structured graph, and construct an objective function for graph adaptive learning. Specifically, this is implemented as follows: First, apply the trained source domain model to the target domain data for the first time, extracting features from the target domain data using the feature extractor in the source domain model, denoted as... The structured graph is obtained, and the features of a single target domain sample are: , This represents the source domain feature extractor, where the features of all target domain samples constitute the feature matrix. ,in The number of samples in the target domain. The feature dimension is the feature matrix of the target domain. As input to graph adaptive learning, graph adaptive learning is performed. By optimizing the objective function of graph adaptive learning, the similarity relationship between samples in the target domain is modeled. The objective function of the graph adaptive learning process is shown below. Through the optimization of this function, a structured graph with clustering structure, i.e., the sample similarity matrix, is finally obtained. : min In the formula, Similarity matrix The Row vectors are used to characterize the first row vector. Individual sample features The strength of association with features of other samples; No. element Indicates: For the first Features of a sample Features of all samples In the middle, the first Features by The probability becomes The neighbors; n is the number of samples in the target domain; c is the number of categories in the emotion recognition task; ,That For the graph Laplace matrix, Let be a degree matrix, and let the degree matrix be the first degree matrix. The diagonal elements are defined as , used to quantify the first The total association strength between a sample feature and all its neighbors; For regularization parameters; Step 4: Based on the structured graph obtained in Step 3, and combined with the feature matrix of the target domain samples, construct a graph structure loss function as the objective function, and fine-tune the trained source domain model. Step 5: Iteratively optimize the source domain model based on the two objective functions to obtain the target domain model, and use the target domain model to obtain the predicted labels of the target domain data as the EEG decoding results.

2. The cross-subject EEG decoding method integrating sample selection and graph adaptive learning according to claim 1, characterized in that, The specific process of graph adaptive learning is as follows: Step 3.1: Extract the feature matrix Z of the target domain data using the feature extractor in the source domain model, and normalize the feature matrix Z; Step 3.2: Based on the normalized feature matrix Z, calculate the Euclidean distance between sample features. and for each sample feature Select the k nearest samples as the initial nearest neighbors; Subsequently, the weights of the initial nearest neighbors are normalized by Simplex projection to obtain the initialized similarity matrix S. Step 3.3: Based on the initialized similarity matrix S, calculate the corresponding graph Laplacian matrix. The Laplacian matrix is ​​subjected to eigenvalue decomposition, and the eigenvectors corresponding to its first c smallest eigenvalues ​​are extracted to form a graph embedding matrix. Finally, for Normalize each column; Step 3.4: In each iteration, combine the current graph embedding matrix... Recalculate sample features based on structural information. and The distance is used to adaptively adjust the nearest neighbor set of each sample, thereby achieving dynamic optimization of neighbor selection; Step 3.5: Based on the updated neighbor set, calculate the value of the objective function and minimize it using gradient descent to optimize the similarity matrix S; simultaneously, extract the connected components in the current similarity matrix S and verify whether the desired similarity is met. That is, forming c connected categories. If the condition is met, the iteration stops and the final structured graph, i.e., the similarity matrix S, is output. If the condition is not met, the iteration returns to step 3.3 and repeats until convergence.

3. The cross-subject EEG decoding method integrating sample selection and graph adaptive learning according to claim 2, characterized in that, Step 4 is specifically implemented as follows: based on the structured graph obtained in step 3, combined with the target domain sample feature matrix... Construct a graph structure loss function Using this loss function as the optimization objective, fine-tune the trained source domain model. The objective function is as follows: In the formula, B is the batch size. The trace function is an operation that sums the elements of the main diagonal of a matrix.

4. A cross-subject EEG decoding system integrating sample selection and graph adaptive learning, used to implement the cross-subject EEG decoding method according to any one of claims 1 to 3, characterized in that, Includes the following modules: The data acquisition module is used to collect EEG data from subjects during emotion recognition tasks; The source domain model module is used to preprocess the acquired EEG data, construct target domain data and source domain data, and train the source domain model consisting of a feature extractor, a bottleneck layer and a classifier. The adaptive learning module is used to first apply the trained source domain model to the target domain data, obtain the features of the target domain data, obtain a structured graph, and construct an objective function for graph adaptive learning. The fine-tuning module is used to construct a graph structure loss function based on the obtained structured graph and the feature matrix of the target domain samples, and use it as the objective function to fine-tune the trained source domain model. The output module is used to iteratively optimize the source domain model based on two objective functions to obtain the target domain model, and then use the target domain model to obtain the predicted labels of the target domain data as the EEG decoding results.