A method and device for recognizing electroencephalogram intention
By adopting a random search algorithm method in EEG intention recognition, using power spectral density features and Bayesian linear classifiers, the problem of low accuracy in the prior art is solved, and a higher recognition accuracy is achieved.
Patent Information
- Application Number
- CN202210776906.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-04
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2042-07-04
AI Technical Summary
The prior art has low accuracy in EEG intent recognition, and it is difficult to effectively extract the characteristics and classification of random time-varying EEG signals.
Using the EEG intention recognition method based on a random search algorithm, feature extraction and intention recognition are performed through feature selectors and intention classifiers, power spectral density features and Bayesian linear classifiers.
The accuracy of EEG intention recognition is improved, and the recognition effect is enhanced by reducing the redundancy of features and selecting the best discriminant features.
Smart Images

Figure CN115227262B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of value range code standardization, and specifically provides a method and device for recognizing electroencephalogram intentions. Background Art
[0002] Brain-Computer Interface (BCI) systems are devices proposed to help disabled people who cannot make motor responses to communicate with computers using brain signals. The purpose of BCI is to interpret brain activity into digital forms that act as computer commands. A key challenge in current BCI research is how to extract the features of random time-varying EEG signals and their classification as accurately as possible.
[0003] Feature extraction techniques are used to extract features that represent unique properties obtained from brain signal patterns. Early EEG analysis was limited to visual inspection. Visual inspection of the signal is highly subjective and hardly allows for any standardization or statistical analysis. Therefore, several different techniques aim to quantify the information of brain signals. There are many linear and nonlinear methods for feature extraction. Therefore, EEG intent recognition has attracted more and more attention from researchers. However, EEG intent recognition has problems such as low accuracy. Summary of the invention
[0004] The present invention aims at solving the above-mentioned deficiencies of the prior art and provides a highly practical method for EEG intention recognition.
[0005] A further technical task of the present invention is to provide a reasonably designed, safe and applicable EEG intention recognition device.
[0006] The technical solution adopted by the present invention to solve the technical problem is:
[0007] A method for recognizing electroencephalogram intentions comprises the following steps:
[0008] S1, obtain an EEG intention database and perform preprocessing;
[0009] S2, feature extraction is performed on the preprocessed data, and the power spectrum density is extracted as the feature of each sample;
[0010] S3. Establish an EEG intention recognition model based on a random search algorithm. The EEG intention recognition network includes a feature selector and an intention classifier.
[0011] S4, training the EEG intention recognition model;
[0012] S5. Extract the EEG intention data to be identified and input it into the trained classifier to finally obtain the identification result.
[0013] Furthermore, in step S1, an EEG intention database is obtained and preprocessed, and the raw data is preprocessed using the EEGLAB toolbox in MATLAB.
[0014] Further, in step S2, ST is used for feature extraction, which provides frequency-dependent resolution while maintaining a direct relationship with the Fourier spectrum. The discrete Fourier transform of the discrete time series x[kT], k=0, 1, ..., N-1 is expressed as:
[0015]
[0016] The ST representation of the discrete time series x[kT] is:
[0017]
[0018]
[0019] Wherein, j, m, n = 0, 1, ..., N-1;
[0020] The power spectral density is calculated as follows:
[0021]
[0022] in, and They represent the ST and its conjugate expression of the time series x[kT] respectively;
[0023] The frequency band is 1-35 Hz, with an interval of 1 Hz. Then, according to the signal calculation based on the ST power spectral density feature, 35 features are extracted from each channel;
[0024] After feature extraction, the data is divided into a training set and a test set, where the EEG intention database contains several EEG motor imagery data and corresponding category labels.
[0025] Furthermore, in step S3, the feature selector includes a group optimization module connected in sequence, which is used to extract the most discriminative features in the input sample data, and the intent classifier is a Bayesian linear classifier, which is used to predict the intent category of the input sample data.
[0026] Furthermore, group optimization is used for feature selection, and a random walk strategy is added to improve the optimal individual, enhance the search capability, and prevent falling into the local optimum.
[0027] Furthermore, in step S4, the EEG intention recognition model is trained. During training, each EEG intention data in the training set is taken as a sample, and the most discriminative feature is selected by the feature selector, and then input into the classifier. The model updates the parameters by calculating the fitness value until the maximum number of iterations is completed, thereby completing the training of the model.
[0028] Furthermore, when calculating the fitness value, the fitness function is calculated as follows:
[0029]
[0030] The parameters of the training process are set as follows: population size is 100, maximum number of iterations is 50, the value of the initial individual position is a random number in [0,1], that is, ub=1, lb=0, warning value ST=0.6; discoverer ratio PD=0.7; individual risk awareness ratio SD=0.2; single dimension is d=64*35. Select the features corresponding to the positions greater than 0.5 within the optimized individual; otherwise, they will be discarded.
[0031] Furthermore, the specific steps of the random search algorithm for EEG intention recognition are as follows:
[0032] (1) Initialize the population, the number of iterations, and the ratio of predators to predators;
[0033] (2) Calculate the fitness value and sort the fitness value;
[0034] (3) Update the predator position;
[0035] (4) Update the producer position;
[0036] (5) Update the location of the alerter;
[0037] (6) Calculate the fitness value and update the individual position.
[0038] (7) Check whether the stop condition is met. If so, exit and output the result. Otherwise, repeat steps (2) to (6).
[0039] Furthermore, in step S5, the EEG intention data to be identified is extracted, and the EEG intention data to be identified is input into the trained model as a test set sample, and the features in the test set are selected according to the position of the feature subset selected in step S4, and are input into the trained classifier to finally obtain the recognition result.
[0040] An electroencephalogram intention recognition device comprises: at least one memory and at least one processor;
[0041] The at least one memory is used to store a machine-readable program;
[0042] The at least one processor is used to call the machine-readable program to execute a method for EEG intention recognition.
[0043] Compared with the prior art, the EEG intention recognition method and device of the present invention have the following outstanding beneficial effects:
[0044] The present invention considers the random search algorithm to reduce the redundancy of features from the perspective of feature selection, and selects the best discriminant feature to improve the EEG intention recognition rate, so that the accuracy of the present invention is higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Attached Figure 1 It is a flowchart of an EEG intention recognition method;
[0047] Attached Figure 2 It provides a complete signal processing framework diagram in an EEG intention recognition method. DETAILED DESCRIPTION
[0048] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] A best embodiment is given below:
[0050] like Figure 1-2 As shown, a method for recognizing EEG intention in this embodiment has the following steps:
[0051] S1. Obtain an EEG intention database and preprocess it. Use the EEGLAB toolbox in MATLAB to preprocess the raw data and filter 0.3-50Hz.
[0052] S2. Feature extraction is performed on the preprocessed data, and the power spectral density is extracted as the feature of each sample. ST (Stockwell transform) is used for feature extraction. ST provides frequency-dependent resolution while maintaining a direct relationship with the Fourier spectrum. The discrete Fourier transform of the discrete time series x[kT], k=0, 1, ..., N-1 is expressed as:
[0053]
[0054] The ST representation of the discrete time series x[kT] is:
[0055]
[0056]
[0057] Among them, j, m, n = 0, 1, ..., N-1.
[0058] The power spectral density is calculated as follows:
[0059]
[0060] in, and They represent the ST of the time series x[kT] and its conjugate expression respectively.
[0061] The frequency band is 1-35 Hz, with an interval of 1 Hz. Then, the signal is calculated based on the ST power spectral density feature according to (4). 35 features are extracted from each channel. Therefore, a spectral density function with higher time-frequency resolution can be obtained using ST. Since ST has an independent Gaussian window, it can obtain higher frequency resolution at low frequencies and better time domain positioning at high frequencies.
[0062] After feature extraction, the data is divided into a training set and a test set, where the EEG intention database contains several EEG motor imagery data and corresponding category labels.
[0063] S3. Establish an EEG intention recognition model based on a random search algorithm. The EEG intention recognition network includes a feature selector and an intention classifier. The feature selector includes a population optimization module and a random walk module connected in sequence, which are used to extract the most discriminative features in the input sample data. The intention classifier is a Bayesian linear classifier, which is used to predict the intention category of the input sample data:
[0064] The population optimization method is used for feature selection, and the random walk strategy is added to improve the optimal individual, enhance the search ability, and prevent falling into the local optimum. According to the description of the sparrow's foraging behavior and anti-predator behavior, the rules are as follows:
[0065] (1) Producers have high energy reserves and are responsible for finding food-rich areas throughout the population, providing foraging areas and directions for all pickers. When building the model, the energy level depends on the fitness value of the individual.
[0066] (2) Once the sparrow discovers the predator, the individual will begin to send out an alarm signal. When the alarm value is greater than the safety value, the producer will take the picker to other safe areas to forage.
[0067] (3) The identities of producers and foragers change dynamically. Every sparrow can become a producer as long as it can find a better food source, but the proportion of producers and foragers in the total population remains unchanged.
[0068] (4) The foraging position of producers in the entire population depends on their fitness value. Scavengers with lower energy have a worse foraging position in the entire population and are more likely to fly to other places to forage for more energy.
[0069] (5) During foraging, foragers can always look for producers that provide the best food and obtain food around producers. In order to increase the predation rate, predators may constantly monitor producers and then compete for food resources.
[0070] (6) When sparrows at the edge of the group sense danger, they will quickly move to a safe area to get a better position, and sparrows in the middle of the group will move randomly to get closer to other sparrows.
[0071] A population consisting of n individuals can be represented by the following matrix:
[0072]
[0073] Where d represents the dimension of the problem variable to be optimized.
[0074] Then, the fitness values of all individuals can be expressed as:
[0075]
[0076] Where f(F X The value of each row in ) represents the fitness value of the individual.
[0077] According to rules I and II, the producer's position update in each iteration is described as follows:
[0078]
[0079] Where t represents the current iteration, represents the value of the i-th sparrow at iteration t, iter max is the maximum number of iterations, and α∈(0,1] is a random number. R(R∈[0,1]) and ST(ST∈[0.5,1.0]) represent the alarm value and safety threshold, respectively. q is a random number that follows a normal distribution. 1 is a random number with dimension x n The vector is d. When R<ST, that is, there are no predators around, the producer enters the wide-area search mode. If R≥ST, it means that some sparrows have discovered predators, and all sparrows need to fly quickly to other safe areas.
[0080] During the search, some predators will monitor the producer. Once they feel that the producer has found better food, they will immediately leave their current position to compete for the food. If they win, they can get the producer's food immediately; otherwise, they need to continue to execute Rule V to update the attacker's position:
[0081]
[0082] where x P is the optimal position occupied by the producer. worst Indicates the current global worst position. a represents a 1×d vector, where each element is randomly assigned 1 or -1, b = a T (aa T ) -1 . When i>n / 2, it indicates that the i-th individual with a poor fitness value is most likely to be eliminated. Assume that sparrows with a sense of danger account for 20% of the population. The initial positions of these sparrows are randomly generated in the population. According to Rule VI, its mathematical expression can be expressed as:
[0083]
[0084] where x best is the current global optimal position. β is a normally distributed random number with a mean of 0 and a variance of 1, which is used to control the step length. k∈[-1, 1] is a random number that indicates the direction of the sparrow's movement and is also the step length control coefficient. Here f i 、f g and f w are the current, current global best and worst fitness values respectively. ε is the smallest constant to avoid zero division errors. i >f g Indicates that the sparrow is at the edge of the group. best Indicates the location of the population center, and the surrounding area is safe. i =f g This indicates that the sparrows in the middle of the flock are aware of the danger and need to get closer to other sparrows.
[0085] Bayesian Linear Discriminant Analysis (BLDA) is a fully automatic learning classifier that can quickly calculate and adjust hyperparameters without user intervention to achieve intent classification. In Bayesian regression, it is assumed that the target t and the feature vector x are linearly related to the additive white Gaussian noise n.
[0086] t=w T x+n
[0087] Here w is the weight used in regression and the likelihood function is calculated as follows:
[0088]
[0089] where t, X, β, N, and D represent the vector of regression targets, the matrix obtained from the horizontal stacking of the training feature vectors, the inverse variance of the noise, the number of examples in the training set, and
[0090] {X, t}.
[0091] To perform inference in a Bayesian setting, we need to specify the prior distribution of the latent variable w:
[0092]
[0093] where D is the number of features. I′(α) is a D+1 dimensional diagonal matrix:
[0094]
[0095] where ∈ is set to a very small value. Given the likelihood and the prior distribution, we can calculate the posterior distribution using Bayes’ rule:
[0096]
[0097] The posterior mean m satisfies the following equation,
[0098] m=β(βXX T +I′(α) -1 Xt
[0099] The following is the linear classification discriminant equation,
[0100]
[0101] in The feature vector representing the test set to be classified.
[0102] S4, training the EEG intention recognition model. During the training, each EEG intention data in the training set is taken as a sample, input into the feature selector to select the most discriminative feature, and then input into the classifier. The model updates the parameters by calculating the fitness value until the maximum number of iterations is completed, thus completing the model training;
[0103] The calculation formula of the fitness function is:
[0104]
[0105] The parameters of the training process are set as follows: population size is 100, maximum number of iterations is 50, the value of the initial individual position is a random number in [0,1], that is, ub=1, lb=0, warning value ST=0.6; discoverer ratio PD=0.7; individual risk awareness ratio SD=0.2; single dimension is d=64*35. Select the features corresponding to the positions greater than 0.5 within the optimized individual; otherwise, they will be discarded.
[0106] The specific steps of the random search algorithm for EEG intention recognition are as follows:
[0107] (1) Initialize the population, the number of iterations, and the ratio of predators to predators;
[0108] (2) Calculate the fitness value and sort the fitness value;
[0109] (3) Update the predator position;
[0110] (4) Update the producer position;
[0111] (5) Update the location of the alerter;
[0112] (6) Calculate the fitness value and update the individual position.
[0113] (7) Check whether the stop condition is met. If so, exit and output the result. Otherwise, repeat steps (2) to (6).
[0114] S5. Extract the EEG intention data to be recognized, input it into the trained model as a test set sample, select the features in the test set according to the position of the feature subset selected in step S4, and input it into the trained classifier to finally obtain the recognition result.
[0115] In order to verify the effectiveness of the present invention, EEG intention recognition was performed on the BCI Competition database, and the same experiment was conducted with the competition method for comparison. The verification results are shown in Table 1:
[0116] Table 1
[0117]
[0118] Experimental results show that the EEG intention recognition method proposed in this invention has a higher recognition rate.
[0119] Based on the above method, an EEG intention recognition device in this embodiment includes: at least one memory and at least one processor;
[0120] The at least one memory is used to store a machine-readable program;
[0121] The at least one processor is used to call the machine-readable program to execute a method for EEG intention recognition.
[0122] The above-mentioned specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementations. Any appropriate changes or substitutions made to the EEG intention recognition method and device in accordance with the claims of the present invention and any ordinary technicians in the technical field shall fall within the patent protection scope of the present invention. Although the embodiments of the present invention have been shown and described, it is understandable to those of ordinary skill in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the attached claims and their equivalents.
Claims
1. A method for recognizing EEG intention, characterized in that: The steps are as follows: S1, obtain an EEG intention database and perform preprocessing; Obtain an EEG intention database and preprocess the raw data using the EEGLAB toolbox in MATLAB; S2, feature extraction is performed on the preprocessed data, and the power spectrum density is extracted as the feature of each sample; ST is used for feature extraction, which provides frequency-dependent resolution while maintaining a direct relationship with the Fourier spectrum; the discrete Fourier transform of a discrete time series x[kT], k=0,1,…,N-1 is expressed as: The ST representation of the discrete time series x[kT] is: Where j,m,n=0,1,…,N-1; The power spectral density is calculated as follows: in, and They represent the ST and its conjugate expression of the time series x[kT] respectively; The frequency band is 1-35 Hz, with an interval of 1 Hz. Then, according to the signal calculation based on the ST power spectral density feature, 35 features are extracted from each channel; After feature extraction, the data is divided into a training set and a test set, where the EEG intention database contains several EEG motor imagery data and corresponding category labels; S3. Establish an EEG intention recognition model based on a random search algorithm. The EEG intention recognition network includes a feature selector and an intention classifier. The feature selector includes a group optimization module connected in sequence, which is used to extract the most discriminative features in the input sample data, and the intent classifier is a Bayesian linear classifier, which is used to predict the intent category of the input sample data; Population optimization is used for feature selection, and a random walk strategy is added to improve the optimal individual, enhance the search capability, and prevent falling into the local optimum; S4, training the EEG intention recognition model; The EEG intention recognition model is trained. During the training, each EEG intention data in the training set is taken as a sample, and the most discriminative feature is selected by the feature selector, and then input into the classifier. The model updates the parameters by calculating the fitness value until the maximum number of iterations is completed, thereby completing the training of the model; When calculating the fitness value, the fitness function is calculated as follows: The parameters of the training process are set as follows: population size is 100, maximum number of iterations is 50, the value of the initial individual position is a random number in [0,1], that is, ub=1, lb=0, warning value ST=0.6; the proportion of discoverers PD=0.7; the proportion of individuals aware of risks SD=0.2; the single dimension is d=64*35; select the features corresponding to the positions greater than 0.5 within the optimized individual; otherwise, they will be discarded; The specific steps of the random search algorithm for EEG intention recognition are as follows: (1) Initialize the population, the number of iterations, and the ratio of predators to predators; (2) Calculate the fitness value and sort the fitness value; (3) Update the predator position; (4) Update the producer location; (5) Update the location of the alerter; (6) Calculate the fitness value and update the individual position; (7) Check whether the stop condition is met. If so, exit and output the result. Otherwise, repeat steps (2) to (6); S5, extracting the EEG intention data to be identified and inputting it into the trained classifier to finally obtain the identification result; Extract the EEG intention data to be identified, input the EEG intention data to be identified into the trained model as a test set sample, select the features in the test set according to the position of the feature subset selected in step S4, and input them into the trained classifier to finally obtain the recognition result.
2. An electroencephalogram intention recognition device, characterized in that: include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method of claim 1.
Citation Information
Patent Citations
Electroencephalogram signal feature optimization method based on dimension reduction mechanism
CN110018739A
Motor imagery task identification method based on fractal geometry and probability cooperation
CN110174947A