Electroencephalogram signal analysis method based on smooth condition domain antagonism training
Through the smooth conditional domain adversarial training method, the domain offset and noise problems of EEG signal decoding in cross-individual and cross-session applications are solved, the transfer ability and classification performance of the model are improved, and the potential of online brain state inference is realized.
Patent Information
- Application Number
- CN202410740474.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-08
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-06-08
AI Technical Summary
Existing EEG signal decoding methods are prone to performance degradation due to domain shift when applied across individuals and across sessions, and are difficult to effectively remove noise, affecting the distinguishability of migrated features.
Adopt the smooth conditional domain adversarial training method, extract domain general and specific features through filtering, generate pseudo labels to remove outliers, calculate and generate adversarial losses, and optimize task losses through sharp perception minimization to ensure effective generalization of the model in the target domain .
It improves the transfer ability and classification ability of the model, significantly improves the cross-session decoding performance and the discriminability of transferred features, and realizes the potential of online brain state reasoning.
Smart Images

Figure CN118643403A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electroencephalogram signals, and in particular relates to an electroencephalogram signal analysis method based on smooth conditional domain adversarial training. Background Art
[0002] Brain-computer interface (BCI) technology based on the motor imagery (MI) paradigm recognizes human movement intention by decoding electroencephalogram (EEG), which plays an increasingly important role in fields such as neurorehabilitation. However, EEG signals are non-static and vary greatly between different sessions and individuals, so it is difficult to find an efficient MI decoding method across individuals and sessions. With the development of deep learning, many studies have proposed models such as recurrent neural networks to try to solve the above problems by learning robust features. However, these deep learning models are sensitive to training data and are prone to overfitting on test data. Therefore, when they are applied to new individuals or sessions (called domains), model performance may deteriorate due to domain shift. In recent years, more and more studies have attempted to align the feature distribution of EEG signals through domain adaptation methods to solve the problem of domain shift in EEG signals. However, these methods still face two major challenges. First, EEG signals have a low signal-to-noise ratio, and the features extracted by most domain adaptation methods may contain a lot of noise. Second, most pre-adaptation methods only align feature distributions between different domains, which ensures the transferability of features but fails to ensure that the transferred features have good discriminability. Summary of the invention
[0003] In order to overcome the shortcomings of the prior art, the present invention provides an EEG signal analysis method based on smooth conditional domain adversarial training. The feature extractor ensures that the features obtained by the model have high-quality information. The smooth conditional domain adversarial training ensures the joint distribution of aligned features and categories, thereby improving the migration and classification capabilities of the model; finally, the model is enabled to autonomously learn the classification boundaries on the target domain through iterative training. The framework proposed in the present invention performs better than other traditional deep learning and transfer learning methods in MI decoding, and improves the discriminability of migrated features while migrating effective features. The model of the present invention has cross-session decoding capabilities and has great potential for realizing online brain state reasoning.
[0004] The technical solution adopted by the present invention to solve the technical problem is as follows:
[0005] Step 1: Filter the EEG signal to obtain domain-general features and domain-specific features;
[0006] The EEG signals x of the source domain and the target domain s and x t The low-frequency band and high-frequency band are filtered separately; the data of the two bands are then added after the interactive frequency convolution F with shared weights, and then the domain-general features are obtained through the temporal pooling layer; then the data of the source domain and the target domain are respectively passed through the channel attention module A without shared weights to obtain the domain-specific features f s and f t ;
[0007] Step 2: Generate pseudo labels and selectively remove outliers;
[0008] The target domain feature f t After passing through the two classifiers C1 and C2, two classification probabilities are obtained. If the highest category probability in the two probabilities is greater than 0.8 and the corresponding categories belong to the same category, then the category is determined as the pseudo label on the target domain; if the proportion of the generated pseudo label is greater than 50% of the original target domain sample proportion, it is used to calculate the classification loss on the target domain in the next iteration; otherwise, the density-based spatial clustering algorithm is used for the original target domain samples to remove outliers in the signal and improve the signal quality;
[0009] The source domain features are also passed through two classifiers to obtain two classification probabilities. The classification loss is obtained by calculating the cross entropy between the classification probabilities and their corresponding labels. and The calculation formula is as follows:
[0010]
[0011]
[0012] Among them, x s and and x t is the EEG signal of the source domain and the target domain, p(y|x s ) and p(y|x t ) is a given x s and x t The classification probability, P s and P t is the distribution of source and target domains, is the sum of all samples with label k in the source domain, It is the sum of all samples with pseudo-label k in the target domain;
[0013] The classifier is composed of a multi-layer perceptron with an activation function, and the data of the source domain and the target domain share weights;
[0014] Step 3: Calculate the generated adversarial loss;
[0015] fs and f t The average of the classification probabilities obtained after the two classifiers is taken as the category prediction probability g s and g t ; Then, the joint distribution h of features and probabilities is obtained through multilinear projection operations s and h t , the calculation formula is as follows:
[0016]
[0017] Where T is the multilinear mapping operation, f s and f t are domain-specific features of the source and target domains, g s and g t is the category prediction probability of the source domain and the target domain, h s and h t It is the joint distribution of features and probabilities of the source domain and the target domain;
[0018] h s and h t It is fed into the domain discriminator D composed of a multi-layer perceptron with an activation function to calculate the adversarial loss The specific formula is as follows:
[0019]
[0020] Next, for f s and f t Perform singular value decomposition to obtain and and use and Calculate the batch spectrum penalty loss BSP, the calculation formula is as follows:
[0021]
[0022]
[0023]
[0024] Among them, U s is an orthogonal matrix, each column vector of which is The characteristic vector of U t is an orthogonal matrix, each column vector of which is The characteristic vector of s is an orthogonal matrix, each column vector of which is The characteristic vector of tis an orthogonal matrix, each column vector of which is The eigenvector of The eigenvalue square root of The square root of the eigenvalue of s,i and σ s,j is the i-th largest eigenvalue of ∑s and ∑t.
[0025] Step 4: Smooth domain adversarial training;
[0026] The objective function is optimized using sharp perception minimization SAM, and the calculation formula of the task loss is as follows:
[0027]
[0028] Among them, θ is the parameter of F, A, C1 and C2, ρ ≥ 0 is the hyperparameter defining the maximum norm ∈;
[0029] Finally, the model is trained using min-max optimization so that the model can classify test data more effectively. The calculation formula is as follows:
[0030]
[0031] Here, Φ is the parameter of D.
[0032] Preferably, the low frequency band refers to 8-16 Hz, and the high frequency band refers to 16-40 Hz.
[0033] Preferably, the shared weight interactive frequency convolution F includes 1-D point-wise spatial convolution and 1-D depth-wise temporal convolution.
[0034] The beneficial effects of the present invention are as follows:
[0035] 1. The present invention is of great significance for EEG signal analysis. The method of the present invention can effectively solve the domain shift problem of EEG signals through adversarial training. More importantly, the model still has excellent classification ability for the migrated data, which can significantly improve the cross-domain classification performance.
[0036] 2. EEG signal classification technology plays an important role in EEG analysis, BCI and neuroscience technology. For the application of BCI, it is crucial to extract effective information from the signal and remove noise. The present invention can extract robustness information from the signal and remove noise, so it has great potential in realizing online brain state reasoning. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1Schematic diagram of the network structure of the method of the present invention.
[0038] Figure 2 Schematic diagram of the general feature extractor and domain-specific feature extractor proposed in the present invention. DETAILED DESCRIPTION
[0039] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0040] like Figure 1 As shown in the figure, an EEG signal analysis method based on smooth conditional domain adversarial training, where modules of the same color represent shared weights between the source domain and the target domain, includes the following steps:
[0041] Step 1: Filter the EEG signal and obtain domain-general features and domain-specific features;
[0042] like Figure 1 In module a and Figure 2 As shown, Figure 2 The blue borders in the middle represent the composition of the general feature extractor and the purple borders represent the composition of the domain-specific feature extractor. s and x t ) are used to filter the low frequency band (8-16Hz) and high frequency band (16-40Hz) respectively. The data of the two bands are then added together through the interactive frequency convolution F (i.e., 1-D point-wise spatial convolution and 1-D depth-wise temporal convolution) with shared weights, and then passed through the temporal pooling layer to obtain domain-general features. Then the data of the source domain and the target domain are respectively passed through the channel attention module A without sharing weights to obtain domain-specific features (f s and f t ).
[0043] Step 2: Generate pseudo labels and selectively remove outliers;
[0044] like Figure 1 As shown in module c, a pseudo-label module and a selective outlier removal module are designed. t After passing through two classifiers C1 and C2, two classification probabilities are obtained. If the highest category probability in the two probabilities is greater than 0.8 and the corresponding categories belong to the same category, then the category is determined as the pseudo label on the target domain. If the proportion of the generated pseudo label is greater than 50% of the original target domain sample proportion, it is used to calculate the classification loss on the target domain in the next iteration. Otherwise, the density-based spatial clustering algorithm is used for the original target domain samples to remove outliers in the signal and improve the signal quality.
[0045] The source domain features are also passed through two classifiers to obtain two classification probabilities. The classification loss is obtained by calculating the cross entropy between the classification probabilities and their corresponding labels. and The calculation formula is as follows:
[0046]
[0047]
[0048] Among them, x s and and x t is the EEG signal of the source domain and the target domain, p(y|x s ) and p(y|x t ) is a given x s and x t The classification probability, P s and P t is the distribution of source and target domains, is the sum of all samples with label k in the source domain, It is the sum of all samples with pseudo label k in the target domain.
[0049] The classifier consists of a multi-layer perceptron with activation functions, and the data from the source and target domains share weights.
[0050] Step 3: Calculate the generated adversarial loss;
[0051] like Figure 1 As shown in module b in the figure, the conditional generation adversarial loss is calculated through this module. s and f t The average of the classification probabilities obtained after the two classifiers is taken as the category prediction probability g s and g t Then, the joint distribution h of features and probabilities is obtained through multilinear projection operation s and h t The calculation formula is as follows:
[0052]
[0053]
[0054] Where T is the multilinear mapping operation, f s and f t are domain-specific features of the source and target domains, g s and g t is the category prediction probability of the source domain and the target domain, h s and h t It is the joint distribution of features and probabilities of the source domain and the target domain.
[0055] h s and h t It is fed into the domain discriminator D composed of a multi-layer perceptron with an activation function to calculate the adversarial loss The specific formula is as follows:
[0056]
[0057] Among them, h s and h t is the joint distribution of features and probabilities of the source and target domains, P s and P t is the distribution of source and target domains.
[0058] Next, for f s and f t Perform singular value decomposition to obtain and and use and Calculate the batch spectral penalty (BSP). The calculation formula is as follows:
[0059]
[0060]
[0061]
[0062] Among them, U s is an orthogonal matrix, each column vector of which is The characteristic vector of U t is an orthogonal matrix, each column vector of which is The characteristic vector of s is an orthogonal matrix, each column vector of which is The characteristic vector of t is an orthogonal matrix, each column vector of which is The eigenvector of The eigenvalue square root of The eigenvalue square root of s,i and σ s,j is the i-th largest eigenvalue of ∑s and ∑t.
[0063] Step 4: Smooth domain adversarial training;
[0064] To improve the generalization ability of the model in the target domain, Sharp Aware Minimization (SAM) is used to optimize the objective function. However, smooth optimization of adversarial loss will lead to suboptimal results, so we only smoothly optimize the task loss (except the adversarial loss) to achieve effective generalization in the target domain. The calculation formula of task loss is as follows:
[0065]
[0066] Here, θ refers to the parameters of F, A, C1 and C2, and ρ ≥ 0 is a hyperparameter that defines the maximum norm ∈.
[0067] Finally, the model is trained using min-max optimization so that the model can classify test data more effectively. The calculation formula is as follows:
[0068]
[0069] Among them, θ refers to the parameters of F, A, C1 and C2, Φ refers to the parameter of D, λ1=1, λ2=2e-6, λ3=1.
[0070] Example:
[0071] 1. Filter the EEG signal and obtain domain-general features and domain-specific features;
[0072] like Figure 1 In module a and Figure 2 As shown, Figure 2 The blue borders in the middle represent the composition of the general feature extractor and the purple borders represent the composition of the domain-specific feature extractor. s and x t ) are used to filter the low frequency band (8-16Hz) and high frequency band (16-40Hz) respectively. The data of the two bands are then added together through the interactive frequency convolution F (i.e., 1-D point-wise spatial convolution and 1-D depth-wise temporal convolution) with shared weights, and then passed through the temporal pooling layer to obtain domain-general features. Then the data of the source domain and the target domain are respectively passed through the channel attention module A without sharing weights to obtain domain-specific features (f s and f t ).
[0073] 2. Generate pseudo labels and selectively remove outliers;
[0074] like Figure 1 As shown in module c, a pseudo-label module and a selective outlier removal module are designed.t After passing through two classifiers C1 and C2, two classification probabilities are obtained. If the highest category probability in the two probabilities is greater than 0.8 and the corresponding categories belong to the same category, then the category is determined as the pseudo label on the target domain. If the proportion of the generated pseudo label is greater than 50% of the original target domain sample proportion, it is used to calculate the classification loss on the target domain in the next iteration. Otherwise, the density-based spatial clustering algorithm is used for the original target domain samples to remove outliers in the signal and improve the signal quality.
[0075] The source domain features are also passed through two classifiers to obtain two classification probabilities. The classification loss is obtained by calculating the cross entropy between the classification probabilities and their corresponding labels. and The calculation formula is as follows:
[0076]
[0077]
[0078] Among them, x s and and x t is the EEG signal of the source domain and the target domain, p(y|x s ) and p(y|x t ) is a given x s and x t The classification probability, P s and P t is the distribution of source and target domains, is the sum of all samples with label k in the source domain, It is the sum of all samples with pseudo label k in the target domain.
[0079] The classifier consists of a multi-layer perceptron with activation functions, and the data from the source and target domains share weights.
[0080] 3. Calculate the generated adversarial loss;
[0081] like Figure 1 As shown in module b in the figure, the conditional generation adversarial loss is calculated through this module. s and f t The average of the classification probabilities obtained after the two classifiers is taken as the category prediction probability g s and g t Then, the joint distribution h of features and probabilities is obtained through multilinear projection operation s and h t The calculation formula is as follows:
[0082]
[0083]
[0084] Where T is the multilinear mapping operation, F s and f t are domain-specific features of the source and target domains, g s and g t is the category prediction probability of the source domain and the target domain, g s and h t It is the joint distribution of features and probabilities of the source domain and the target domain.
[0085] h s and h t It is fed into the domain discriminator D composed of a multi-layer perceptron with an activation function to calculate the adversarial loss The specific formula is as follows:
[0086]
[0087] Among them, h s and h t is the joint distribution of features and probabilities of the source and target domains, P s and P t is the distribution of source and target domains.
[0088] Next, for f s and f t Perform singular value decomposition to obtain and and use and Calculate the batch spectral penalty (BSP). The calculation formula is as follows:
[0089]
[0090]
[0091]
[0092] Among them, U s is an orthogonal matrix, each column vector of which is The characteristic vector of U t is an orthogonal matrix, each column vector of which is The characteristic vector of s is an orthogonal matrix, each column vector of which is The characteristic vector of t is an orthogonal matrix, each column vector of which is The eigenvector of The eigenvalue square root of The square root of the eigenvalue of s,i and σ s,j is the i-th largest eigenvalue of ∑s and ∑t.
[0093] 4. Smooth domain adversarial training;
[0094] To improve the generalization ability of the model in the target domain, Sharp Aware Minimization (SAM) is used to optimize the objective function. However, smooth optimization of adversarial loss will lead to suboptimal results, so we only smoothly optimize the task loss (except the adversarial loss) to achieve effective generalization in the target domain. The calculation formula of task loss is as follows:
[0095]
[0096] where θ is a parameter of F, A, C1, and C2, and ρ ≥ 0 is a hyperparameter defining the maximum norm ∈.
[0097] Finally, the model is trained using min-max optimization so that the model can classify test data more effectively. The calculation formula is as follows:
[0098]
[0099] Among them, Φ refers to the parameter of D, λ1=1, λ2=2e-6, λ3=1.
[0100] 4. Testing phase
[0101] The dataset is trained through steps 1, 2, 3 and 4 to obtain the final trained model. The model is then used to classify the test data, and the category corresponding to the maximum probability value output by the classifier is the final classification result. Two public EEG datasets are used to evaluate the performance of the model: BCI Competition IV 2a (four-classification cross-session task) and BCI Competition IV 2b (two-classification cross-session task). The model achieved excellent classification results (average accuracy of 80.34%) on each individual in the 2a dataset, and also achieved excellent classification results (average accuracy of 85.49%) on the 2a dataset. The test performance of various classification methods was statistically analyzed. Compared with the most advanced traditional machine learning models, deep learning models and transfer learning models, the present invention is superior to these advanced models, proving the effectiveness of the method of the present invention. At the same time, ablation experiments and visualization experiments were also performed to prove that the smooth conditional domain adversarial training method can improve the classification ability of the model in the target domain while migrating effective features.
Claims
1. A method for EEG signal analysis based on adversarial training in smooth conditional domain, It is characterized in that The steps include: Step 1: Filter the EEG signal to obtain domain-general features and domain-specific features; The EEG signals x of the source domain and the target domain s and x t The low-frequency band and high-frequency band are filtered separately; the data of the two bands are then added after the interactive frequency convolution F with shared weights, and then the domain-general features are obtained through the temporal pooling layer; then the data of the source domain and the target domain are respectively passed through the channel attention module A without shared weights to obtain the domain-specific features f s and f t ; Step 2: Generate pseudo labels and selectively remove outliers; The target domain feature f t After two classifiers C 1 and C 2 After that, two classification probabilities are obtained. If the highest category probability in the two probabilities is greater than 0.8 and the corresponding categories belong to the same category, then the category is determined as the pseudo label on the target domain; if the proportion of the generated pseudo label is greater than 50% of the proportion of the original target domain samples, it is used to calculate the classification loss on the target domain in the next iteration; otherwise, the density-based spatial clustering algorithm is used for the original target domain samples to remove outliers in the signal and improve the signal quality; The source domain features are also passed through two classifiers to obtain two classification probabilities. The classification loss is obtained by calculating the cross entropy between the classification probabilities and their corresponding labels. and The calculation formula is as follows: Among them, x s and and x t is the EEG signal of the source domain and the target domain, p(y|x s ) and p(y|x t ) is a given x s and x t The classification probability, P s and P t is the distribution of source and target domains, is the sum of all samples with label k in the source domain, It is the sum of all samples with pseudo-label k in the target domain; The classifier is composed of a multi-layer perceptron with an activation function, and the data of the source domain and the target domain share weights; Step 3: Calculate the generated adversarial loss; f s and f t The average of the classification probabilities obtained after the two classifiers is taken as the category prediction probability g s and g t ; Then, the joint distribution h of features and probabilities is obtained through multilinear projection operations s and h t , the calculation formula is as follows: Where T is the multilinear mapping operation, f s and f t are domain-specific features of the source and target domains, g s and g t is the category prediction probability of the source domain and the target domain, h s and h t It is the joint distribution of features and probabilities of the source domain and the target domain; h s and h t It is fed into the domain discriminator D composed of a multi-layer perceptron with an activation function to calculate the adversarial loss The specific formula is as follows: Next, for f s and f t Perform singular value decomposition to obtain and and use and Calculate the batch spectrum penalty loss BSP, the calculation formula is as follows: Among them, U s is an orthogonal matrix, each column vector of which is The characteristic vector of U t is an orthogonal matrix, each column vector of which is The characteristic vector of s is an orthogonal matrix, each column vector of which is The characteristic vector of t is an orthogonal matrix, each column vector of which is The eigenvector of The eigenvalue square root of The square root of the eigenvalue of s,i and σ s,j is the i-th largest eigenvalue of ∑s and ∑t; Step 4: Smooth domain adversarial training; The objective function is optimized using sharp perception minimization SAM, and the calculation formula of the task loss is as follows: Where θ is F, A, C 1 and C 2 Parameters of , ρ ≥ 0 are hyperparameters that define the maximum norm ∈; Finally, the model is trained using min-max optimization so that the model can classify test data more effectively. The calculation formula is as follows: Here, Φ is the parameter of D.
2. According to claim 1, a method for analyzing EEG signals based on smooth conditional domain adversarial training, It is characterized in that The low frequency band refers to 8-16 Hz, and the high frequency band refers to 16-40 Hz.
3. According to claim 1, a method for analyzing EEG signals based on smooth conditional domain adversarial training, It is characterized in that The shared weight interactive frequency convolution F includes 1-D point-wise spatial convolution and 1-D depth-wise temporal convolution.
