EEG adaptive classification method and its application based on dynamic joint domain adaptation network
Through the dynamic joint domain adaptation network (DJDAN) model, combined with global and local domain adaptation techniques, the problems of individual differences and signal non-stationarity in EEG signal classification are solved, and more efficient and accurate motor imagery EEG signal classification is achieved, which is suitable for stroke rehabilitation training systems.
Patent Information
- Application Number
- CN202510978628.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-16
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-07-16
AI Technical Summary
Existing EEG signal classification methods face problems of individual differences and signal non-stationarity when processing motor imagery EEG signals, resulting in poor generalization ability of traditional machine learning models and the need for time-consuming and tedious calibration processes, which hinders the widespread application of brain-computer interface technology.
The Dynamic Joint Domain Adaptation Network (DJDAN) model is adopted, combining global and local domain adaptation techniques. EEG signal features are extracted through convolutional neural networks, and global and local domain discriminators are used to reduce the distribution difference between the source domain and the target domain, optimizing the training process to achieve more robust classification.
It improves the accuracy and adaptability of EEG signal classification, reduces the impact of individual differences on model performance, improves real-time performance and training efficiency, and reduces the demand for training samples for new patients.
Smart Images

Figure CN120493029B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an electroencephalogram (EEG) signal classification technology, and in particular to an EEG adaptive classification model based on a dynamic joint domain adaptation network and its application in rehabilitation. Background Art
[0002] Stroke, a severe acute cerebrovascular disease, is the leading cause of long-term disability in adults worldwide. Its sudden onset and high disability rate place a heavy medical and economic burden on patients, their families, and society as a whole. Among the many sequelae of stroke, motor dysfunction is particularly common and difficult to treat. Patients often lose the ability to control part or all of their limbs due to damage to the nervous system. This loss of motor ability not only severely deprives patients of their ability to take care of themselves in daily life, but also has a profound impact on their mental health and quality of life. Therefore, developing efficient and precise rehabilitation treatments to maximize the restoration of patients' motor function has always been a core topic in modern medical research and clinical practice.
[0003] Against this backdrop, the intersection of neuroscience and engineering has catalyzed the emergence and development of brain-computer interface (BCI) technology, revolutionizing the field of neurorehabilitation. Among the various available brain signal acquisition technologies, electroencephalography (EEG), with its non-invasive nature, relatively portable equipment, low cost, and extremely high temporal resolution, has become the most promising and feasible option for clinical rehabilitation applications. Within EEG-based BCI rehabilitation, motor imagery (MI) is a core paradigm that has been extensively studied and proven effective. Motor imagery involves the dynamic and immersive mental simulation of specific physical movements while remaining completely still and without any actual physical movement. This intuitive experience effectively strengthens the neural pathways associated with motor intention, significantly enhancing patients' active participation and intrinsic motivation in rehabilitation training while also enabling the implementation of personalized, adjustable, and precise rehabilitation programs.
[0004] Although the concept of brain-computer interface rehabilitation based on motor imagery has broad prospects, its clinical application still faces huge technical challenges brought about by the characteristics of the EEG signal itself. This is mainly due to the high variability of the signal, which is reflected in two core aspects: first, the significant individual differences, that is, different patients have very different EEG patterns when performing the same task; second, the non-stationarity of the signal. Even for the same patient, their signal will drift dynamically over time due to factors such as fatigue and attention. This inherent signal variability leads to extremely poor generalization ability of traditional machine learning models. Therefore, current BCI systems generally rely on a time-consuming and cumbersome calibration process. This process requires the collection of a large amount of new labeled data for patients before each training to train personalized models, which greatly increases the burden on patients and reduces clinical efficiency, becoming the biggest bottleneck hindering the widespread application of BCI technology.
[0005] To overcome this bottleneck, domain adaptation technology has been introduced into the BCI field. It aims to leverage knowledge learned from existing data (the source domain) to improve performance on new data (the target domain). Its core technology lies in learning domain-invariant features through algorithms. This means that while retaining the core information of the task, it ignores inter-domain differences caused by individual differences.
[0006] However, many existing DA methods are still insufficient when processing complex EEG signals because most of them only focus on aligning the global feature distribution. This strategy ignores the fact that the distribution drift of EEG signals is often category-related, that is, there is conditional distribution drift. For example, the feature offset patterns of the "left hand" and "right hand" motor imagery signals of a new patient may be completely different. A simple global alignment cannot accurately correct these fine-grained differences and may even impair classification performance. Therefore, the field urgently needs a more advanced adaptive method that must be able to simultaneously handle global and category-specific conditional distribution differences to achieve more robust and accurate calibration-free BCI classification. Summary of the Invention
[0007] Purpose of the invention: To address the deficiencies of the prior art, the present invention provides a motor imagery EEG classification method and application based on a dynamic joint domain adaptive network.
[0008] Technical solution: To achieve the above-mentioned purpose, the present invention adopts the following technical solution:
[0009] The present invention first provides an EEG adaptive classification method based on a dynamic joint domain adaptation network, which includes the following steps:
[0010] S1. EEG Signal Acquisition and Preprocessing: The EEG signal is collected and filtered using a third-order Butterworth bandpass filter in the 4-38 Hz frequency band. The filtered signal is then subjected to exponential shift normalization before being transmitted to the host computer.
[0011] S2. Signal Processing and Feature Extraction: After receiving the EEG signal preprocessed in step S1, the host computer performs signal feature extraction and classification based on the Dynamic Joint Domain Adaptation Network (DJDAN) model. The DJDAN model includes a feature extractor, a classifier, a global domain discriminator, and a local domain discriminator.
[0012] S3. Rehabilitation control signal output: The host computer outputs the motion intention label of the classifier Converted into control signals required by rehabilitation equipment ;
[0013] S4. Feedback and Evaluation: Rehabilitation equipment generates feedback signals based on the patient’s training movements And transmit it to the host computer, which records and evaluates the patient's training progress.
[0014] Furthermore, step S1 specifically includes:
[0015] S1.1. Use an EEG acquisition device to collect motor imagery EEG signal data from stroke patients. The data collected by the EEG acquisition device includes The EEG signal of electrodes, where the number of electrodes , each trial contains sampling points, thus forming a dimension of The data matrix of
[0016] S1.2. Filter the raw EEG signals using a third-order Butterworth bandpass filter in the 4-38 Hz frequency band to remove frequency signals and noise irrelevant to the motor imagery task.
[0017] S1.3. Perform exponential shift normalization on the EEG signal filtered in step S1.2, and , the normalized EEG signal The calculation is as follows:
[0018] ,
[0019] in After filtering at time point The input signal, and At time points The exponential moving average and variance of are calculated as follows:
[0020] ,
[0021] ,
[0022] in is the attenuation factor, and The previous time point The exponential moving average and variance of ;
[0023] S1.4. The EEG signal after standardization in step S1.3 is transmitted to the host computer.
[0024] Furthermore, step S2 specifically includes:
[0025] S2.1. Feature Extractor: The feature extractor uses a convolutional neural network (ConvNet) structure to extract the temporal and spatial features of the EEG signal, respectively, using temporal convolution and spatial convolution. First, the temporal convolution layer convolves the EEG signal along the time axis, using 40 convolution kernels of length 25 to learn the time-frequency information. Then, the spatial convolution layer performs spatial convolution between electrodes on the output of the temporal convolution, using 40 convolution kernels with a kernel length equal to the number of electrodes. , learning the spatial dependency between electrodes; finally, the batch normalization BN layer, square activation function, average pooling layer, logarithmic activation function and Dropout layer are used to generate deep features with high discrimination, which are recorded as ,in is the EEG signal unit processed by the model once, is the space where the output eigenvector is located, is the dimension of this feature vector;
[0026] S2.2. Classifier: The classifier receives the deep features generated by the feature extractor and The operation classifies the signal and outputs the patient's movement intention label ,in is the weight matrix, is the bias term, Represents the normalized exponential function, which returns the index of the maximum element in the input vector. Represents the activation function, which can convert a real number vector into a probability distribution vector. The labels correspond to different sports categories, and the classifier loss function is the cross entropy loss. :
[0027] ,
[0028] in is the total number of task categories, is the one-hot representation of the true label, is the model prediction probability, represents the natural logarithm with base e ( );
[0029] S2.3. Global domain discriminator: The global domain discriminator is used to determine whether the deep features generated by the feature extractor are from the source domain or the target domain by performing binary classification on the deep features generated by the feature extractor. The global domain discriminator is used to reduce the global distribution difference between the source domain and the target domain, and the global adversarial loss Defined as:
[0030] ,
[0031] in From the source domain A sample of Is from the target domain A sample of In the source domain The expectation obtained from the data distribution, In the target domain The expectation obtained from the data distribution, is the deep feature output by the feature extractor, It is the probability output of the global domain discriminator for the binary classification of the input features, and the output value is [0,1] Between, represents the probability of the source domain, represents the natural logarithm with base e ( );
[0032] S2.4. Local domain discriminator: The local domain discriminator is used to reduce the distribution difference between the source domain and the target domain in the fine-grained subdomain. The local domain discriminator uses the patient's motion intention label predicted by the classifier , conditional adversarial learning is used to further align the deep features generated by the feature extractor to ensure the consistency of the features learned by the classifier across different domains. , introducing class-conditional local discriminator , using the predicted label probability weighted features for discrimination, local domain discriminator loss for:
[0033] ,
[0034] in It is the local domain discriminator in the The binary classification probability output on the category, Indicates that the sample in the source domain belongs to the category The predicted probability of Indicates that the sample in the target domain belongs to the category The predicted probability of is the deep feature output by the feature extractor, It is the product of the classifier's category prediction probability and the feature, which is input into the local domain discriminator as a conditional feature;
[0035] S2.5. Training and Optimization: The DJDAN model is trained by optimizing the total loss function Implementation, total loss function Defined as:
[0036] ,
[0037] in, To balance the hyperparameters of classification loss and domain discrimination loss, is a dynamic adversarial factor, which is used to dynamically adjust the relative importance of the global domain discriminator loss and the local domain discriminator loss. ω ∈ [ 0,1] Dynamically adjust the weights of the global and local domain discriminators, and the calculation formula is:
[0038] ,
[0039] in Indicates the total number of task categories, is the average value of the local A distance under all categories; if When it approaches 1, it indicates that the training focuses more on global domain differences; when it approaches 0, it focuses more on local domain consistency.
[0040] Furthermore, the window size of the average pooling layer described in S2.1 is 1x75, and the step size is 15.
[0041] Furthermore, in the Dropout layer described in S2.1, p=0.5, where p refers to the probability that the output of any neuron is randomly set to zero in each step of model training.
[0042] The present invention also provides an application of the above-mentioned EEG adaptive classification method based on the dynamic joint domain adaptation network in stroke rehabilitation, comprising the following steps:
[0043] 1) The host computer receives the EEG signal and uses the above method to classify the EEG signal, identify the patient's movement intention, and control the rehabilitation equipment to perform the corresponding action;
[0044] 2) The rehabilitation equipment performs movement training on the patient based on the control signals and feeds the training data back to the host computer for evaluation;
[0045] 3) The upper computer uses the exercise assessment method of muscle activity monitoring to evaluate the patient's exercise training effect and help adjust the rehabilitation plan.
[0046] Beneficial effects: Compared with the prior art, the present invention adopts the above technical solution and has the following advantages:
[0047] 1. The present invention improves classification accuracy and adaptability: The present invention adopts the DJDAN model, which effectively reduces the distribution difference between the source domain and the target domain by combining global and local domain adaptation techniques, improves the accuracy of motor imagery EEG signal classification, and reduces the impact of individual differences on model performance.
[0048] 2. The present invention improves real-time performance and efficiency: It adopts a dynamically adjusted adversarial learning method to optimize the training process, so that the system can process EEG signals in real time while ensuring high classification accuracy, meeting the real-time requirements of the rehabilitation system.
[0049] 3. The present invention reduces the training burden: The present invention can reduce the amount of training samples required for each new patient through transfer learning, thereby avoiding the complex process of retraining the model for each subject in traditional methods, and improving the applicability and efficiency of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 This is a flow chart of the motor imagery classification method and application based on the dynamic joint domain adaptive network of the present invention;
[0051] Figure 2 It is an EEG topographic map that visualizes the intensity of brain electrical activity at a specific time and frequency band in an embodiment of the present invention;
[0052] Figure 3 This is a partial EEG signal waveform diagram after data preprocessing in an embodiment of the present invention, specifically showing representative signals from key electrodes in the sensorimotor cortex under different task states. Figure 3 Middle: (a) is the EEG signal waveform recorded by the C3 electrode in the resting state; (b) is the EEG signal waveform recorded by the C4 electrode (corresponding to the right cerebral hemisphere) when the subject was performing a left-hand motor imagery task; (c) is the EEG signal waveform recorded by the C3 electrode (corresponding to the left cerebral hemisphere) when the subject was performing a right-hand motor imagery task; (d) is the EEG signal waveform recorded by the Cz electrode (located at the center top) when the subject was performing a right-hand motor imagery task; (e) is the EEG signal waveform recorded by the FC4 electrode (located in the right frontal-central area) when the subject was performing a left-hand motor imagery task;
[0053] Figure 4 is a schematic diagram of the structure of a dynamic joint domain adaptation network in an embodiment of the present invention;
[0054] Figure 5 This is a comparison chart of classification accuracy in an embodiment of the present invention;
[0055] Figure 6 This is a block diagram of the EEG acquisition device in an embodiment of the present invention. DETAILED DESCRIPTION
[0056] The technical solution of the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0057] like Figure 1 As shown, the acquisition of EEG signals is the first step of this method. The present invention specifically adopts an EEG acquisition device that complies with the international 10-20 system standard, and the electrode cap of the device contains 22 recording electrodes. In order to achieve high-precision decoding of motor intention, the positions of key electrodes are carefully selected to cover the sensorimotor cortex and its adjacent functional areas, including but not limited to the C3, Cz, and C4 electrodes in the central area, and the FC3, FCz, and FC4 electrodes in the adjacent frontocentral area and the CP3, CPz, and CP4 electrodes in the parietal central area. The electrodes in these specific positions are systematically selected to accurately collect EEG signals with high spatial resolution related to fine motor imagination tasks of different limbs, thereby ensuring the quality and task relevance of the input data, and laying a solid foundation for subsequent feature extraction and accurate classification. As Figure 2 As shown in the figure, when stroke patients perform autonomous motor imagery activities under the guidance of rehabilitation physicians, such as imagining the movement of a specific limb (such as the left hand, right hand, left foot or right foot), the EEG acquisition device will record the real-time data of each electrode. In each motor imagery trial The output of this process is the original multi-channel EEG data matrix .
[0058] like Figure 3 As shown in Figure 1, after obtaining the raw EEG data, a series of key preprocessing operations are performed to improve the signal quality and prepare for subsequent feature extraction. First, the collected raw EEG data matrix A third-order Butterworth bandpass filter was applied. The passband frequency range was selected to be 4-38 Hz. This step was designed to effectively remove frequency band signals irrelevant to the motor imagery task, such as low-frequency baseline drift, high-frequency noise, and some electromyographic artifacts, thereby obtaining a filtered signal. Subsequently, in order to further deal with the inherent non-stationary problem of EEG signals and make the signal amplitudes of different channels and different trials comparable, the filtered signals were Perform exponential shift normalization on a channel-by-channel and time-point basis. Specifically, at any time point , for the filtered signal value of a certain channel , the normalized signal value Calculated by the following formula:
[0059] ,
[0060] in After filtering at time point The input signal, and At time points The exponential moving average and variance of are calculated as follows:
[0061] ,
[0062] ,
[0063] parameter Is an attenuation factor, which controls the weighted influence of historical data in calculating the current mean and variance. After completing all the above preprocessing steps, the final output is the preprocessed EEG data matrix This preprocessed data will be used as the direct input for DJDAN model processing and transmitted to the host computer through the data transmission module for subsequent more complex feature extraction and classification tasks.
[0064] like Figure 4 As shown, the motor imagery EEG classification method of the present invention using a dynamic joint domain adaptive network includes the following steps:
[0065] 1. Feature Extractor
[0066] The feature extractor is the first core component of the DJDAN model, and its input is the preprocessed EEG data segment. (For simplicity, Represents the data matrix after preprocessing A specific data segment or trial taken out from the EEG signal). The feature extractor uses a convolutional neural network (ConvNet) structure specially designed for processing the spatiotemporal characteristics of EEG signals. Specifically, it first performs a convolution operation along the time axis of the EEG signal through a temporal convolution layer. 40 one-dimensional convolution kernels with a length of 25 are used, with the aim of learning the dynamic change pattern and frequency-related information of the EEG signal from the sampling points. Next, the output of the temporal convolution layer is sent to a spatial convolution layer, which is mainly responsible for spatial convolution between different electrodes. 40 one-dimensional convolution kernels are used, and the length of the kernel is the same as the number of EEG electrodes. Similarly, the purpose of this design is to learn the spatial dependencies between different brain regions (i.e., different electrode positions) and their coordinated activity patterns when performing motor imagery tasks. After time and space convolution, the feature map will pass through a series of subsequent processing layers, including a batch normalization layer, which helps to accelerate the model training process and improve the stability of the model; an average pooling layer using a pooling operation with a window size of 1x75 and a step size of 15, which is used to reduce the feature dimension and extract the main local features; a logarithmic activation function to further enhance the nonlinear expression ability of the network; and a Dropout layer to set the Dropout probability , which is a regularization technique used to prevent the model from overfitting on the training data. Through this series of carefully designed operations, the feature extractor ultimately outputs a deep feature representation with high discriminative power. ,in Represents the dimension of the feature vector.
[0067] 2. Classifier
[0068] The classifier is the component responsible for the final decision in the DJDAN model. Its input is the deep features carefully generated by the feature extractor. The classifier maps the high-dimensional depth features to the predefined motion intention category space through a fully connected layer (in the actual application of convolutional neural networks, this is usually achieved through a fully connected convolutional layer). The activation function converts the output of the fully connected layer into a probability distribution corresponding to each motion intention category. Finally, the motion intention label predicted by the model is is determined to be the class with the highest output probability, where represents the weight matrix of the classifier, and is the corresponding bias term.
[0069] This predicted label Directly corresponds to several predefined different movement categories, such as left hand, right hand, left foot or right foot movement imagination. In order to train the classifier so that it can accurately map features to labels, the classifier uses the cross entropy loss function during the training process. For samples from the source domain Extracted deep features By minimizing this cross entropy loss, the classifier learns to map deep features to the correct classification labels and generates corresponding classification labels. The loss function used is the classic cross entropy loss , the loss function is defined as follows:
[0070] ,
[0071] in, Indicates the total number of categories of tasks; is the one-hot encoding form of the true label of the sample corresponding to The value of the element (that is, if the true category of the sample is Class, then is 1, otherwise 0); and The classifier model predicts that the sample belongs to By minimizing this cross entropy loss, the classifier continuously adjusts its parameters to learn the mapping relationship from deep features to correct motion intent. The final output of the classifier is two parts: one is the predicted motion intent label , and the second is the complete prediction probability vector corresponding to each category .
[0072] In order to achieve domain adaptation, the present invention introduces domain discriminators at both global and local levels. The global domain discriminator performs binary classification on the deep features from the source domain and the target domain. Its main function is to reduce the global marginal distribution difference between the source domain and the target domain, ensuring that the features learned by the model are domain invariant as a whole. The local domain discriminator introduces a class conditional discriminator and uses the category probability information predicted by the classifier to reduce the conditional distribution difference between the source domain and the target domain in each specific category subdomain, thereby achieving finer-grained domain alignment and ensuring that the features learned by the classifier are also consistent for specific categories between different domains.
[0073] 3. Global Domain Discriminator
[0074] The global domain discriminator plays a key role in the DJDAN model to enable the feature extractor to learn domain-invariant features. Its inputs are the features from the source domain and and features from the target domain . The global domain discriminator itself is a two-classification neural network, and its core task is to distinguish whether the received deep features are derived from source domain data or target domain data. Through an adversarial training mechanism, the global domain discriminator and the feature extractor play a game: the discriminator strives to improve its distinguishing ability, while the feature extractor strives to generate features that the discriminator cannot distinguish. The purpose of this game is to force the feature extractor to learn global feature representations that are shared between the source domain and the target domain and do not change with the domain, thereby effectively reducing the marginal distribution difference between the source domain and the target domain, and ensuring that the model adapts well between the source domain and the target domain. The global adversarial loss generated by the global domain discriminator when training the feature extractor The definition is as follows:
[0075] ,
[0076] In this formula, This represents the probability output by the global domain discriminator for an input feature. This probability indicates the confidence that the input feature originates from the source domain. During feature extraction training, the optimization goal is to maximize this loss. This essentially tricks the global domain discriminator into accurately determining the source of the feature. The direct output of the global domain discriminator is the probability that a given input feature belongs to the source domain.
[0077] 4. Local Domain Discriminator
[0078] The local domain discriminator is a component in the DJDAN model used to achieve finer-grained domain adaptation. Its goal is to reduce the conditional distribution difference between the source domain and the target domain on specific, fine-grained subcategories. Unlike the global domain discriminator that focuses on the overall distribution, the local domain discriminator focuses more on domain consistency under specific categories. Its input includes features from the source domain , features from the target domain , and an important auxiliary information - the category probability predicted by the classifier for these input features (usually called pseudo labels), respectively recorded as and , these two probabilities represent the source domain samples and target domain samples Belong to a specific category To achieve this category-conditional domain alignment, the local domain discriminator internally predicts each predefined category. A special class-conditional local domain discriminator is introduced . Using the pseudo-label information predicted by the classifier, the specific approach is to predict the category probability And the corresponding deep features Weighted, and the weighted features are used as input for conditional adversarial learning. , and its corresponding local domain discrimination loss The definition is as follows:
[0079] ,
[0080] In this formula, and The source domain samples and target domain samples belong to the categories Similar to the global domain discriminator, in the stage of training the feature extractor, the goal is also to maximize the local domain discrimination loss , in order to "fool" the local domain discriminator of each class condition. The direct output of the local domain discriminator is the probability value of a given feature that has been attached with a class condition, and it determines that the feature belongs to the source domain.
[0081] 5. Training and Optimization
[0082] The training process of the Dynamic Joint Domain Adaptation Network (DJDAN) model proposed in the present invention adopts an iterative adversarial optimization strategy. The core of this strategy is to simultaneously improve the classification accuracy and domain adaptation ability of the model through an alternating two-stage training. In the first stage of training, the goal of the model is to enhance the resolution ability of the domain discriminator. At this time, the present invention will fix the parameters of the feature extractor and classifier, and focus on updating the parameters of the global domain discriminator and the local domain discriminator. By minimizing its discrimination loss, the present invention trains the global domain discriminator to more accurately distinguish the overall domain origin of the feature, and trains the local domain discriminator to more accurately identify the domain origin under specific category conditions (with the help of pseudo-labels provided by the classifier). This step aims to create a strong "adversary" to provide a clear gradient signal for subsequent feature alignment.
[0083] In the second stage of training, the roles are reversed. The goal of this invention is to train the feature extractor to generate domain-invariant features and enable the classifier to accurately classify. In this stage, the parameters of the domain discriminator are fixed. The parameter updates of the feature extractor and the classifier aim to minimize a total loss function consisting of the classification loss and the adversarial domain adaptation loss. Among them, the adversarial loss aims to "cheat" the fixed discriminator. It consists of a weighted global adversarial loss and a local adversarial loss. The weight between the two is determined by a dynamic adversarial factor Adaptive adjustments are made based on the domain differences during training, and the importance of the entire domain adaptation task is determined by the hyperparameters By repeatedly iterating between these two stages, the feature extractor and discriminator in the model form a "min-max" game, which ultimately forces the feature extractor to learn a robust feature representation that is highly sensitive to the classification task but insensitive to domain changes.
[0084] In the specific training setup, the source domain data is the public EEG dataset from Dataset IIa of the BCI Competition IV, which contains labeled motor imagery task data from nine healthy subjects recorded in different previous sessions. The target domain data can be unlabeled motor imagery task data from the same subjects recorded in new, different sessions. This setup enables adaptive classification across sessions, significantly reducing the reliance on large amounts of labeled target domain data.
[0085] Total loss function The specific definition is as follows:
[0086] ,
[0087] parameter is an important hyperparameter that is used to balance the classification loss The relative importance between (ensuring classification performance on the source domain) and the overall domain discriminative (adversarial) loss. Another key parameter is ω ∈ [0,1] , which is a dynamic adversarial factor, whose function is to dynamically adjust the weight of the global domain discriminator loss and the local domain discriminator loss in the total adversarial loss according to the real-time situation of training. The calculation method is based on the concept of A-distance, which is a metric used to quantify the difference between two probability distributions. The specific calculation method is:
[0088] ,
[0089] in, Indicates the total number of categories of tasks; is the global A distance, which is estimated by the performance of the global domain discriminator in distinguishing the source domain and target domain features, reflecting the difference in the overall marginal distribution; is the average of the local A distances (estimated by the performance of the local domain discriminators under each class condition) under all categories, reflecting the average difference in the conditional distribution. Therefore, if the global domain difference Larger, then As it approaches 1, model training will focus more on aligning the marginal distribution of the global domain; on the contrary, if the average conditional distribution difference of the local domain is relatively larger, then As the probability approaches 0, model training will focus more on aligning the conditional distributions of each category. This dynamic adjustment mechanism enables the DJDAN model to adaptively focus on aligning the more divergent parts of the global marginal distribution and local conditional distribution between the source and target domains at different training stages, adapting to changes in distribution differences. This optimizes the overall domain adaptation effect and is used to optimize the alignment of the global marginal distribution and local conditional distribution during training.
[0090] The entire training process uses the Adam efficient optimization algorithm and utilizes the Gradient Reversal Layer (GRL) technology to achieve the goal of adversarial training. Specifically, the training process is an alternating optimization process:
[0091] The first step is to fix the parameters of the feature extractor and classifier, and then train the global domain discriminator and the local domain discriminator. In this step, the goal is to make the discriminator distinguish as accurately as possible which features come from the source domain and which come from the target domain (for the local discriminator, the category condition also needs to be considered).
[0092] Step 2: Fix the parameters of the discriminator and then train the feature extractor and classifier. In this step, the optimization goals are twofold: one is to minimize the classification loss on the source domain. , to ensure the classification accuracy of the model; the second is to maximize the confusion level of the discriminator, that is, to make the features generated by the feature extractor as difficult as possible for the discriminator to distinguish their sources.
[0093] These two steps are repeated throughout the training process until the model converges or reaches the preset number of training rounds. Through such sufficient training and optimization, a set of optimized model parameters is finally obtained.
[0094] 6. Experimental verification and results
[0095] 1) Performance Comparison: To comprehensively evaluate the performance of our proposed Dynamic Joint Domain Adaptation Network (DJDAN) method, we conducted a detailed performance comparison with several leading benchmark methods on the publicly available Dataset IIa and Dataset IIb. The results presented in Tables 1 and 2 demonstrate that our DJDAN method achieved leading average classification accuracy on both datasets. These benchmark methods encompass a wide range of representative techniques from traditional machine learning to deep learning. Traditional methods include classification pipelines based on filter bank co-spatial patterns (FBCSP), canonical correlation analysis co-spatial patterns (CCSP), stationary subspace manifold mapping (SSMM), and channel-to-channel manifold (C2CM). Deep learning benchmarks include a basic convolutional neural network (ConvNet) model and EEGNet, a compact network designed specifically for EEG signals.
[0096] Specifically, on Dataset IIa (as shown in Table 1), the DJDAN method of our invention achieved an average accuracy of 81.52%, significantly improving upon the representative traditional method FBCSP (67.75%) and the deep learning method EEGNet (74.50%) by 13.77% and 7.02%, respectively. On the more complex Dataset IIb (as shown in Table 2), the DJDAN method also achieved an average accuracy of 83.00%, surpassing all other compared methods. These data strongly demonstrate the superiority of our method in processing and improving the accuracy of motor imagery EEG signal classification.
[0097] Table 1 Comparison of classification accuracy (%) on Dataset IIa
[0098]
[0099] Table 2 Comparison of classification accuracy (%) on Dataset IIb
[0100]
[0101] like Figure 5As shown in the figure, the proposed Dynamic Joint Domain Adaptation Network (DJDAN) method is compared in classification accuracy with several baseline methods. These baselines include two representative traditional machine learning pipelines: one based on co-spatial pattern (CSP) feature extraction and an OVR-CSP-LDA classifier; and another using the same features but combined with an OVR-CSP-SVM classifier. Furthermore, the method is compared with ShallowNet, a classic shallow convolutional neural network model designed specifically for EEG signals.
[0102] The comparison results show that our DJDAN method achieves optimal or near-optimal performance on the vast majority of subjects (A1 to A9), significantly outperforming all baseline methods in terms of average accuracy (Avg). This result validates the excellent individual adaptability and generalization capabilities of our method, and strongly demonstrates that by dynamically combining global and local domain adaptation strategies, we can effectively learn domain-invariant features, thereby significantly improving cross-session EEG classification performance.
[0103] 2) Ablation Experiments: Combined with Table 3, the full DJDAN model achieves superior average classification accuracy on both datasets compared to MAAN and CAAN. This demonstrates that while either MAAN or CAAN alone improves performance, combining them with a dynamic adjustment mechanism (DJDAN) can more comprehensively reduce inter-domain differences, learn more transferable features, and ultimately achieve better classification results.
[0104] Table 3. Comparison of ablation test accuracy of different domain adaptation strategies (%)
[0105]
[0106] 3) Hyperparameter Sensitivity Analysis: As shown in Table 4, when the hyperparameter α is in an intermediate range (e.g., close to 0.3), the model achieves high average classification accuracy, demonstrating the importance of the domain adaptation loss term and the necessity of selecting an appropriate weight. The DJDAN model maintains good performance within a certain range of α values, demonstrating its robustness. In particular, when α = 0.3, the model achieves optimal performance on both datasets. When α = 0.0 (i.e., ignoring the domain adaptation adversarial loss and performing classification only) or α = 1.0 (i.e., overweighting the domain adaptation adversarial loss), performance degrades, further demonstrating the importance of balancing classification and domain adaptation tasks.
[0107] Table 4 Hyperparameters Sensitivity analysis and performance comparison of model variants (%)
[0108]
[0109] In summary, this supplementary note demonstrates the remarkable effectiveness of the proposed DJDAN method through comprehensive experimental validation on two publicly available motor imagery EEG datasets. Comparative experiments demonstrate its superior classification accuracy; ablation experiments verify the essential synergy between the model's core components; and parameter sensitivity analysis demonstrates the model's robustness. The proposed DJDAN method effectively addresses the domain drift problem of motor imagery EEG signals, providing reliable technical support for intelligent rehabilitation training systems for stroke patients and promising clinical applications.
[0110] 7. Rehabilitation control signal output
[0111] like Figure 6 As shown in Figure 2, after the DJDAN model successfully identifies the patient's movement intention, the next step is to convert this recognition result into actual rehabilitation action. The input of this process is the movement intention label output by the classifier. The host system receives this tag, for example, if stands for "left hand motor imagery," which the system translates into a set of control commands specific to the connected rehabilitation device. These rehabilitation devices can take many forms, such as upper or lower limb exoskeleton robots, functional electrical stimulation (FES) devices, or other types of assistive training devices. The conversion process needs to ensure that the generated control signals The output of this step is the specific control instructions for the specific rehabilitation equipment. These instructions will directly drive the rehabilitation equipment to assist the patient in performing the corresponding exercises. Figure 1 Functional training movements.
[0112] 8. Feedback and Evaluation
[0113] Rehabilitation training is a dynamic process that requires continuous monitoring and adjustment, so feedback and evaluation are crucial. The inputs to this process are multifaceted: first, the feedback signals generated by the rehabilitation equipment during patient training. These signals usually contain rich kinematic information, such as the range of motion of the patient's joints, the speed and strength of the movement, the smoothness of the movement, etc.; secondly, the movement intention label output by the DJDAN model itself and the related classification confidence; in addition, other physiological signals can be selectively introduced as auxiliary evaluation means, such as surface electromyography (sEMG), which can reflect the actual degree of muscle activation during exercise. The host computer system will record and integrate all these multimodal data in real time, and conduct a comprehensive and quantitative evaluation of the patient's training progress based on these data. For example, the system can compare the movement intention predicted by the DJDAN model The accuracy and effectiveness of the brain-computer interface's decoding are evaluated by comparing the results with those actually performed with the assistance of the rehabilitation device or with those attempted independently by the patient. Simultaneously, the combination of sEMG signals can further verify the authenticity of the patient's movement intentions and the degree of muscle involvement. Ultimately, the output of this step is a detailed training evaluation report, which includes various quantitative indicators of the training effect. This objective evaluation information is of great guiding significance to the rehabilitation process: rehabilitation therapists can use these reports to adjust subsequent rehabilitation plans, such as increasing or decreasing the difficulty of training or changing the type of training tasks. Furthermore, the system can use this feedback information to fine-tune and optimize the parameters of the DJDAN model online to better adapt to the dynamic changes in the patient's individual condition, thereby continuously improving the personalization level and overall effectiveness of rehabilitation training.
[0114] In summary, through the above-mentioned carefully designed embodiments, the EEG adaptive classification method based on the dynamic joint domain adaptation network proposed in the present invention can be effectively integrated into a closed-loop stroke rehabilitation training system. Through its powerful domain adaptation capability, this method is expected to significantly improve the domain drift problem faced by motor imagery EEG signals in practical applications, thereby improving the accuracy of motor intention classification and the overall robustness of the system. This provides stroke patients with a new approach to personalized and precise rehabilitation treatment based on brain-computer interface with great application prospects.
Claims
1. A method for adaptive EEG classification based on a dynamic joint domain adaptation network, characterized in that: The method comprises the following steps: S1. EEG Signal Acquisition and Preprocessing: The EEG signal is collected and filtered using a third-order Butterworth bandpass filter in the 4-38 Hz frequency band. The filtered signal is then subjected to exponential shift normalization before being transmitted to the host computer. S2. Signal Processing and Feature Extraction: After receiving the EEG signal preprocessed in step S1, the host computer performs signal feature extraction and classification based on the Dynamic Joint Domain Adaptation Network (DJDAN) model. The DJDAN model includes a feature extractor, a classifier, a global domain discriminator, and a local domain discriminator. S3. Rehabilitation control signal output: The host computer outputs the motion intention label of the classifier Converted into control signals required by rehabilitation equipment ; S4. Feedback and Evaluation: Rehabilitation equipment generates feedback signals based on the patient’s training movements The data are then transmitted to the host computer, which records and evaluates the patient's training progress; Step S2 specifically includes: S2.
1. Feature Extractor: The feature extractor uses a convolutional neural network (ConvNet) structure to extract the temporal and spatial features of the EEG signal, respectively, using temporal convolution and spatial convolution. First, the temporal convolution layer convolves the EEG signal along the time axis, using 40 convolution kernels of length 25 to learn the time-frequency information. Then, the spatial convolution layer performs spatial convolution between electrodes on the output of the temporal convolution, using 40 convolution kernels with a kernel length equal to the number of electrodes. , learning the spatial dependency between electrodes; finally, the batch normalization BN layer, square activation function, average pooling layer, logarithmic activation function and Dropout layer are used to generate deep features with high discrimination, which are recorded as ,in is the EEG signal unit processed by the model once, is the space where the output eigenvector is located, is the dimension of this feature vector; S2.
2. Classifier: The classifier receives the deep features generated by the feature extractor and The operation classifies the signal and outputs the patient's movement intention label ,in is the weight matrix, is the bias term, Represents the normalized exponential function, which returns the index of the maximum element in the input vector. Represents the activation function, which can convert a real number vector into a probability distribution vector. The labels correspond to different sports categories, and the classifier loss function is the cross entropy loss. : , in is the total number of task categories, is the one-hot representation of the true label, is the model prediction probability, represents the natural logarithm with base e; S2.
3. Global domain discriminator: The global domain discriminator is used to determine whether the deep features generated by the feature extractor are from the source domain or the target domain by performing binary classification on the deep features generated by the feature extractor. The global domain discriminator is used to reduce the global distribution difference between the source domain and the target domain, and the global adversarial loss Defined as: , in From the source domain A sample of Is from the target domain A sample of In the source domain The expectation obtained from the data distribution, In the target domain The expectation obtained from the data distribution, is the deep feature output by the feature extractor, It is the probability output of the global domain discriminator for the binary classification of the input features, and the output value is Between, represents the probability of the source domain, represents the natural logarithm with base e; S2.
4. Local domain discriminator: The local domain discriminator is used to reduce the distribution difference between the source domain and the target domain in the fine-grained subdomain. The local domain discriminator uses the patient's motion intention label predicted by the classifier , conditional adversarial learning is used to further align the deep features generated by the feature extractor to ensure the consistency of the features learned by the classifier across different domains. , introducing class-conditional local discriminator , using the predicted label probability weighted features for discrimination, local domain discriminator loss for: , in It is the local domain discriminator in the The binary classification probability output on the category, Indicates that the sample in the source domain belongs to the category The predicted probability of Indicates that the sample in the target domain belongs to the category The predicted probability of is the deep feature output by the feature extractor, It is the product of the classifier's category prediction probability and the feature, which is input into the local domain discriminator as a conditional feature; S2.
5. Training and Optimization: The DJDAN model is trained by optimizing the total loss function Implementation, total loss function Defined as: , in, To balance the hyperparameters of classification loss and domain discrimination loss, is a dynamic adversarial factor, which is used to dynamically adjust the relative importance of the global domain discriminator loss and the local domain discriminator loss. Dynamically adjust the weights of the global and local domain discriminators, and the calculation formula is: , in Indicates the total number of task categories, is the average value of the local A distance under all categories; if When it approaches 1, it indicates that the training focuses more on global domain differences; when it approaches 0, it focuses more on local domain consistency.
2. The EEG adaptive classification method based on dynamic joint domain adaptation network according to claim 1 is characterized in that: Step S1 specifically includes: S1.
1. Use an EEG acquisition device to collect motor imagery EEG signal data from stroke patients. The data collected by the EEG acquisition device includes The EEG signal of electrodes, where the number of electrodes , each trial contains sampling points, thus forming a dimension of The data matrix of S1.
2. Filter the raw EEG signals using a third-order Butterworth bandpass filter in the 4-38 Hz frequency band to remove frequency signals and noise irrelevant to the motor imagery task. S1.
3. Perform exponential shift normalization on the EEG signal filtered in step S1.2, and , the normalized EEG signal The calculation is as follows: , in After filtering at time point The input signal, and At time points The exponential moving average and variance of are calculated as follows: , , in is the attenuation factor, and The previous time point The exponential moving average and variance of ; S1.
4. The EEG signal after standardization in step S1.3 is transmitted to the host computer.
3. The EEG adaptive classification method based on dynamic joint domain adaptation network according to claim 1 is characterized in that: The average pooling layer described in S2.1 has a window size of 1x75 and a stride of 15.
4. The EEG adaptive classification method based on dynamic joint domain adaptation network according to claim 1 is characterized in that: In the Dropout layer described in S2.1, p=0.5, where p refers to the probability that the output of any neuron is randomly set to zero in each step of model training.
5. An application of the EEG adaptive classification method based on the dynamic joint domain adaptation network according to any one of claims 1 to 4 in stroke rehabilitation, characterized in that: The following steps are involved: 1) The host computer receives the EEG signal and classifies the EEG signal using the method according to any one of claims 1 to 4, identifies the patient's movement intention, and controls the rehabilitation equipment to perform corresponding actions; 2) The rehabilitation equipment performs movement training on the patient based on the control signals and feeds the training data back to the host computer for evaluation; 3) The upper computer uses the exercise assessment method of muscle activity monitoring to evaluate the patient's exercise training effect and help adjust the rehabilitation plan.
Citation Information
Patent Citations
Electroencephalogram self-adaptive model based on discriminant adversarial network, and application of electroencephalogram self-adaptive model in rehabilitation
CN111584029A
Domain-adaptive cross-subject motor imagery electroencephalogram signal recognition system and method
CN113408397A