Cross-subject class incremental learning method of motor imagery classification model and classification method
By employing an incremental learning method across subject classes, a local replay sample pool and an Euclidean space alignment matrix are constructed. Combined with nonlinear dimensionality reduction, the memory and time consumption issues of the motion imagery classification model when expanding categories are resolved, achieving stability of old tasks and improved accuracy of new tasks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-03
- Publication Date
- 2026-03-27
AI Technical Summary
Existing technologies require data collection and model retraining when expanding categories in motion imagery classification models, resulting in high memory and time consumption. Furthermore, they struggle to maintain the stability of old tasks and improve classification accuracy for new tasks in dynamic scenarios.
We employ a cross-subject class incremental learning approach. By constructing a local replay sample pool and an Euclidean space alignment matrix, combined with nonlinear dimensionality reduction, we select EEG data closest to the centroid for sample selection and data alignment. This constructs local and global replay mechanisms to maintain old knowledge and improve the accuracy of new tasks.
In the process of incremental learning across subject classes, it effectively reduces redundancy, maintains feature consistency, eliminates distribution bias, and improves classification accuracy, making it suitable for application scenarios that dynamically expand the categories of motion imagination.
Smart Images

Figure CN121743966A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of brain-computer interfaces, and more specifically, relates to a cross-subject class incremental learning method and classification method for a motor imagery classification model. Background Technology
[0002] Brain-computer interface (BCI) refers to the creation of a direct connection between the brain and an external device, enabling information exchange between the brain and the device. Motor imagery (MI) is a classic paradigm in BCI, which involves imagining specific limb movements without actually performing physical actions. The theoretical basis of MI lies in event-related desynchronization and event-related synchronization.
[0003] Electroencephalography (EEG) is widely used in non-invasive brain-computer interfaces due to its ease of acquisition and high temporal resolution. In the motor cortex (MI) task, EEG signals reflect the activation levels of different regions of the motor cortex and can be decoded into control commands using classification algorithms. MI has been successfully applied in various fields such as robot control, hand orthotics, and stroke rehabilitation.
[0004] Mind Space (MI) classification algorithms can be categorized into machine learning methods and deep learning methods. In machine learning, cospace patterns are often combined with traditional classifiers such as SVM (Support Vector Machine) and LDA (Linear Discriminant Analysis). In contrast, deep learning methods extract features from the raw signal in an end-to-end manner and have shown reliable results, such as EEGNet and Deep ConvNet. However, current research on MI focuses only on static scenarios where the number of categories is fixed. When users wish to expand the activity types, data for all categories must be collected again and the model retrained, which is a huge drain on memory and time.
[0005] Class-incremental learning (CIL) aims to retain knowledge of previous classes while continuously learning new tasks with different classes, with the goal of developing a single model that achieves high performance across all learned classes. CIL allows for dynamic expansion of the number of classes (MI) without resampling data. Replay-based methods are effective in CIL by retaining some old task data and adding it to the training of new tasks to mitigate forgetting; the core principle is to preserve samples that maximize knowledge of old tasks. However, most replay-based methods only consider the representativeness of the samples, which easily leads to sample redundancy.
[0006] Therefore, in the practical application of motion imagination in dynamic scenes, we need to introduce incremental learning to maintain the stability of old categories and the plasticity of new tasks. How to achieve the maximum performance gain with the fewest labeled samples, and improve the classification accuracy of new tasks while ensuring the stability of old tasks, is an urgent problem to be solved. Summary of the Invention
[0007] In view of the above-mentioned defects or improvement needs of existing technologies, this invention provides a cross-subject class incremental learning method and classification method for a motion imagery classification model, thereby solving the technical problem of how to achieve the maximum performance gain with the fewest labeled samples, and improve the classification accuracy for new tasks while ensuring the stability of old tasks.
[0008] To achieve the above objectives, according to a first aspect of the present invention, a cross-subject class incremental learning method for a motion imagery classification model is provided, comprising: If the current training task is the first training task, the motor imagery classification model is trained based on the EEG data and classification labels of each subject corresponding to the current training task, and multiple EEG data are selected from the EEG data of each subject corresponding to the current training task to construct a local replay sample pool; different training tasks correspond to different classification tasks. Otherwise, the motor imagery classification model is trained based on the EEG data and classification labels of each subject corresponding to the current training task and the EEG data and classification labels in the local replay sample pool, and multiple EEG data are selected from the EEG data of each subject corresponding to the current training task to update the local replay sample pool. The selection of multiple EEG data points from the EEG data of each subject corresponding to the current training task specifically includes: Based on the preset number of local replays and the number of subjects, the sample selection number corresponding to each subject is determined; For any subject, the EEG data corresponding to the current training task of any subject are clustered based on the number of samples selected for that subject, resulting in a corresponding number of clusters. The EEG data closest to the centroid is then selected from each cluster to construct or update the local playback sample pool.
[0009] Based on the cross-subject class incremental learning method of the above-mentioned motor imagery classification model, the motor imagery classification model is trained for any training task, specifically including: Acquire training data corresponding to any of the training tasks; the training data is the EEG data of the subject corresponding to any of the training tasks or the EEG data in the local playback sample pool; If any of the training tasks is the first training task, then based on the EEG data of each subject corresponding to any training task, the Euclidean space alignment matrix of each subject corresponding to any training task is determined, and the training data corresponding to any training task is aligned based on the Euclidean space alignment matrix of each subject corresponding to any training task to obtain the alignment sample corresponding to any training task; otherwise, based on the EEG data of each subject corresponding to any training task, the Euclidean space alignment matrix of each subject corresponding to any training task is determined, and the training data corresponding to any training task is aligned based on the fusion result of the historical training tasks of each subject and the Euclidean space alignment matrix of any training task to obtain the alignment sample corresponding to any training task. The motion imagery classification model is trained based on the aligned samples and their classification labels corresponding to any of the training tasks.
[0010] Based on the cross-subject class incremental learning method of the above-mentioned motor imagery classification model, the step of determining the Euclidean space alignment matrix of each subject for each training task based on the EEG data of each subject for each training task specifically includes: For any subject, calculate the mean covariance matrix of the EEG data of that subject corresponding to any training task; Based on the mean covariance matrix of the EEG data of any subject corresponding to any training task, the Euclidean space alignment matrix of any subject corresponding to any training task is determined, such that the mean covariance matrix of the aligned data obtained by multiplying the Euclidean space alignment matrix of any subject corresponding to any training task with the EEG data of any subject corresponding to any training task is the identity matrix.
[0011] Based on the cross-subject class incremental learning method of the above-mentioned motor imagery classification model, the step of aligning the training data corresponding to any training task based on the fusion result of the historical training tasks corresponding to each subject and the Euclidean space alignment matrix of any training task to obtain the aligned sample corresponding to any training task specifically includes: Calculate the average value of each matrix element in the Euclidean space alignment matrix of any subject's historical training task and any training task to obtain the merge alignment matrix corresponding to any subject. The merged alignment matrix corresponding to any subject is multiplied by the training data belonging to any subject corresponding to any training task to obtain the alignment sample.
[0012] According to the cross-subject class incremental learning method of the above-mentioned motion imagery classification model, the step of training the motion imagery classification model based on the aligned samples and their classification labels corresponding to any training task specifically includes: If the current iteration round is less than the preset round, the parameters of the feature reduction model are frozen, and the parameters of the feature extraction module and the first classification module in the motion imagery classification model are adjusted based on the aligned samples and their classification labels corresponding to any training task; the feature extraction module is used to extract features from the input aligned samples, and the first classification module is used to classify the classification features output by the feature extraction module. If the current iteration round is greater than the preset round, the parameters of the motion imagery classification model are frozen. Based on the aligned samples and their classification labels corresponding to any training task, the parameters of the feature selection module and the second classification module in the feature dimensionality reduction model are adjusted. The feature selection module is used to select features from the input aligned samples, and the second classification module is used to classify the selected features output by the feature selection module. Specifically, when clustering the EEG data of any subject corresponding to the current training task based on the number of samples selected for that subject, the feature selection module is used to select features from the EEG data of the subject corresponding to the current training task, so as to perform clustering based on the selected features output by the feature selection module.
[0013] Based on the cross-subject class incremental learning method of the above-mentioned motion imagery classification model, the adjustment of the parameters of the feature selection module and the second classification module in the feature dimensionality reduction model based on the aligned samples and their classification labels corresponding to any training task specifically includes: The aligned samples are input into the feature dimensionality reduction model to obtain the selected features output by the feature selection module and the classification result output by the second classification module; The aligned samples are input into the motion imagery classification model to obtain the classification features output by the feature extraction module; Based on the classification results and corresponding classification labels output by the second classification module, the classification loss corresponding to the feature dimensionality reduction model is calculated; Based on the difference between the classification features and selected features output by the feature extraction module and the feature selection module for the same aligned sample, the feature dimensionality reduction loss corresponding to the feature dimensionality reduction model is calculated. Based on the classification loss and feature dimensionality reduction loss corresponding to the feature dimensionality reduction model, the parameters of the feature selection module and the second classification module are adjusted.
[0014] According to a second aspect of the present invention, a cross-subject class incremental learning device for a motor imagery classification model is provided, the cross-subject class incremental learning device being used to perform the cross-subject class incremental learning method for the motor imagery classification model as described in the first aspect.
[0015] According to a third aspect of the present invention, a classification method is provided, comprising: Acquire the EEG data currently to be classified; The EEG data is input into the motor imagery classification model to obtain the motor imagery classification result of the EEG data output by the motor imagery classification model; The motor imagery classification model is trained based on the cross-subject class incremental learning method of the motor imagery classification model as described in the first aspect.
[0016] According to a fourth aspect of the invention, a classification apparatus is provided for performing the classification method as described in the third aspect.
[0017] According to a fifth aspect of the present invention, an electronic device is provided, comprising: a computer-readable storage medium and a processor; The computer-readable storage medium is used to store executable instructions; The processor is configured to read executable instructions stored in the computer-readable storage medium and execute the method described in the first or third aspect.
[0018] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects: By constructing and continuously updating the local replay sample pool, the motor imagery classification model can learn new knowledge while retaining old knowledge during incremental learning across subject classes. Furthermore, by uniformly selecting EEG data from each subject, samples covering the complete feature space can be chosen. More importantly, by selecting the EEG data closest to the centroid within each cluster, the most representative sample for that cluster can be selected, reducing redundancy. This allows for the selection of a replay set that is both representative and diverse, while minimizing redundancy and preserving the subject distribution.
[0019] As a preferred approach, for the first training task, the Euclidean space alignment matrix of each subject corresponding to that training task is calculated. Based on this alignment matrix, the training data for that task is aligned, and the mean covariance matrix of the EEG data for all subjects corresponding to the same training task is converted into an identity matrix. This makes the data distribution across subjects more similar, eliminating distributional bias between subjects and promoting knowledge sharing among different subjects. During training for subsequent tasks, the Euclidean space alignment matrices of each subject corresponding to previous training tasks and the current training task are fused. The fusion result is then used to align the training data for that training task. This not only achieves the aforementioned effect of eliminating distributional bias between subjects but also serves as a global replay mechanism, preserving the data distribution information of each subject in past tasks while narrowing the distribution differences between subjects in different tasks. This helps maintain global knowledge and feature consistency, preventing the model from becoming overly biased towards new tasks and causing domain shift.
[0020] As a preferred approach, sample selection often relies on high-dimensional deep features, such as the distance to the class center or decision boundary, which is easily affected by the curse of dimensionality in MI tasks. Therefore, in order to alleviate this problem, a nonlinear dimensionality reduction method is proposed. Unlike traditional linear methods, this nonlinear dimensionality reduction method retains the discriminative power of features while reducing dimensionality. Attached Figure Description
[0021] Figure 1 A schematic diagram of a partial playback method provided in an embodiment of the present invention; Figure 2 A schematic diagram of the alignment method provided in an embodiment of the present invention; Figure 3 A schematic diagram of the cross-subject class incremental learning framework provided in an embodiment of the present invention; Figure 4 This is one of the comparison diagrams between the cross-subject class incremental learning method provided in this embodiment of the invention and various baseline methods; Figure 5 The second comparison diagram is between the cross-subject class incremental learning method provided in this embodiment of the invention and various baseline methods; Figure 6 A comparison chart showing the effects of various strategies for playback, alignment, and dimensionality reduction provided in the embodiments of the present invention; Figure 7 The diagram shows a comparison of the replay strategies provided in the embodiments of the present invention, where (a) is the replay effect of the random selection method, (b) is the replay effect of the mean-like method, (c) is the replay effect of the grazing strategy, and (d) is the replay effect of the local replay strategy provided in the embodiments of the present invention. Figure 8One of the comparison diagrams is shown between the local playback strategy provided in the embodiments of the present invention and the traditional method; Figure 9 The second comparison diagram shows the local playback strategy provided in this embodiment of the invention and the traditional method. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0023] This invention provides a cross-subject class incremental learning method for a motion imagery classification model, comprising: If the current training task is the first training task, the motor imagery classification model is trained based on the EEG data and classification labels of each subject corresponding to the current training task, and multiple EEG data are selected from the EEG data of each subject corresponding to the current training task to construct a local replay sample pool; different training tasks correspond to different classification tasks. Otherwise, the motor imagery classification model is trained based on the EEG data and classification labels of each subject corresponding to the current training task and the EEG data and classification labels in the local replay sample pool, and multiple EEG data are selected from the EEG data of each subject corresponding to the current training task to update the local replay sample pool. The step of selecting multiple EEG data points from the EEG data of each subject corresponding to the current training task specifically includes: Based on the preset number of local replays and the number of subjects, the sample selection number corresponding to each subject is determined; For any subject, the EEG data corresponding to the current training task of any subject are clustered based on the number of samples selected for that subject, resulting in a corresponding number of clusters. The EEG data closest to the centroid is then selected from each cluster to construct or update the local playback sample pool.
[0024] Specifically, one challenge in ensuring stability for old tasks while improving adaptability for new tasks lies in the "catastrophic forgetting" problem. Neural networks typically preserve knowledge through parameter optimization; therefore, parameter changes resulting from learning new categories can severely degrade the model's performance on older categories, rendering it unusable on those tasks. To address this, this invention provides a novel replay mechanism to overcome this problem.
[0025] For the motor imagery classification scenario, during the cross-subject class incremental learning process of the motor imagery classification model, training tasks arrive sequentially, and each training task introduces a new motor category. All subjects participate in each training task to provide training data. For the first training task, the motor imagery classification model can be trained based on the EEG data and classification labels (labeling the corresponding motor type) of each subject for the current training task. After the current training task is completed, multiple EEG data points are selected from each subject's EEG data corresponding to the current training task to construct a local replay sample pool to implement the local replay strategy. This local replay sample pool will provide relevant information from the old training tasks in subsequent training tasks, helping the model not to forget the knowledge of the old tasks while learning the knowledge of the new tasks. Therefore, for subsequent training tasks, the motor imagery classification model can be trained based on the EEG data and classification labels of each subject for the current training task, as well as the EEG data and classification labels in the local replay sample pool. Similarly, after the current training task ends, multiple EEG data points are selected from the EEG data of each subject corresponding to the current training task to update the local replay sample pool for use in subsequent training tasks. It is evident that the construction and continuous updating of the local replay sample pool is crucial for the motor imagery classification model to learn new knowledge while retaining old knowledge during incremental learning across subject classes.
[0026] To improve the cross-subject class incremental learning performance of the motor imagery classification model, when selecting multiple EEG data points from each subject's EEG data corresponding to the current training task to construct or update the local replay sample pool, the number of samples selected for each subject can be determined based on a preset number of local replays and the number of subjects. Then, for any subject, such as... Figure 1 As shown, based on the number of samples selected for the subject, the EEG data of the subject corresponding to the current training task are clustered to obtain a corresponding number of clusters, and the EEG data closest to the centroid is selected from each cluster.
[0027] Assuming a preset local replay count of M EEG data points for each category, the sample selection for each category can be based on the number of subjects. Specifically, for any category, each subject will have M / S (the number of selected subjects) EEG data points replayed, where S is the number of subjects, ensuring the samples cover the entire data space. Within the sample set of EEG data points from a single subject, clustering algorithms such as KMeans++ can be applied to better initialize centroids and improve clustering stability, clustering all EEG data points into a number of clusters equal to the number of selected subjects, i.e., M / S. From each cluster, the EEG data point closest to the centroid can be selected as a representative for replay and placed in the local replay sample pool. For example, EEG data can be selected based on the following formula:
[0028] in Indicates the first Clusters, It is its center of mass. This represents the EEG data within the cluster. By uniformly selecting the EEG data from each subject and initializing using KMeans++, samples covering the entire feature space can be selected. More importantly, by selecting the EEG data closest to the centroid within each cluster, the most representative sample for that cluster can be chosen, reducing redundancy. This allows for the selection of a replay set that is both representative and diverse, while minimizing redundancy and preserving the subject distribution.
[0029] Furthermore, unlike the generally consistent data distribution in the image domain, BCI faces the challenge of distribution shifts among subjects due to individual differences in brain activity and external factors. In Cross Subject Class-Incremental Learning (CS-CIL), this shift further degrades model performance. To address the issue of distribution shifts among subjects and to better retain knowledge from older training tasks during the learning process of new training tasks, different mechanisms can be used to align the EEG data of each subject across different training tasks. Specifically, for any training task, the corresponding training data is first acquired. This training data can be the EEG data of the subject corresponding to that training task or EEG data from a local replay sample pool. Then, different alignment strategies are adopted for different training tasks: For the first training task, based on the EEG data of each subject corresponding to the training task, a Euclidean space alignment matrix for each subject corresponding to the training task can be determined, and the training data corresponding to the training task can be aligned based on the Euclidean space alignment matrix of each subject corresponding to the training task to obtain the alignment sample corresponding to the training task; For subsequent training tasks, based on the EEG data of each subject corresponding to the training task, a Euclidean space alignment matrix for each subject corresponding to the training task can be determined, and the training data corresponding to the training task can be aligned based on the fusion result of the historical training tasks of each subject and the Euclidean space alignment matrix of the current training task to obtain the alignment sample corresponding to the training task. Based on the alignment sample corresponding to the training task and its classification label, the motor imagery classification model can be trained.
[0030] Here, during the training process of the first training task, such as Figure 2As shown, by calculating the Euclidean space alignment matrix of each subject for the corresponding training task, and aligning the training data for that training task based on this alignment matrix, the mean covariance matrix of the EEG data for all subjects corresponding to the same training task is converted into an identity matrix. This makes the data distribution across subjects more similar, eliminating distributional bias between subjects and promoting knowledge sharing among different subjects. During training for tasks other than the first one, by fusing the Euclidean space alignment matrix of each subject for the previous training task with the data from that task, the fusion result is used to align the training data for that task. This not only achieves the aforementioned effect of eliminating distributional bias between subjects but also serves as a global replay mechanism. It preserves the data distribution information of each subject in past tasks while narrowing the distribution differences between subjects in different tasks, helping to maintain global knowledge and feature consistency, and preventing the model from becoming overly biased towards new tasks, thus preventing domain shift.
[0031] In some embodiments, when determining the Euclidean alignment matrix of each subject for the corresponding training task based on their EEG data, the mean covariance matrix of the EEG data for that subject for the training task can be calculated using the following formula for any given subject:
[0032] in, Let N be the mean covariance matrix of the EEG data for this subject corresponding to the training task, and N be the number of EEG data points for any subject. The EEG data of the subject corresponding to the training task.
[0033] Subsequently, based on the mean covariance matrix of the subject's EEG data corresponding to the training task, the Euclidean space alignment matrix of the subject for the training task can be determined, such that the mean covariance matrix of the aligned data obtained by multiplying the subject's Euclidean space alignment matrix for the training task with the subject's EEG data for the training task is an identity matrix. The subject's Euclidean space alignment matrix for the training task can be expressed as follows: The mean covariance matrix of the aligned data, obtained by multiplying the Euclidean space alignment matrix of the subject for the corresponding training task with the EEG data of the subject for the corresponding training task, can be represented as follows:
[0034] in, .
[0035] In other embodiments, when aligning the training data corresponding to a training task, based on the fusion result of the historical training task corresponding to each subject and the Euclidean space alignment matrix of that training task, the average value of each matrix element in the Euclidean space alignment matrix of the historical training task corresponding to any subject can be calculated based on the following formula to obtain the merged alignment matrix corresponding to that subject:
[0036] in, , where is the Euclidean alignment matrix of the training task t corresponding to the subject.
[0037] Subsequently, the merged alignment matrix corresponding to the subject is multiplied by the training data belonging to the subject corresponding to the training task to obtain the aligned sample.
[0038] In some embodiments, considering that sample selection during CS-CIL replay often relies on high-dimensional deep features, such as distances to class centers or decision boundaries, this is susceptible to the curse of dimensionality in MI tasks. To alleviate this problem, embodiments of the present invention propose a nonlinear dimensionality reduction method. Unlike traditional linear methods (such as PCA or LDA), embodiments of the present invention preserve the discriminative power of features while reducing dimensionality. Specifically, a two-stage training strategy will be adopted during the training process for any training task: If the current epoch is less than the preset epoch, the parameters of the feature reduction model are frozen. Based on the aligned samples and their classification labels corresponding to the training task, the parameters of the feature extraction module and the first classification module in the motion imagery classification model are adjusted. The feature extraction module extracts features from the input aligned samples, and the first classification module classifies the classification features output by the feature extraction module to obtain the motion category of the corresponding aligned sample predicted by the motion imagery classification model. When adjusting the parameters of the feature extraction module and the first classification module, the model loss at this stage can be calculated using the following cross-entropy loss function, and the parameters can be adjusted based on this model loss:
[0039] Where C is the sample size. Let i be the classification label. The classification features output by the feature extraction module. This represents the probability of each motion category corresponding to sample i output by the first classification module.
[0040] If the current iteration number is greater than a preset number of iterations, the parameters of the motion imagery classification model are frozen. Based on the aligned samples and their classification labels corresponding to the training task, the parameters of the feature selection module and the second classification module in the feature reduction model are adjusted. The feature selection module selects features from the input aligned samples, and the second classification module classifies the selected features output by the feature selection module to obtain the motion category of the corresponding aligned sample predicted by the feature reduction model. In some embodiments, the feature reduction model can be constructed based on an MLP (Multi-Layer Perceptron).
[0041] In some embodiments, when adjusting the parameters of the feature selection module and the second classification module in the feature dimensionality reduction model, aligned samples can be input into the feature dimensionality reduction model to obtain the selected features output by the feature selection module and the classification results output by the second classification module. Simultaneously, aligned samples can also be input into the motion imagery classification model to obtain the classification features output by the feature extraction module. Based on the classification results output by the second classification module and the corresponding classification labels, the classification loss corresponding to the feature dimensionality reduction model can be calculated using the following formula:
[0042] in, The selected features output by the feature selection module. This represents the probability of each motion category corresponding to sample i output by the second classification module.
[0043] Based on the difference between the classification features and selected features output by the feature extraction and feature selection modules for the same aligned sample, the feature dimensionality reduction loss corresponding to the feature dimensionality reduction model is calculated. For example, the feature dimensionality reduction loss corresponding to the feature dimensionality reduction model can be calculated based on the following formula:
[0044] in, The softmax normalized distribution of the classification features output by the feature extraction module. The softmax normalized distribution of the selected features output by the feature selection module.
[0045] Based on the classification loss and feature dimensionality reduction loss corresponding to the above feature dimensionality reduction model, the model loss for this stage is calculated, and the parameters of the feature selection module and the second classification module are adjusted based on the model loss for this stage. For example, the model loss for this stage can be calculated using the following formula:
[0046] in, It is a hyperparameter that balances the two losses.
[0047] After the training process for the current training task is completed, when constructing or updating the local playback sample pool by selecting multiple EEG data points from the EEG data of each subject corresponding to the current training task, clustering is performed on the EEG data of any subject corresponding to the current training task. At this time, the aforementioned feature selection module can be used to perform feature selection on the EEG data of the subject corresponding to the current training task. That is, the EEG data of the subject corresponding to the current training task are input into the feature selection module, and the selected features corresponding to each EEG data point are obtained from the output of the feature selection module. Clustering is then performed based on the selected features corresponding to each EEG data point.
[0048] Overall, the entire cross-subject class incremental learning framework (REMIND) of the motor imagery classification model is as follows: Figure 3 As shown, for the first training task, the training data can be aligned based on the alignment method provided in the above embodiments, wherein... Figure 3 The EA matrix is the Euclidean alignment matrix of any subject for the training task, and it can also be stored in the Global Reply Buffer for subsequent global replay; in the current iteration round less than the preset round (e.g., Figure 3 In the first stage of the training task (M), the parameters of the feature reduction model are frozen. Based on the aligned samples and their classification labels corresponding to the training task, the motor imagery classification model is adjusted. In the second stage, when the current iteration round is greater than the preset round, the parameters of the motor imagery classification model are frozen. Based on the aligned samples and their classification labels corresponding to the training task, the parameters of the feature selection module and the second classification module in the feature reduction model are adjusted. After training is completed, multiple EEG data are selected from the EEG data of each subject corresponding to the current training task to construct a local playback sample pool (SampleBuffer).
[0049] For subsequent training tasks, the basic process is similar to the first training task. The difference lies in the training data, which includes not only the EEG data of each subject corresponding to the current training task, but also EEG data from the local playback sample pool. Therefore, during alignment, the Euclidean alignment matrix of the subject's historical training task (located in the global playback buffer) can be fused with the Euclidean alignment matrix corresponding to the current training task to obtain a merged alignment matrix, and then alignment is performed based on the merged alignment matrix. Furthermore, for later training tasks (e.g., starting from the T-th training task), the second stage of learning can be omitted, i.e., the parameters of the feature dimensionality reduction model are no longer adjusted.
[0050] Figure 4-5The results show the comparison between the cross-subject class incremental learning method provided in the above embodiments and various baseline methods on two public MI datasets, with the numerical values that outperform all comparison methods indicated in bold. The experimental results demonstrate that the method provided by the embodiments of the present invention achieves significantly better performance than the comparison methods on all task sequences, particularly excelling in overcoming cross-subject distribution shift and mitigating catastrophic forgetting. On the BCI Competition IV-2a dataset (four-class classification task), the method provided by the embodiments of the present invention achieves a final average accuracy of 43.0%, an improvement of 3.9% over the best baseline method; on the Weibo dataset (six-class classification task), it achieves an accuracy of 32.8%, expanding its lead to 2.4%. These results fully demonstrate the effectiveness of the method provided by the embodiments of the present invention in dynamically expanding MI categories.
[0051] To verify the effectiveness of the method provided in the embodiments of the present invention, the contributions of each module were also evaluated. For example... Figure 6 As shown, taking the BCI Competition IV-2a dataset as an example, when only the local replay strategy provided in this embodiment of the invention is used, the model's accuracy on the old task is improved by 6.1% compared to the baseline, indicating that the selection of representative samples is crucial for knowledge preservation. Furthermore, after introducing an alignment matrix for global replay, the performance is further improved by 3.4%, confirming the effect of cross-subject alignment on improving distribution shift. Finally, the complete solution combining dimensionality reduction (i.e., KLMap in the figure) achieves the best balance between the old and new tasks.
[0052] The advantages of local playback strategies can be intuitively observed through feature space visualization. For example... Figure 7 As shown, the samples selected by the local replay strategy are evenly distributed across the core and boundary regions of each category, while the random selection method exhibits obvious clustering, and the class mean method concentrates the samples in a narrow region. This favorable distribution characteristic allows the local replay strategy to more comprehensively preserve the original data features.
[0053] like Figure 8-9 As shown, the local replay strategy demonstrates significant advantages in the comparison of sample selection strategies. Compared to class mean selection in traditional incremental class learning, the local replay strategy significantly improves the preservation of class diversity, achieving the highest accuracy. Furthermore, compared to active learning methods that focus on uncertainty, the local replay strategy effectively avoids interference from outlier samples during model training. These advantages enable the local replay strategy to achieve optimal knowledge preservation within a limited memory budget.
[0054] The above results show that the local replay strategy achieves optimal knowledge retention without a limited memory budget. Furthermore, the addition of EA alignment and dimensionality reduction makes the method proposed in this invention more suitable for dynamic application scenarios such as cross-subject motor imagery.
[0055] In summary, the cross-subject class incremental learning method for the motor imagery classification model provided in this embodiment of the invention can achieve the following beneficial effects: By constructing and continuously updating the local replay sample pool, the motor imagery classification model can learn new knowledge while retaining old knowledge during incremental learning across subject classes. Furthermore, by uniformly selecting EEG data from each subject, samples covering the complete feature space can be chosen. More importantly, by selecting the EEG data closest to the centroid within each cluster, the most representative sample for that cluster can be selected, reducing redundancy. This allows for the selection of a replay set that is both representative and diverse, while minimizing redundancy and preserving the subject distribution.
[0056] As a preferred approach, for the first training task, the Euclidean space alignment matrix of each subject corresponding to that training task is calculated. Based on this alignment matrix, the training data for that task is aligned, and the mean covariance matrix of the EEG data for all subjects corresponding to the same training task is converted into an identity matrix. This makes the data distribution across subjects more similar, eliminating distributional bias between subjects and promoting knowledge sharing among different subjects. During training for subsequent tasks, the Euclidean space alignment matrices of each subject corresponding to previous training tasks and the current training task are fused. The fusion result is then used to align the training data for that training task. This not only achieves the aforementioned effect of eliminating distributional bias between subjects but also serves as a global replay mechanism, preserving the data distribution information of each subject in past tasks while narrowing the distribution differences between subjects in different tasks. This helps maintain global knowledge and feature consistency, preventing the model from becoming overly biased towards new tasks and causing domain shift.
[0057] As a preferred approach, sample selection often relies on high-dimensional deep features, such as the distance to the class center or decision boundary, which is easily affected by the curse of dimensionality in MI tasks. Therefore, in order to alleviate this problem, a nonlinear dimensionality reduction method is proposed. Unlike traditional linear methods, this nonlinear dimensionality reduction method retains the discriminative power of features while reducing dimensionality.
[0058] Based on any of the above embodiments, this invention also provides a classification method, including: Acquire the EEG data currently to be classified; The EEG data is input into the motor imagery classification model to obtain the motor imagery classification result of the EEG data output by the motor imagery classification model; The motor imagery classification model is trained using a cross-subject class incremental learning method based on the motor imagery classification model provided in any of the above embodiments.
[0059] The following describes the cross-subject class incremental learning device for the motor imagery classification model provided by the present invention. The cross-subject class incremental learning device for the motor imagery classification model described below can be referred to in correspondence with the cross-subject class incremental learning method for the motor imagery classification model described above.
[0060] This invention provides a cross-subject class incremental learning device for a motor imagery classification model, used to execute the cross-subject class incremental learning method for the motor imagery classification model provided in the above embodiments.
[0061] This invention also provides a classification device for performing the classification method provided in the above embodiments.
[0062] This invention provides an electronic device, including: a computer-readable storage medium and a processor; The computer-readable storage medium is used to store executable instructions; The processor is configured to read executable instructions stored in the computer-readable storage medium and execute the method as described in any of the above embodiments.
[0063] This invention provides a computer-readable storage medium storing computer instructions that cause a processor to perform the method described in any of the above embodiments.
[0064] This invention provides a computer program product, including a computer program or instructions, which, when executed by a processor, implement the method described in any of the above embodiments.
[0065] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A cross-subject class incremental learning method for a motor imagery classification model, characterized in that, include: If the current training task is the first training task, the motor imagery classification model is trained based on the EEG data and classification labels of each subject corresponding to the current training task, and multiple EEG data are selected from the EEG data of each subject corresponding to the current training task to construct a local replay sample pool; different training tasks correspond to different classification tasks. Otherwise, the motor imagery classification model is trained based on the EEG data and classification labels of each subject corresponding to the current training task and the EEG data and classification labels in the local replay sample pool, and multiple EEG data are selected from the EEG data of each subject corresponding to the current training task to update the local replay sample pool. The selection of multiple EEG data points from the EEG data of each subject corresponding to the current training task specifically includes: Based on the preset number of local replays and the number of subjects, the sample selection number corresponding to each subject is determined; For any subject, the EEG data corresponding to the current training task of any subject are clustered based on the number of samples selected for that subject, resulting in a corresponding number of clusters. The EEG data closest to the centroid is then selected from each cluster to construct or update the local playback sample pool.
2. The cross-subject class incremental learning method for the motor imagery classification model as described in claim 1, characterized in that, For any training task, the motion imagery classification model is trained, specifically including: Acquire training data corresponding to any of the training tasks; the training data is the EEG data of the subject corresponding to any of the training tasks or the EEG data in the local playback sample pool; If any of the training tasks is the first training task, then based on the EEG data of each subject corresponding to any of the training tasks, the Euclidean space alignment matrix of each subject corresponding to any of the training tasks is determined, and the training data corresponding to any of the training tasks is aligned based on the Euclidean space alignment matrix of each subject corresponding to any of the training tasks to obtain the alignment sample corresponding to any of the training tasks; otherwise, based on the EEG data of each subject corresponding to any of the training tasks, the Euclidean space alignment matrix of each subject corresponding to any of the training tasks is determined, and the training data corresponding to any of the training tasks is aligned based on the fusion result of the historical training tasks of each subject and the Euclidean space alignment matrix of any of the training tasks to obtain the alignment sample corresponding to any of the training tasks. The motion imagery classification model is trained based on the aligned samples and their classification labels corresponding to any of the training tasks.
3. The cross-subject class incremental learning method for the motor imagery classification model as described in claim 2, characterized in that, The step of determining the Euclidean space alignment matrix for each subject corresponding to any training task, based on the EEG data of each subject for each training task, specifically includes: For any subject, calculate the mean covariance matrix of the EEG data of that subject corresponding to any training task; Based on the mean covariance matrix of the EEG data of any subject corresponding to any training task, the Euclidean space alignment matrix of any subject corresponding to any training task is determined, such that the mean covariance matrix of the aligned data obtained by multiplying the Euclidean space alignment matrix of any subject corresponding to any training task with the EEG data of any subject corresponding to any training task is the identity matrix.
4. The cross-subject class incremental learning method for the motor imagery classification model as described in claim 2, characterized in that, The step of aligning the training data corresponding to any training task based on the fusion result of the historical training tasks corresponding to each subject and the Euclidean space alignment matrix of any training task to obtain the aligned sample corresponding to any training task specifically includes: Calculate the average value of each matrix element in the Euclidean space alignment matrix of any subject's historical training task and any training task to obtain the merge alignment matrix corresponding to any subject. The merged alignment matrix corresponding to any subject is multiplied by the training data belonging to any subject corresponding to any training task to obtain the alignment sample.
5. The cross-subject class incremental learning method for the motor imagery classification model as described in any one of claims 2 to 4, characterized in that, The process of training the motion imagery classification model based on the aligned samples and their classification labels corresponding to any of the training tasks specifically includes: If the current iteration round is less than the preset round, the parameters of the feature reduction model are frozen, and the parameters of the feature extraction module and the first classification module in the motion imagery classification model are adjusted based on the aligned samples and their classification labels corresponding to any training task; the feature extraction module is used to extract features from the input aligned samples, and the first classification module is used to classify the classification features output by the feature extraction module. If the current iteration round is greater than the preset round, the parameters of the motion imagery classification model are frozen. Based on the aligned samples and their classification labels corresponding to any training task, the parameters of the feature selection module and the second classification module in the feature dimensionality reduction model are adjusted. The feature selection module is used to select features from the input aligned samples, and the second classification module is used to classify the selected features output by the feature selection module. Specifically, when clustering the EEG data of any subject corresponding to the current training task based on the number of samples selected for that subject, the feature selection module is used to select features from the EEG data of the subject corresponding to the current training task, so as to perform clustering based on the selected features output by the feature selection module.
6. The cross-subject class incremental learning method for the motor imagery classification model as described in claim 5, characterized in that, The step of adjusting the parameters of the feature selection module and the second classification module in the feature dimensionality reduction model based on the aligned samples and their classification labels corresponding to any of the training tasks specifically includes: The aligned samples are input into the feature dimensionality reduction model to obtain the selected features output by the feature selection module and the classification result output by the second classification module; The aligned samples are input into the motion imagery classification model to obtain the classification features output by the feature extraction module; Based on the classification results and corresponding classification labels output by the second classification module, the classification loss corresponding to the feature dimensionality reduction model is calculated; Based on the difference between the classification features and selected features output by the feature extraction module and the feature selection module for the same aligned sample, the feature dimensionality reduction loss corresponding to the feature dimensionality reduction model is calculated. Based on the classification loss and feature dimensionality reduction loss corresponding to the feature dimensionality reduction model, the parameters of the feature selection module and the second classification module are adjusted.
7. A cross-subject class incremental learning device for a motor imagery classification model, characterized in that, The cross-subject class incremental learning device is used to perform the cross-subject class incremental learning method of the motor imagery classification model as described in any one of claims 1 to 6.
8. A classification method, characterized in that, include: Acquire the EEG data currently to be classified; The EEG data is input into the motor imagery classification model to obtain the motor imagery classification result of the EEG data output by the motor imagery classification model; The motor imagery classification model is trained using a cross-subject class incremental learning method based on the motor imagery classification model as described in any one of claims 1 to 6.
9. A sorting device, characterized in that, The classification device is used to perform the classification method as described in claim 8.
10. An electronic device, characterized in that, include: Computer-readable storage media and processors; The computer-readable storage medium is used to store executable instructions; The processor is configured to read executable instructions stored in the computer-readable storage medium and execute the method as described in any one of claims 1-6 and 8.