Multi-scale motor imagery cross-subject identification method combining global and subdomain adaptation
Through a multi-scale method that combines full-domain and sub-domain adaptation, multi-scale convolutional layers and classifiers are used to align the edge and conditional distributions of EEG signals, solving the problems of distribution differences and fine-grained information loss in motor imagery recognition, and significantly improving recognition. Accuracy and usefulness of BCI systems.
Patent Information
- Application Number
- CN202410702331.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-02
- Publication Date
- 2024-09-27
AI Technical Summary
Existing technology is difficult to effectively handle the non-stationarity and distribution differences of EEG signals in motor imagery recognition, resulting in poor classification performance. In particular, it fails to fully consider the relationship between subdomains, resulting in the loss of fine-grained information and classification accuracy. affected.
A multi-scale motor imagery cross-subject recognition method that combines global and sub-domain adaptation is used to capture spatiotemporal structure information through multi-scale convolutional layers, and combine global domain and sub-domain domain classifiers to align edges and conditional distributions, significantly improving the ability of domain adaptation networks. Enhance the accuracy of EEG signal recognition.
It significantly improves the accuracy of motor imagery recognition, reduces the impact of distribution differences between subjects on classification, enhances the practicality of the BCI system, and improves the generalization of domain transfer by adaptively adjusting the weight of the loss function.
Smart Images

Figure CN118709069A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electroencephalogram signal recognition, and in particular to a multi-scale motor imagery cross-subject recognition method and system combining global and sub-domain adaptation. Background Art
[0002] EEG signals have been widely used in various motor imagery (MI) applications, including robotic wheelchairs, BCI spellers for people with disabilities, robotic arms, and neurorehabilitation, due to their non-invasiveness and high temporal resolution. Therefore, it is crucial to develop an effective scheme for decoding EEG-based motor imagery signals.
[0003] Traditional two-stage machine learning algorithms rely heavily on expert knowledge, which results in insufficient information utilization and suboptimal classification performance. Although neural network methods have achieved good performance, they usually assume that the training and test data have the same or similar distributions. However, EEG signals are non-stationary and are easily affected by human psychological state and equipment noise, resulting in inconsistent data distribution.
[0004] Domain adaptation is an important branch of transfer learning to solve distribution differences and is widely used in computer vision, natural language processing and other fields. For motor imagery, deep representation-based domain adaptation (DRDA) introduces an additional domain discriminator to confuse the features between the source and target domains, thereby facilitating the extraction of domain-invariant features. At present, the domain adaptation of the existing technology focuses on the method based on global feature alignment. For example, Zhong proposed a domain adaptation framework based on correlation alignment to calculate the second-order statistics of feature distribution to reduce the difference between the source and target domains. Although the above-mentioned method based on global feature alignment can reduce the distribution difference, it only considers the global domain shift, that is, aligning the global source distribution and the target distribution, without considering the relationship between the two subdomains in the two domains (the subdomains contain samples in the same class). The macro-correlation features and micro-category features of the source and target domains are not considered in detail, which may cause confusion of all data and identification structures in the source and target domains, and thus lose the fine-grained information of each category. Summary of the invention
[0005] In view of the problems existing in the above-mentioned prior art, the present invention provides a multi-scale motor imagery cross-subject recognition method and system with combined global and sub-domain adaptation, which aims to quantify the global and local distribution differences of EEG signals between subjects of motor imagery recognition. It combines multi-scale convolutional layers to capture spatiotemporal structural information, global domain classifiers to reduce cross-domain marginal distribution offsets, and sub-domain classifiers to align the conditional distribution offsets of related sub-domains in the source domain and the target domain. By capturing fine-grained information to expand the domain adaptation network capabilities, the accuracy of motor imagery recognition technology can be significantly improved.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] In a first aspect, the present invention provides a multi-scale motor imagery cross-subject recognition method combining global and sub-domain adaptation, comprising:
[0008] Obtain EEG signals of multiple subjects, divide them into source domain and target domain data, and perform data preprocessing;
[0009] A multi-scale feature extraction unit is used to obtain the spatiotemporal features of the source domain and target domain data respectively;
[0010] Introduce a global domain classifier to train domain discrimination and align the marginal distribution between the source domain and the target domain;
[0011] Introduce subdomain classifier to learn local domain transfer and align the conditional distribution between the source domain and the target domain;
[0012] Training a deep classifier using the spatiotemporal features after the edge distribution and the conditional distribution are aligned;
[0013] The total loss function value of the global domain classifier, the subdomain classifier, and the deep classifier is calculated, and the total loss function value is converged through iterative training to obtain a motor imagery cross-subject recognition model.
[0014] Furthermore, the data preprocessing includes:
[0015] Use a sixth-order Chebyshev bandpass filter to perform bandpass filtering on the EEG signal in the range of [4,40] Hz to obtain motor imagery related signals and eliminate high-frequency and low-frequency noise interference;
[0016] Euclidean alignment is used to make the covariance matrix distributions of EEG signals of different subjects similar, and the distribution of the source domain and the target domain is preliminarily optimized.
[0017] Furthermore, the multi-scale feature extraction unit includes a multi-scale feature extractor, a batch normalization layer, an activation layer, a pooling layer, and a Dropout layer;
[0018] The multi-scale feature extractor includes three groups of parallel spatiotemporal convolution modules, each group of spatiotemporal convolution modules includes a one-dimensional time convolution block and a one-dimensional space convolution block;
[0019] The one-dimensional temporal convolution blocks respectively use convolution kernels of sizes (1, 16), (1, 24) and (1, 36), and the step sizes are all (1, 1), to capture the dynamic changes of EEG signals in the temporal dimension;
[0020] The one-dimensional spatial convolution blocks are all convolution kernels of size (C, 1) and step size (1, 1), where C represents the number of electrode channels and is used to capture the distribution law of EEG signals in the spatial dimension.
[0021] Further, the global domain classifier includes a domain discriminator and the multi-scale feature extractor, and the discriminator is used to distinguish the domain from which the spatiotemporal features come;
[0022] The adversarial training is constructed based on the minimax game of the multi-scale feature extractor and the discriminator, and is used to align the marginal distribution between the source domain and the target domain, specifically including:
[0023] The multi-scale feature extractor maps spatiotemporal features from the source domain and the target domain to a latent common space;
[0024] Obtaining a marginal distribution distance between spatiotemporal features of a source domain and a target domain based on the domain discriminator;
[0025] The domain discriminator is trained by maximizing the marginal distribution distance, so that the domain discriminator can distinguish the domain sources of the input spatiotemporal features, and the optimal parameters of the domain discriminator are obtained;
[0026] Substituting the optimal parameters of the domain discriminator into the global domain classifier, training the multi-scale feature extractor by minimizing the marginal distribution distance, so that the multi-scale feature extractor can learn the common features of the source domain and the target domain, and obtaining the optimal parameters of the multi-scale feature extractor;
[0027] Based on the optimal parameters of the domain discriminator and the optimal parameters of the multi-scale feature extractor, iterative adversarial learning is performed to align the marginal distribution between the source domain and the target domain.
[0028] Furthermore, the subdomain classifier adopts a deep subdomain adaptive network; the method further includes a shallow classifier after the multi-scale feature extraction, which is used to train the target domain data according to the source domain data and the corresponding labels to obtain pseudo labels for the target domain data;
[0029] The method of introducing a subdomain domain classifier to learn local domain migration and aligning the conditional distribution between the source domain and the target domain includes:
[0030] Based on the source domain label and the target domain pseudo label obtained by the shallow classifier, the source domain and the target domain are divided into multiple subdomains containing data of the same category;
[0031] In each subdomain, the conditional distributions of source and target domain data of the same category are aligned by minimizing the mapping between the mean difference between the source and target domain data.
[0032] Furthermore, the training of a deep classifier using the spatiotemporal features aligned with the marginal distribution and the conditional distribution includes:
[0033] The spatiotemporal features after the alignment of the marginal distribution and the conditional distribution are used as input, and the three fully connected layers are used as deep classifiers;
[0034] The input of each spatiotemporal feature corresponds to an M-dimensional vector outputted by the Softmax layer, which is used to represent the probability that the spatiotemporal feature belongs to different categories; M is the number of categories of motor imagery EEG signals.
[0035] Furthermore, the total loss function value includes the adversarial loss function value of the global domain classifier, the category difference loss of the subdomain classifier, and the prediction loss of the deep classifier. Each loss has a corresponding weight assignment, and the motor imagery cross-subject recognition model is obtained by minimizing the total loss function value.
[0036] Furthermore, before obtaining the EEG signal of the subject, the method further includes:
[0037] Obtain identity information, physiological information, and test information of multiple subjects, and extract individual difference characteristics of each subject;
[0038] Analyzing the similarity of the source domain data and the target domain data based on the individual difference features in the source domain and the target domain, wherein the larger the individual difference features are, the smaller the similarity is;
[0039] The weight distribution corresponding to each loss is adjusted based on the similarity between the source domain and the target domain data.
[0040] Furthermore, the weight allocation corresponding to each loss item is adjusted based on the similarity between the source domain and the target domain data, including:
[0041] (1) When the similarity between the source domain and the target domain data is greater than or equal to a preset threshold, the weight of the adversarial loss function value of the global domain classifier is constrained to be greater than the weight of the category difference loss of the subdomain classifier; and the weight of the prediction loss of the deep classifier is optimized:
[0042] Use source domain data and corresponding labels to train a motor imagery EEG signal classifier;
[0043] Inputting the target domain data with the true label into the motor imagery EEG signal classifier to predict the category of the target domain data;
[0044] Obtaining the average predicted probability distribution of all target domain data with real labels under the motor imagery EEG signal classifier based on the comparison between the predicted categories and the real labels;
[0045] Adjusting the weight of the prediction loss of the deep classifier based on the average prediction probability distribution;
[0046] (2) When the similarity between the source domain and the target domain data is less than a preset threshold, the weight of the adversarial loss function value of the global domain classifier is constrained to be less than the weight of the category difference loss of the subdomain classifier; and the weight of the category difference loss of the subdomain classifier is optimized:
[0047] Divide the source domain and the target domain into multiple subdomains containing data of the same category;
[0048] In each subdomain, the conditional distributions of source and target domain data of the same category are aligned by minimizing the mapping between the mean difference between the source and target domain data.
[0049] In the subdomain classifier, the identification of source domain and target domain data in each motor imagery category is divided into a target subclass, each of the target subclasses is iteratively trained, and the corresponding subclass loss function value is calculated;
[0050] Determine the classification accuracy deviation of each of the target subclasses according to the subclass loss function value of each of the target subclasses in multiple iterations;
[0051] A subclass loss function value of each of the target subclasses is weighted and adjusted based on the classification accuracy deviation, and the subclass loss function values of all the target subclasses constitute the category difference loss of the subdomain classifier.
[0052] In a second aspect, the present invention provides a multi-scale motor imagery cross-subject recognition system combining global and sub-domain adaptation, comprising:
[0053] A data acquisition module is used to acquire EEG signals of multiple subjects, divide them into source domain and target domain data, and perform data preprocessing;
[0054] A feature extraction module, used to respectively obtain the spatiotemporal features of source domain and target domain data using a multi-scale feature extraction unit;
[0055] The global alignment module is used to introduce a global domain classifier to train domain discrimination and align the marginal distribution between the source domain and the target domain;
[0056] The local alignment module is used to introduce subdomain classifiers to learn local domain transfer and align the conditional distribution between the source domain and the target domain;
[0057] A deep classification module, used for training a deep classifier using the spatiotemporal features after the edge distribution and the conditional distribution are aligned;
[0058] The iterative training module is used to calculate the total loss function value of the global domain classifier, the subdomain classifier, and the deep classifier, and through iterative training, the total loss function value is converged to obtain a motor imagery cross-subject recognition model.
[0059] The present invention provides a multi-scale motor imagery cross-subject recognition method and system combining global and sub-domain adaptation, which has the following beneficial effects:
[0060] 1. The present invention combines multi-scale convolutional layers to capture spatiotemporal structural information, a global domain classifier to reduce cross-domain marginal distribution shifts, and a subdomain classifier to align the distributions of related subdomains within the same category in the source and target domains. The present invention has significant potential to promote EEG classification tasks and improve the practicality of BCI systems.
[0061] 2. Based on global alignment and local alignment, the present invention quantifies the individual differences in EEG signals of different subjects, reducing the impact of this difference on the accuracy of classification and prediction tasks. Considering that the global distribution and local distribution between domains usually contribute differently to domain adaptation, if the two domains are very different, the local distribution is more important; when the distributions of the two domains are close, more attention should be paid to the global distribution. The present invention adaptively adjusts the weight of the total loss function value, significantly improving the generalization of domain migration. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 It is a flowchart of a multi-scale motion imagery cross-subject recognition method combining global and sub-domain adaptation according to the present invention;
[0063] Figure 2 Schematic diagram of the overall model of the multi-scale motion imagery cross-subject recognition method combining global and sub-domain adaptation of the present invention;
[0064] Figure 3 It is a structural block diagram of a multi-scale motion imagery cross-subject recognition system combining global and sub-domain adaptation according to the present invention. DETAILED DESCRIPTION
[0065] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0066] To facilitate understanding of this embodiment, a multi-scale motion imagery cross-subject recognition method combining global and sub-domain adaptation disclosed in an embodiment of the present invention is first introduced in detail.
[0067] The embodiment of the present invention provides a multi-scale motor imagery cross-subject recognition method combining global and sub-domain adaptation, such as Figure 1 Flowchart and Figure 2 As shown in the model diagram, it includes:
[0068] S1, obtain EEG signals of multiple subjects, divide them into source domain and target domain data and perform data preprocessing.
[0069] It should be noted that EEG signals are easily affected by human psychological state and equipment noise, which makes the data distribution of the training set and the test set inconsistent. It can be simply understood that the source domain D s is the training set, the target domain D t is the test set. In this embodiment, the classification task of motor imagery EEG signals is four categories, including imagining the movement of the left hand, right hand, foot and tongue. For a subject, we use the data of the current subject as the target domain and the data from other subjects as the source domain. Represents N in the source domain s EEG experiments, including is the ith trial with C electrode channels and T time samples, y∈Z M are the corresponding M category labels. Similarly, Represents N in the source domain t EEG trials represent trials in the target domain. In general, the source and target domains have similar but different distributions, and our goal is to reduce the distribution differences between subjects and utilize useful information from the source domain to improve the decoding performance of the target domain.
[0070] In one embodiment, the preprocessing specifically includes:
[0071] S11: A sixth-order Chebyshev bandpass filter was used to preserve the relevant rhythms of the motor sensory cortex. The original EEG signal was bandpass filtered in the [4,40] Hz range to eliminate high-frequency and low-frequency noise interference.
[0072] S12: Use Euclidean alignment to preliminarily align the distribution of the source domain and the target domain. After alignment, the mean of the covariance matrix of each subject's EEG signal is equal to the unit matrix, making the distribution of the covariance matrix of EEG signals of different subjects more similar.
[0073] Specifically, by establishing a reference matrix To calculate the arithmetic mean of the covariance matrix, assuming there are n trials in a domain. The calculation formula is as follows:
[0074] Euclidean alignment is performed by:
[0075] S2, a multi-scale feature extraction unit is used to obtain the spatiotemporal features of the source domain and target domain data respectively;
[0076] See also Figure 2 , the multi-scale feature extraction unit includes a multi-scale feature extractor, a batch normalization layer, an activation layer, a pooling layer, and a Dropout layer;
[0077] The multi-scale feature extractor includes three groups of parallel spatiotemporal convolution modules, each group of spatiotemporal convolution modules includes a one-dimensional time convolution block and a one-dimensional space convolution block;
[0078] The one-dimensional temporal convolution blocks respectively use convolution kernels of sizes (1, 16), (1, 24) and (1, 36), and the step sizes are all (1, 1);
[0079] The one-dimensional spatial convolution blocks are all convolution kernels with a size of (C, 1) and a step size of (1, 1), where C represents the number of electrode channels.
[0080] The preprocessed EEG signal should first be subjected to temporal convolution to capture the dynamic changes of the EEG signal in the time dimension, so as to extract more and richer features. Secondly, spatial convolution is used to capture the distribution law of the EEG signal in the spatial dimension.
[0081] The batch normalization layer uses batch normalization to improve the generalization ability of the model, and the activation layer uses the nonlinear activation function ELU (exponential linear unit) to improve training efficiency. The pooling layer uses two-dimensional average pooling with a kernel size of (1, 70) and a step size of (1, 15) for dimensionality reduction. This pooling layer smoothes the temporal features, effectively prevents overfitting, and reduces computational complexity. The Dropout layer is introduced to connect the output features of the three branches and pass them to the next module through the Dropout layer with a probability of 0.5 to improve the sparsity of data representation and reduce redundancy.
[0082] S3, introduces a global domain classifier to train domain discrimination and aligns the marginal distribution between the source domain and the target domain;
[0083] The global domain classifier includes a domain discriminator and the multi-scale feature extractor, wherein the discriminator is used to distinguish the domain from which the spatiotemporal features come;
[0084] The adversarial training is constructed based on the minimax game of the multi-scale feature extractor and the discriminator, and is used to align the marginal distribution between the source domain and the target domain, specifically including:
[0085] The multi-scale feature extractor maps spatiotemporal features from the source domain and the target domain to a latent common space;
[0086] S31, obtaining the marginal distribution distance between the spatiotemporal features of the source domain and the target domain based on the domain identifier;
[0087] S32, training the domain discriminator by maximizing the marginal distribution distance, so that the domain discriminator can distinguish the domain source of the input spatiotemporal features, and obtaining the optimal parameters of the domain discriminator;
[0088] S33, substituting the optimal parameters of the domain discriminator into the global domain classifier, and training the multi-scale feature extractor by minimizing the marginal distribution distance, so that the multi-scale feature extractor can learn the common features of the source domain and the target domain, and obtaining the optimal parameters of the multi-scale feature extractor;
[0089] S34, aligning the marginal distribution between the source domain and the target domain based on the optimal parameters of the domain discriminator and the optimal parameters of the multi-scale feature extractor through iterative adversarial learning.
[0090] Taking the spatiotemporal features extracted in step S2 as input, the discriminator aims to distinguish which domain the features come from; at the same time, the feature extractor maps the EEG inputs from the two domains to a potential common space. Finally, the feature extractor is able to deceive the domain discriminator, making it impossible for the domain discriminator to distinguish the source of the extracted features. In this way, the marginal distribution between the source features and the target features is gradually aligned until the edges are completely confused. Then the target domain can also get good classification results on the category classifier, achieving domain migration.
[0091] In order to reduce the distribution difference, a minimax game is played between the feature extractor and the domain discriminator. The feature extractor reduces the feature distribution gap between the source domain and the target domain based on the feedback of the similarity of the domain discriminator, and finally deceives the inter-domain similarity with similar inter-domain feature distribution. Therefore, the adversarial loss used to update the feature extractor is formulated as:
[0092]
[0093] Where a = 1, L adv represents the adversarial loss function value of the global domain classifier, E represents the expectation, and D(F(s)) represents the spatiotemporal features extracted from the source domain.
[0094] With this adversarial loss, it will lead to a balanced state where the source domain data has a similar feature distribution to the target domain, and the latent features finally generated by the feature extractor are indistinguishable from any domain. S4, introduces a subdomain classifier to learn local domain transfer and align the conditional distribution between the source domain and the target domain;
[0095] The subdomain classifier adopts a deep subdomain adaptive network; the method further includes a shallow classifier after the multi-scale feature extraction, which is used to train the target domain data according to the source domain data and the corresponding labels to obtain the pseudo labels of the target domain data;
[0096] The method of introducing a subdomain domain classifier to learn local domain migration and aligning the conditional distribution between the source domain and the target domain includes:
[0097] S41, based on the source domain label and the target domain pseudo label obtained by the shallow classifier, dividing the source domain and the target domain into multiple subdomains containing data of the same category;
[0098] S42, in each subdomain, the conditional distribution of the source domain and target domain data of the same category are aligned by minimizing the mapping of the mean difference between the source domain and the target domain data.
[0099] It should be noted that the deep subdomain adaptation network used as a subdomain classifier can align the distribution of related subdomains by integrating deep feature learning and feature adaptation in an end-to-end deep learning model. Based on the true labels of the source domain and the pseudo labels of the target domain obtained by the shallow classifier, the source domain and the target domain are divided into multiple subdomains containing similar samples, and by aligning related subdomains, the fine-grained information of each category is captured. This information can be trained in an end-to-end framework, thereby expanding the feature representation capability of the deep adaptation network.
[0100] In order to align the distribution of related subdomains in the same category in the source domain and the target domain, this embodiment adopts LMMD loss as the subdomain adaptation loss:
[0101]
[0102] Where L d is the category difference loss of the subdomain classifier, H is the reproducing kernel Hilbert space (RKHS) endowed with Gaussian kernel function (RBF); and Respectively represent the x of class c i and x j The weight of It represents the distribution of data. Other symbols are the same as mentioned above and will not be repeated here.
[0103] This embodiment introduces a global domain classifier and a subdomain classifier to reduce the marginal distribution offset between the source domain and the target domain while making the fine-grained features of the source domain and the target domain as similar as possible.
[0104] S5, training a deep classifier using the spatiotemporal features after the edge distribution and the conditional distribution are aligned;
[0105] Specifically, the spatiotemporal features after the edge distribution and the conditional distribution are aligned are used as input, and three fully connected layers are used as deep classifiers;
[0106] The input of each spatiotemporal feature corresponds to an M-dimensional vector outputted by the Softmax layer, which is used to represent the probability that the spatiotemporal feature belongs to different categories; M is the number of categories of motor imagery EEG signals.
[0107] In one embodiment, the model can be optimized using a cross entropy loss, which minimizes the model's predicted value and the corresponding true value y:
[0108]
[0109] S6, calculating the total loss function value of the global domain classifier, the subdomain classifier, and the deep classifier, and obtaining a motor imagery cross-subject recognition model by iterative training so that the total loss function value converges. The total loss function value includes the adversarial loss function value of the global domain classifier, the category difference loss of the subdomain classifier, and the prediction loss of the deep classifier:
[0110] minL=ω cls L cls +ω adv L adv +ω d L d
[0111] Among them, L represents the total loss function value, L cls is the prediction loss of the deep classifier, L adv is the adversarial loss function value of the global domain classifier, L d is the category difference loss of the subdomain classifier; ω cls ,ω adv ,ω d are the weights of the corresponding loss functions respectively.
[0112] It should be understood that the global distribution and local distribution between domains usually contribute differently to domain adaptation. For source domains and target domains in different situations, the migration capabilities between the two are different. Therefore, in this embodiment, the multi-scenario adaptation capability is achieved by considering the weight adaptive adjustment of the loss function.
[0113] Specifically, before acquiring the EEG signal of the subject, the method of this embodiment further includes:
[0114] Obtain identity information, physiological information, and test information of multiple subjects, and extract individual difference characteristics of each subject;
[0115] It should be noted that although EEG has the advantages of being non-invasive and having high time domain resolution, there are significant differences in the EEG signals of different individuals, which are specifically reflected in the differences in each person's EEG signals, differences in experimental factors, etc., which leads to limited accuracy of classification and prediction tasks.
[0116] The identity information may include the subject's age, handedness, gender, education level, etc.; the physiological information may include physiological, psychological or neurological diseases, regular intake of substances that affect the central nervous system such as alcohol, etc.; the test information may include collection equipment, sensor settings, operation time, etc.
[0117] Analyzing the similarity of the source domain data and the target domain data based on the individual difference features in the source domain and the target domain, wherein the larger the individual difference features are, the smaller the similarity is;
[0118] The weight distribution corresponding to each loss is adjusted based on the similarity between the source domain and the target domain data.
[0119] Since the recognition of the target domain of unknown labels is affected by the source domain, the more similar the source and target domain data are, the smaller the difference between the two data is, and the migration between different domains can be easily achieved. However, when the source and target domain data are very different, the effect of in-depth regional migration will be unsatisfactory.
[0120] Furthermore, the weight allocation corresponding to each loss item is adjusted based on the similarity between the source domain and the target domain data, including:
[0121] (1) When the similarity between the source domain and the target domain data is greater than or equal to a preset threshold, the weight of the adversarial loss function value of the global domain classifier is constrained to be greater than the weight of the category difference loss of the subdomain classifier; and the weight of the prediction loss of the deep classifier is optimized:
[0122] It should be noted that for the source domain and the target domain with large similarity, the distributions of the two are close. At this time, the classifier extracted from the source domain can be well transferred to the target domain, and the overall recognition effect mainly depends on the prediction deviation between the predicted value and the actual value. For small distribution differences that cannot be ignored, more attention should be paid to the global distribution, that is, the weight assigned to the global domain classifier is greater than that of the subdomain classifier.
[0123] The motor imagery EEG signal classifier is trained using the source domain data and the corresponding labels; this can be implemented by referring to the “shallow classifier” in the aforementioned step S4.
[0124] Inputting the target domain data with the true label into the motor imagery EEG signal classifier to predict the category of the target domain data;
[0125] It should be noted that, in order to achieve more accurate recognition, when performing motor imagery recognition of EEG signals, the true labels of some data in the target domain can be obtained through manual annotation as an aid and verification for the recognition and classification task.
[0126] Based on the comparison between the predicted category and the true label, the average predicted probability distribution of all target domain data with true labels under the motor imagery EEG signal classifier is obtained; that is, the probability that each target domain data with true labels is correctly classified under the source domain classifier.
[0127] Adjusting the weight of the prediction loss of the deep classifier based on the average prediction probability distribution;
[0128] When there are multiple source domains in some embodiments, the weight of each source domain can also be determined based on the average predicted probability distribution of the target domain data with true labels under the source domain classifier and individual differences, that is, data that is more similar to the target domain is found in the source domain to identify the motor imagery category of the target domain.
[0129] (2) When the similarity between the source domain and the target domain data is less than a preset threshold, the weight of the adversarial loss function value of the global domain classifier is constrained to be less than the weight of the category difference loss of the subdomain classifier; and the weight of the category difference loss of the subdomain classifier is optimized:
[0130] It should be noted that when the source domain and the target domain are very different and their distributions are very different, the classifier extracted from the source domain cannot be directly transferred to the target domain. The overall recognition effect mainly depends on the domain adaptation ability, and attention should be paid to more detailed recognition differences in categories. Local distribution is more important.
[0131] Specifically, the source domain and the target domain are divided into a plurality of subdomains containing data of the same category; this can be achieved by taking step S41 in this implementation.
[0132] In each subdomain, the conditional distributions of source and target domain data of the same category are aligned by minimizing the mapping between the mean difference between the source and target domain data.
[0133] In the subdomain classifier, the identification of source domain and target domain data in each motor imagery category is divided into a target subclass, each of the target subclasses is iteratively trained, and the corresponding subclass loss function value is calculated;
[0134] Determine the classification accuracy deviation of each of the target subclasses according to the subclass loss function value of each of the target subclasses in multiple iterations;
[0135] It should be noted that at the beginning of the iteration for solving the optimal weight of each target subclass, the same weight is assigned to each target subclass; for example, assuming there are G target subclasses in total, the weight of the subclass loss function value of each target subclass is set to 1 / G.
[0136] Then iterative training begins so that the category recognition task in each target subcategory can extract the common features of this category as accurately as possible.
[0137] After every preset r iterations, the loss function change rate of each target subclass is calculated to represent the classification accuracy deviation:
[0138]
[0139] Among them, h i represents the rate of change of the loss function of the i-th target subclass, L i represents the loss function value of the i-th target subclass in each iteration, R represents the number of iterations, and r is the preset iteration interval.
[0140] The loss function of each target subclass is sorted based on its change rate. The largest change rate indicates that the current optimal solution of the target subclass in these r iterations has changed significantly. It is not stable at a value in these iterations, but still fluctuates in the global range, that is, it is still far away from the global optimal solution. In this embodiment, this target subclass is regarded as a category in the target domain that is significantly different from the source domain. They will resist the positive transfer of the domain, so it is necessary to focus on its subdomain adaptation and should have a greater weight for iterative training.
[0141] Sort the loss function change rates of all target subclasses in descending order, and calculate the weight ω of the subclass loss function value of each target subclass g for: where h G represents the maximum loss function change rate after sorting, h1 represents the minimum loss function change rate after sorting; m is the target subclass number, indicating that the target subclass g is the mth target subclass after sorting from large to small.
[0142] A subclass loss function value of each of the target subclasses is weighted and adjusted based on the classification accuracy deviation, and the subclass loss function values of all the target subclasses constitute the category difference loss of the subdomain classifier.
[0143] That is to say, the category difference loss L of the subdomain classifier in the above embodiment is d The calculation formula of The total category average is replaced by the loss function value of each category.
[0144] Using the method described in the present invention, the present invention conducts experiments on two public datasets BCI IV IIa and BCI IV IIb. In order to quantitatively evaluate the emotion recognition results, average precision and Kappa are used as evaluation indicators.
[0145] Table 1
[0146]
[0147] Table 2
[0148]
[0149] Tables 1 and 2 show the average accuracy and Kappa of the subjects' motor imagery recognition task. The results show that the method has achieved better performance than the other eight methods. First, it can be found from Table 1 that compared with traditional methods such as FBCSP and SSMM, the average accuracy of the method of the present invention is improved by 11.48% and 5.78%, respectively. Secondly, compared with deep learning methods such as ConvNet, EEGNet, and SHNN, the average accuracy of the method of the present invention is improved by 6.7%, 4.62%, and 4.97%, respectively. In addition, compared with the domain adaptive methods CCSP, DRDA, and GAT, the average accuracy of the method of the present invention is improved by 12.72%, 4.48%, and 2.65%, respectively. The results show that the accuracy of the task can be improved by combining global and subdomain adaptation and extracting features using a multi-scale method. It can be found from Table 2 that compared with traditional methods such as FBCSP and SSMM, the average accuracy of the method of the present invention is improved by 5.07% and 7.07%, respectively. Secondly, compared with deep learning methods such as ConvNet, EEGNet, and SHNN, the average accuracy of the method described in the present invention is improved by 5.7%, 8.95%, and 1.58%, respectively. In addition, compared with the domain adaptive methods CCSP, DRDA, and GAT, the average accuracy of the method described in the present invention is improved by 12.37%, 1.09%, and 0.63%, respectively. It can be seen that the proposed MJGSA shows higher accuracy.
[0150] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0151] Based on the same inventive concept, the embodiment of the present application also provides an operating system for realizing the above-mentioned joint global and subdomain adaptive multi-scale motor imagery cross-subject recognition. The implementation scheme for solving the problem provided by the system is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more joint global and subdomain adaptive multi-scale motor imagery cross-subject recognition system embodiments provided below can refer to the limitations of the joint global and subdomain adaptive multi-scale motor imagery cross-subject recognition method above, and will not be repeated here.
[0152] like Figure 3 As shown, the present invention also provides a multi-scale motion imagery cross-subject recognition system combining global and sub-domain adaptation, comprising:
[0153] A data acquisition module is used to acquire EEG signals of multiple subjects, divide them into source domain and target domain data, and perform data preprocessing;
[0154] A feature extraction module, used to respectively obtain the spatiotemporal features of source domain and target domain data using a multi-scale feature extraction unit;
[0155] The global alignment module is used to introduce a global domain classifier to train domain discrimination and align the marginal distribution between the source domain and the target domain;
[0156] The local alignment module is used to introduce subdomain classifiers to learn local domain transfer and align the conditional distribution between the source domain and the target domain;
[0157] A deep classification module, used for training a deep classifier using the spatiotemporal features after the edge distribution and the conditional distribution are aligned;
[0158] The iterative training module is used to calculate the total loss function value of the global domain classifier, the subdomain classifier, and the deep classifier, and through iterative training, the total loss function value is converged to obtain a motor imagery cross-subject recognition model.
[0159] It should be noted that: the multi-scale motor imagery cross-subject recognition system for joint global and sub-domain adaptation provided in this embodiment only uses the division of the above-mentioned functional modules as an example when processing the problem of motor imagery EEG signal recognition. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the system can be divided into different functional modules. Each functional module can be composed of a single execution unit, or it can be integrated into a functional module by two or more execution units to realize all the functions of the functional module.
[0160] Those skilled in the art will appreciate that the various modules of the above system may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in a computer device in the form of software, so that the processor may call and execute operations corresponding to the above modules.
[0161] The present invention is not limited to the above-mentioned specific implementation modes. Various changes made by ordinary technicians in this field based on the above-mentioned concepts without creative work are all within the protection scope of the present invention.
Claims
1. A multi-scale motion imagery cross-subject recognition method combining global and sub-domain adaptation, characterized in that: The steps include: Obtain EEG signals of multiple subjects, divide them into source domain and target domain data, and perform data preprocessing; A multi-scale feature extraction unit is used to obtain the spatiotemporal features of the source domain and target domain data respectively; Introduce a global domain classifier to train domain discrimination and align the marginal distribution between the source domain and the target domain; Introduce subdomain classifier to learn local domain transfer and align the conditional distribution between the source domain and the target domain; Training a deep classifier using the spatiotemporal features after the edge distribution and the conditional distribution are aligned; The total loss function value of the global domain classifier, the subdomain classifier, and the deep classifier is calculated, and the total loss function value is converged through iterative training to obtain a motor imagery cross-subject recognition model.
2. The multi-scale motor imagery cross-subject recognition method based on joint global and sub-domain adaptation according to claim 1, characterized in that: The data preprocessing includes: Use a sixth-order Chebyshev bandpass filter to perform bandpass filtering on the EEG signal in the range of [4,40] Hz to obtain motor imagery related signals and eliminate high-frequency and low-frequency noise interference; Euclidean alignment is used to make the covariance matrix distributions of EEG signals of different subjects similar, and the distribution of the source domain and the target domain is preliminarily optimized.
3. The multi-scale motor imagery cross-subject recognition method based on combined global and sub-domain adaptation according to claim 1, characterized in that: The multi-scale feature extraction unit includes a multi-scale feature extractor, a batch normalization layer, an activation layer, a pooling layer, and a Dropout layer; The multi-scale feature extractor includes three groups of parallel spatiotemporal convolution modules, each of which includes a one-dimensional time convolution block and a one-dimensional space convolution block; The one-dimensional temporal convolution blocks respectively use convolution kernels of sizes (1, 16), (1, 24) and (1, 36), and the step sizes are all (1, 1), to capture the dynamic changes of EEG signals in the temporal dimension; The one-dimensional spatial convolution blocks are all convolution kernels of size (C, 1) and step size (1, 1), where C represents the number of electrode channels and is used to capture the distribution law of EEG signals in the spatial dimension.
4. The multi-scale motor imagery cross-subject recognition method based on joint global and sub-domain adaptation according to claim 3 is characterized in that: The global domain classifier includes a domain discriminator and the multi-scale feature extractor, wherein the discriminator is used to distinguish the domain from which the spatiotemporal features come; The adversarial training is constructed based on the minimax game of the multi-scale feature extractor and the discriminator, and is used to align the marginal distribution between the source domain and the target domain, specifically including: The multi-scale feature extractor maps spatiotemporal features from the source domain and the target domain to a latent common space; Obtaining a marginal distribution distance between spatiotemporal features of a source domain and a target domain based on the domain discriminator; The domain discriminator is trained by maximizing the marginal distribution distance, so that the domain discriminator can distinguish the domain sources of the input spatiotemporal features, and the optimal parameters of the domain discriminator are obtained; Substituting the optimal parameters of the domain discriminator into the global domain classifier, training the multi-scale feature extractor by minimizing the marginal distribution distance, so that the multi-scale feature extractor can learn the common features of the source domain and the target domain, and obtaining the optimal parameters of the multi-scale feature extractor; Based on the optimal parameters of the domain discriminator and the optimal parameters of the multi-scale feature extractor, iterative adversarial learning is performed to align the marginal distribution between the source domain and the target domain.
5. The multi-scale motor imagery cross-subject recognition method based on combined global and sub-domain adaptation according to claim 1, characterized in that: The subdomain classifier adopts a deep subdomain adaptive network; the method further includes a shallow classifier after the multi-scale feature extraction, which is used to train the target domain data according to the source domain data and the corresponding labels to obtain the pseudo labels of the target domain data; The introduction of the subdomain classifier to learn local domain migration and align the conditional distribution between the source domain and the target domain includes: Based on the source domain label and the target domain pseudo label obtained by the shallow classifier, the source domain and the target domain are divided into multiple subdomains containing data of the same category; In each subdomain, the conditional distributions of source and target domain data of the same category are aligned by minimizing the mapping between the mean difference between the source and target domain data.
6. The multi-scale motor imagery cross-subject recognition method based on combined global and sub-domain adaptation according to claim 1, characterized in that: The deep classifier training using the spatiotemporal features aligned with the marginal distribution and the conditional distribution includes: The spatiotemporal features after the alignment of the marginal distribution and the conditional distribution are used as input, and the three fully connected layers are used as deep classifiers; The input of each spatiotemporal feature corresponds to an M-dimensional vector outputted by the Softmax layer, which is used to represent the probability that the spatiotemporal feature belongs to different categories; M is the number of categories of motor imagery EEG signals.
7. The multi-scale motor imagery cross-subject recognition method based on combined global and sub-domain adaptation according to claim 1, characterized in that: The total loss function value includes the adversarial loss function value of the global domain classifier, the category difference loss of the subdomain classifier, and the prediction loss of the deep classifier. Each loss has a corresponding weight assignment. Minimizing the total loss function value can obtain the motor imagery cross-subject recognition model.
8. The multi-scale motor imagery cross-subject recognition method based on combined global and sub-domain adaptation according to claim 7, characterized in that: The method further comprises, before acquiring the EEG signal of the subject: Obtain identity information, physiological information, and test information of multiple subjects, and extract individual difference characteristics of each subject; Analyzing the similarity of the source domain data and the target domain data based on the individual difference features in the source domain and the target domain, wherein the larger the individual difference features are, the smaller the similarity is; The weight distribution corresponding to each loss is adjusted based on the similarity between the source domain and the target domain data.
9. The multi-scale motor imagery cross-subject recognition method based on combined global and sub-domain adaptation according to claim 8, characterized in that: The weight allocation corresponding to each loss item is adjusted based on the similarity between the source domain and the target domain data, including: (1) When the similarity between the source domain and the target domain data is greater than or equal to a preset threshold, the weight of the adversarial loss function value of the global domain classifier is constrained to be greater than the weight of the category difference loss of the subdomain classifier; and the weight of the prediction loss of the deep classifier is optimized: Use source domain data and corresponding labels to train a motor imagery EEG signal classifier; Inputting the target domain data with the true label into the motor imagery EEG signal classifier to predict the category of the target domain data; Obtaining the average predicted probability distribution of all target domain data with real labels under the motor imagery EEG signal classifier based on the comparison between the predicted categories and the real labels; Adjusting the weight of the prediction loss of the deep classifier based on the average prediction probability distribution; (2) When the similarity between the source domain and the target domain data is less than a preset threshold, the weight of the adversarial loss function value of the global domain classifier is constrained to be less than the weight of the category difference loss of the subdomain classifier; and the weight of the category difference loss of the subdomain classifier is optimized: Divide the source domain and the target domain into multiple subdomains containing data of the same category; In each subdomain, the conditional distributions of source and target domain data of the same category are aligned by minimizing the mapping between the mean difference between the source and target domain data. In the subdomain classifier, the identification of source domain and target domain data in each motor imagery category is divided into a target subclass, each of the target subclasses is iteratively trained, and the corresponding subclass loss function value is calculated; Determine the classification accuracy deviation of each of the target subclasses according to the subclass loss function value of each of the target subclasses in multiple iterations; A subclass loss function value of each of the target subclasses is weighted and adjusted based on the classification accuracy deviation, and the subclass loss function values of all the target subclasses constitute the category difference loss of the subdomain classifier.
10. A multi-scale motor imagery cross-subject recognition system combining global and sub-domain adaptation, characterized in that: include: A data acquisition module is used to acquire EEG signals of multiple subjects, divide them into source domain and target domain data, and perform data preprocessing; A feature extraction module, used to respectively obtain the spatiotemporal features of source domain and target domain data using a multi-scale feature extraction unit; The global alignment module is used to introduce a global domain classifier to train domain discrimination and align the marginal distribution between the source domain and the target domain; The local alignment module is used to introduce subdomain classifiers to learn local domain transfer and align the conditional distribution between the source domain and the target domain; A deep classification module, used for training a deep classifier using the spatiotemporal features after the edge distribution and the conditional distribution are aligned; The iterative training module is used to calculate the total loss function value of the global domain classifier, the subdomain classifier, and the deep classifier, and through iterative training, the total loss function value is converged to obtain a motor imagery cross-subject recognition model.
Citation Information
Cited By
Cross-domain WiFi personnel identity recognition method based on multi-branch domain alignment model
CN119150145A
A cross-domain WiFi personnel identification method based on multi-branch domain alignment model
CN119150145B
Motor imagery electroencephalogram recognition method based on domain adaptation network
CN119622543A
Open set human body activity identification method based on two-stage feature alignment
CN120597133A
An open-set human activity recognition method based on two-stage feature alignment
CN120597133B
