Multi-category motor imagery EEG signal recognition method based on Riemann space quantization
Through the multi-category motion imaginary EEG signal recognition method based on Riemann space quantization, the logarithmic Euclidean distance metric learning function and stochastic gradient descent method is used to solve the problem of low accuracy of multi-category EEG signal recognition in the existing technology, and realize the realization of the following methods. It has efficient and real-time recognition, and is suitable for brain-computer interface systems.
Patent Information
- Application Number
- CN202011170973.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-28
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2040-10-28
AI Technical Summary
The existing methods for identifying EEG signals in the scalp are mainly binary classifiers, which are difficult to efficiently identify multiple categories of EEG signals, resulting in low recognition accuracy and affecting the actual use of brain-computer interfaces and user experience.
Using multi-category motor imaginary EEG signal recognition method based on Riemann space quantization, the learning rules for prototype and distance measurement functions are established by obtaining the covariance matrix of EEG signals, and using logarithmic Euclidean distance measurement learning function and stochastic gradient descent method. , realize logarithmic European measurement learning, conduct quantitative learning, and finally use the winner to obtain all rules to output the recognition results.
It improves the recognition accuracy of multiple categories of EEG signals, simplifies preprocessing steps, reduces the computational complexity, realizes real-time recognition and online updates, and is suitable for practical brain-computer interface systems.
Smart Images

Figure CN114510956B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of biological signal recognition, and in particular is a multi-category motor imagery scalp electroencephalogram signal recognition method based on Riemann space quantization and adopting logarithmic Euclidean measurement. Background Art
[0002] Brain-computer interface technology uses EEG signals to control external devices, providing a new way for the brain to interact with the outside world. Its core technology is the recognition of EEG signals. Motor imagery scalp EEG signals have become the most promising control signals for brain-computer interface systems due to their flexibility in acquisition, ease of operation, and high user recognition. However, scalp EEG signals are non-stationary and nonlinear signals with characteristics such as weak signal amplitude, low signal-to-noise ratio, and large noise interference. Therefore, it is difficult to recognize EEG signals.
[0003] At present, most of the recognition methods of motor imagery scalp EEG signals are essentially binary classifiers. For multi-category EEG signal recognition, a one-to-many or one-to-one strategy is usually used to decompose it into several binary classification problems, and finally a decision is made by voting. Therefore, the recognition accuracy of multi-category EEG signals is not high, which affects the actual use of brain-computer interfaces and the user experience. Summary of the invention
[0004] The purpose of the present invention is to provide a natural multi-category EEG signal recognition method to improve the recognition accuracy of multi-category motor imagery EEG signals.
[0005] The technical solution adopted by the present invention to achieve the above-mentioned purpose is:
[0006] The multi-category motor imagery EEG signal recognition method based on Riemann space quantization includes the following steps:
[0007] Collect EEG signals of different motor imagery tasks;
[0008] Obtain the covariance matrix of the EEG signal to form a sample space;
[0009] The covariance matrix is regarded as a point in the Riemann symmetric space, and the logarithmic Euclidean distance is used to measure the distance between two points in the Riemann symmetric space;
[0010] Based on the logarithmic Euclidean distance, establish the logarithmic Euclidean metric learning distance function
[0011] Use the logarithmic Euclidean metric to learn the distance function and establish a quantitative learning cost function;
[0012] Minimize the quantized learning cost function through the stochastic gradient descent method, calculate the Riemann gradient corresponding to the prototype, establish the learning rule of the prototype, calculate the gradient of the parameter Q of the logarithmic Euclidean metric learning distance function, and establish the learning rule of Q;
[0013] Using the winner-takes-all rule, the recognition result of the EEG signal to be recognized is output.
[0014] The motor imagery task includes at least one of imagining left hand movement, imagining right hand movement, imagining foot movement, and imagining tongue movement.
[0015] The log-Euclidean metric learns the distance function for:
[0016]
[0017] Where X i and X j represents any two points in Riemann space, log represents the matrix logarithm, which is calculated by taking the covariance matrix X as the training sample i Do eigendecomposition X i =Vdiag(λ1, ..., λ n )V T , where λ1, ..., λ n Yes X i , i, j = 1, ..., m, diag(λ1, ..., λ n ) means constructing a diagonal element with parameters λ1, ..., λ n diagonal matrix, V is an n×n square matrix, n represents the number of electrodes used to collect EEG signals, X i The matrix logarithm is calculated as logX i =Vdiag(log(λ1),...,log(λ n ))V T , Tr is the sum of the main diagonal elements of the matrix.
[0018] The quantization learning cost function E(W) is:
[0019]
[0020]
[0021] The prototype W represents the model parameters that are representative of the covariance matrices of different motor imagery actions that need to be learned from the training samples; W J Indicates the distance from the training sample X i Recent with X i Prototypes with the same label are called correct prototypes. KIndicates the distance from the training sample X i Recent with X i Prototypes with different labels are called error prototypes here; Φ(·) is a monotonically increasing scaling function, using the logical function Φ(x) = 1 / (1+e -x ).
[0022] The learning rule of the prototype is simplified to the original covariance matrix X i , i = 1, ..., the sample space composed of is converted to its matrix logarithmic space, and quantitative learning is performed in the converted matrix logarithmic space. The specific learning rules are:
[0023]
[0024]
[0025] Among them, T i For sample X i The matrix logarithm of i =log(X i );U J For the sample X i The closest correct prototype W J The matrix logarithm of U J =log(W J );U K For the sample X i Recent Error Prototype W K The matrix logarithm of U K =log(W K ); and Represent the training samples X i The logarithmic Euclidean distance between its nearest correct sample and the nearest wrong sample, and α is the learning rate.
[0026] The learning rule of the logarithmic Euclidean distance metric learning function parameter Q is:
[0027]
[0028] Q←GG T
[0029] Among them, η is the learning rate.
[0030] The method of outputting the EEG signal recognition result by using the winner-takes-all rule comprises the following steps:
[0031] Collect the EEG signal S induced by the motor imagery task to be identified u ;
[0032] Calculate its covariance matrix X u, as samples to be identified;
[0033] Calculate the logarithm of its covariance matrix T u ;
[0034] Calculate T according to the following formula u The logarithm of all prototype matrices U learned in claim 5 j The distance between j :
[0035] δ j =Tr[Q(T u -U j )(T u -U j )]
[0036] Where Q is the logarithmic Euclidean metric learning distance function parameter learned in claim 6;
[0037] According to the following formula, find the prototype matrix logarithm closest to the sample matrix logarithm to be identified, that is, find δ j , j = 1, ..., the smallest value among m, assign the subscript of that value to j * :
[0038] j * = arg min j δ j ;
[0039] The label of the prototype matrix logarithm closest to the matrix logarithm of the sample to be identified is assigned to the sample to be identified as its predicted label, and the predicted label is output according to the following formula, that is, the predicted motor imagery task:
[0040]
[0041] in, is the EEG signal S u Corresponding motor imagery task y u The predicted value of is the prototype matrix logarithm The corresponding label.
[0042] The present invention has the following beneficial effects and advantages:
[0043] 1. The present invention adopts a spatial covariance matrix to characterize the characteristics of motor imagery EEG signals, and only uses a bandpass filter as a signal preprocessing, avoiding complex preprocessing calculations such as spatial filtering and time-frequency filtering.
[0044] 2. The present invention is a natural multi-category EEG signal recognition method. For simultaneously identifying multiple categories of EEG signals, there is no need to use one-to-one or one-to-residual strategies like traditional support vector machine methods to decompose the multi-category EEG signal recognition problem into multiple binary classification recognition problems, and then use voting to decide the final prediction result, thereby improving the recognition accuracy of multi-category EEG signals.
[0045] 3. The present invention adopts logarithmic Euclidean measurement to establish a prototype-based learning method. During recognition, it only needs to calculate the logarithmic Euclidean distance with several prototypes. The calculation complexity is low, and the category of motor imagery EEG signals can be recognized in real time, providing a fast EEG signal recognition method for building a practical brain-computer interface system.
[0046] 4. The present invention adopts the Riemann gradient descent method to establish the learning rules of the prototype and the distance metric function parameter Q, and adopts the local tangent space to approximate the Riemann space, thereby avoiding the data distortion caused by the global tangent space approximating the Riemann space. At the same time, the learning model can be updated online, providing an effective EEG signal recognition method for building an online brain-computer interface system, which is conducive to the promotion of brain-computer interface systems based on motor imagery in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a framework diagram of the method of the present invention;
[0048] Figure 2 is a schematic diagram of metric learning based on logarithmic Euclidean distance of the present invention;
[0049] Figure 3 is a schematic diagram of the Riemann space quantization method of the present invention;
[0050] Figure 4 is a flow chart of the model training phase of the present invention;
[0051] Figure 5 is a flow chart of the model identification phase of the present invention;
[0052] Figure 6a The model learning convergence of the present invention Figure 1 ;
[0053] Figure 6b The model learning convergence of the present invention Figure 2 ;
[0054] Figure 7 is a characteristic value distribution diagram of the metric learning distance function parameter Q of the present invention;
[0055] Figure 8 It is the recognition effect diagram of the present invention. DETAILED DESCRIPTION
[0056] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.
[0057] A multi-category EEG signal recognition method based on Riemann space quantization converts EEG signals extracted under the motor imagery paradigm into a spatial covariance matrix. This feature expression is a symmetric positive definite matrix located in a curved Riemann symmetric space. In the Riemann space, a quantitative learning method is designed using logarithmic Euclidean distance to learn several labeled prototypes for the covariance matrix corresponding to each category of EEG signals. When predicting the category of the EEG signal to be recognized, its corresponding spatial covariance matrix is compared with the learned prototype, and the label of the prototype closest to it is used as the category of the EEG signal.
[0058] like Figure 1 As shown, the specific implementation of the present invention includes the following steps:
[0059] First, the EEG signal was collected according to the commonly used motor imagery paradigm. According to the action instructions displayed on the computer, the motor imagery task was performed, and the data was collected through the commonly used wet electrode EEG cap. The motor imagery actions included: imagining the left hand movement, imagining the right hand movement, imagining the foot movement, and imagining the tongue movement. Each motor imagery task lasted for 4 seconds. After completing a motor imagery task, rest for 1 to 2 seconds. The data set collected in this process is recorded as Where S i represents the EEG signal collected during the i-th motor imagery task, y i Indicates the category label corresponding to the motor imagery task, y i =1 means imagine the left hand movement, y i =2 means imagine the right hand moving, y i =3 means imagining foot movement, y i =4 represents imagining tongue movement, and m represents the number of times the process performs the motor imagery task.
[0060] Secondly, a bandpass filter is used to convert the EEG signal S i Filter to 10-30 Hz frequency band, i = 1, ..., m. The filtered EEG signal is recorded as The bandpass recorder mentioned here includes a 5th-order Butterworth filter. Calculate the covariance matrix of the EEG signal Forming sample space Where l represents the number of sampling times of the 4-second motor imagery EEG signal, X i It is an n×n symmetric positive definite matrix, where n represents the number of electrodes used to collect EEG signals.
[0061] The covariance matrix is a symmetric positive definite matrix. All symmetric positive definite matrices form a curved Riemann space, called the Riemann symmetric space, denoted by S + (n). For two points X in a Riemann symmetric spacei and X j , using logarithmic Euclidean distance to measure the distance δ between them LE (X i , X j )=Tr[(log X i -log X j )(log X i -log X j )], where log represents the matrix logarithm, which can be calculated by i Do eigendecomposition X i =Vdiag(λ1, ..., λ n )V T , where λ1, ..., λ n Yes X i The eigenvalues of diag(λ1,...,λ n ) means constructing a diagonal element with parameters λ1, ..., λ n The diagonal matrix of V is an n×n square matrix, and its kth column is X i The kth eigenvector of i The matrix logarithm of can be calculated as log X i =Vdiag(log(λ1),...,log(λ n ))V T .
[0062] Next, based on the logarithmic Euclidean distance, a distance metric learning function is established
[0063]
[0064] Among them, Q is an n×n learnable matrix. Figure 2 As shown, Q learning is equivalent to learning the tangent space T of the Riemann manifold X S + (n) to the subcut space T F(X) S + (r). If Q satisfies the symmetric semi-positive definite property, the mapping f from the tangent space to the sub-tangent space corresponds to a unique mapping F from the original Riemann manifold to its submanifold. Therefore, this logarithmic Euclidean metric learning can map the original symmetric positive definite Riemann manifold to its submanifold, playing a role in dimensionality reduction.
[0065] Then, we use the logarithmic Euclidean metric to learn the distance function and establish a quantitative learning cost function:
[0066]
[0067]
[0068] Where W is the same as the training sample X, which is also the Riemann symmetric space S + (n) Points in; W J Indicates the distance from the training sample X i Recent with X i Prototypes with the same label are called correct prototypes. K Indicates the distance from the training sample X i Recent with X i Prototypes with different labels are called error prototypes; Φ(·) is a monotonically increasing scaling function. Here we use the logistic function Φ(x) = 1 / (1+e -x ). The prototype is a typical representative learned from the training samples. The training samples are the covariance matrix, so the prototype is also the covariance matrix.
[0069] By minimizing the above cost function through the Riemann stochastic gradient descent method, we can obtain the learning rule of the prototype and the distance function parameter Q. i , the valence function E for the training sample i for
[0070]
[0071] The closest correct prototype W to the sample J and the recent error prototype W K The Riemann gradients are:
[0072]
[0073]
[0074] in and Represent the training samples X i The logarithmic Euclidean distance between the nearest correct sample and the wrong sample, so for W J and W K The update rule is:
[0075]
[0076]
[0077] Where exp(·) and log(·) represent the matrix exponential and matrix logarithm respectively, and the matrix exponential exp(X) = V diag(exp(λ1), ..., exp(λ n ))V T ,λ1,...,λ n is the eigenvalue of X, and V is the matrix of eigenvectors of X. Figure 3As shown in the figure, in the Riemann space, the prototype position moves along the geodesic between it and the sample. The correct prototype will be close to the training sample along the geodesic, while the wrong prototype will be far away from the training sample along the geodesic. The solid circle and triangle represent the correct and wrong prototypes closest to the training sample, respectively, and the solid square represents the training sample.
[0078] To W J and W K The update rule can be simplified to let U J =log(W J ), U K =log(W K ), T i =log(X i ), we can take the matrix logarithm of both the left and right sides of the update rule, and then obtain the following simplified update rule:
[0079]
[0080]
[0081] The simplified update rule is equivalent to transforming the symmetric positive definite matrix space into its logarithmic space, which is a Euclidean space. Then, learning can be performed in the logarithmic space according to the Euclidean quantization method.
[0082] Since Q needs to satisfy the semi-symmetric positive definite property, we can factorize Q into Q = GG T , it only requires that G satisfies the full row rank or is reversible, and the learning of Q is transformed into the learning of G. Since this factorization of Q satisfies the rotation invariance, the theory of quotient manifold can be used to obtain the update rule of G and further obtain the learning rule of Q:
[0083]
[0084] Where η is the learning rate, which is a small positive number.
[0085] like Figure 4 As shown, the specific process of learning the prototype and the distance function parameter Q is as follows:
[0086] Step 1: Set the number of prototypes M to be learned for each category, the learning rate α of the prototype, the learning rate η of the distance function parameter Q, and the total number of learning times T;
[0087] Step 2: Input all training samples into feature X i , i = 1, ..., m is converted to its matrix logarithm T i =log X i ;
[0088] Step 3: For each prototype corresponding to each category, randomly initialize its initial position. For any prototype U j , whose label c j :
[0089]
[0090] Where E is a very small random symmetric matrix of size n×n; G is initialized to the n×n identity matrix, Q = GG T , learning times t = 1;
[0091] Step 4: Randomly select a transformed training sample (T i ,y i ), the distance between the training sample and all prototypes is calculated by the following formula:
[0092] δ j =Tr[Q(T i -U j )(( T i j )]
[0093] Step 5: Find the correct prototype U closest to the training sample J and the closest error prototype U K , update its position according to formula (1), and update G and Q according to formula (2);
[0094] Step 6: Repeat steps 4 to 6 until all training samples are traversed;
[0095] Step 7: The number of learning times increases by 1, t=t+1;
[0096] Step 8: Repeat steps 4 to 7 until t>T, and the entire learning process ends;
[0097] Step 9: Get a set of labeled prototypes Where C represents the category format of the sample, CM represents the number of all prototypes, and the distance function parameter matrix Q.
[0098] Finally, the winner-takes-all rule is used to establish the output EEG signal recognition result. The specific process is as follows Figure 5 As shown:
[0099] Step 1: Follow the computer prompts to collect a new scalp EEG signal S under the motor imagery task u ;
[0100] Step 2: Use a bandpass filter to filter the signal to the 10-30 Hz frequency band as in the training sample, and calculate its covariance matrix X u ;
[0101] Step 3: Xu Do eigendecomposition X u =V∑V T , calculate its logarithmic matrix T u =V log(∑)V T ;
[0102] Step 4: Calculate T according to the following formula u With all prototypes j The logarithmic Euclidean distance between them is:
[0103] δ j =Tr[Q(T u -U j )((T u -U j )]
[0104] Step 5: Find the closest prototype to the test sample:
[0105] j * = arg min j δ j ;
[0106] Step 6: Assign the prototype label to the test sample as its predicted label and output the predicted label:
[0107]
[0108] In order to test the effectiveness of the motor imagery EEG signal recognition method, the recognition accuracy was compared with the top three in the brain-computer interface competition IV2a. The recognition accuracy was measured by the kappa value. where p a represents the proportion of all correct classifications, and p c is the proportion of random classification. Figure 6a to Figure 6b As shown in Figure 1, on the subject 1 dataset, it shows an excellent convergence effect, and both the cost function and the test accuracy converge to a stable value. Figure 7 As shown in , only a few of the eigenvalues of the distance matrix parameter Q are much larger than 1, and the rest are very close to 0, which effectively reduces the dimension of the data implicitly. Figure 8 As shown, the average recognition kappa value of the method for the EEG signals of 9 subjects is higher than the average recognition kappa value of the first place in the BCI competition, and is much higher than the average recognition kappa values of the second and third places, reaching 0.58, showing a good recognition effect.
Claims
1. A multi-category motor imagery EEG signal recognition method based on Riemann space quantization, characterized in that: The following steps are involved: Collect EEG signals of different motor imagery tasks; Obtain the covariance matrix of the EEG signal to form a sample space; The covariance matrix is regarded as a point in the Riemann symmetric space, and the logarithmic Euclidean distance is used to measure the distance between two points in the Riemann symmetric space; Based on the logarithmic Euclidean distance, establish the logarithmic Euclidean metric learning distance function Use the logarithmic Euclidean metric to learn the distance function and establish a quantitative learning cost function; Minimize the quantized learning cost function through the stochastic gradient descent method, calculate the Riemann gradient corresponding to the prototype, establish the learning rule of the prototype, calculate the gradient of the parameter Q of the logarithmic Euclidean metric learning distance function, and establish the learning rule of Q; Using the winner-takes-all rule, output the recognition result of the EEG signal to be recognized; The log-Euclidean metric learns the distance function for: Where X i and X i represents any two points in Riemann space, log represents the matrix logarithm, which is calculated by taking the covariance matrix X as the training sample i Do eigendecomposition X i =Vdiag(λ1, ..., λ n )V T , where λ1, ..., λ n Yes X i , i, j = 1, ..., m, diag(λ1, ..., λ n ) means constructing a diagonal element with parameters λ1, ..., λ n diagonal matrix, V is an n×n square matrix, n represents the number of electrodes used to collect EEG signals, X i The matrix logarithm of is calculated as log X i =Vdiag(log(λ1),...,log(λ n ))V T , Tr is the sum of the main diagonal elements of the matrix; The quantization learning cost function E(W) is: The prototype W represents the model parameters that are representative of the covariance matrices of different motor imagery actions that need to be learned from the training samples; W J Indicates the distance from the training sample X i Recent with X i Prototypes with the same label are called correct prototypes. K Indicates the distance from the training sample X i Recent with X i Prototypes with different labels are called error prototypes here; Φ(·) is a monotonically increasing scaling function, using the logical function Φ(x) = 1 / (1+e -x ); The learning rule of the logarithmic Euclidean distance metric learning function parameter Q is: Q←GG T Where η is the learning rate, Q is the logarithmic Euclidean metric learning distance function parameter; The method of outputting the EEG signal recognition result by using the winner-takes-all rule comprises the following steps: Collect the EEG signal S induced by the motor imagery task to be identified u ; Calculate its covariance matrix X u , as samples to be identified; Calculate the logarithm of its covariance matrix T u ; Calculate T according to the following formula u With all prototype matrix logarithms U j The distance between j : δ j =Tr[Q(T u -U j )(T u -U j )] According to the following formula, find the prototype matrix logarithm closest to the sample matrix logarithm to be identified, that is, find δ j , j = 1, ..., the smallest value among m, assign the subscript of this value to j * : j * =arg min j d j ; The label of the prototype matrix logarithm closest to the matrix logarithm of the sample to be identified is assigned to the sample to be identified as its predicted label, and the predicted label is output according to the following formula, that is, the predicted motor imagery task: in, is the EEG signal S u Corresponding motor imagery task y u The predicted value of is the prototype matrix logarithm The corresponding label.
2. The multi-category motor imagery EEG signal recognition method based on Riemann space quantization according to claim 1 is characterized in that: The motor imagery task includes at least one of imagining left hand movement, imagining right hand movement, imagining foot movement, and imagining tongue movement.
3. The multi-category motor imagery EEG signal recognition method based on Riemann space quantization according to claim 1 is characterized in that: The learning rule of the prototype is simplified to the original covariance matrix X i , i = 1, ..., the sample space composed of is converted to its matrix logarithmic space, and quantitative learning is performed in the converted matrix logarithmic space. The specific learning rules are: Among them, T i For sample X i The matrix logarithm of i =log(X i );U J For the sample X i The closest correct prototype W J The matrix logarithm of U J =log(W J );U K For the sample X i Recent Error Prototype W K The matrix logarithm of U K =log(W K ); and Represent the training samples X i The logarithmic Euclidean distance between its nearest correct sample and the nearest wrong sample, and α is the learning rate.
