SSVEP EEG signal classification method based on convolutional neural network
By constructing a convolutional neural network of the LSTM layer and using the grid search method to optimize parameters, the problem of feature loss and non-universality in SSVEP EEG signal classification is solved, and high-precision and robust SSVEP EEG signal classification is achieved. .
Patent Information
- Application Number
- CN202210272742.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-18
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-03-18
AI Technical Summary
The existing technology easily loses effective features in SSVEP EEG signal classification, resulting in low classification accuracy, and requires training model parameters for each subject separately, which lacks universality.
Construct a convolutional neural network containing an LSTM layer, set the hidden_size parameter of the LSTM layer to 8, and iteratively update the parameters of the convolutional neural network through the grid search method to obtain the best parameter combination and avoid model overfitting and features. Loss, achieving high-precision classification of SSVEP EEG signals and being applicable to different subjects.
It improves the accuracy and universality of SSVEP EEG signal classification, ensures the integrity and robustness of the classification results, and avoids the need for special training of model parameters for each subject.
Smart Images

Figure CN114611560B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information detection technology, and further relates to a method for classifying steady state visual evoked potential (SSVEP) electroencephalogram (EEG) signals based on a convolutional neural network in the field of physiological information intelligent detection technology. The present invention can induce SSVEP signals of subjects, and use a model trained with SSVEP signals to perform six classifications on the SSVEP signals to determine the output of the SSVEP paradigm. Background Art
[0002] SSVEP EEG signals refer to a continuous response related to the stimulation frequency produced by the visual cortex of the human brain when subjected to a visual stimulus of a fixed frequency. A major method for obtaining SSVEP EEG signals is based on the SSVEP paradigm, that is, the subjects collect SSVEP signals during the process of multiple rapidly flashing target images. Since the SSVEP signal is a non-stationary, nonlinear, random weak physiological electrical signal with an amplitude of generally around 50μV and mixed with various types of power frequency noise and artifacts, it is difficult to effectively characterize its features with existing technologies, and it is impossible to perform high-precision classification and detection of SSVEP signals. In recent years, EEG signal classification methods based on deep learning have been widely used to improve the classification accuracy of brain-computer interfaces. However, these methods are not very effective in classifying noise-sensitive and unstable EEG signals. For the collected SSVEP signals, there are power frequency noise and artifacts that cannot be well removed from the EEG signals, which further aggravates the overfitting of the model and reduces the robustness. These methods either focus too much on SSVEP EEG signal preprocessing, which results in the loss of valid original EEG signals by constructing variations of the original signals; or the reference signals used cannot fully retain all EEG signal features, resulting in feature loss and reducing the accuracy of subsequent EEG signal detection.
[0003] Beijing Institute of Technology disclosed a SSVEP EEG signal recognition and classification method in its patent application "SSVEP EEG signal recognition method technology based on MVMD-CCA" (application number: CN202010457759.8, application publication number: CN111568415 A). The method includes the following steps: (1) collecting multi-channel SSVEP signals as the EEG signals to be identified; (2) setting the number of components with decomposition K, constructing a variational problem, and using the ADMM algorithm to solve the variational problem, decomposing the EEG signals to be identified into K multivariate modulation components; (3) the visual stimulation frequency that induces the EEG signals to be identified is defined as the reference signal; (4) solving the weighted correlation coefficient of the specific stimulation frequency fi; (5) the frequency corresponding to the maximum weighted correlation coefficient is the induced stimulation frequency of the EEG signals to be identified. The shortcomings of this method are: using multivariate modulation components to obtain the target EEG signals, it is easy to lose effective EEG signals during decomposition, resulting in incomplete training data and thus affecting the classification accuracy of SSVEP EEG signals.
[0004] Jiajun Lin proposed a detection method for SSVEP EEG signals based on Volterra filters in his published paper "Cross-Target Transfer Algorithm Based on the Volterra Model of SSVEP-BCI" (Tsinghua science and technology, 2021, 26(04): 505-522). This method uses Volterra filters to classify SSVEP EEG signals and reconstructs stable reference signals using training targets through transfer learning. First, a steady-state visual evoked potential-brain-computer interface SSVEP-BCI (Steady state visual evoked potential-Brain computer interface) system with N different flicker frequencies is built; then the N stimulation frequencies are sampled equidistantly to train and identify the Volterra model parameters; the amplitude of each harmonic is transferred to all stimulation frequencies through polynomial interpolation; and a stable reference signal is reconstructed. The shortcomings of this method are: since the detection method requires the Volterra model parameters to be trained for each subject separately, this method is not universal. Summary of the invention
[0005] The purpose of the present invention is to address the deficiencies of the above-mentioned prior art and propose a SSVEP EEG signal classification method based on a convolutional neural network to solve the problem that effective EEG signals are easily lost in the decomposition of target EEG signals using multivariate modulation components, and the problem that the method is not universal due to the need to train Volterra model parameters for each subject separately.
[0006] The idea of achieving the purpose of the present invention is: the present invention constructs a convolutional neural network including an LSTM layer. According to engineering practice, if the hidden_size parameter value in the LSTM layer is set too high, when classifying the sample set and the SSVEP EEG signals to be classified, the more SSVEP EEG signals are retained, and the SSVEP EEG signals are more likely to overfit. If the hidden_size parameter value in the LSTM layer is set too low, although the SSVEP EEG signals are not easy to overfit, it also results in the sample set and the SSVEP EEG signals to be classified retaining fewer SSVEP EEG signals. Therefore, in order to take both into account, the present invention sets the hidden_size parameter of the LSTM network layer to 8, so that the LSTM layer can retain valid SSVEP EEG signals while avoiding overfitting of SSVEP EEG signals, thereby solving the problem of the prior art that valid EEG signals are easily lost when decomposing the target EEG signals using multivariate modulation components. Since the present invention uses a grid search method to iteratively update the parameters of the convolutional neural network, all parameters of the convolutional neural network after each iterative update are arranged and combined, and all possible combinations are cross-validated to obtain the best parameter combination, it is only necessary to use the best parameter combination for any subject's SSVEP electroencephalogram signal to be classified to iteratively update the parameters of the convolutional neural network, and it is not necessary to train a proprietary model parameter for each subject to iteratively update the parameters of the convolutional neural network, thereby solving the problem of the lack of universality of the method caused by the need to train the Volterra model parameters for each subject in the prior art
[0007] The specific steps of the present invention are as follows:
[0008] Step 1: Build a convolutional neural network consisting of three modules connected in series;
[0009] The structure of the first module is: convolution layer, batch normalization layer, ReLU activation layer, Dropout layer;
[0010] Set the parameters of each layer of the first module: set the total number of convolutional layer filters to 10, the convolution kernel size to 20×1, the stride to 1, the padding of the convolutional layer to 0×16, and the bias of the convolutional layer to no; set the eps parameter of the batch normalization layer to 1×10 -5, momentum parameter is set to 0.1, affine parameter is set to yes; inplace parameter of ReLU activation layer is set to yes; drop_rate parameter of Dropout layer is set to 0.05;
[0011] The structure of the second module is: convolution layer, batch normalization layer, ReLU activation layer, Dropout layer, Lambda layer;
[0012] Set the parameters of each layer of the second module: set the total number of convolutional layer filters to 20, the convolution kernel size to 10×1, the stride to 1, the padding of the convolutional layer to 0×8, and the bias of the convolutional layer to no; set the eps parameter of the batch normalization layer to 1×10 -5 , momentum parameter is set to 0.1, affine parameter is set to yes; inplace parameter of ReLU activation layer is set to yes; drop_rate parameter of Dropout layer is set to 0.05; l2_lambda parameter of Lambda layer is 0.0001;
[0013] The structure of the third module is: LSTM layer, Dropout layer, Flatten layer, and fully connected layer;
[0014] Set the parameters of each layer of the third module: set the hidden_size parameter of LSTM to 8, the number of recurrent layers to 2, and the bias parameter to no; set the drop_rate parameter of the Dropout layer to 0.01; set the parameter of the Falten layer to 0; set the number of neurons in the fully connected layer to 2;
[0015] Step 2: Generate sample set:
[0016] Step 2.1: Collect EEG signals of at least 10 subjects for α minutes, change the SSVEP paradigm frequency every t seconds, and retain the SSVEP EEG signals of each subject's visual-related channels, where α≥1,
[0017] Step 2.2, the SSVEP EEG signals of all vision-related channels of each subject are grouped into a sample set of size m×n×i×j, where m represents the total number of SSVEP EEG signal categories of all vision-related channels of each subject, and the category refers to classifying the SSVEP EEG signals collected at the same frequency into one category, n represents the total number of vision-related channels of each subject, i represents the total number of samples of SSVEP EEG signals of all vision-related channels of each subject corresponding to each paradigm frequency, and j represents the total number of segments after each frequency signal in the vision-related channel is segmented;
[0018] Step 3, extract the features of each sample:
[0019] Using Fourier transform, the time domain signal of each sample set is converted into a frequency domain signal, and a four-dimensional spectrum feature set of the sample set m×n×k×j is obtained, where k is the spectrum feature of each sample after Fourier transform;
[0020] Step 4: Train the convolutional neural network:
[0021] Step 4.1, initialize the parameters of the convolutional neural network: set the initial learning rate to 10 -3 , the learning rate decay rate is reduced by 1 / 5 for every 10 iterations; the initial downsampling rate is set to 32, and the downsampling rate is increased to twice the original for every 10 iterations; the regularization parameter L2 is set to 10 -4 , L2 increases to 5 times for every 10 iterations;
[0022] Step 4.2, input the spectral feature set into the convolutional neural network, and use the grid search method to iteratively update the parameters of the convolutional neural network until the loss function converges to obtain a trained convolutional neural network;
[0023] The grid search method refers to arranging and combining all parameters of the convolutional neural network after each iteration in ascending order, and cross-validating all possible combinations to obtain the best parameter combination;
[0024] Step 5: Process the SSVEP EEG signal to be classified:
[0025] The SSVEP EEG signals to be classified are processed in the same manner as steps (2) and (3), and each processed SSVEP EEG data to be classified is input into the trained convolutional neural network. Each data to be classified output by the convolutional neural network is judged. If the output is 1, it is determined that the subject sees the first target in the SSVEP paradigm. If the output is 2, it is determined that the subject sees the second target in the SSVEP paradigm. And so on. If the output is 6, it is determined that the subject sees the sixth target in the SSVEP paradigm.
[0026] Compared with the prior art, the present invention has the following advantages:
[0027] First, since the present invention constructs a convolutional neural network including an LSTM layer, by increasing the value of the hidden_size parameter, the defect of the prior art that effective EEG signals are easily lost in the decomposition of target EEG signals using multivariate modulation components is overcome, so that the SSVEP EEG signals classified by the present invention are more complete, thereby improving the accuracy of EEG signal classification.
[0028] Second, since the present invention uses a grid search method to iteratively update the parameters of the convolutional neural network, all parameters of the convolutional neural network after each iterative update are arranged and combined, and all possible combinations are cross-validated to obtain the optimal parameter combination, it overcomes the deficiency of the SSVEP EEG signal detection method in the prior art that the model parameters need to be trained for each subject, so that the present invention uses a grid search algorithm to improve the universality of SSVEP EEG signals. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0030] Combine the following Figure 1 The present invention is further described with reference to the accompanying drawings and examples.
[0031] Step 1: Build a convolutional neural network.
[0032] Build a convolutional neural network consisting of three modules connected in series:
[0033] The structure of the first module is: convolution layer, batch normalization layer, ReLU activation layer, and Dropout layer.
[0034] Set the parameters of each layer of the first module: set the total number of convolutional layer filters to 10, the convolution kernel size to 20×1, the stride to 1, the padding of the convolutional layer to 0×16, and the bias of the convolutional layer to no; set the eps parameter of the batch normalization layer to 1×10 -5 , momentum parameter is set to 0.1, affine parameter is set to yes; inplace parameter of ReLU activation layer is set to yes; drop_rate parameter of Dropout layer is set to 0.05.
[0035] The structure of the second module is: convolution layer, batch normalization layer, ReLU activation layer, Dropout layer, and Lambda layer.
[0036] Set the parameters of each layer of the second module: set the total number of convolutional layer filters to 20, the convolution kernel size to 10×1, the stride to 1, the padding of the convolutional layer to 0×8, and the bias of the convolutional layer to no; set the eps parameter of the batch normalization layer to 1×10 -5 , momentum parameter is set to 0.1, affine parameter is set to yes; inplace parameter of ReLU activation layer is set to yes; drop_rate parameter of Dropout layer is set to 0.05. l2_lambda parameter of Lambda layer is 0.0001.
[0037] The structure of the third module is: LSTM layer, Dropout layer, Flatten layer, and fully connected layer.
[0038] Set the parameters of each layer of the third module: set the hidden_size parameter of LSTM to 8, the number of recurrent layers to 2, and the bias parameter to no; set the drop_rate parameter of the Dropout layer to 0.01; set the parameter of the Falten layer to 0; and set the number of neurons in the fully connected layer to 2.
[0039] Step 2: Generate a sample set.
[0040] Step 2.1: Collect EEG signals of at least α minutes from 10 subjects, change the SSVEP paradigm frequency every 5 seconds, and retain the SSVEP EEG signals of the vision-related channels of each subject.
[0041] In the embodiment of the present invention, a g.tec EEG cap was used to collect EEG signals of 20 subjects under SSVEP paradigm stimulation for 1 minute, and the SSVEP paradigm frequency was changed to That is, the SSVEP paradigm frequency changes 12 times in 5 seconds and 1 minute. Since the SSVEP paradigm stimulation has the greatest impact on the EEG signals in the visual area of the brain, the SSVEP EEG signals of the seven channels of PO3, POz, PO4, P3, Pz, P4, and Cz related to vision are retained for each subject.
[0042] Since there is often power frequency interference when collecting SSVEP EEG signals, and directly using the original SSVEP EEG signals for analysis will affect the iteration speed, it is necessary to perform the following preprocessing on the collected SSVEP EEG signals of each channel.
[0043] The SSVEP EEG signal of each channel was band-pass filtered from 6Hz to 45Hz to remove the power frequency interference in the SSVEP EEG signal to obtain the filtered SSVEP EEG signal. The SSVEP EEG signal of each channel was segmented every 2.5 seconds. In order to speed up the iteration speed, the filtered SSVEP EEG signal was normalized and downsampled. After calling the scale function in the Python programming software for Z_score normalization, the resample function in python was called for average downsampling.
[0044] Step 2.2, the SSVEP EEG signals of all channels related to vision of each subject are combined into a sample set of size m×n×i×j. In the embodiment of the present invention, where m=12, n=7, i=500, j=24, the downsampled data of all channels of each subject are combined into a sample set of size 12×7×500×24. Among them, 12 represents the total number of SSVEP EEG signal classifications, 7 represents the number of channels for collecting SSVEP EEG signals, 500 represents the total number of samples collected in an SSVEP experiment, and 24 represents the total number of signal segments after the EEG signal of one minute is segmented every 2.5 seconds.
[0045] Step 3: Extract the features of each sample.
[0046] In the embodiment of the present invention, the time domain signal of each sample is converted into a frequency domain signal by Fourier transform, and a four-dimensional sample of the sample set 12×7×220×24 is obtained, wherein 220 is the total number of 500 samples and the total number of 220 eigenvalues is obtained after Fourier transform.
[0047] Step 4: Train the convolutional neural network.
[0048] The features of each sample are input into the convolutional neural network, and the network parameters are iteratively updated using the grid search method until the loss function converges to obtain a trained convolutional neural network.
[0049] The first step is to initialize the parameters of the convolutional neural network: set the initial learning rate to 10 -3 , the learning rate decay rate is reduced by 1 / 5 for every 10 iterations; the initial downsampling rate is set to 32, and the downsampling rate is increased to twice the original for every 10 iterations; the regularization parameter L2 is set to 10 -4 , L2 increases to 5 times for every 10 iterations.
[0050] The second step is to use the Log_Softmax function As the loss function, S i Represents the output value of the convolutional neural network at the i-th iteration. The weight parameter of the loss function is set to 1:5, and the smoothing parameter is set to epsilon = 0.01.
[0051] The third step is to input the spectral feature set into the convolutional neural network, call the grid_search function in Python to perform a grid search on all parameters, and iteratively update the parameters of the convolutional neural network until the loss function converges to obtain a trained convolutional neural network.
[0052] The grid search method refers to permuting and combining all parameters of the convolutional neural network after each iteration, and cross-validating all possible combinations to obtain the best parameter combination;
[0053] The grid search method is further described by the embodiment of the present invention. The learning rate parameter of the convolutional neural network after 20 iterations is {10 -3 ,2×10 -2 ,4×10 -1}, where 10 -3 Set the learning rate parameter for initialization, 2×10 -2 is the learning rate parameter downsampling parameter after 10 iterations, 4×10 -1 is the learning rate parameter downsampling parameter after 20 iterations. The downsampling parameters of the convolutional neural network after 20 iterations are: {32, 64, 128}, where 32 is the downsampling rate set at initialization, 64 is the downsampling rate after 10 iterations, and 128 is the downsampling rate after 20 iterations. The regularization parameters of the convolutional neural network after 20 iterations are: {10 -4 , 5×10 -3 , 2.5×10 -2}, where 10 -4 is the initial regularization parameter, 5×10 -3 is the regularization parameter after 10 iterations, 2.5×10 -2 The regularization parameters after 20 iterations are arranged and cross-validated for the same parameters of the three groups of parameters at the initial, 10th, and 20th times from small to large, and the best parameter combination is {10 -3 , 64,5×10 -3}.
[0054] Step 5: Process the SSVEP EEG signal to be classified.
[0055] In the same way as step 3, the features of the SSVEP EEG signal to be classified are extracted and then input into the trained convolutional neural network.
[0056] Judge each data to be classified output by the convolutional neural network. If the output is 1, it is determined that the first frequency in the SSVEP paradigm is detected. If the output is 2, it is determined that the second frequency in the SSVEP paradigm is detected. And so on. If the output is 12, it is determined that the subject sees the twelfth frequency in the SSVEP paradigm.
Claims
1. A SSVEP electroencephalogram signal classification method based on convolutional neural network, characterized in that: A convolutional neural network including an LSTM layer is constructed, and the parameters of the convolutional neural network are iteratively updated using a grid search method; the steps of the method include the following: Step 1: Build a convolutional neural network consisting of three modules connected in series; The structure of the first module is: convolution layer, batch normalization layer, ReLU activation layer, Dropout layer; Set the parameters of each layer of the first module: set the total number of convolutional layer filters to 10, the convolution kernel size to 20×1, the stride to 1, the padding of the convolutional layer to 0×16, and the bias of the convolutional layer to no; set the eps parameter of the batch normalization layer to 1×10 -5 , momentum parameter is set to 0.1, affine parameter is set to yes; inplace parameter of ReLU activation layer is set to yes; drop_rate parameter of Dropout layer is set to 0.05; The structure of the second module is: convolution layer, batch normalization layer, ReLU activation layer, Dropout layer, Lambda layer; Set the parameters of each layer of the second module: set the total number of convolutional layer filters to 20, the convolution kernel size to 10×1, the stride to 1, the padding of the convolutional layer to 0×8, and the bias of the convolutional layer to no; set the eps parameter of the batch normalization layer to 1×10 -5 , momentum parameter is set to 0.1, affine parameter is set to yes; inplace parameter of ReLU activation layer is set to yes; drop_rate parameter of Dropout layer is set to 0.05; l2_lambda parameter of Lambda layer is 0.0001; The structure of the third module is: LSTM layer, Dropout layer, Flatten layer, and fully connected layer; Set the parameters of each layer of the third module: set the hidden_size parameter of LSTM to 8, the number of recurrent layers to 2, and the bias parameter to no; set the drop_rate parameter of the Dropout layer to 0.01; set the parameter of the Falten layer to 0; set the number of neurons in the fully connected layer to 2; Step 2: Generate sample set: Step 2.1: Collect EEG signals of at least 10 subjects for α minutes, change the SSVEP paradigm frequency every t seconds, and retain the SSVEP EEG signals of each subject's visual-related channels, where α≥1, Step 2.2, the SSVEP EEG signals of all vision-related channels of each subject are grouped into a sample set of size m×n×i×j, where m represents the total number of SSVEP EEG signal categories of all vision-related channels of each subject, and the category refers to classifying the SSVEP EEG signals collected at the same frequency into one category, n represents the total number of vision-related channels of each subject, i represents the total number of samples of SSVEP EEG signals of all vision-related channels of each subject corresponding to each paradigm frequency, and j represents the total number of segments after each frequency signal in the vision-related channel is segmented; Step 3, extract the features of each sample: Using Fourier transform, the time domain signal of each sample set is converted into a frequency domain signal, and a four-dimensional spectrum feature set of the sample set m×n×k×j is obtained, where k is the spectrum feature of each sample after Fourier transform; Step 4: Train the convolutional neural network: Step 4.1, initialize the parameters of the convolutional neural network: set the initial learning rate to 10 -3 , the learning rate decay rate is reduced by 1 / 5 for every 10 iterations; the initial downsampling rate is set to 32, and the downsampling rate is increased to twice the original for every 10 iterations; the regularization parameter L2 is set to 10 -4 , L2 increases to 5 times for every 10 iterations; Step 4.2, input the spectral feature set into the convolutional neural network, and use the grid search method to iteratively update the parameters of the convolutional neural network until the loss function converges to obtain a trained convolutional neural network; The grid search method refers to arranging and combining all parameters of the convolutional neural network after each iteration in ascending order, and cross-validating all possible combinations to obtain the best parameter combination; Step 5: Process the SSVEP EEG signal to be classified: The SSVEP EEG signals to be classified are processed in the same manner as steps (2) and (3), and each processed SSVEP EEG data to be classified is input into the trained convolutional neural network. Each data to be classified output by the convolutional neural network is judged. If the output is 1, it is determined that the subject sees the first target in the SSVEP paradigm. If the output is 2, it is determined that the subject sees the second target in the SSVEP paradigm. And so on. If the output is 6, it is determined that the subject sees the sixth target in the SSVEP paradigm.
2. The SSVEP EEG signal classification method based on convolutional neural network according to claim 1, characterized in that: The loss function described in step 4.2 is: Among them, S q represents the parameter value of the convolutional neural network output at the qth iteration, lg represents the logarithmic operation with base 10, ∑ represents the summation operation, and e (.) Represents an exponential operation with the natural constant e as the base.
