RSVP normal form electroencephalogram electrode offset self-adaptive compensation method for autonomous motion scene
By employing a decoupled training strategy and supervised contrastive learning with lightweight spatiotemporal convolutional layers, the problems of EEG signal artifacts and electrode offset during motion are resolved, improving the EEG signal classification performance of the RSVP paradigm and making it suitable for small-batch data scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-28
AI Technical Summary
During movement, artifacts and electrode misalignment exist in EEG signals, leading to a decrease in the signal-to-noise ratio of RSVP-paradigm EEG signals, which affects classification performance. Traditional transfer learning methods are ineffective and the small amount of data makes it difficult to compensate effectively.
Supervised contrastive learning based on a decoupled training strategy is adopted. The feature extractor is optimized by the InfoNCE loss function, and the CSCN model is constructed by combining lightweight spatiotemporal convolutional layers and classifier fine-tuning to achieve alignment and compensation between the anchor feature space and the feature space to be compensated.
It improves the feature extraction and classification performance of RSVP EEG signals under motion conditions, reduces the number of model parameters and training costs, and enhances classification accuracy and robustness, making it suitable for small-batch data applications.
Smart Images

Figure CN121935524A_ABST
Abstract
Description
Technical Field
[0001] This invention proposes an RSVP paradigm-based adaptive compensation method for EEG electrode offset in autonomous motion scenarios, which is applicable to EEG signal decoding tasks in motion states and belongs to the interdisciplinary field of computer science and biomedical engineering. Background Technology
[0002] Brain-computer interfaces (BCIs) are communication systems that use electroencephalograms (EEGs) or other physiological signals related to brain activity to recognize human thought patterns and control external devices. The RSVP paradigm is a specific paradigm based on BCI systems. It identifies the classification of images observed by the subject by detecting specific waveforms in the EEG induced by specific visual stimuli—specifically, P300, which appears approximately 300 milliseconds after stimulus presentation. In the RSVP experimental paradigm, letters or images are typically displayed on a screen flashing sequentially at a fixed frequency. Subjects are asked to view these image sequences and count the number of times a target image (a specific type of picture) appears. When the brain receives stimulation from the target image, neurons generate a series of P300 electrical signals. The sum of these signals can be accurately detected by an EEG device and applied to subsequent classification tasks. Therefore, the detection and recognition of the P300 component plays a crucial role in RSVP classification tasks. The RSVP-BCI classification framework includes preprocessing, feature extraction, and classification, with effective feature extraction significantly improving classification accuracy. However, when the experimental scenario changed from static to dynamic, the RSVP EEG signal showed obvious artifact interference, which reduced the signal-to-noise ratio and made it difficult to identify the effective P300 components, thus affecting the classification performance.
[0003] In recent years, many studies have focused on feature extraction methods to improve RSVP classification performance, and significant progress has been made. Ran Manor et al., not limited to EEG signals, first proposed an RSVP classification network combining multimodal data. They investigated three different fusion strategies combining image and EEG data: input-level fusion, decision-level fusion, and feature-level fusion. They argued that input-level fusion needs to consider the correlation between the two modes, decision-level fusion does not need to consider correlation but may miss important information, and feature-level fusion combines the advantages of the former two, providing ideas and directions for subsequent multimodal RSVP (Multimodal Neural Network for Rapid Serial Visual PresentationBrain Computer Interface). Schirrmeister et al. proposed a CNN model called DeepConvNet for EEG decoding tasks in BCI, consisting of five convolutional layers and a softmax layer for classification. Lawhern et al. proposed a compact neural network called EEGNet for EEG-based BCI, achieving significant performance on various EEG classification tasks. Zhang et al. addressed the sample imbalance problem in RSVP tasks by proposing an improved EEGNet model. This model uses the focal loss function instead of the cross-entropy loss function, significantly improving classification performance, especially in object detection tasks. Luo et al. mainly improved the feature extractor, proposing a Domain Corrected Transfer Learning (DRTL) framework that combines cross-scale Transformer and triple-viewpoint attention for EEG signal classification in RSVP tasks. This framework significantly improves cross-subject classification performance through multi-scale temporal feature extraction and spectral feature fusion. Addressing the issues of low signal-to-noise ratio and significant individual variability in event-related potentials (ERPs) in RSVP tasks, traditional single-trial decoding algorithms based on common spatial pattern (CSP) or linear discriminant analysis (LDA) exhibit unstable performance on different datasets. Zhao et al. proposed a Multilayer Classification Algorithm of Frequency-Time-Space Feature Extraction on RSVP Task, which extracts features from multiple dimensions (frequency, time, and space) by designing alternately iteratively optimized spatiotemporal filters.
[0004] To implement a compensation algorithm for EEG electrode offset during motion, the key is to effectively utilize EEG data from a resting state as a reference, decoding the information portion of the EEG signal that remains unchanged with motion, and ultimately compensating for the offset in the motion-state EEG signal. Current research on compensation algorithms for motion-state EEG is limited and suffers from the following problems:
[0005] 1. Motion Artifacts: During motion, artifacts caused by electrode displacement due to movement and EEG noise unrelated to the RSVP paradigm generated by the brain controlling limb movement can both affect the neural network's decoding and classification of RSVP EEG signals. Therefore, how to effectively remove noise and improve the signal-to-noise ratio becomes crucial for the success of compensation algorithms.
[0006] 2. Dynamic changes in electrode offset: During movement, electrode offset may be a dynamic process rather than a static offset. This requires the compensation algorithm to track and compensate for this dynamic offset in real time, thus increasing the complexity of the algorithm.
[0007] Considering both of the above problems, traditional EEG decoding methods ultimately perform poorly on motion-state data. Therefore, a transfer learning approach was considered, treating motion-state EEG data as the target domain and resting-state EEG data as the source domain. However, after multiple rounds of comparative experiments, traditional transfer learning methods such as adversarial transfer, Euclidean feature alignment, and MMD did not achieve satisfactory results. This is because the difference between motion-state and resting-state data is not limited to differences in data distribution, but rather because noise and artifacts have a greater impact on effective data in motion, resulting in a lower signal-to-noise ratio (SNR). If traditional transfer learning methods are still used, it is inevitable to transfer source domain data with a higher SNR to target domain data with a lower SNR, leading to a decline in the final model performance. Therefore, under the premise of conforming to the transfer learning paradigm, how to design cross-domain transfer and compensation becomes the primary issue. In addition, unlike the application of traditional transfer learning in the RSVP paradigm, this study uses single-subject data, thus also facing the problem of small data volume.
[0008] Firstly, supervised contrastive learning based on a decoupled training strategy is considered. The model training process is decomposed into two stages: contrastive training and classifier training. This allows the model to fully utilize limited EEG information from motion states during the contrastive learning stage, distinguishing between inter-class and cross-domain differences, while maintaining classification performance. Features extracted from resting and moving EEGs are respectively considered as an artifact-free anchored feature space and an artifact-laden feature space to be compensated. By minimizing the classic InfoNCE (Information Noise-Contrastive Estimation) loss in contrastive learning, the feature extractor is optimized, enabling the model to learn to bring samples from the feature space to be compensated closer to similar samples in the anchored feature space, while simultaneously pushing away samples from different classes in both feature spaces. Simultaneously, during the classifier training stage, the classic fine-tuning approach from transfer learning is adopted, with the complete resting EEG data used as compensation data input into the classifier for training. However, while traditional contrastive learning schemes narrow the gap between samples in the two feature spaces, they also cause the static EEG data, which should serve as the baseline feature space, to converge towards the motor EEG data. This significantly impacts the compensation effect of static EEG data on motor EEG data, thus losing the compensation potential of static data. Therefore, a method for anchoring to a baseline feature space is urgently needed. Furthermore, traditional CNN+attention mechanisms or Transformer feature extractors, due to their large number of parameters, are prone to overfitting with data sets of only 300-500 EEG samples, failing to demonstrate the advantages of complex model structures. Therefore, selecting a suitable feature extractor for small-batch supervised contrastive learning is also a key research area.
[0009] By discussing and analyzing the advantages and disadvantages of the above methods and ideas, a lightweight adaptive compensation method for RSVP-based EEG electrode offset in autonomous motion scenarios is proposed. Compared with EEG decoding for individual motion states, this algorithm can effectively improve the RSVP classification accuracy. Moreover, compared with the EEG transfer models CST_TVA_DRTL and mCADA models in recent years, the classification method proposed in this invention can more effectively improve the decoding performance of RSVP EEG signals. Summary of the Invention
[0010] This invention proposes a lightweight RSVP paradigm EEG electrode offset compensation method for autonomous motion scenarios. This method can effectively solve the impact of motion artifacts on EEG decoding tasks, thereby improving the feature extraction and classification performance of RSVP motion EEG signals.
[0011] To address the artifact interference problem in motion states, a supervised contrastive learning approach based on a decoupled training strategy is adopted. This involves introducing positive and negative sample pairs sampled from an artifact-free anchored feature space and an artifact-laden feature space to be compensated, respectively. The InfoNCE loss is applied to train the compensation capability of the feature extractor. Simultaneously, based on the characteristics of small-batch sample data, a lightweight feature extractor is designed. Spatiotemporal convolution is used to downsample the EEG signal into spatiotemporal features for subsequent contrastive learning. Compared to complex feature extractors using self-attention mechanisms and multi-scale feature extraction modules, the lightweight design significantly improves classification metrics such as BA and RECALL while substantially reducing computational costs.
[0012] To achieve the above-mentioned objectives, after research, discussion, and repeated practice, the final solution determined by this method is as follows:
[0013] First, the original RSVP EEG dataset of a subject was preprocessed and channel-selected. The resting EEG data after preprocessing and channel selection was defined as X. S Motor state EEG data is X T Define the resting state EEG label as Y. S The motor state EEG label is Y. T X T Y T The dataset is divided into two parts: a training set and a test set, in a 2:1 ratio, defined as X and X respectively. T-train and X T-test Y T-train and Y T-tes Then X S Y S X T-train Y T-train The inputs are jointly fed into the constructed CSCN (Compensate-Supervision-Comparison-Net) model for supervised comparative training to improve the inter-class classification and cross-domain compensation capabilities of the feature extractor. Then, X... S X T X T-train Y T-train The input is fed into the CSCN model for classifier training to improve the classifier's classification performance, and finally X is processed. T-test and Y T-tes Perform classification tests to obtain classification results for the test set, and evaluate the classification results to verify the effectiveness of the method.
[0014] The specific steps of the technical solution of this invention are as follows:
[0015] Step 1, Data Preprocessing and Channel Selection: First, visualization is performed to observe and remove obvious noise, and bad electrodes are identified and marked. Then, bandpass filtering is used to retain only the effective EEG frequency band (0.5-50Hz), removing low-frequency drift and high-frequency noise. Finally, independent component analysis is used to preliminarily remove artifacts from the motor EEG. After channel selection, the optimal channel combination is generated (channel names: "P3", "Pz", "P4", "PO3", "POz", "PO4", "O1", "Oz"), and input into subsequent steps.
[0016] Step 2, construct the CSCN model. This is divided into a feature extraction training phase and a classifier training phase. For the feature extraction training phase, X is used. S X T-train Anchored feature spaces and feature spaces to be compensated are constructed separately. Different random sampling ranges are used for the two spaces to mitigate the displacement of the anchored feature space and increase the displacement of the feature space to be compensated. That is, in X... S Random sampling across the entire range is used to construct diverse and rich anchoring feature spaces, in X T-train Random sampling within a small area is used to construct a single and dedicated feature space to be compensated.
[0017] Step 3 decouples the training process into two stages: In the contrastive learning stage, after feature extraction from sampled data in different feature spaces, the infoNCE loss based on cosine similarity is calculated. Through backpropagation of the loss function, the target and non-target features in the moving state can be aligned to their corresponding features in the stationary state, thereby improving the model's alignment ability across different feature spaces. This compensates for features in the moving state through the stationary feature space of the anchor point. Simultaneously, the inter-class classification ability of the feature extractor is trained. In the classifier learning stage, the feature extractor trained in the contrastive learning stage is loaded and its parameters are frozen. Then, X is used... T-train During training, add X S The data fine-tunes the classifier, allowing it to fully utilize the potential of the domain-invariant features extracted during the contrastive learning phase. This avoids the situation where the compensated features are not adapted to the moving state of the classifier, thus preventing a final decline in classification performance.
[0018] Step 4. In the testing and evaluation phase, the trained model is used to make predictions and evaluate on the divided test dataset. The metrics include balanced accuracy, recall, precision, and F1 score to comprehensively measure the model performance and determine its effectiveness and robustness in real-world applications.
[0019] The present invention has the following advantages:
[0020] 1. This is the first research on compensation algorithm based on EEG electrode offset in autonomous movement scenarios.
[0021] 2. Compared to networks that incorporate multi-scale convolutional layers or self-attention mechanisms, using lightweight spatiotemporal convolutional layers can significantly reduce the number of model parameters and training costs while maintaining classification accuracy, and this has been validated as equally effective on small batches of samples. It retains more original EEG information for the comparative learning phase without losing it.
[0022] 3. By decoupling the contrastive learning and classification learning stages, and constructing multiple positive and negative sample pairs in the contrastive learning stage by building an anchored feature space and a feature space to be compensated, multiple positive and negative sample pairs are formed. While ensuring that the change in the anchored sample space is small, the feature space to be compensated is forced to align with the anchored sample space, thereby achieving compensation of static EEG data for dynamic EEG data. Simultaneously, contrastive learning can also alleviate the class imbalance problem in the RSVP classification task through a two-round training strategy.
[0023] 4. A fine-tuning strategy based on calibration datasets, which is used in traditional transfer learning, is introduced. During the classification learning stage, the classifier parameters are fine-tuned so that the classifier can generalize to EEG in motion state. At the same time, the electrode offset can be compensated by referring to EEG in still state. Attached Figure Description
[0024] Figure 1 Overall flowchart of the present invention
[0025] Figure 2 CSCN Network Data Flow Diagram Detailed Implementation
[0026] This method aims to address the issue of insufficient decoding accuracy of EEG information during motion and validates the compensation algorithm in the RSVP experimental paradigm. It employs supervised contrastive transfer learning based on lightweight feature extraction. The decoupled training strategy of contrastive learning ensures the model's ability to extract different features between classes while also learning the compensation ability for EEG data in different motion states. The fine-tuning strategy of transfer learning ensures the generalization ability of the classifier. The combination of these two approaches improves the RSVP classification performance for motion-state EEG data in the RSVP paradigm. Furthermore, the lightweight feature extractor design significantly reduces training costs while preserving domain-invariant information in small batches of samples, avoiding overfitting due to excessive parameters. Finally, the cross-domain InfoNCE loss function based on cosine similarity not only enables the feature extractor to extract different features for different classes of data but also blurs the feature distribution of different motion states, facilitating subsequent compensation by the classifier for different features. The entire process of this method includes four main steps: data preprocessing and channel selection, model building, training, and testing. Experimental results show that this method not only effectively addresses the artifact problem that is difficult to eliminate in motor EEG signals, but also improves indicators such as classification recall and model robustness.Figure 1 This can be considered as the overall flowchart of the present invention, which can be broken down into the following steps:
[0027] Step 1: Data preprocessing and channel selection.
[0028] Step 2: Construct the CSCN model.
[0029] Step 3: Train the model using the training set.
[0030] Step four: Test the model's performance and evaluate metrics such as Recall.
[0031] The specific details of each step are explained below:
[0032] Step 1 is as follows:
[0033] (1) Use a second-order Butterworth filter with a frequency range of 0.5-50Hz, that is, only retain the effective frequency band of EEG (0.5-50Hz) to remove low-frequency drift and high-frequency noise;
[0034] (2) Linear noise removal method is used to automatically remove artifacts containing noise. Defective channels carrying abnormal signals with a standard deviation higher than the z-fraction threshold are removed, where the threshold is 4 and the window length is 5s. Subsequently, the removed defective channels are interpolated using the ultrafast spherical interpolation method to avoid loss of channel information;
[0035] (3) After dimensionality reduction of the data using independent component analysis, the Infomax algorithm is used to decompose the independent components and automatically label the artifact components. The automatic detection method uses the sliding window statistical method, that is, to calculate the variance within the window and label the outlier windows;
[0036] (4) Calculate the mutual information between each channel signal and the target label, quantify the correlation between the channel and the task, retain only the top 70% of channels with the highest MI values, and remove low-correlation channels. Then, perform time-frequency decomposition of the EEG signal using short-time Fourier transform to extract the time-frequency features of the target-related ERP components, retaining only the channels that are highly consistent with the time-frequency patterns of the target ERP components. After the channel selection algorithm, the optimal channel combination ("P3", "Pz", "P4", "PO3", "POz", "PO4", "O1", "Oz") is generated. These electrodes are located in the core brain regions of the human brain that process visual target recognition, attentional resources, and decision updates (i.e., generate P300 ERP components)—the parietal and parieto-occipital cortices. This combination maximizes task classification performance while greatly reducing data dimensionality, improving the efficiency and robustness of the model. At the same time, this combination includes relevant electrodes at the midline (Pz, POz, Oz) and bilaterally symmetrical positions, making it easier for the algorithm to capture this topological feature.
[0037] (5) Divide each EEG signal block into different trials. For each trial, normalize the data to zero mean and unit variance.
[0038] (6) The training set contains all the static state data X S Y S and some motion state data X T-train Y T-train The test set contains another portion of motion state data X. T-test and Y T-tes ;
[0039] Step 2 is as follows:
[0040] The CSCN model's structure can be summarized into two main parts: lightweight spatiotemporal convolutional layers and classification layers. PyTorch is used to build the model. The following is a detailed explanation of each part:
[0041] (1) Lightweight spatiotemporal convolutional layer
[0042] In the lightweight spatiotemporal separation convolutional layer, a 2D convolutional kernel with (channels, time_window) is used. The spatial dimension height is equal to the number of channels, and the temporal dimension width is controlled by the number of sampling points, where time_window = number of sampling points / 25. This design decouples spatiotemporal features, reducing parameters by approximately 50% compared to a square convolutional kernel. Simultaneously, a large stride dimensionality reduction is employed, with a stride of (1, time_window) achieving a 4x downsampling in the temporal dimension. This directly compresses the sequence length, reducing computational load in subsequent layers and ensuring that each sampling point in the temporal dimension does not excessively participate in the different feature values after convolution. The output dimension is set to 16, providing multiple spatiotemporal channel weight coefficients for the convolutional layer. Subsequently, Dropout2D and BatchNorm2d layers are added. The Dropout2D layer randomly places null features with a 0.2 probability, preventing overfitting and reducing computational graph complexity through sparsity. The BatchNorm2d momentum parameter is set to 0.8, accelerating training convergence while allowing for a more aggressive learning rate, indirectly reducing the number of iterations.
[0043] This design employs spatiotemporal joint modeling, with 2D convolutions simultaneously capturing spatial (inter-electrode) and temporal (series) dependencies, making it suitable for the spatiotemporal dynamics of EEG. Furthermore, its reduced parameter count makes the model suitable for mobile / embedded deployments, meeting the real-time requirements of BCI devices. This strategy ensures that the convolutional features avoid overfitting due to insufficient sample size caused by too many convolutional layers, while also providing spatiotemporal features with different weight combinations needed for subsequent comparative learning, which is crucial for subsequent feature processing. Experiments show that excessive convolutional layers easily lead to overfitting on static EEG data, thus reducing the model's classification performance on dynamic EEG data.
[0044] (2) Classification layer
[0045] In the classification layer, a multilayer perceptron (MLP) based on a fully connected neural network divides the classification stage into three parts: Feature extraction layer: input layer → 1024 neurons (ReLU activation + Dropout 0.2); Feature deepening layer: 1024 → 2048 neurons (ReLU activation + Dropout 0.5); Output layer: 2048 → output number of categories 2 (Softmax activation). This design fully utilizes its three-layer cascaded structure and the strong nonlinearity introduced by the double ReLU activation function to achieve adaptability to high-dimensional data. The number of neurons in the hidden layer increases layer by layer (1024 → 2048), forming a "wider-wider" hourglass structure, which is suitable for capturing multi-scale spatiotemporal features in EEG signals. At the same time, the ultra-large parameter space of 2048 dimensions can theoretically model weak event-related potentials such as P300 / N200 in EEG signals.
[0046] Step 3 specifically involves:
[0047] During the random sampling phase, for class-imbalanced RSVP data (where the target data is much lower than the non-target data), additional processing is performed during the data sampling phase to prevent the model from having a natural bias towards a certain class.
[0048] During the data sampling process, for each target data (or non-target data) sampled, one non-target data (target data) is simultaneously sampled to achieve a balance in the number of samples of the two types.
[0049] During the contrastive learning phase, the CSCN model uses the InfoNCE loss function based on cosine similarity to simultaneously learn inter-class features and compensate for EEG data under different motion states. First, the cosine similarity (CosineSimilarity(a,n)) is used to calculate the similarity between two vectors a (positive class sample) and b (negative class sample), as shown in the following formula:
[0050]
[0051] Where a·b represents the dot product of positive class sample a and negative class sample b, and ||a|| and ||b|| are the moduli (i.e., lengths) of vectors a and b, respectively. The InfoNCE loss function based on this cosine similarity is as follows:
[0052]
[0053] Where q is the query feature sample vector, k + k is the positive feature sample vector paired with q. j It iterates through all sample vectors from 1 to N, where N is the entire sample set. τ is a temperature coefficient used to scale the cosine similarity; in this method, τ is set to 0.07. cos is the cosine similarity.
[0054] During training, static EEG data is considered as sampling range k1, and dynamic EEG data is considered as sampling range k2. Multiple batches of small-volume sampling of dynamic EEG data are used. After passing through the feature extractor, a query and comparison operation is first performed within sampling range k1, i.e., the InfoNCE loss value of q and k is calculated. The calculation formula is as follows:
[0055]
[0056] in, Represents the target label data in the source domain data. N represents the non-target labeled data in the source domain data. S This represents the entire source domain dataset. q1 and q2 are two distinct query feature sample vectors, respectively. i k j Iterate separately and All sample vectors in the data domain.
[0057] This formula treats EEG data from different motion states as different data domains. The constrained model can extract common intra-class features between different data domains to compensate for the motion data domain by the static data domain. Subsequently, multiple batches of motion-state EEG data are sampled in small batches. After passing through the feature extractor, a query and comparison operation is performed within the sampling range k2, i.e., the InfoNCE loss values of q and k are calculated. The calculation formula is as follows:
[0058]
[0059] in, Represents the target label data in the source domain data. N represents the non-target labeled data in the source domain data. TThis refers to the entire target domain dataset. This formula ensures that the model can learn the inter-class feature differences based on the motion domain data, thereby extracting different features according to different categories of data, and providing distinct features for subsequent classifiers.
[0060] During the classifier learning phase, the CSCN model loads the feature extractor trained in the contrastive learning phase and further optimizes it. First, starting with loading the pre-trained feature extractor, the feature extractor parameters are frozen. Specific parameters are detailed in the lightweight spatiotemporal convolutional layer in step two. Then, using class-balanced random sampling, both static and dynamic state data are input into the feature extractor. The output features are then used as new input to the classifier, which is trained separately. Finally, cross-entropy loss is used to iteratively optimize the classifier.
[0061] Step 4 is as follows:
[0062] Input the test set from step 1 into the model trained in step 3 for classification and recognition, and evaluate the classification metrics such as BA, recall, and F1 score.
[0063] The dataset and experimental results used in the method of this invention are described below:
[0064] 1. Dataset
[0065] This invention utilizes a publicly available dataset published in 2023 by Young-Eun Lee et al., accessible at https: / / osf.io / r7s9b / . This dataset records scalp and ear electroencephalogram (EEG) data from 24 participants under four different motion states (standing, walking slowly, walking briskly, and jogging), simultaneously performing two BCI paradigms (event-related potentials (ERP) and steady-state visual evoked potentials (SSVEP)). Data was acquired from multiple sensors, including a 32-channel scalp EEG, a 14-channel ear EEG, a 4-channel electrooculogram (EOG), and a 9-channel inertial measurement unit (IMU) placed at different body sites, providing rich information on brain activity and motion.
[0066] In the ERP paradigm, data collectors require participants to maintain accurate identification of target stimuli during movement, simulating the attention allocation needs in a real-world environment.
[0067] This invention uses the average values of BA, Recall, and F1 scores of 24 subjects as the performance metrics of the model.
[0068] 2. Experimental Results
[0069] To verify the effectiveness of the method of this invention, multiple comparative experiments were conducted on the aforementioned dataset, and compensation experiments were performed using a combination of multi-motion state datasets (2m / s, 1.6m / s, 0.8m / s, 0m / s). Evaluation metrics such as BA, recall, and F1 score were used to verify the effectiveness of the compensation algorithm.
[0070] First, we verified the effect of EEG data on RSVP classification results under different motion states. The results are shown in Table 1.
[0071] Table 1 Comparison of the impact of different states on the results
[0072]
[0073] As can be clearly observed from the results in Table 1, the faster the EEG data in motion, the greater the impact on the accuracy of RSVP classification results. This proves the necessity of the compensation algorithm, namely, that the traditional RSVP classification algorithm cannot cope with the loss of EEG signal quality in motion.
[0074] The impact of EEG data with and without compensation algorithm on the RSVP classification experiment results was then verified under different motion states, and compared with the results under the same conditions without compensation algorithm. The results are shown in Table 2. All motion state data were compensated using EEG data from the resting state.
[0075] Table 2 Comparison of the impact of compensation on the results
[0076]
[0077]
[0078] As shown in Table 2, the relevant classification indicators after adding the compensation algorithm all showed varying degrees of improvement compared to those without it. Furthermore, the improvement in these indicators showed a positive correlation with the speed of movement, exhibiting a non-linear trend. Specifically, for brisk walking, adding the compensation algorithm only improved the balance accuracy (BA) indicator by about 1.8%, but for jogging, the improvement in BA reached 15%.
[0079] The above comparison shows that the compensation algorithm proposed in this method significantly improves the RSVP classification accuracy of EEG data under motion conditions. Moreover, the faster the motion, the better the compensation algorithm performs, with the balance accuracy increasing from 0.72 to 0.83.
[0080] Meanwhile, comparative experiments were conducted using different models under the same dataset conditions to verify the effectiveness of the present invention for compensation under different motion states. The table data is as follows:
[0081]
[0082] Ultimately, the CSCN method achieved the highest overall performance. This method outperformed other methods across all evaluation metrics, including balanced accuracy, recall, and F1 score. These results demonstrate that the compensation algorithm described in this invention offers significant advantages in improving the classification accuracy and stability of the RSVP-BCI system for EEG decoding research under motion conditions. These findings not only validate the effectiveness of the new method but also showcase its potential for practical applications.
Claims
1. An adaptive compensation method for RSVP-based EEG electrode offset in autonomous movement scenarios, characterized in that, Includes the following steps: Step 1, Data Preprocessing and Channel Selection: First, visualization is performed to observe and remove obvious noise, and bad electrodes are identified and marked; then, bandpass filtering is used to retain only the effective frequency band of EEG (0.5-50Hz) to remove low-frequency drift and high-frequency noise; finally, independent component analysis is used to preliminarily remove artifacts in the motor EEG; after passing through the channel selection algorithm, the optimal channel combination is generated and input into subsequent steps. Step 2, construct the CSCN model; It is divided into a feature extraction training phase and a classifier training phase; For the feature extraction training phase, dataset X is used. S X T-train Anchored feature space and feature space to be compensated are constructed separately, and different random sampling ranges are used for the two spaces; that is, in X S Random sampling across the entire range, in X T-train Random sampling within a small area; Step 3: The training process is decoupled into two stages: In the contrastive learning stage, after feature extraction, the sampled data from different feature spaces are used to calculate the infoNCE loss based on cosine similarity; through backpropagation of the loss function, the target features and non-target features in the moving state are aligned with their corresponding features in the stationary state; at the same time, the inter-class classification ability of the feature extractor is trained; in the classifier learning stage, the feature extractor trained in the contrastive learning stage is loaded and its parameters are frozen.
2. The method according to claim 1, characterized in that: Step 1 is as follows: (1) Use a second-order Butterworth filter with a frequency range of 0.5-50Hz, that is, only retain the effective EEG frequency band of 0.5-50Hz to remove low-frequency drift and high-frequency noise; (2) The line noise removal method is used to automatically remove artifacts containing noise. For bad channels carrying abnormal signals with a standard deviation higher than the z-fraction threshold, the removal process is performed, where the threshold is 4 and the window length is 5s. Then, the removed bad channels are interpolated using the ultrafast spherical interpolation method. (3) After dimensionality reduction of the data using independent component analysis, the Infomax algorithm is used to decompose the independent components and automatically label the artifact components; the automatic detection method uses the sliding window statistical method, that is, to calculate the variance within the window and label the outlier window; (4) Calculate the mutual information between each channel signal and the target tag, quantify the correlation between the channel and the task, retain only the channels with the top 70% MI values, and remove low-correlation channels; then perform time-frequency decomposition of the EEG signal by short-time Fourier transform, extract the time-frequency features of the target-related ERP components, and retain only the channels that are highly consistent with the time-frequency patterns of the target ERP components; after the channel selection algorithm, the optimal channel combination is generated. (5) Divide each EEG signal block into different trials. For each trial, normalize the data to zero mean and unit variance. (6) The training set contains all the static state data X S Y S The test set contains a portion of motion state data, XT-train and YT-train; the test set contains another portion of motion state data, X. T-test and Y T-tes .
3. The method according to claim 1, characterized in that: Step 2 is as follows: The CSCN model has a two-part structure: a lightweight spatiotemporal convolutional layer and a classification layer. PyTorch is used to build the model. The following is a detailed explanation: (1) Lightweight spatiotemporal convolutional layer In the lightweight spatiotemporal separation convolutional layer, a 2D convolutional kernel with (channels, time_window) is used, where the spatial dimension height is channels, and the temporal dimension width is controlled by the number of sampling points, with time_window = number of sampling points / 25. A stride of (1, time_window) is set to achieve 4x downsampling in the temporal dimension, and the output dimension is set to 16 to provide multiple spatiotemporal channel weight coefficients for the convolutional layer. Subsequently, Dropout2D and BatchNorm2d layers are added. The Dropout2D layer randomly places null features with a probability of 0.2, and the momentum parameter of BatchNorm2d is set to 0.
8. (2) Classification layer In the classification layer, a multilayer perceptron (MLP) based on a fully connected neural network is used to divide the classification stage into three parts: feature extraction layer: input layer → 1024 neurons, with ReLU activation + Dropout 0.2; feature deepening layer: 1024 → 2048 neurons, with ReLU activation + Dropout 0.5; output layer: 2048 → output number of categories 2, with Softmax activation.
4. The method according to claim 1, characterized in that: Step 3 specifically involves: During the random sampling phase, for imbalanced RSVP data, additional processing is performed during the data sampling phase; during the data sampling process, for each target data point, one non-target data point is sampled simultaneously to achieve a balance between the number of samples of the two classes. During the contrastive learning phase, the CSCN model uses the InfoNCE loss function based on cosine similarity to simultaneously learn inter-class features and compensate for EEG data under different motion states. First, the cosine similarity (CosineSimilarity(a, n)) is used to calculate the similarity between two vectors, a (positive class sample) and b (negative class sample), as shown in the following formula: Where a·b represents the dot product of positive class sample a and negative class sample b. |a|| and ||b|| are the moduli, i.e., the lengths of vectors a and b, respectively; the InfoNCE loss function based on this cosine similarity is as follows: Where q is the query feature sample vector, k + For the positive feature sample vector paired with q, k j It iterates through all sample vectors from 1 to N, where N is the entire sample set; τ is the temperature coefficient with a value of 0.07; cos is the cosine similarity. During training, the static EEG data is considered as the sampling range k1, and the dynamic EEG data is considered as the sampling range k2. Multiple batches of small-volume sampling of dynamic EEG data are used. After passing through the feature extractor, a query and comparison operation is first performed within the sampling range k1, i.e., the InfoNCE loss value of q and k is calculated; the calculation formula is as follows: in, Represents the target label data in the source domain data. N represents the non-target labeled data in the source domain data. S The entire source domain dataset; q1 and q2 are two different query feature sample vectors; i and j are iterated respectively. and Data in the data domain; After passing through the feature extractor, a query and comparison operation is performed within the sampling range k2, i.e., the InfoNCE loss values of q and k are calculated; the calculation formula is as follows: in, Represents the target label data in the source domain data. N represents the non-target labeled data in the source domain data. T For the entire target domain dataset; During the classifier learning phase, the CSCN model loads the feature extractor trained in the contrastive learning phase and further optimizes it. First, it loads the pre-trained feature extractor and freezes its parameters. Then, it uses a class-balanced sampling method, inputting both static and dynamic state data into the feature extractor and using the output features as new inputs into the classifier for separate training. Finally, it uses cross-entropy loss to iteratively optimize the classifier.