Causal invariant motor imagery decoding method supported by recognizable hidden variables
The invariant representation related to motion intention in the EEG signal is extracted through the principle of causal invariance and the pre-trained model, which solves the problem of difficulty in extracting key hidden variables in the prior art, and improves the accuracy and robustness of motion imagination decoding.
Patent Information
- Application Number
- CN202510191857.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-21
- Publication Date
- 2025-06-10
AI Technical Summary
The prior art is difficult to effectively extract key hidden variables directly related to motor imagination in EEG signals, affecting decoding performance and generalization ability.
Using the principle of causal invariance, the invariant representations in the EEG signal that are only related to motor intention from the perspective of causal relationship are extracted through pre-training models, and used as a priori knowledge solution to entangle the implicit representations related to motor intention in the EEG signal.
It improves the accuracy and robustness of decoding of EEG signals in motion imagination, and enhances the generalization ability and application prospects of the model.
Smart Images

Figure CN120123729A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of bioelectric signal processing, and in particular to a causal invariant motor imagery decoding method capable of identifying latent variable support. Background Art
[0002] Brain-Computer Interface (BCI) is a very promising technology that establishes a direct channel for communication and control between the brain and external devices. By recording and decoding brain activity, BCI systems can achieve many exciting applications, such as helping people with disabilities recover motor function and improving the entertainment experience of healthy people. Among the many BCI paradigms, motor imagery is one of the most widely used active experimental paradigms. This paradigm allows users to imagine the movement of a limb without actual movement and is considered to be a very effective rehabilitation training method. Although motor imagery has shown great application potential in the field of rehabilitation, its actual promotion still faces many limitations. Among them, improving the accuracy and stability of motor imagery EEG signal decoding is one of the most critical challenges. To solve this problem, many studies have tried to use methods based on traditional machine learning or deep learning. However, these methods are usually difficult to effectively extract the key hidden variables in EEG signals that are directly related to motor imagery, and this limitation may significantly affect their decoding performance and generalization ability. In recent years, causal inference technology has made remarkable progress in image processing, recommender systems and other fields, providing a new perspective and tool to reveal the potential causal relationship in complex data. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a causal-invariant motor imagery decoding method supported by identifiable latent variables. Drawing on the theoretical framework of causal inference, an in-depth analysis of motor imagery EEG signals is conducted, aiming to explore the task-related features in the signals from the perspective of causality, thereby further improving the accuracy and robustness of motor imagery EEG signal decoding.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0005] A causal invariant motor imagery decoding method capable of identifying latent variable support comprises the following steps:
[0006] S1 Prior Knowledge Extraction:
[0007] S11 aligns the motor imagery EEG signals of the two subjects according to the labels;
[0008] S12 constructs two dynamic hierarchical convolutional encoders to encode the EEG signals of the two subjects into two multivariate Gaussian distributions respectively;
[0009] S13 Calculate the model posterior distribution according to the encoded multivariate Gaussian distribution, and calculate the Kullback-Leibler divergence loss between the posterior distribution and the encoded distributions of the EEG signals of the two subjects respectively. At the same time, obtain the identifiable latent variables by reparameterizing the posterior distribution;
[0010] S14 Construct two volume-preserving flow decoders, reconstruct the latent variables obtained by reparameterization, obtain two reconstructed EEG signals, and calculate the reconstruction loss;
[0011] S2 Causal invariant variational autoencoder training:
[0012] S21 Construct two dynamic hierarchical convolutional encoders to encode the input motor imagery EEG signals into a task-related latent distribution and a task-unrelated latent distribution;
[0013] S22 According to the encoded task-related latent distribution, obtain the task-related variables by reparameterization; construct a classifier to classify and identify the task-related variables;
[0014] S23 Calculate the Kullback-Leibler divergence loss between the task-related latent distribution and the prior distribution, and the Kullback-Leibler divergence loss between the task-unrelated latent distribution and the prior distribution;
[0015] S24 Calculate the model posterior distribution according to the encoded task-related latent distribution and task-unrelated latent distribution and perform reparameterization to obtain the latent variables of the input EEG signals;
[0016] S25 Construct a volume-preserving flow decoder to reconstruct the reparameterized latent variables and obtain the reconstructed EEG signals.
[0017] A further improvement of the technical solution of the present invention lies in: in S11, according to the labels, align the motor imagery EEG signals of the two subjects and For a dataset containing EEG signals of multiple subjects, first calculate the average of the EEG signals of multiple trials of each subject as follows:
[0018]
[0019] where, X i represents the EEG signal of the i-th trial, t represents the total number of trials, c represents the number of EEG signal channels, and m represents the number of sampling points;
[0020] Select the EEG signals of one subject from the dataset as the training data, and calculate the Pearson correlation coefficient r between the EEG signals of this subject and the remaining subjects;
[0021]
[0022] Among them, and represent the average EEG signals of two different subjects, and represent the EEG signals of the i-th trial of two different subjects;
[0023] According to the calculated Pearson correlation coefficient, select the subject with the largest Pearson correlation coefficient with this subject from the dataset as the data of another subject for the pre-trained model.
[0024] A further improvement of the technical solution of the present invention lies in: in S12, the dynamic hierarchical convolutional encoder includes:
[0025] Three multi-scale temporal convolutional blocks to extract features of EEG signals in different frequency ranges;
[0026] One global spatial convolutional block to extract the global spatial domain features of EEG signals;
[0027] One left-right symmetric hemisphere spatial convolutional block to extract the spatial features of the left-right symmetric brain regions of EEG signals.
[0028] Two multivariate Gaussian distributions and are parameterized by the two dynamic hierarchical convolutional encoders respectively;
[0029] Among them, μ 1 , σ 1 , μ 2 , σ 2 represent the mean and variance of the data of two subjects respectively, x 1 and x 2 represent two different subjects respectively.
[0030] A further improvement of the technical solution of the present invention lies in: in S13, calculate the posterior distribution p(u|x 1 , x 2 ) of the model according to the encoded multivariate Gaussian distribution, and calculate the Kullback-Leibler divergence losses between the posterior distributions p(u|x 1 , x 2 ) and p(u|x 1 ) and p(u|x 2 ) respectively, and at the same time obtain the identifiable latent variable through the reparameterized posterior distribution The calculation process of the posterior distribution of the model is:
[0031] p(u|x 1 , x 2 ) = p(u|x 1)p(u|x 2 );
[0032] The posterior distribution p(u|x 1 ,x 2 ), respectively, and the distributions p(u|x 1 ) and p(u|x 2 ) The calculation process of the Kullback-Leibler divergence loss is as follows:
[0033]
[0034] Among them, D KL (·) represents the Kullback-Leibler divergence;
[0035] After obtaining the posterior distribution p(u|x 1 ,x 2 ), the identifiable latent variable is obtained through the reparameterization trick
[0036]
[0037] Among them, μ u and σ u represent the mean and variance, respectively, and ε represents random noise.
[0038] A further improvement of the technical solution of the present invention lies in: in S14, two volume-preserving flow decoders are constructed to reconstruct the latent variable obtained by reparameterization to obtain two reconstructed electroencephalogram signals and and calculate the reconstruction loss;
[0039] The specific process of constructing the volume-preserving flow decoder is as follows: First, the latent variable u is divided into two parts u 1:l ,u l+1:n , and then by concatenating y 1:l and y l+1:n to get where:
[0040] y 1:l =u 1:l
[0041] y l+1:n =u l+1:n ⊙exp(g(u 1:l )+t(u 1:l ))
[0042] g(·) and t(·) are two functions, mapping Let \(l\) denote the number of features in the first part, and \(n\) denote the total number of features;
[0043] After obtaining the identifiable latent variable \(u\), two volume-preserving flow decoders are used to reconstruct the identifiable latent variable to obtain the reconstructed EEG signal and and calculate the reconstruction loss:
[0044]
[0045] where MSE(·) represents the mean square error, and represent the reconstructed data of two different subjects respectively.
[0046] A further improvement of the technical solution of the present invention lies in: in S21, the dynamic hierarchical convolutional encoder described in S12 is applied to encode the input motor imagery EEG signal into a task-related latent distribution and a task-unrelated latent distribution
[0047] A further improvement of the technical solution of the present invention lies in: in S22, according to the encoded task-related latent distribution \(p(s|x)\), a task-related variable is obtained through reparameterization
[0048]
[0049] where \(\epsilon\) represents random noise; the constructed classifier consists of a linear transformation layer and a ReLU activation layer, and classifies and identifies the task-related variable \(s\).
[0050] A further improvement of the technical solution of the present invention lies in: in S23, calculate the Kullback-Leibler divergence loss between \(p(s|x)\) and \(p(u)\) and the Kullback-Leibler divergence loss between \(p(v|x)\) and \(p(u)\), and at the same time constrain the Kullback-Leibler divergence loss between \(p(u)\) and \(p(s|x)\) to decrease along the gradient direction and the Kullback-Leibler divergence loss between \(p(u)\) and \(p(v|x)\) to increase along the gradient direction:
[0051] Calculate the Kullback-Leibler divergence loss between \(p(u)\) and \(p(s|x)\) and constrain it to decrease along the gradient direction, and at the same time calculate the Kullback-Leibler divergence loss between \(p(u)\) and \(p(v|x)\) and constrain it to increase along the gradient direction. Therefore, the Kullback-Leibler divergence loss is expressed as:
[0052]
[0053] Among them, D KL (·) represents the Kullback-Leibler divergence loss;
[0054] The specific process of the Kullback-Leibler divergence loss that constrains p(u) and p(v|x) to increase along the gradient direction is to add a gradient reversal layer during the process of calculating the mean and variance of the distribution p(v|x), ensuring the constraint
[0055] A further improvement of the technical solution of the present invention lies in: in S24, according to the task-related p(s|x) and task-unrelated p(v|x) hidden distributions of the encoding, calculate the posterior distribution p(z|x) of the model and perform reparameterization to obtain the latent variable of the input EEG signal The calculation process of the posterior distribution is as follows:
[0056] p(z|x) = p(s, v|x) = p(s|x)p(v|x).
[0057] A further improvement of the technical solution of the present invention lies in: in S25, through a volume-preserving flow decoder, map the reparameterized latent variable to reconstruct y into an EEG signal
[0058] and calculate the reconstruction loss:
[0059]
[0060] Among them, MSE(·) represents the mean square error.
[0061] Due to the adoption of the above technical solution, the technical progress achieved by the present invention is:
[0062] 1. The present invention is novel and efficient; based on the principle of causal invariance, this invention patent has successfully extracted the invariant representation related only to the movement intention in the EEG signal from the perspective of causal relationship through a pre-trained model, and used it as prior knowledge to disentangle the hidden representations related and unrelated to the movement intention in the EEG signal, thereby improving the decoding performance of motor imagery.
[0063] 2. The present invention has high robustness and generalization; this invention patent designs two different decoders to encode the task-related and task-unrelated hidden distributions respectively, and uses the invariant representation obtained from the pre-trained model as prior knowledge to ensure the successful encoding of the task-related and task-unrelated hidden distributions, promoting the generalization and robustness of the model.
[0064] 3. The present invention has certain application prospects; in the field of brain-computer interface research, electroencephalogram (EEG) intention recognition is the current key research direction, and the method proposed in this invention patent can effectively extract the invariant representation characterizing the movement task in the EEG signal, improve the generalization ability of the model, and has good research prospects for promoting the practical application of the brain-computer interface. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 It is a causal graph of the EEG signal generation structure assumed by a causal invariant motor imagery decoding method supported by identifiable latent variables disclosed by the present invention;
[0066] Figure 2 It is the overall structure diagram of a causal invariant motor imagery decoding method supported by identifiable latent variables disclosed by the present invention;
[0067] Figure 3 It is the encoder structure diagram of a causal invariant motor imagery decoding method supported by identifiable latent variables disclosed by the present invention;
[0068] Figure 4 It is the distribution diagram of latent variables obtained in the pre-trained model of a causal invariant motor imagery decoding method supported by identifiable latent variables disclosed by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0069] The present invention will be further described in detail below with reference to the drawings and embodiments:
[0070] In the description of the present invention, it should be understood that the orientation or positional relationship indicated by terms such as "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention.
[0071] In addition, terms such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first", "second", etc. may explicitly or implicitly include at least one such feature. In the description of the present invention, the meaning of "a plurality of" is at least two, such as two, three, etc., unless otherwise specifically defined.
[0072] As Figure 1 shown, Figure 1The structural causal graph generated by the electroencephalogram (EEG) signals hypothesized by a causal invariant motor imagery decoding method supported by identifiable latent variables disclosed in the present invention. The present invention assumes that the EEG signals are generated by potential task-related signals S (i.e., EEG signals related only to the motor imagery intention of the subject, also known as semantic or invariant features) and task-unrelated signals V, such as EEG signals related to the physiological characteristics of the subject, electrooculogram, eye movement signals, artifacts, and environmental noise, etc. Under this assumption, it can be seen that the task-unrelated signal V will change with the change of the subject or the external environment, while the task-related signal S is only related to the motor intention of the subject and will not be affected by the environment E. Therefore, the motor intention Y of the subject can be more stably identified through the task-related signal S.
[0073] As Figure 2 shown, Figure 2 The overall structure diagram of a causal invariant motor imagery decoding method supported by identifiable latent variables disclosed in the present invention. Specifically, the extraction of identifiable latent variables includes the steps of prior knowledge extraction and causal invariant variational autoencoder training:
[0074] S1. Prior knowledge extraction;
[0075] S11. Select subject pairs; according to the labels, align the motor imagery EEG signals of two subjects and For a dataset containing EEG signals of multiple subjects, first calculate the average of the EEG signals of multiple trials of each subject :
[0076]
[0077] where, X i represents the EEG signal of the i-th trial, t represents the total number of trials, c represents the number of EEG signal channels, and m represents the number of sampling points;
[0078] Select the EEG signal of one subject from the dataset as the training data, and calculate the Pearson correlation coefficient r between the EEG signals of this subject and the remaining subjects:
[0079]
[0080] where, and represent the average EEG signals of two different subjects, and represent the EEG signals of the i-th trial of two different subjects;
[0081] According to the calculated Pearson correlation coefficient, select the subject with the largest Pearson correlation coefficient with this subject from the dataset as the data of another subject for the pre-training model;
[0082] S12 constructs two dynamic hierarchical convolutional encoders, which respectively encode the motor imagery EEG signals of two subjects into two multivariate Gaussian distributions;
[0083] That is, the data of the two subjects selected in S11 are respectively input into two different encoders to encode the distributions of these two subjects, namely encoding and
[0084] where, μ 1 , σ 1 , μ 2 , σ 2 respectively represent the mean and variance of the data of the two subjects, x 1 and x 2 respectively represent two different subjects;
[0085] S13 calculates the model posterior distribution p(u|x 1 , x 2 ) according to the encoded multivariate Gaussian distributions, and constrains the posterior distribution p(u|x 1 , x 2 ) to be similar to p(u|x 1 ) and p(u|x 2 ) respectively, and at the same time obtains an identifiable latent variable by reparameterizing the posterior distribution
[0086] According to the two distributions p(u|x 1 ) and p(u|x 2 ) calculated in S12, calculate the posterior distribution:
[0087] p(u|x 1 , x 2 ) = p(u|x 1 ) p(u|x 2 ) (3)
[0088] And constrain the posterior distribution p(u|x 1 , x 2 ) to be similar to the distributions p(u|x 1 ) and p(u|x 2 ) respectively by calculating the Kullback-Leibler divergence, that is, by calculating:
[0089]
[0090] where, D KL (·) represents the Kullback-Leibler divergence;
[0091] After obtaining the posterior distribution p(u|x 1 ,x 2 ), an identifiable latent variable is obtained through the reparameterization trick
[0092]
[0093] where μ u and σ u represent the mean and variance respectively, and ε represents random noise;
[0094] S14 constructs two volume-preserving flow decoders to reconstruct the latent variable obtained by reparameterization to obtain two reconstructed EEG signals and and calculate the reconstruction loss;
[0095] The specific process of constructing the volume-preserving flow decoder is as follows: First, the latent variable u is divided into two parts u 1:l ,u l+1:n , and then by concatenating y 1:l and y l+1:n to obtain where:
[0096] y 1:l = u 1:l (6)
[0097] y l+1:n = u l+1:n ⊙ exp(g(u 1:l )) + t(u 1:l )) (7)
[0098] g(·) and t(·) are two functions, mapping l represents the number of features in the first part, and n represents the total number of features;
[0099] After obtaining the identifiable latent variable u, two volume-preserving flow decoders are used to reconstruct the identifiable latent variable to obtain the reconstructed EEG signals and and calculate the reconstruction loss:
[0100]
[0101] where, MSE(·) represents the mean square error, and represent the reconstructed data of two different subjects respectively.
[0102] S2. Train to obtain a causally invariant variational autoencoder;
[0103] S21 applies the dynamic hierarchical convolutional encoder described in S12 to encode the input motor imagery EEG signals into a task-related latent distribution and a task-unrelated latent distribution
[0104] Select the data of one subject from the data of the two subjects used to train the pre-trained model in S1 as the training target, and input the data of this subject into two different dynamic hierarchical convolutional encoders to encode the task-related latent distribution and the task-unrelated latent distribution
[0105] S22 obtains the task-related variables through reparameterization according to the encoded task-related latent distribution p(s|x).
[0106]
[0107] where ε represents random noise;
[0108] Then, the task-related variables s are input into a classifier composed of a linear layer and a ReLU activation layer to identify the motor intention.
[0109] S23 constrains the task-related latent distribution p(s|x) to be more similar to the prior distribution p(u), and the task-unrelated latent distribution p(v|x) to be less similar to the prior distribution p(u);
[0110] Calculate the Kullback-Leibler divergence between p(u) and p(s|x) and constrain it to be minimized, and at the same time calculate the Kullback-Leibler divergence between p(u) and p(v|x) and constrain it to be maximized. Therefore, the Kullback-Leibler divergence loss is expressed as:
[0111]
[0112] where D KL (·) represents the Kullback-Leibler divergence loss;
[0113] In addition, constraining the Kullback-Leibler divergence between p(u) and p(v|x) to be maximized specifically adds a gradient reversal layer in the process of calculating the mean and variance of the distribution p(v|x) to ensure the constraint
[0114] S24 Calculate the posterior distribution p(z|x) of the model according to the encoded task-related p(s|x) and task-unrelated p(v|x) latent distributions, and perform reparameterization to obtain the latent variables of the input EEG signals.
[0115] According to the encoded task-related p(s|x) and task-unrelated p(v|x) latent distributions, calculate the posterior distribution of the model:
[0116] p(z|x) = p(s, v|x) = p(s|x)p(v|x) (11)
[0117] Meanwhile, obtain the latent variables from the posterior distribution p(z|x) through the reparameterization trick.
[0118]
[0119] S25 Construct a volume-preserving flow decoder to reconstruct the reparameterized latent variables to obtain the reconstructed EEG signals.
[0120] Similar to S1, construct a volume-preserving flow decoder to reconstruct the latent variable z and obtain the reconstructed EEG signals. And calculate the reconstruction loss:
[0121]
[0122] where MSE(·) represents the mean squared error.
[0123] As Figure 3 shown, Figure 3 is the encoder structure diagram of a causal invariant motor imagery decoding method supported by identifiable latent variables disclosed in the present invention; the encoders described in S1.2 and S2.1 include a dynamic time convolution module and a hierarchical spatial convolution, and the following will elaborate on these two parts.
[0124] The dynamic time convolution module is essentially a multi-scale convolution module, which includes three convolutional layers with different temporal convolution kernels, and each convolutional layer can be expressed as:
[0125]
[0126] where Conv(·) represents the convolution operation, represents the i-th temporal scale convolution kernel;
[0127] After obtaining the convolution features of three different temporal scales, concatenate them, that is
[0128]
[0129] Among them, Concat(·) represents the concatenation operation;
[0130] Next, the dynamic time convolution features are input into the hierarchical spatial convolution module; this module includes two parts: global spatial convolution and symmetric hemispherical spatial convolution;
[0131] The global spatial convolution layer performs spatial convolution on all channels, and its operation process is expressed as:
[0132] Layer sg = Conv(Layer t , k sg ) (16)
[0133] Among them, k sg represents the global spatial convolution kernel;
[0134] The symmetric hemispherical spatial convolution layer performs symmetric convolution on the channels within the left and right hemispheres and then concatenates them. Its specific process is expressed as:
[0135]
[0136]
[0137] Among them, k sl represents the symmetric hemispherical spatial convolution kernel, and respectively represent the spatial convolution features of the left and right symmetric hemispheres;
[0138] Finally, the outputs of the global spatial convolution layer and the symmetric hemispherical spatial convolution layer are concatenated and fused through a fusion layer, which is used as the output result of the encoder. Its operation process is expressed as:
[0139] Layer f = Conv(Concat(Layer sg , Layer sl ), k) (19)
[0140] Among them, k represents the convolution kernel of the fusion layer.
[0141] See Figure 4 , Figure 4 which is the distribution diagram of different category variables obtained by obtaining latent variables in the pre-trained model and using t-SNE for dimensionality reduction in a causal invariant motor imagery decoding method supported by identifiable latent variables disclosed in the present invention. It can be seen from the dimensionality reduction result diagram that there are obvious distinctions between different categories and obvious clustering between the same categories.
[0142] The above embodiments are only used to illustrate the present invention rather than limit the technical solutions described in the present invention. Therefore, although this specification has described the present invention in detail with reference to the above respective embodiments, the present invention can still be modified or equivalently replaced. Its technical solutions and improvements should all be covered within the scope of the claims of the present invention.
Claims
1. A causal invariant motor imagery decoding method capable of identifying latent variable support, characterized in that: The following steps are involved: S1 Prior Knowledge Extraction: S11 aligns the motor imagery EEG signals of the two subjects according to the labels; S12 constructs two dynamic hierarchical convolutional encoders to encode the EEG signals of the two subjects into two multivariate Gaussian distributions respectively; S13 calculates the posterior distribution of the model according to the encoded multivariate Gaussian distribution, and calculates the Kullback-Leibler divergence loss between the posterior distribution and the EEG signal encoding distribution of the two subjects, and obtains identifiable latent variables by reparameterizing the posterior distribution; S14 constructs two volume-preserving stream decoders, reconstructs the latent variables obtained by reparameterization, obtains two reconstructed EEG signals, and calculates the reconstruction loss; S2 Causally Invariant Variational Autoencoder Training: S21 constructs two dynamic hierarchical convolutional encoders to encode the input motor imagery EEG signals into task-related latent distribution and task-independent latent distribution; S22 obtains task-related variables by reparameterization based on the encoded task-related latent distribution; constructs a classifier to classify and identify task-related variables; S23 calculates the Kullback-Leibler divergence loss between the task-dependent latent distribution and the identifiable latent variable distribution, as well as the Kullback-Leibler divergence loss between the task-independent latent distribution and the identifiable latent variable distribution; S24 calculates the model posterior distribution and reparameterizes it according to the encoded task-related latent distribution and task-independent latent distribution to obtain the latent representation of the input EEG signal; S25 constructs a volume-preserving stream decoder to reconstruct the reparameterized latent variables and obtain the reconstructed EEG signal.
2. The causal invariant motor imagery decoding method supported by identifiable latent variables according to claim 1, characterized in that: In S11, the motor imagery EEG signals of the two subjects were analyzed according to the labels. Perform data alignment; for a data set containing multiple EEG signals of subjects, first calculate the EEG signals of each subject for multiple trials Average of: Among them, X i represents the EEG signal of the ith trial, t represents the total number of trials, c represents the number of EEG signal channels, and m represents the number of sampling points; Select the EEG signal of a subject from the data set as training data, and calculate the Pearson correlation coefficient r between the EEG signals of this subject and the remaining subjects: in, represents the average EEG signal of two different subjects, represents the EEG signals of the i-th trial of two different subjects; According to the calculated Pearson correlation coefficient, the subject with the largest Pearson correlation coefficient with the subject is selected from the data set as another subject data of the pre-training model.
3. The causal invariant motor imagery decoding method supported by identifiable latent variables according to claim 1, characterized in that: In S12, the dynamic hierarchical convolution encoder includes: Three multi-scale temporal convolution blocks to extract features of EEG signals in different frequency ranges; A global spatial convolution block to extract global spatial features of EEG signals; A left-right symmetrical hemispheric spatial convolution block extracts the spatial features of the left-right symmetrical brain regions of the EEG signal. Two multivariate Gaussian distributions Parameterized by the two dynamic hierarchical convolutional encoders respectively; Among them, μ1, σ1, μ2, σ2 represent the mean and variance of the data of two subjects respectively, and x1 and x2 represent two different subjects respectively.
4. The causal invariant motor imagery decoding method supported by identifiable latent variables according to claim 1, characterized in that: In S13, the posterior distribution p(u|x1,x2) of the model is calculated according to the encoded multivariate Gaussian distribution, and the Kullback-Leibler divergence loss between the posterior distribution p(u|x1,x2) and p(u|x1) and p(u|x2) is calculated respectively. At the same time, the identifiable latent variables are obtained by reparameterizing the posterior distribution The calculation process of the posterior distribution of the model is: p(u|x1,x2)=p(u|x1)p(u|x2); The Kullback-Leibler divergence loss calculation process between the posterior distribution p(u|x1,x2) and the distribution p(u|x1) and p(u|x2) is: in, D KL (·) represents the Kullback-Leibler divergence; After obtaining the posterior distribution p(u|x1,x2), the identifiable latent variables are obtained through the reparameterization technique Among them, μ u and σ u denote the mean and variance respectively, and ε denotes random noise.
5. The causal invariant motor imagery decoding method supported by identifiable latent variables according to claim 1, characterized in that: In S14, two volume-preserving stream decoders are constructed to transform the latent variables obtained by reparameterization into Reconstruct and obtain two reconstructed EEG signals And calculate the reconstruction loss; The specific process of constructing the volume-preserving stream decoder is as follows: First, the latent variable u is divided into two parts u 1:l ,u l+1:n , and then by concatenating y 1:l and l+1:n get in: y 1:l =u 1:l y l+1:n =u l+1:n ⊙exp(g(u 1:l )+t(u 1:l )) g(·) and t(·) are two functions that map l represents the number of features in the first part, and n represents the total number of features; After obtaining the identifiable latent variable u, the identifiable latent variable is reconstructed through two volume-preserving stream decoders to obtain the reconstructed EEG signal And calculate the reconstruction loss: in, MSE(·) represents mean square error, They represent the reconstructed data of two different subjects.
6. The causal invariant motor imagery decoding method supported by identifiable latent variables according to claim 1, characterized in that: In S21, the dynamic hierarchical convolutional encoder described in S12 is used to convert the input motor imagery EEG signal Encoded as task-dependent latent distribution Task-independent implicit distribution 7. The causal invariant motor imagery decoding method supported by identifiable latent variables according to claim 1, characterized in that: In S22, task-related variables are obtained by reparameterization according to the encoded task-related implicit distribution p(s|x). Among them, ε represents random noise; The constructed classifier consists of a linear transformation layer and a ReLU activation layer to classify and identify the task-related variables s.
8. The causal invariant motor imagery decoding method capable of identifying latent variable support according to claim 1, characterized in that: In S23, the Kullback-Leibler divergence loss between p(s|x) and p(u) and the Kullback-Leibler divergence loss between p(v|x) and p(u) are calculated, while constraining the Kullback-Leibler divergence loss between p(u) and p(s|x) to decrease in the direction of the gradient and the Kullback-Leibler divergence loss between p(u) and p(v|x) to increase in the direction of the gradient: The Kullback-Leibler divergence loss of p(u) and p(s|x) is calculated and constrained to descend in the direction of the gradient. At the same time, the Kullback-Leibler divergence loss of p(u) and p(v|x) is calculated and constrained to rise in the direction of the gradient. Therefore, the Kullback-Leibler divergence loss is expressed as: in, D KL (·) represents the Kullback-Leibler divergence loss; The specific process of constraining the Kullback-Leibler divergence loss of p(u) and p(v|x) to rise along the gradient direction is to add a gradient reversal layer in the process of calculating the mean and variance of the distribution p(v|x) to ensure that the constraints 9. The causal invariant motor imagery decoding method capable of identifying latent variable support according to claim 1, characterized in that: In S24, according to the encoded task-related p(s|x) and task-independent p(v|x) latent distributions, the model posterior distribution p(z|x) is calculated and reparameterized to obtain the latent variables of the input EEG signal The calculation process of the posterior distribution is: p(z|x)=p(s,v|x)=p(s|x)p(v|x).
10. The causal invariant motor imagery decoding method capable of identifying latent variable support according to claim 1, characterized in that: In S25, the re-parameterized latent variables are decoded through the volume-preserving flow decoder. Mapping Reconstruct y into EEG signal And calculate the reconstruction loss: Here, MSE(·) represents mean square error.