Motor imagery brain-computer interface MI-BMI classification method based on electroencephalogram EEG signal
By adopting convolutional neural network model and automatic channel selection technology in MI-BMI system, the problem of high computing resources of MI-BMI system on low-power MCUs is solved, and real-time EEG signal classification with high accuracy and low resource requirements is achieved , suitable for wearable devices, improving user experience and battery life.
Patent Information
- Application Number
- CN202410978413.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-12
AI Technical Summary
When existing MI-BMI systems are implemented on low-power MCUs, the computing resources and memory requirements are high, and the lack of automatic channel selection leads to increased complexity and power consumption, making it difficult to adapt to individual differences and real-time processing.
The convolutional neural network model is combined with automatic channel selection and quantization technology, and the most relevant EEG channel is selected through the co-spatial mode algorithm and the convolutional neural network module, and the weight and activation value are quantized to 8-bit accuracy, reducing the computing and memory requirements. .
Real-time EEG signal classification with high accuracy on low-power MCUs is achieved, which significantly reduces resource requirements, improves the energy efficiency and adaptability of the system, and extends the battery life of wearable devices.
Smart Images

Figure BDA0004955284200000031 
Figure BDA0004955284200000081 
Figure FDA0004955284070000021
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of brain-computer interface, and in particular to a motor imagery brain-computer interface MI-BMI classification method based on electroencephalogram (EEG) signals. Background Art
[0002] In the field of brain-machine interface (BMI) technology, motor imagery (MI) classification methods based on electroencephalogram (EEG) signals are an important research direction. Traditional MI-BMI systems usually rely on complex classification models that require a lot of computing resources and power consumption, and are therefore not suitable for low-power microcontroller units (MCUs). However, with the development of wearable technology, methods for real-time processing of EEG data on low-power platforms are needed to improve user experience and device battery life.
[0003] Existing MI-BMI systems have some problems in terms of resource consumption and energy efficiency. First, traditional classification models usually require a lot of computing resources, which makes them difficult to implement on low-power MCUs. Second, these models often require high-precision weights and activation values, resulting in large memory usage, further increasing hardware costs and power consumption. In addition, existing MI-BMI systems usually do not take into account the importance of automatic channel selection, resulting in excessively high dimensions of input data, increasing the complexity of the model and the amount of computation. However, implementing automatic channel selection faces the following difficulties:
[0004] 1. Assessment of channel relevance: Different EEG channels may contain different degrees of information relevance. Accurately assessing the relevance of each channel to the motor imagery task is the key to automatic channel selection.
[0005] 2. Adaptability to individual differences: Due to differences in brain structure and function, EEG signal characteristics may vary from one individual to another. The automatic channel selection algorithm needs to be able to adapt to these individual differences to ensure high classification accuracy across users.
[0006] 3. Real-time performance and computational efficiency: Automatic channel selection needs to be performed while processing EEG signals in real time, which places high demands on the computational efficiency of the algorithm. Especially when implemented on a low-power MCU, the algorithm needs to be as simple as possible to reduce resource consumption and improve energy efficiency.
[0007] 4. Generalization ability of the algorithm: The automatic channel selection algorithm needs to have good generalization ability and be able to maintain stability and accuracy under different experimental environments and conditions. This usually requires a large amount of data to train and verify the performance of the algorithm.
[0008] 5. Co-design with classification models: The automatic channel selection algorithm needs to be co-designed with the classification model to ensure that the channel selection process can actually improve the classification accuracy rather than introducing additional noise or errors.
[0009] Therefore, although automatic channel selection has potentially important application value in MI-BMI systems, its implementation still faces multiple technical challenges and requires further research and development. Summary of the invention
[0010] The purpose of the present invention is to solve how to achieve real-time EEG signal classification with high accuracy and low resource requirements on a low-power microcontroller unit (MCU). The network is implemented on a low-power MCU with high accuracy and low resource requirements. The model of the present invention can significantly reduce memory and computing requirements while maintaining high classification accuracy through automatic channel selection and quantization techniques.
[0011] In order to achieve the above-mentioned purpose, the present invention adopts the following technical solutions:
[0012] The present invention provides a motor imagery brain-computer interface MI-BMI classification method based on electroencephalogram (EEG) signals, characterized in that it comprises the following steps:
[0013] Collect EEG signals through sensors worn on the head;
[0014] Input the collected EEG signal into the convolutional neural network model;
[0015] The convolutional neural network model includes:
[0016] Automatic channel selection module, which reduces the input dimensionality by selecting the most relevant EEG channels;
[0017] A convolutional neural network module, which contains multiple convolutional layers, pooling layers, and fully connected layers to extract spatiotemporal features from EEG signals;
[0018] Quantization module: The weights and activation values of the convolutional neural network module are quantized to 8-bit precision to reduce memory usage and optimize hardware performance;
[0019] The above convolutional neural network model is implemented on a low-power MCU, and real-time EEG signal classification is performed.
[0020] In the above scheme, the convolutional neural network model includes multiple convolutional layers, pooling layers and fully connected layers, which are used to extract the spatiotemporal features in the EEG signal and output the probability of each category through the Softmax activation function. Specifically:
[0021] The convolution layer is used to extract the spatiotemporal features in the EEG signal. The size of the convolution kernel in the first layer is 1x10, which is used to capture the temporal features, and the size of the convolution kernel in the subsequent layers is 1x3, which is used to capture the high-order features.
[0022] The pooling layer uses the maximum pooling layer (Max Pooling) to reduce the dimension of the convolution layer output and reduce the amount of calculation;
[0023] The fully connected layer flattens the output of the convolutional layer and the pooling layer and classifies them through several fully connected layers. The last layer uses the Sofimax activation function to output the probability of each category.
[0024] In the above scheme, the automatic channel selection module uses a spatial filter to extract features and select channels based on feature importance.
[0025] In the above scheme, the automatic channel selection module includes the following steps:
[0026] a. Use the common spatial pattern algorithm to spatially filter the collected EEG signals, separate the information in different channels, and obtain the feature importance index;
[0027] Input EEG signal data: The collected and preprocessed EEG signal data, including bandpass filtering, artifact removal and signal normalization, is input into the CSP algorithm to calculate feature importance;
[0028] The CSP algorithm consists of the following steps:
[0029] Calculate the covariance matrix: Calculate the covariance matrix C for each category of EEG signal i , where i represents different motor imagery task categories, and the calculation formula of the covariance matrix is:
[0030]
[0031] Among them, x i (t) is the data of the EEG signal of the i-th category at time t, T i is the total number of time points of the signal of this category;
[0032] Eigenvalue decomposition: Perform eigenvalue decomposition on the covariance matrix of each category to obtain eigenvalues and eigenvectors. By jointly diagonalizing the two types of covariance matrices at the same time, we can obtain the eigenvector that can maximize the variance of the target category and minimize the variance of the non-target category.
[0033] Select the optimal filter: According to the size of the eigenvalue, select the optimal first N eigenvectors as filters to form a feature space. Use these filters to project the original EEG signal to obtain the projected feature signal.
[0034] Calculate the variance of the projection signal: Calculate the variance of the projected feature signal and use the variance value as a feature importance indicator. The higher the feature importance, the greater the contribution of the channel in distinguishing different motor imagery tasks.
[0035] Select top N channels: sort all EEG channels according to feature importance scores and select the top N most relevant channels;
[0036] b. Extract features from the filtered EEG signal and calculate the feature importance of each channel in the motor imagery task;
[0037] Feature extraction: Further feature extraction is performed on the first N EEG channels selected by the CSP algorithm, and the feature vector reflecting the motor imagery task is extracted using the time-frequency analysis method;
[0038] Calculate feature importance score: According to the feature vector, calculate the importance score of each channel in the classification task. The specific formula is:
[0039] I(X i ; Y) = H(Y) - H(Y|X i )
[0040] Among them, H(X i ; Y) is the feature vector X of channel i i The mutual information with the classification label Y, H(Y) is the entropy of the classification label, H(Y|X i ) is the feature X in a given channel i Conditional entropy of the next classification label;
[0041] c. Re-rank all channels based on feature importance scores and select the top N most relevant channels for subsequent processing;
[0042] Dynamically adjust the channel set: All channels are sorted again according to the feature importance score, and the top N most relevant channels are selected for subsequent classification models.
[0043] The above scheme also includes cross-validation: using the cross-validation method, different channel selection strategies are verified to evaluate their impact on classification accuracy and computational efficiency, and the optimal channel selection scheme is selected through multiple verifications;
[0044] Step 6.1: Divide the collected and preprocessed EEG signal dataset into k non-overlapping subsets (usually k=5 or 10). In each iteration, select one of the subsets as the validation set and the remaining subsets as the training set:
[0045] Step 6.1.1, divide the entire data set into k equal parts;
[0046] Step 6.1.2, each time select a different subset as the validation set, and the remaining k-1 subsets as the training set;
[0047] Step 6.2, for each partition, use the training set to train the convolutional neural network,model, and then use the validation set for evaluation, recording the classification accuracy and F1 score indicators for each evaluation:
[0048] Step 6.2.1, train the model with the training set, and perform forward propagation and back propagation to update the model parameters;
[0049] Step 6.2.2, evaluate the model using the validation set and record performance indicators such as classification accuracy, F1 score, confusion matrix, etc.
[0050] Step 6.3: After all iterations are completed, calculate the average value of each evaluation indicator as the final evaluation result of the model. By combining these results, determine the overall performance of the model and find possible overfitting:
[0051] Step 6.3.1. Calculate the classification accuracy, mean and standard deviation of the F1 score for each verification.
[0052] Step 6.3.2: Analyze the mean and standard deviation to evaluate the stability and generalization ability of the model;
[0053] Step 6.4: During the cross-validation process, optimize the channel selection strategy based on the results of each validation, retain channels that show high classification accuracy, and remove channels with poor performance:
[0054] Step 6.4.1. Analyze the importance scores of different channels in each verification.
[0055] Step 6.4.2: Select the top N channels with the highest overall importance scores and remove the channels with larger noise.
[0056] The above solution also includes model optimization: combining the convolutional neural network model to further optimize the channel selection and feature extraction process to ensure that the selected channel can maximize the classification performance;
[0057] Step 7.1: Use grid search or random search to adjust the hyperparameters of the convolutional neural network (CNN) (such as learning rate, convolution kernel size, number of layers, etc.) to find the optimal hyperparameter combination:
[0058] Step 7.1.1, define the hyperparameter search space, such as different learning rates, convolution kernel sizes, network depth, etc.;
[0059] Step 7.1.2: Use grid search or random search to perform multiple experiments in the search space and record the model performance of each experiment.
[0060] Step 7.1.3: Select the hyperparameter combination with the best performance and apply it to the final model training;
[0061] Step 7.2: Use regularization methods such as L2 regularization or Dropout technology to prevent model overfitting and improve the generalization ability of the model:
[0062] Step 7.2.1. Add L2 regularization term to the fully connected layer or convolutional layer of the model and adjust the regularization coefficient.
[0063] Step 7.2.2: During the network training process, use the Dropout technique to randomly discard some neurons to prevent overfitting.
[0064] Step 7.3. Select a suitable loss function (such as the cross entropy loss function) and improve the classification performance of the model on different categories by adjusting the weight of the loss function:
[0065] Step 7.3.1. Define the cross entropy loss function and calculate the loss value during model training.
[0066] Step 7.3.2: Balance the class imbalance problem by adjusting the class weights and improve the classification performance of the model;
[0067] Step 7.4: Use the Adam optimizer for training and the Early Stopping strategy to terminate the training early when the performance on the validation set no longer improves to avoid overfitting:
[0068] Step 7.4.1. During the model training process, use the Adam optimizer to update the parameters;
[0069] Step 7.4.2: Monitor the loss value and classification accuracy on the validation set. When the validation set performance no longer improves after several iterations, stop training early.
[0070] The above scheme also includes real-time adjustment: in practical applications, combined with online learning algorithms, the channel selection strategy is dynamically adjusted according to changes in real-time EEG signals to adapt to changes in different users and environments, thereby improving the robustness and accuracy of the system.
[0071] Step 8.1. In practical applications, an online learning algorithm (such as an incremental learning algorithm) is used to enable the model to update and adjust itself when receiving new EEG signal data to adapt to the new data distribution:
[0072] Step 8.1.1, collect new EEG signal data and update the model in real time;
[0073] Step 8.1.2: Use the incremental learning algorithm to adjust the model parameters to adapt it to the new data distribution;
[0074] Step 8.2: Monitor the signal quality and feature importance of each channel in real time, dynamically adjust the channel set used according to the real-time data, eliminate channels with large noise or low feature contribution, and select the current optimal channel for classification:
[0075] Step 8.2.1, calculate the signal quality and feature importance score of each channel in real time;
[0076] Step 8.2.2, dynamically adjust the channel set used according to the score, and remove the channels with large noise;
[0077] Step 8.3: Develop a user interface that allows users to provide feedback data (such as the correctness of the classification results) and incorporate this feedback data into the model training process to continuously improve the accuracy and adaptability of the model:
[0078] Step 8.3.1. Design a user interface to allow users to input feedback data.
[0079] Step 8.3.2: Collect user feedback data and update the model regularly to adapt it to individual differences of users;
[0080] Step 8.4: Consider environmental factors (such as electromagnetic interference, user status changes, etc.), add adaptive filtering algorithm to signal preprocessing, adjust filtering parameters according to real-time environmental changes, and ensure the stability of signal quality:
[0081] Step 8.4.1, monitor changes in environmental factors, such as electromagnetic interference, user motion status, etc.;
[0082] Step 8.4.2: Dynamically adjust the filtering parameters in the signal preprocessing step according to real-time environmental changes to improve signal quality.
[0083] The beneficial effects of the present invention are as follows:
[0084] 1. Evaluation of channel correlation: The common spatial pattern (CSP) algorithm is used to perform eigenvalue decomposition on the covariance matrix of the EEG signal to extract the channel with the largest eigenvalue. The objective function is used to optimize the channel selection process so that the selected channel has the highest classification discrimination.
[0085] 2. Adaptability to individual differences: During the model training phase, personalized data sets are used to train and tune the algorithm. Through online learning and adaptive algorithms, the channel selection strategy is adjusted in real time to adapt to individual differences.
[0086] 3. Real-time and computational efficiency: In order to improve the real-time and computational efficiency of the motor imagery brain-computer interface (MI-BMI) classification method based on electroencephalogram (EEG) signals, the present invention adopts a lightweight CSP algorithm and convolutional neural network (CNN) model, and combines it with 8-bit precision quantization technology: by simplifying the CSP algorithm and designing a streamlined CNN architecture, the problems of high computing resource consumption and high memory requirements when the traditional method runs on a low-power MCU are solved. At the same time, the 8-bit quantization technology further reduces the storage and computing requirements of the model. These optimization methods work together to significantly reduce the computational complexity and memory usage, thereby greatly improving the operating efficiency of the model on a low-power MCU without sacrificing classification accuracy, and realizing fast and energy-saving real-time classification of EEG signals, bringing better performance and longer battery life to wearable devices.
[0087] 4. Generalization ability of the algorithm: The algorithm is trained with a variety of training data sets, including data from different tasks, environments, and individuals, to enhance its generalization ability. In the validation phase, cross-validation and data augmentation techniques are used to ensure the stability and accuracy of the model under different conditions.
[0088] 5. Co-design with classification model: Design a co-optimization strategy that combines the automatic channel selection module with the feature extraction and classification capabilities of the CNN model. Through iterative training and optimization, ensure that the selected channels can maximize the performance of the classification model.
[0089] In summary, the present invention designs an efficient convolutional neural network model, while maintaining high classification accuracy, minimizing hardware resource requirements and power consumption, making the method suitable for low-power wearable devices. In addition, the memory usage and computing performance of the model are further optimized through automatic channel selection and quantization technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0090] Figure 1 , Figure 2 The present invention provides an overall flow chart of the method and device. DETAILED DESCRIPTION
[0091] In order to realize an efficient motor imagery brain-computer interface, the present invention proposes a convolutional neural network model, which is implemented on a low-power MCU of the PULP platform. The specific implementation steps include:
[0092] 1) Data collection:
[0093] The EEG sensor is worn on the user's head to collect EEG signals. The EEG sensor is placed at a specific scalp location, usually using the international 10-20 system for electrode placement. The sensor converts the collected analog signals into digital signals and transmits them to a data processing unit via wired or wireless means.
[0094] 2) Data preprocessing:
[0095] The preprocessing step aims to remove noise and interference in the EEG signal and improve the signal quality. First, the EEG signal is limited to between 0.5Hz and 40Hz using a bandpass filter to remove myoelectric noise and power supply interference; then, the independent component analysis (ICA) method is used to remove artifacts such as eye movements and muscle movements; finally, the EEG signal is standardized to eliminate the influence of individual differences on the signal.
[0096] 3) Model design:
[0097] The present invention designs an efficient convolutional neural network (CNN) model for classifying EEG signals. The model design includes an automatic channel selection module, a convolutional neural network module and a quantization module.
[0098] The automatic channel selection module reduces the dimensionality of the input data by evaluating the correlation of individual EEG channels and selecting the most important channels. This module uses spatial filters, such as co-spatial patterns (CSP), to extract features and performs channel selection based on feature importance.
[0099] Automatic channel selection module:
[0100] a. Common Space Pattern (CSP) algorithm:
[0101] Input EEG signal data: The collected and preprocessed EEG signal data is input into the CSP algorithm. The preprocessing steps include bandpass filtering, artifact removal and signal normalization.
[0102] Calculate the covariance matrix: Calculate the covariance matrix C for each category of EEG signal i , where i represents different motor imagery task categories. The calculation formula of the covariance matrix is:
[0103]
[0104] Among them, x i (t) is the data of the EEG signal of the i-th category at time t, T i is the total number of time points of this type of signal.
[0105] Eigenvalue decomposition: Perform eigenvalue decomposition on the covariance matrix of each category to obtain eigenvalues and eigenvectors. By jointly diagonalizing the two types of covariance matrices at the same time, we can obtain the eigenvector that can maximize the variance of the target category and minimize the variance of the non-target category.
[0106] Select the best filter: According to the eigenvalue size, select the best first N eigenvectors as filters to form the feature space. Use these filters to project the original EEG signal to obtain the projected feature signal.
[0107] Calculate the variance of the projected signal: Calculate the variance of the projected feature signal and use the variance value as the feature importance indicator. The higher the feature importance, the greater the contribution of the channel in distinguishing different motor imagery tasks.
[0108] b. Feature extraction and evaluation:
[0109] Feature extraction: Further feature extraction is performed on the first N EEG channels selected by the CSP algorithm. Time-frequency analysis methods, such as wavelet transform or short-time Fourier transform (STFT), are used to extract feature vectors reflecting the motor imagery task.
[0110] Calculate feature importance score: Based on the extracted feature vector, calculate the importance score of each channel in the classification task. The scoring method can be evaluated based on information gain, mutual information or other statistical methods. The specific formula is:
[0111] I(X i ; Y) = H(Y) - H(Y|X i )
[0112] Among them, H(Y|X i ) is the feature vector X of channel i i The mutual information with the classification label Y, H(Y) is the entropy of the classification label, H(Y|X i ) is the feature vector X in a given channel i Conditional entropy of the categorical labels.
[0113] Dynamically adjust the channel set: sort all channels according to the feature importance score, and select the top N most relevant channels for the subsequent classification model. This step can be combined with cross-validation to ensure the robustness and generalization ability of the selected channel set on different data sets.
[0114] c. Optimization and verification:
[0115] Cross-validation: Use the cross-validation method to verify different channel selection strategies and evaluate their impact on classification accuracy and computational efficiency. After multiple validations, the optimal channel selection scheme is selected.
[0116] Model optimization: Combined with the convolutional neural network model, the channel selection and feature extraction process are further optimized to ensure that the selected channels can maximize the classification performance.
[0117] Real-time adjustment: In practical applications, combined with online learning algorithms, the channel selection strategy is dynamically adjusted according to the changes in real-time EEG signals to adapt to changes in different users and environments, thereby improving the robustness and accuracy of the system.
[0118] The CNN module consists of multiple convolutional layers, pooling layers, and fully connected layers. The specific structure is as follows: The convolutional layer is used to extract the spatiotemporal features in the EEG signal. The size of the first convolution kernel is 1x10, which is used to capture the temporal features. The size of the subsequent convolution kernel is 1x3, which is used to capture higher-order features; the pooling layer uses the maximum pooling layer (Max Pooling) to reduce the dimension of the convolutional layer output to reduce the amount of calculation; the fully connected layer flattens the output of the convolutional layer and the pooling layer, and classifies them through several fully connected layers. The last layer uses the Sofimax activation function to output the probability of each category.
[0119] The quantization module is used to reduce the memory and computing requirements of the model, and quantize the weights and activation values of the convolutional neural network to 8-bit precision. This step uses the dynamic fixed-point quantization method, which optimizes the quantization parameters so that the model can still maintain a high classification accuracy at low precision.
[0120] 4) Model training:
[0121] The model training process includes data preparation, model training, and validation.
[0122] First, we use public EEG datasets (such as BCI Competition IV-2a and Physionet EEG MotorMovement / Imagery) for model training. The datasets contain EEG signals of various motor imagery tasks and are divided into training and validation sets.
[0123] The training was performed using the cross entropy loss function and the Adam optimizer. The following steps were performed in sequence: randomly initialize the weights of the CNN model; forward propagate the input EEG signal through the CNN model and calculate the output probability; calculate the cross entropy loss based on the actual label and the predicted probability; calculate the gradient through the back-propagation algorithm and update the model weights; evaluate the performance of the model on the validation set and adjust the hyperparameters based on the validation results.
[0124] During the training process, the early stopping strategy is used to prevent overfitting, and the data augmentation technology is used to increase the diversity of data and improve the generalization ability of the model.
[0125] 5) Deployment:
[0126] The trained CNN model is deployed on a low-power microcontroller unit (MCU) for real-time EEG signal classification.
[0127] Convert the trained model to a format suitable for MCU. Use TensorFlow Lite or other adaptation tools to convert the model to ensure that the model can run efficiently on MCU.
[0128] The converted model is deployed on the MCU to process and classify the collected EEG signals in real time. The MCU sends the classification results to external devices such as smartphones or computers through the wireless communication module.
[0129] Develop a user interface on the external device to display the classification results and provide user feedback. The user interface includes real-time display of EEG signals, classification results, and statistical information to improve the user experience.
[0130] 6) Experiment and evaluation:
[0131] Several subjects were selected for the experiment and were asked to perform designated motor imagery tasks while their EEG signals were collected.
[0132] The model performance is evaluated using indicators such as accuracy, F1 score, and computational complexity.
[0133] Experimental results show that the MI-BMI system proposed in the present invention can achieve high-accuracy real-time EEG signal classification on a low-power MCU, and its resource requirements are significantly lower than those of traditional methods.
[0134] 7) Summary:
[0135] Through the above steps, the present invention provides an efficient motor imagery brain-computer interface (MI-BMI) classification method, which can achieve real-time processing with high accuracy and low resource requirements on a low-power platform, is suitable for wearable devices, and significantly improves user experience and battery life of the device.
[0136] It is to be understood that the present invention is described by some embodiments, and it is known to those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are within the scope of protection of the present invention.
Claims
1. A motor imagery brain-computer interface MI-BMI classification method based on EEG signals, characterized in that: The following steps are involved: Collect EEG signals through sensors worn on the head; Input the collected EEG signal into the convolutional neural network model; The convolutional neural network model includes: Automatic channel selection module, which reduces the input dimensionality by selecting the most relevant EEG channels; A convolutional neural network module, which contains multiple convolutional layers, pooling layers, and fully connected layers to extract spatiotemporal features from EEG signals; Quantization module: The weights and activation values of the convolutional neural network module are quantized to 8-bit precision to reduce memory usage and optimize hardware performance; The above convolutional neural network model is implemented on a low-power MCU, and real-time EEG signal classification is performed.
2. The motor imagery brain-computer interface MI-BMI classification method based on EEG signals according to claim 1, characterized in that: The convolutional neural network model includes multiple convolutional layers, pooling layers, and fully connected layers, which are used to extract the spatiotemporal features in the EEG signal and output the probability of each category through the Softmax activation function. Specifically: The convolution layer is used to extract the spatiotemporal features in the EEG signal. The size of the convolution kernel in the first layer is 1x10, which is used to capture the temporal features, and the size of the convolution kernel in the subsequent layers is 1x3, which is used to capture the high-order features. The pooling layer uses the maximum pooling layer to reduce the dimension of the convolution layer output and reduce the amount of calculation; The fully connected layer flattens the output of the convolutional layer and the pooling layer and classifies them through several fully connected layers. The last layer uses the Softmax activation function to output the probability of each category.
3. The motor imagery brain-computer interface MI-BMI classification method based on EEG signals according to claim 1, characterized in that: The automatic channel selection module uses spatial filters to extract features and select channels based on feature importance.
4. The motor imagery brain-computer interface MI-BMI classification method based on EEG signals according to claim 3, characterized in that: The automatic channel selection module includes the following steps: a. Use the common spatial pattern algorithm to spatially filter the collected EEG signals, separate the information in different channels, and obtain the feature importance index; Input EEG signal data: The collected and preprocessed EEG signal data, including bandpass filtering, artifact removal and signal normalization, is input into the CSP algorithm to calculate feature importance; The CSP algorithm consists of the following steps: Calculate the covariance matrix: Calculate the covariance matrix C for each category of EEG signal i , where i represents different motor imagery task categories, and the calculation formula of the covariance matrix is: Among them, x i (t) is the data of the EEG signal of the i-th category at time t, T i is the total number of time points of the signal of this category; Eigenvalue decomposition: Perform eigenvalue decomposition on the covariance matrix of each category to obtain eigenvalues and eigenvectors. By jointly diagonalizing the two types of covariance matrices at the same time, we can obtain the eigenvector that can maximize the variance of the target category and minimize the variance of the non-target category. Select the optimal filter: According to the size of the eigenvalue, select the optimal first N eigenvectors as filters to form a feature space. Use these filters to project the original EEG signal to obtain the projected feature signal. Calculate the variance of the projection signal: Calculate the variance of the projected feature signal and use the variance value as a feature importance indicator. The higher the feature importance, the greater the contribution of the channel in distinguishing different motor imagery tasks. Select top N channels: sort all EEG channels according to feature importance scores and select the top N most relevant channels; b. Extract features from the filtered EEG signal and calculate the feature importance of each channel in the motor imagery task; Feature extraction: Further feature extraction is performed on the first N EEG channels selected by the CSP algorithm, and the feature vector reflecting the motor imagery task is extracted using the time-frequency analysis method; Calculate feature importance score: According to the feature vector, calculate the importance score of each channel in the classification task. The specific formula is: I(X i ;Y)=H(Y)-H(Y|X i ) Among them, H(X i ; Y) is the feature vector X of channel i i The mutual information with the classification label Y, H(Y) is the entropy of the classification label, H(Y|X i ) is the feature X in a given channel i Conditional entropy of the next classification label; c. Re-rank all channels based on feature importance scores and select the top N most relevant channels for subsequent processing; Dynamically adjust the channel set: All channels are sorted again according to the feature importance score, and the top N most relevant channels are selected for subsequent classification models.
5. The motor imagery brain-computer interface MI-BMI classification method based on EEG signals according to claim 4, characterized in that: It also includes cross-validation: using the cross-validation method, verifying different channel selection strategies, evaluating their impact on classification accuracy and computational efficiency, and selecting the optimal channel selection scheme through multiple verifications; Step 6.1: Divide the collected and preprocessed EEG signal dataset into k non-overlapping subsets. In each iteration, select one of the subsets as the validation set and the remaining subsets as the training set: Step 6.1.1, divide the entire data set into k equal parts; Step 6.1.2, each time select a different subset as the validation set, and the remaining k-1 subsets as the training set; Step 6.2, for each partition, use the training set to train the convolutional neural network,model, and then use the validation set for evaluation, recording the classification accuracy and F1 score indicators for each evaluation: Step 6.2.1, train the model with the training set, and perform forward propagation and back propagation to update the model parameters; Step 6.2.2, evaluate the model using the validation set and record performance indicators such as classification accuracy, F1 score, confusion matrix, etc. Step 6.3: After all iterations are completed, calculate the average value of each evaluation indicator as the final evaluation result of the model. By combining these results, determine the overall performance of the model and find possible overfitting: Step 6.3.
1. Calculate the classification accuracy, mean and standard deviation of the F1 score for each verification. Step 6.3.2: Analyze the mean and standard deviation to evaluate the stability and generalization ability of the model; Step 6.4: During the cross-validation process, optimize the channel selection strategy based on the results of each validation, retain channels that show high classification accuracy, and remove channels with poor performance: Step 6.4.
1. Analyze the importance scores of different channels in each verification. Step 6.4.2: Select the top N channels with the highest overall importance scores and remove the channels with larger noise.
6. The motor imagery brain-computer interface MI-BMI classification method based on EEG signals according to claim 4, characterized in that: It also includes model optimization: combining the convolutional neural network model to optimize the channel selection and feature extraction process to ensure that the selected channels can maximize the classification performance; Step 7.1, adjust the hyperparameters of the convolutional neural network through grid search or random search method to find the optimal hyperparameter combination, including learning rate, convolution kernel size, and number of layers; Step 7.1.1, define the hyperparameter search space, such as different learning rates, convolution kernel sizes, and network depths; Step 7.1.2: Use grid search or random search to perform multiple experiments in the search space and record the model performance of each experiment. Step 7.1.3: Select the hyperparameter combination with the best performance and apply it to the final model training; Step 7.2: Use regularization methods such as L2 regularization or Dropout technology to prevent model overfitting and improve the generalization ability of the model: Step 7.2.
1. Add L2 regularization term to the fully connected layer or convolutional layer of the model and adjust the regularization coefficient. Step 7.2.2: During the network training process, use the Dropout technique to randomly discard some neurons to prevent overfitting. Step 7.3: Select a suitable loss function and adjust the weight of the loss function to improve the classification performance of the model in different categories: Step 7.3.
1. Define the cross entropy loss function and calculate the loss value during model training. Step 7.3.2: Balance the class imbalance problem by adjusting the class weights and improve the classification performance of the model; Step 7.4: Use the Adam optimizer for training and the early stopping strategy to terminate the training early when the performance on the validation set no longer improves: Step 7.4.
1. During the model training process, use the Adam optimizer to update the parameters; Step 7.4.2: Monitor the loss value and classification accuracy on the validation set. When the validation set performance no longer improves after several iterations, stop training early.
7. The motor imagery brain-computer interface MI-BMI classification method based on EEG signals according to claim 4, characterized in that: It also includes real-time adjustment: combining online learning algorithms to dynamically adjust the channel selection strategy according to the changes in real-time EEG signals to adapt to changes in different users and environments, thereby improving the robustness and accuracy of the system; Step 8.
1. In practical applications, an online learning algorithm is used to enable the model to update and adjust itself when receiving new EEG signal data to adapt to the new data distribution: Step 8.1.1, collect new EEG signal data and update the model in real time; Step 8.1.2: Use the incremental learning algorithm to adjust the model parameters to adapt it to the new data distribution; Step 8.2: Monitor the signal quality and feature importance of each channel in real time, dynamically adjust the channel set used according to real-time data, eliminate channels with large noise or low feature contribution, and select the current optimal channel for classification: Step 8.2.1, calculate the signal quality and feature importance score of each channel in real time; Step 8.2.2, dynamically adjust the channel set used according to the score, and remove the channels with large noise; Step 8.3: Develop a user interface that allows users to provide feedback data, incorporate this feedback data into the model training process, and continuously improve the accuracy and adaptability of the model: Step 8.3.
1. Design a user interface to allow users to input feedback data. Step 8.3.2: Collect user feedback data and update the model regularly to adapt it to individual differences of users; Step 8.4: Consider environmental factors and add adaptive filtering algorithm to signal preprocessing. Adjust filtering parameters according to real-time environmental changes to ensure the stability of signal quality: Step 8.4.1, monitor changes in environmental factors, such as electromagnetic interference and user motion status; Step 8.4.2: Dynamically adjust the filtering parameters in the signal preprocessing step according to real-time environmental changes to improve signal quality.
