Motion intention detection method and system based on comparative learning and domain adaptation
Through comparative learning and domain adaptation methods, filter group data enhancement and multi-loss function optimization are used to solve the problem of poor motion intention detection results caused by large differences between individuals, and a higher detection accuracy is achieved.
Patent Information
- Application Number
- CN202510359119.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-08-05
AI Technical Summary
In the prior art, due to the large differences between individuals, the detection methods of EEG signal in patients with dyskinesia diseases are difficult to perform well in new individuals, and data collection is time-consuming and unstable, resulting in limited results in the detection of motor intentions.
Using a method based on contrast learning and domain adaptation, the EEG signal is processed through filter group data enhancement technology. Combined with supervised contrast learning and multi-adversarial domain adaptation, time, space and frequency band features are extracted, global related information is captured, and multiple loss functions are fused to optimize model parameters.
It improves the accuracy of motion intention detection, effectively deals with differences between individuals, and improves detection performance in new individuals.
Smart Images

Figure CN120419979A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electroencephalogram (EEG) signal processing, and in particular relates to a motion intention detection method and system based on contrastive learning and domain adaptation. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] Movement disorders include Parkinson's disease, stroke sequelae, etc. Patients with movement disorders usually have intact brain functions, but due to damage to the peripheral nerves or neuromuscular systems, they are unable to effectively control body movements, which seriously affects their daily living ability; such patients have a huge demand for rehabilitation training.
[0004] While traditional rehabilitation methods are somewhat effective, they are often time-consuming and limited in effectiveness, making them unable to meet users' urgent need for functional recovery. Against this backdrop, active medical service devices based on the user's movement intention have emerged, offering new hope for those with movement disorders. By detecting movement intention, users can control external devices using EEG signals, thereby restoring some of their lost motor function. This not only significantly improves users' quality of life but also provides them with a more independent lifestyle.
[0005] Due to the complex process of collecting and processing EEG signals, collecting sufficient labeled training data is time-consuming and difficult to achieve. EEG signals are easily affected by factors such as environmental noise and physiological state, and their signal characteristics are unstable. In addition, EEG signals are non-stationary, and EEG signals vary significantly between individuals. In the existing technology, traditional methods generally rely on labeled data from specific individuals for training. Due to the large differences between individuals, the performance of motion intention detection in new individuals is often poor, making it difficult to meet the needs of practical applications. Summary of the Invention
[0006] To address these issues, the present invention proposes a method and system for motion intention detection based on contrastive learning and domain adaptation. This method enhances the target subject's data, extracts temporal, spatial, and frequency band features, and integrates globally relevant information from the EEG signal. Combining supervised contrastive learning with multi-adversarial domain adaptation further enhances feature separability. Multi-adversarial domain adaptation, while retaining category information, further explores potential connections between the source and target domains, effectively narrowing the distribution gap between the domains and improving the accuracy of motion intention detection in the target subject.
[0007] According to some embodiments, the present invention adopts the following technical solutions:
[0008] A motion intention detection method based on contrastive learning and domain adaptation includes the following steps:
[0009] Acquire EEG data and preprocess it;
[0010] The original data and the data after the filter group are spliced in the channel dimension to form the filter group samples, and the EEG data of the target domain is enhanced;
[0011] Input the filter bank samples and enhanced data samples into the trained contrastive learning domain adaptation network model to determine the motion intention;
[0012] Among them, the contrastive learning domain adaptation network model extracts the time, space and frequency band features of the input data and captures the global relevant information in the EEG data. Based on the extracted features, the contrast loss, classification loss and adversarial loss are calculated respectively, and multiple losses are integrated to jointly optimize the parameters of the contrastive learning domain adaptation network model.
[0013] As an optional implementation, in the process of acquiring EEG data, multi-channel EEG data of several subjects are acquired at a set sampling frequency.
[0014] As an optional implementation, the process of preprocessing all EEG data includes: filtering the original EEG data using a bandpass FIR filter within a set frequency range, downsampling the filtered EEG data, acquiring the filtered EEG data at a second set frequency, the second set frequency being less than the set sampling frequency, and segmenting and normalizing the downsampled EEG data according to a set time window.
[0015] As an optional implementation, the process of splicing the original data and the data passed through the filter group in the channel dimension to form filter group samples includes: dividing the filtered data into multiple sub-band signals through filter groups with different rhythms, and splicing the original data and the data after being divided into multiple sub-band signals in the channel dimension to form filter group samples.
[0016] As an optional implementation, the process of enhancing the EEG data of the target domain includes randomly splicing different frequency bands for all training samples under the same label while maintaining the original frequency band order.
[0017] As an optional implementation, the contrastive learning domain adaptation network model includes a feature extraction module, which includes a convolution module and a Transformer encoder connected in series. The convolution module is used to extract time, space and frequency band features, and the Transformer encoder is used to extract and represent the features of the input sequence layer by layer to establish a connection of global information.
[0018] Furthermore, the convolution module includes a time feature convolution layer, a spatial feature convolution layer, a frequency band feature convolution layer, a batch normalization layer and an average pooling layer. The time feature convolution layer, the spatial feature convolution layer and the frequency band feature convolution layer are used to learn time, space and frequency band features, respectively. The batch normalization layer is used to maintain the same distribution of features. The average pooling layer is used to smooth the time features, remove the electrode channel dimension with a dimension of 1, and transpose the convolution channel dimension and the time dimension. All features at each time point are sent to the Transformer encoder as input tags.
[0019] Furthermore, the Transformer encoder incorporates a multi-head attention mechanism and integrates a feedforward network layer and a residual connection layer. The multi-head attention mechanism is derived from the self-attention mechanism and is used to capture the relationship between sequences of different time points in the EEG signal. The feedforward network layer and the residual connection layer are used to perform nonlinear transformation and mapping of features.
[0020] As an optional implementation, the contrastive learning domain adaptation network model further includes a nonlinear projection head, a multi-adversarial domain discriminator and a classifier, wherein the nonlinear projection head is used to map the input data into a low-dimensional feature space, and the output features are used to calculate the contrast loss;
[0021] The multi-adversarial domain discriminator is connected to the feature extractor through a gradient reversal layer. Its training goal is to determine the domain to which the input data belongs and obtain the adversarial loss.
[0022] The classifier is used to convert the output into a probability distribution of each category, judge the subject's movement intention according to the category with the highest probability, and obtain the classification loss.
[0023] As an optional implementation, the process of fusing multiple losses includes the overall loss being the classification loss, adversarial loss, and contrast loss, each multiplied by a corresponding weight, and the sum of the three.
[0024] A motion intention detection system based on contrastive learning and domain adaptation, comprising:
[0025] A data acquisition module is configured to acquire EEG data and pre-process it;
[0026] The data enhancement module is configured to concatenate the original data and the data after the filter bank in the channel dimension to form filter bank samples, thereby enhancing the EEG data in the target domain.
[0027] a motion intention detection module configured to input the filter bank samples and the enhanced data samples into the trained contrastive learning domain adaptation network model to determine the motion intention;
[0028] Among them, the contrastive learning domain adaptation network model extracts the time, space and frequency band features of the input data and captures the global relevant information in the EEG data. Based on the extracted features, the contrast loss, classification loss and adversarial loss are calculated respectively, and multiple losses are integrated to jointly optimize the parameters of the contrastive learning domain adaptation network model.
[0029] A computer-readable storage medium is used to store computer instructions, and when the computer instructions are executed by a processor, the steps in the above method are completed.
[0030] An electronic device includes a memory and a processor, and computer instructions stored in the memory and executed on the processor. When the computer instructions are executed by the processor, the steps in the above method are completed.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] The present invention uses filter bank data enhancement technology to enhance the data of the target subject. Through a feature extractor constructed by a convolution module and a Transformer encoder, it extracts temporal, spatial, and frequency band features and coordinates the global relevant information in the EEG signal.
[0033] This paper combines supervised contrastive learning with multi-adversarial domain adaptation. Supervised contrastive learning further enhances the separability of features by shortening the distance between similar samples and increasing the distance between heterogeneous samples. Multi-adversarial domain adaptation, on the other hand, deeply explores the potential correlation between source domain subjects and target subjects while retaining category information, thereby effectively narrowing the distribution differences between subjects.
[0034] The present invention solves the problems in existing methods such as large inter-individual differences and inability to perform well in new individuals in motion intention detection, thereby improving the accuracy of motion intention detection.
[0035] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0037] Figure 1 is a method flow chart of an embodiment;
[0038] Figure 2 2 is a structural diagram of a contrastive learning domain adaptation network according to an embodiment. DETAILED DESCRIPTION
[0039] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0040] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs.
[0041] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.
[0042] In the absence of conflict, the embodiments and features in the embodiments of this application can be combined with each other.
[0043] Example 1
[0044] As mentioned in the background, due to the complexity of EEG signal acquisition and processing, collecting sufficient labeled training data is both time-consuming and difficult to achieve. EEG signals are easily affected by various factors, such as environmental noise and physiological state, resulting in unstable characteristics. Furthermore, EEG signals are non-stationary, and signals vary significantly between individuals.
[0045] Contrastive learning can effectively extract useful features by learning similarities and differences between samples. Domain adaptation can reduce the differences between different data distributions, improving the adaptability of motion intention detection models in different environments or individuals. Deep learning methods based on contrastive learning and domain adaptation have significant potential for application in the field of motion intention detection and deserve further research.
[0046] To this end, this embodiment provides a motion intention detection method based on contrastive learning and domain adaptation. After preprocessing the original EEG signal, the filter bank data enhancement technology is used to enhance the data of the target subject. The filter bank and enhanced samples are further processed using a feature extractor to extract time, space, and frequency band features and capture global dependencies. The output features are sent to three downstream modules in parallel: the nonlinear projection head maps the features to a nonlinear space, and measures the intra-class compactness and inter-class separability through supervised contrast loss; the multi-adversarial domain discriminator performs domain discrimination on the features according to the category label, and combines the gradient reversal layer to achieve adversarial domain adaptation. The classifier is used to detect motion intention on the target subject.
[0047] A series of experiments were conducted based on the above process to verify that the method based on contrastive learning and domain adaptation proposed in this embodiment is superior to the results of other contrastive detection algorithms and can effectively judge motion intention.
[0048] In this embodiment, a motion intention detection method based on contrastive learning and domain adaptation is Figure 1 As shown, the following steps are included:
[0049] Step S1: Obtain EEG data of multiple subjects and preprocess them, specifically:
[0050] S101, sampling 63 channels of EEG data:
[0051] The EEG data consists of 63 channels of two-dimensional data with a sampling frequency of 1000 Hz.
[0052] Of course, in other embodiments, the EEG data (or EEG signal) may be a data structure with other numbers of channels, and the sampling frequency may be adjusted as required and is not limited to the above values.
[0053] S102, filtering the collected EEG data:
[0054] Since common artifacts include eye movement artifacts (1-4 Hz), blink artifacts (1-4 Hz), muscle artifacts (above 30 Hz), and 50 Hz power frequency interference, and the characteristic frequencies related to movement intention are mainly concentrated in the μ (8-12 Hz) rhythm and β (13-30 Hz) rhythm range, in this embodiment, a 5-30 Hz bandpass FIR filter is used to filter the raw EEG data. The transfer function of the FIR filter can be expressed as:
[0055]
[0056] Among them, b0, b1, b2, …, b N-1 are the filter coefficients (often called the filter impulse response coefficients), and N is the filter order.
[0057] Likewise, the above values / ranges may be adjusted according to specific circumstances and are not limited to the above values.
[0058] S103, downsampling the filtered EEG data:
[0059] In order to reduce computational complexity, the sampling rate is downsampled to 100 Hz.
[0060] Of course, in other embodiments, the sampling frequency here can be lower than the original data sampling frequency, and is not limited to the above values.
[0061] S104. Segment and normalize the downsampled EEG data:
[0062] The continuous EEG signal is segmented using event markers in the EEG data.
[0063] In this embodiment, each experiment lasts for 4.5 seconds, a time window of [0, 4.5] seconds is selected, and each EEG signal segment corresponds to 450 time sampling points.
[0064] In order to eliminate the amplitude differences between different channels or experiments, the data is normalized. The normalization formula is as follows:
[0065]
[0066] Among them, X is the EEG data after downsampling, μ is the mean, and σ is the standard deviation. norm has zero mean and unit variance.
[0067] Of course, in other embodiments, the width of the time window and the normalization method may use other values or algorithms.
[0068] Step S2: Enhance the target domain subject data using the filter bank data enhancement method; specifically:
[0069] Step S201: The EEG signals of all subjects are passed through filters with different rhythms to form filter bank samples:
[0070] The EEG signal after preprocessing is Where N is the number of channels and T is the time feature.
[0071] 1) Filter bank processing: In order to retain more frequency domain information in the temporal features, all preprocessed EEG signals are divided into multiple sub-band signals through filter banks of different rhythms.
[0072] In this embodiment, filters for different rhythms include the θ rhythm of 5-8 Hz, the α rhythm of 8-13 Hz, and the β rhythm of 13-30 Hz.
[0073] The signal after each filter processing can be expressed as:
[0074]
[0075]
[0076]
[0077] 2) Splicing: Splice the original signal and the filtered signal in the channel dimension to form a filter bank sample
[0078]
[0079] Thus, the filter bank samples The dimension is expanded from the original N×T to 4N×T, N=63, T=450.
[0080] Step S202: Perform data augmentation only on the target subject:
[0081] The EEG signal acquisition process for each subject is time-consuming and difficult to obtain sufficient labeled training data. Due to the limited amount of data per subject, overfitting is prone to occur during training. Therefore, data augmentation is performed on the target subject's data.
[0082] Specifically, in this embodiment, for all training samples with the same label, different frequency bands are randomly spliced while maintaining the original frequency band order. This generates data that includes frequency band signals from multiple experiments, thereby enhancing the signal's expressiveness and enriching the data features.
[0083] Step S3: input the filter group samples and the enhanced samples into the trained contrastive learning domain adaptation network to determine the motion intention;
[0084] The contrastive learning domain adaptation network model mainly includes four parts: feature extraction module (also called feature extractor), nonlinear projection head, multi-adversarial domain discriminator and classifier. Figure 2 As shown, filter bank samples and enhanced samples are first fed into a feature extraction module consisting of a convolutional module and a Transformer encoder to extract temporal, spatial, and frequency features and capture global dependencies. The extracted features are then fed into three downstream modules in parallel: a nonlinear projection head maps the features into a nonlinear space, optimizing intra-class compactness and inter-class separability using a supervised contrastive loss; a multi-adversarial domain discriminator combines class labels to perform domain discrimination on the features and implements adversarial domain adaptation using a gradient reversal layer. The classifier predicts the subject's motion intention based on the features; ultimately, the overall optimization objective is a weighted sum of the supervised contrastive loss, the classification loss, and the adversarial loss, which are jointly optimized to improve the accuracy of motion intention detection.
[0085] Among them, the convolution module of the feature extraction module is mainly composed of the time feature convolution layer, the spatial feature convolution layer, the frequency band feature convolution layer, the batch normalization layer and the average pooling layer. First, the sample is expanded into one dimension as the convolution channel. Then, it passes through the convolution layers in the time direction, space direction, and frequency band direction in sequence to learn the time, space, and frequency band features respectively.
[0086] In this embodiment, ELU is selected as the activation function. Its formula is as follows:
[0087]
[0088] Of course, other functions may be selected as activation functions in other embodiments.
[0089] The model then undergoes batch normalization and then an average pooling layer along the temporal dimension. Smoothing out temporal features not only effectively reduces the interference of EEG signal noise on model training, but also reduces computational complexity.
[0090] Finally, to be connected in series with the Transformer encoder module, the electrode channel dimension of dimension 1 is removed and the convolution channel dimension and the time dimension are transposed. All features at each time point are fed into the Transformer encoder module as input tokens.
[0091] The Transformer encoder in the feature extraction module incorporates a multi-head attention mechanism and integrates a feedforward network layer and a residual connection layer. The multi-head attention mechanism, derived from the self-attention mechanism layer, is used to capture the relationship between sequences at different time points in the EEG signal, while the fully connected feedforward layer is used to perform nonlinear transformation and mapping of features. Therefore, the Transformer encoder can extract and represent the features of the input sequence layer by layer, establishing a global information connection. The valid features it outputs are fed in parallel into three downstream modules, enabling the model to more effectively capture complex patterns in the EEG signal, significantly improving the accuracy and robustness of motion intention detection.
[0092] In this embodiment, the calculation of self-attention is as follows:
[0093]
[0094] Among them, Attention(·) is the self-attention calculation function; Q, K and V are the query vector matrix, key vector matrix and value vector matrix respectively; d k is the key vector dimension; softmax(·) is the normalization function used to normalize the score to a probability value.
[0095] This embodiment uses a multi-head attention mechanism derived from the self-attention mechanism to further enhance the diversity of feature representation. The multi-head attention mechanism concatenates the outputs of different attention heads and obtains the final multi-head attention output through linear transformation:
[0096]
[0097] Where W Query,h 、W Key,h 、W Value,hRespectively represent the attention mechanism operation parameters on the h-th different feature space; W mul Used to compress the merged attention matrix.
[0098] The nonlinear projection head consists of a global average pooling layer, a nonlinear activation function ELU, and a fully connected layer. Its function is to map the input data into a low-dimensional feature space, and the output features are used to calculate the contrast loss:
[0099]
[0100] x i Only from target subject D t , P(i) represents the value of sample x i The positive sample set of x i A(i) represents a set of samples x i The anchor point set, except x i The set of all samples except . τ is the temperature coefficient.
[0101] This example sets up two domain discriminators based on the number of classification labels. The features output by the feature extraction module are fed into different domain discriminators based on the classification labels, with each domain discriminator responsible for domain adaptation for only one category. Because each data point is aligned only with data with the same label, while data with different labels is filtered out, this method promotes positive transfer of data with the same label while mitigating negative transfer of data with different labels.
[0102] The multi-adversarial domain discriminator and the feature extractor are connected through a gradient reversal layer.
[0103] The training goal of the domain discriminator is to determine the domain to which the input data belongs as accurately as possible, while the training goal of the feature extractor is the opposite. This adversarial relationship encourages the model to learn features that are more suitable for the target subject. Each domain discriminator consists of two fully connected layers: the first layer uses ELU as the activation function, and the last layer uses the softmax activation function to output the probability distribution of the domain label and obtain the adversarial loss:
[0104]
[0105] Among them, D y (·) represents the yth domain discriminator. For an input sample x, it will enter the corresponding domain discriminator according to its classification label y. m = 0 means x is from the source domain; m = 1 means x is from the target domain. I is an indicator function, which is set to 1 if the condition m == k is met, and to 0 otherwise.
[0106] The classifier is constructed using three fully connected layers, with dropout layers added between them to prevent overfitting. The number of neurons in the output layer is equal to the number of label types. The output is converted into a probability distribution for each category using the softmax activation function. The subject's movement intention is determined based on the category with the highest probability, and the classification loss is calculated:
[0107]
[0108] Where F(·) represents the total feature extraction part, C(·) represents the classifier, and cls represents the number of categories of the classification label. In addition, I is an indicator function, which is set to 1 if the condition y == k is met, and set to 0 otherwise.
[0109] The entire contrastive learning domain adaptation network is jointly optimized through three loss functions to improve the accuracy of the target subject's motion intention. The overall loss can be expressed as:
[0110] L total =ω c L c +ω d L d +ω s L s
[0111] where ω c 、ω d 、ω s are the weights of classification loss, adversarial loss and contrastive loss respectively.
[0112] The contrastive learning domain adaptation network used in the above process was trained using a dataset using conventional neural network training methods. The dataset used here is the publicly available Berlin Distracted Motor Imagery dataset. It primarily contains EEG data and movement intention category labels. The EEG data consists of 63 channels of two-dimensional data with a sampling frequency of 1000 Hz. The movement intention category labels are encoded using 0s and 1s, corresponding to left-hand movement intentions and right-hand movement intentions, respectively.
[0113] Accuracy and Kappa coefficient are used as evaluation indicators for the method proposed in this example. Accuracy reflects the detection accuracy of the method, while Kappa coefficient further eliminates the influence of random consistency and can more comprehensively evaluate the performance of the method. The calculation formulas for these two indicators are as follows:
[0114] 1) Accuracy:
[0115]
[0116] Among them, TP represents the number of samples correctly predicted by the model as “left hand movement intention”; TN represents the number of samples correctly predicted by the model as “right hand movement intention”; FP represents the number of samples incorrectly predicted by the model as “left hand movement intention” (actually “right hand movement intention”); FN represents the number of samples incorrectly predicted by the model as “right hand movement intention” (actually “left hand movement intention”).
[0117] 2) Kappa coefficient:
[0118]
[0119] where p o Indicates the classification accuracy of the model, p e Represents random consistency, and the calculation formula is:
[0120]
[0121] The effectiveness of the method proposed in this embodiment was verified through experiments. Samples were input into the contrastive learning domain adaptation network to obtain the predicted motion intention category. The accuracy and kappa coefficient of motion intention judgment were calculated based on the real labels and compared with other classic motion intention detection models. The comparison results are shown in Table 1:
[0122] Table 1 Comparison results of different model experiments
[0123]
[0124] As shown in Table 1, FBCSP achieved the lowest accuracy and Kappa value, indicating that traditional feature extraction methods struggle to capture nonlinear relationships and patterns in complex data, resulting in suboptimal model performance on both source and target subjects. In contrast, deep learning methods such as EEGNet outperformed FBCSP, demonstrating the advantages of deep learning in feature representation. Across all experiments, the proposed model achieved higher accuracy and average Kappa values across various tasks than other methods, achieving average accuracy increases of 9.55%, 20.99%, and 20.84% over the three classic models, EEGNet, LSTM, and DAN, respectively.
[0125] The excellent performance of the model proposed in this embodiment is due to the design of a filter bank data enhancement method, which generates new data samples by fusing frequency band signals from multiple experiments. These generated data significantly improve the expressiveness of the signal and enrich the data features. In addition, supervised contrastive learning and multi-adversarial domain adaptation are combined. Supervised contrastive learning uses category information to shorten the distance between samples of the same type and increase the distance between samples of different types, thereby enhancing intra-class consistency and inter-class distinction. Multi-adversarial domain adaptation, on the other hand, reduces the domain differences between different subjects through adversarial training while retaining category information. Therefore, the model proposed in this embodiment can effectively deal with the problems of large individual differences in EEG signals and limited data volume, and significantly improve the accuracy of motion intention detection of target subjects.
[0126] Example 2
[0127] In one embodiment of the present disclosure, a motion intention detection system based on contrastive learning and domain adaptation is provided, including a data acquisition module, a data enhancement module, and a motion intention detection module:
[0128] A data acquisition module is configured to acquire EEG data of multiple subjects and pre-process the data;
[0129] The data augmentation module is configured to divide the EEG signals of all subjects into multiple sub-band signals using filter banks with different rhythms. These sub-band signals are concatenated in parallel with the full-band EEG signal to form filter bank samples. Data augmentation is performed only on the target subjects.
[0130] The motion intention detection module is configured to: input the enhanced samples and the original filter bank samples into the trained contrastive learning domain adaptation network to determine the target subject's motion intention;
[0131] Among them, the contrastive learning domain adaptation network uses a feature extractor to extract time, space and frequency band features and coordinate the global relevant information in the EEG signal; using the nonlinear projection head, the classifier and the multi-adversarial domain discriminator respectively obtain the contrast loss, classification loss and adversarial loss, and improve the performance of the motion intention detection module by jointly optimizing multiple loss functions.
[0132] Example 3
[0133] The purpose of this embodiment is to provide a computer-readable storage medium.
[0134] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the motion intention detection method based on contrastive learning and domain adaptation as described in the first embodiment of the present disclosure.
[0135] Example 4
[0136] The purpose of this embodiment is to provide an electronic device.
[0137] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, the steps of the motion intention detection method based on contrastive learning and domain adaptation as described in the first embodiment of the present disclosure are implemented.
[0138] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0139] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0140] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0141] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0142] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made by those skilled in the art that fall within the spirit and principles of the present invention and do not require creative effort are intended to be within the scope of protection of the present invention.
Claims
1. A motion intention detection method based on contrastive learning and domain adaptation, characterized by: The following steps are involved: Acquire EEG data and preprocess it; The original data and the data after the filter group are spliced in the channel dimension to form the filter group samples, and the EEG data of the target domain is enhanced; Input the filter bank samples and enhanced data samples into the trained contrastive learning domain adaptation network model to determine the motion intention; Among them, the contrastive learning domain adaptation network model extracts the time, space and frequency band features of the input data and captures the global relevant information in the EEG data. Based on the extracted features, the contrast loss, classification loss and adversarial loss are calculated respectively, and multiple losses are integrated to jointly optimize the parameters of the contrastive learning domain adaptation network model.
2. The motion intention detection method based on contrastive learning and domain adaptation as claimed in claim 1, characterized in that: The process of obtaining EEG data and preprocessing all EEG data includes: obtaining multi-channel EEG data of several subjects at a set sampling frequency; filtering the original EEG data using a bandpass FIR filter within a set frequency range, downsampling the filtered EEG data, obtaining the filtered EEG data at a second set frequency, the second set frequency being less than the set sampling frequency, and segmenting and normalizing the downsampled EEG data according to a set time window.
3. The motion intention detection method based on contrastive learning and domain adaptation as claimed in claim 1, characterized in that: The process of splicing the original data and the data after the filter group in the channel dimension to form the filter group samples includes: dividing the filtered data into multiple sub-band signals through the filter group with different rhythms, and splicing the original data and the data after being divided into multiple sub-band signals in the channel dimension to form the filter group samples.
4. The motion intention detection method based on contrastive learning and domain adaptation as claimed in claim 1, characterized in that: The process of enhancing the EEG data of the target domain includes randomly splicing different frequency bands for all training samples under the same label while maintaining the original frequency band order.
5. The motion intention detection method based on contrastive learning and domain adaptation as claimed in claim 1, wherein: The contrastive learning domain adaptation network model includes a feature extraction module, which includes a convolution module and a Transformer encoder connected in series. The convolution module is used to extract time, space and frequency band features, and the Transformer encoder is used to extract and represent the features of the input sequence layer by layer to establish a connection of global information.
6. The motion intention detection method based on contrastive learning and domain adaptation as claimed in claim 5, characterized in that: The convolution module includes a time feature convolution layer, a spatial feature convolution layer, a frequency band feature convolution layer, a batch normalization layer and an average pooling layer. The time feature convolution layer, the spatial feature convolution layer and the frequency band feature convolution layer are used to learn time, space and frequency band features respectively. The batch normalization layer is used to maintain the same distribution of features. The average pooling layer is used to smooth the time features, remove the electrode channel dimension with a dimension of 1, and transpose the convolution channel dimension and the time dimension. All features at each time point are sent to the Transformer encoder as input tags.
7. The motion intention detection method based on contrastive learning and domain adaptation as claimed in claim 5, characterized in that: The Transformer encoder incorporates a multi-head attention mechanism and integrates a feedforward network layer and a residual connection layer. The multi-head attention mechanism is derived from the self-attention mechanism and is used to capture the relationship between sequences of different time points in the EEG signal. The feedforward network layer and the residual connection layer are used to perform nonlinear transformation and mapping of features.
8. The motion intention detection method based on contrastive learning and domain adaptation as claimed in claim 1, wherein: The contrastive learning domain adaptation network model further includes a nonlinear projection head, a multi-adversarial domain discriminator and a classifier, wherein the nonlinear projection head is used to map input data into a low-dimensional feature space, and the output features are used to calculate the contrast loss; The multi-adversarial domain discriminator is connected to the feature extractor through a gradient reversal layer. Its training goal is to determine the domain to which the input data belongs and obtain the adversarial loss. The classifier is used to convert the output into a probability distribution of each category, judge the subject's movement intention according to the category with the highest probability, and obtain the classification loss.
9. The motion intention detection method based on contrastive learning and domain adaptation as claimed in claim 1, wherein: The process of integrating multiple losses includes the overall loss being the classification loss, adversarial loss and contrast loss, each multiplied by the corresponding weight, and the sum of the three.
10. A motion intention detection system based on contrastive learning and domain adaptation, characterized by: include: A data acquisition module is configured to acquire EEG data and pre-process it; The data enhancement module is configured to concatenate the original data and the data after the filter bank in the channel dimension to form filter bank samples, thereby enhancing the EEG data in the target domain. a motion intention detection module configured to input the filter bank samples and the enhanced data samples into the trained contrastive learning domain adaptation network model to determine the motion intention; Among them, the contrastive learning domain adaptation network model extracts the time, space and frequency band features of the input data and captures the global relevant information in the EEG data. Based on the extracted features, the contrast loss, classification loss and adversarial loss are calculated respectively, and multiple losses are integrated to jointly optimize the parameters of the contrastive learning domain adaptation network model.
Citation Information
Cited By
Electroencephalogram signal analysis method
CN121154179A