Motor imagery EEG signal classification method based on one-dimensional convolution kernel
Through the combination method of wavelet packet transform and one-dimensional convolution kernel, the problem of resolution uncertainty and information loss in motor imagery EEG signal classification is solved, high-precision multi-category EEG signal recognition is achieved, and the classification accuracy is improved. .
Patent Information
- Application Number
- CN202111485345.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-07
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-12-07
AI Technical Summary
The existing technology has the problems of uncertain resolution and loss of detailed information in the classification of motor imagery EEG signals. In particular, the traditional wavelet transform ignores the high-frequency part, which leads to a greater impact on the analysis and low classification accuracy.
Using a method based on wavelet packet transform and one-dimensional convolution kernel, through the combination of Z-Score standardization, wavelet threshold denoising, wavelet packet decomposition and convolutional neural network, a convolutional neural network model is constructed to realize multi-type motor imagination EEG. High-precision identification of signals.
It effectively avoids the loss of details and edge information, improves the accuracy of time-frequency analysis of EEG signals, achieves high-precision classification of multiple types of motor imagination EEG signals, and improves classification accuracy.
Smart Images

Figure CN114492500B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of information technology, relates to the classification and recognition of motor imagery EEG signals, and specifically to a motor imagery EEG signal classification method based on a one-dimensional convolution kernel. Background Art
[0002] At present, brain-computer interface technology has gradually become a hot topic in the fields of brain science, rehabilitation engineering, biomedical engineering and automatic control. Brain-computer interface collects brain signals through EEG equipment, and after a series of operations such as EEG signal processing, it converts EEG signals into relevant instructions to control external devices. This technology has greatly improved the quality of life of patients with movement disorders, and has also enriched people's lives in smart homes, entertainment and other aspects.
[0003] Since motor imagery electroencephalogram (MI-EEG) has the characteristics of non-stationarity and nonlinearity, accurate classification of MI-EEG has become a difficult problem that needs to be solved. When processing non-stationary time-varying signals, the time window method and the frequency window method are often used. These two methods have the same problem, that is, the uncertainty principle of the resolution in the time domain and the frequency domain. The higher the resolution in the time domain, the lower the resolution in the frequency domain. Later, the wavelet transform method that combines the time domain and the frequency domain appeared. As a powerful tool for processing non-stationary signals, the wavelet transform has been widely used in many aspects. However, due to the complexity of EEG signals, the traditional wavelet transform decomposes the low-frequency part of the signal and ignores the high-frequency part, resulting in the loss of a large amount of detail information and edge information, which affects the analysis of the signal.
[0004] At present, the number of motor imagery EEG signal classifications is small or the classification accuracy is not high. Tang Zhichuan et al. designed a 5-layer convolutional neural network based on the combination of EEG signal temporal and spatial information to classify and identify motor imagery EEG signals of the left hand and foot. The average recognition rate of the two-class classification was 88.75%, and it was applied to the real-time control of the upper limb rehabilitation exoskeleton; Li Duanling et al. proposed a MI-EEG processing method based on the combination of energy wavelet packet transform and LM algorithm, with an accuracy of 90.13% on the BCI CompetitionIV Dataset2b two-class classification data set; Cheng Shiwei et al. established a convolutional neural network consisting of 3 convolutional layers, 3 pooling layers and 2 fully connected layers on the premise of reducing the EEG signal acquisition channels and increasing the number of classifications, with an average classification accuracy of 82.81%. Summary of the invention
[0005] The purpose of the present invention is to provide a motor imagery EEG signal classification method based on wavelet packet transform and one-dimensional convolution kernel, so as to realize high-precision recognition of multiple types of motor imagery EEG signals.
[0006] The present invention comprises the following steps:
[0007] Step (1) obtaining motor imagery EEG data: extracting EEG data of three channels, C3, Cz, and C4, from the original EEG signal through an EEG acquisition module based on the 10 / 20 system method for classification;
[0008] Step (2) using the Z-Score method to standardize the EEG data, and the standardized EEG data conforms to the normal distribution;
[0009] Step (3) performs wavelet threshold denoising on the original EEG signals of the three channels, sets the noise threshold thr, and compares the wavelet decomposition coefficient WT4(a,τ) obtained after wavelet transform with thr: if the wavelet decomposition coefficient is less than thr, remove the wavelet decomposition coefficient; if the wavelet decomposition coefficient is greater than or equal to thr, retain the wavelet decomposition coefficient; finally, perform wavelet reconstruction calculation on the wavelet decomposition coefficient processed by threshold to obtain the denoised EEG signal;
[0010] Step (4) wavelet packet transform to obtain EEG signals in α and β frequency bands;
[0011] Step (5) Constructing a convolutional neural network: using a convolutional neural network with a one-dimensional convolution kernel to classify the constructed MI-EEG data, the network structure includes a convolutional layer and a fully connected layer;
[0012] Step (6) obtaining and training a convolutional neural network model;
[0013] (6-1) Obtaining training and validation sets: Expand the data set using the five-fold cross-validation method, randomly divide the original EEG data into five parts, select one part as the test set without duplication, and use the other four parts as the training set to train the model;
[0014] (6-2) Training the convolutional neural network model: The training of the convolutional neural network model includes two processes: forward propagation and back propagation. In the forward propagation stage, the data is transformed by convolution and activation functions to reach the output layer. In the back propagation stage, the error between the training sample and the known label is used to adjust and update the weights.
[0015] Step (7) Select the final classification model: Perform model training and verification on the corresponding data set, and select the model with the best classification effect during the training process as the final motor imagery EEG data classification model.
[0016] Furthermore, the Z-Score data standardization method in step (2) is: μ represents the mean of the original data, σ represents the standard deviation of the original data, x represents the standardized EEG data, and x * The normalized EEG data.
[0017] Further, step (3) is specifically:
[0018] (3-1) Perform wavelet transform on the EEG signal to obtain a set of wavelet decomposition coefficients: the original EEG signal voltage amplitude sequence normalized by Z-Score represents the voltage amplitude of the nth original EEG signal, n = 1, 2, ..., N, N represents the number of amplitudes contained in the original EEG signal; using the Db4 wavelet basis, that is, a finite length and decaying wavelet basis function, denoted as ψ4((n-τ) / a), the original EEG signal is expanded with a set of orthogonal wavelet bases of different frequencies, and the wavelet decomposition coefficients corresponding to the Db4 wavelet basis are obtained: Among them, τ is the translation amount, and the scale a controls the expansion and contraction of the wavelet function, which is inversely proportional to the frequency of the wavelet;
[0019] (3-2) Threshold processing of wavelet decomposition coefficients WT4(a,τ) to obtain wavelet estimation coefficients WT4′(a,τ):
[0020] Using a universal threshold, under the constraints of maximum and minimum estimation, the optimal threshold is the noise threshold σ represents the standard variance of noise; the decomposed wavelet coefficients are processed as follows using the soft threshold method to obtain the wavelet estimation coefficients WT4′(a,τ): Wherein, sgn represents a step function. When the wavelet decomposition coefficient WT4(a,τ)>0, the value of sgn(WT4(a,τ)) is 1; when the wavelet decomposition coefficient WT4(a,τ)<0, the value of sgn(WT4(a,τ)) is -1; when the wavelet decomposition coefficient WT4(a,τ)=0, the value of sgn(WT4(a,τ)) is 0;
[0021] (3-3) Use the wavelet estimation coefficient WT4′(a,τ) to perform wavelet reconstruction and obtain the denoised EEG signal: According to the processed wavelet coefficient WT4′(a,τ) and the scale a and translation τ in the wavelet basis, the original EEG signal is reconstructed. The nth amplitude of the original EEG signal after denoising is
[0022] Furthermore, it is characterized in that step (4) specifically comprises:
[0023] (4-1) Wavelet packet decomposition to calculate wavelet coefficients: For the denoised EEG signal sequence x = {x1, x2, ..., x N}, the Db4 wavelet basis function is used to perform W-layer decomposition according to the binary tree method. The Db4 wavelet basis function corresponding to the μth node (w,μ) in the wth layer is recorded as For different nodes (w, μ) different wavelet coefficients are obtained
[0024] (4-2) EEG signal reconstruction: For EEG signals in the α and β frequency bands, select the corresponding node combination U in the binary tree i , i∈(α,β), and U i The wavelet coefficients contained in the reconstruct the wavelet basis, and the reconstruction expression is:
[0025] Among them, x i Indicates the amplitude of the original EEG signal in frequency band i;
[0026] (4-3) The reconstructed EEG data of the α and β frequency bands of the C3, Cz and C4 channels are constructed into a 6×N two-dimensional matrix and used as the input of the convolutional neural network, where N represents the number of EEG signal amplitudes in each frequency band.
[0027] Furthermore, in step (5), the convolution layer: converts the 6×N two-dimensional matrix into three 1×1×2×N four-dimensional matrices, wherein the first dimension represents a single motor imagery, the second dimension represents a single channel, the third dimension represents two frequency bands α and β, and the fourth dimension represents the amplitude of the EEG signal in each frequency band; uses a method of separate convolution of three channels, selects a one-dimensional convolution kernel, and performs convolution only in time; assumes that the size of the convolution kernel is 1×q, and the weight of the 1st row and jth column in the convolution kernel is w 1j , the EEG signal amplitude of each element in the time-frequency matrix block corresponding to the convolution kernel is v 1j , then the output after multiplying by the convolution kernel conv a,b is the value of the ath row and bth column in the matrix obtained after the convolution operation;
[0028] A batch normalization operation is added before the activation layer. After batch normalization, each element in the obtained matrix is activated. The activation function selects the linear rectifier unit ReLu as shown below to replace the tanh and sigmoid functions in the traditional neural network: a,b =max(0,conv a,b ), z a,b Represents the element in the ath row and bth column of the convolution matrix;
[0029] The fully connected layer: combines the local features extracted by the convolutional layer to form a one-dimensional global feature vector, and uses the feature vector as the input of the fully connected layer; the output vector U of the lth layer in the fully connected layer l , is the output vector U of the previous layer l-1 Multiply it by the corresponding weight matrix and obtain it through the response of the activation function; use a fully connected layer with 4 neurons to output the results of the multi-classification task.
[0030] Furthermore, (6-2) training the convolutional neural network model specifically includes:
[0031] a. Select the ReLu activation function, which is a piecewise linear function, and the derivative in the non-negative interval is a constant;
[0032] b. Back propagation, that is, optimizing the cross entropy loss function to train the convolutional neural network model, with the learning rate set to 0.01; its loss function Among them, h θ (x (i) ) is the predicted value of the i-th sample data, y (i) is the true value of the i-th sample data, m represents the number of sample data points, and J(θ) is the sum of square errors of each sample point;
[0033] c. Dropout is set in the first fully connected layer with a loss rate of 0.5.
[0034] Compared with the prior art, the present invention has the following effects:
[0035] The present invention proposes a method for extracting EEG data in a specific frequency band based on wavelet packet transform, which avoids the loss of a large amount of details and marginal EEG information, and can make the time-frequency analysis of EEG signals more accurate. The present invention proposes a method for classifying motor imagery EEG data based on a one-dimensional convolution kernel, which uses a convolutional neural network model with three convolutional layers and three fully connected layers, but does not include a pooling layer, and convolves a single channel separately, and finally uses a fully connected layer with four neurons to output the results of a multi-classification task. The convolutional neural network model has a simple structure, which not only retains the characteristic information of each channel, but also retains the integrity of the EEG data, and is easy to implement in motor imagery multi-classification tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a schematic diagram of the process of the present invention;
[0037] Figure 2 An experimental paradigm for the motor imagery four-classification dataset;
[0038] Figure 3 This is a schematic diagram of the EEG signal acquisition channel;
[0039] Figure 4 Schematic diagram of wavelet packet transform;
[0040] Figure 5 This is the structure diagram of the convolutional neural network. DETAILED DESCRIPTION
[0041] For a clearer description, the specific technical solution of the present invention is described in detail below.
[0042] A motor imagery EEG signal classification method based on wavelet packet transform and one-dimensional convolution kernel. The scheme flow is as shown in the attached figure. Figure 1 shown.
[0043] Step (1) Obtain motor imagery EEG data.
[0044] According to the impact of different motor imagery tasks on different areas, the EEG data of the three channels C3, Cz, and C4 in the original EEG signal are extracted through the EEG acquisition module based on the 10 / 20 system method for classification. The motor imagery EEG signal four-classification dataset BCI Competition IV Dataset 2a is introduced to extract the C3, C4, and Cz channel data.
[0045] This dataset records 288 random motor imagery experiments of nine normal people, including left hand, right hand, feet, and tongue (represented by 0, 1, 2, and 3 respectively). The experimental paradigm of the dataset is as follows: Figure 2 As shown in the figure, each experimental time is divided into three stages: 0-2s is the preparation stage, 2s-6s is the motor imagery stage, and 6s is a short rest stage. In a single experiment, 25 electrodes are used to collect EEG data from 22 EEG channels and 3 EOG channels. The entire collection process records EEG signals at a sampling frequency of 250Hz and performs band-pass filtering of 0.5-100Hz.
[0046] When performing four-category motor imagery, synchronization (ERS) / desynchronization (ERD) phenomena occur: when performing left-hand and right-hand motor imagery, the cerebral cortex will experience corresponding synchronization and desynchronization phenomena, while when performing foot and tongue motor imagery, only synchronization phenomena occur. At the same time, there are obvious differences in synchronization and desynchronization phenomena in the three regions of the cerebral cortex, C3, Cz, and C4. The specific differences are summarized in Table 1. According to the impact of different motor imagery tasks on different regions, the EEG data of the three channels of C3, Cz, and C4 in the original EEG signal were extracted for classification, as shown in the attached figure. Figure 3 .
[0047] aisle Left Hand Right hand Feet Tongue C3 synchronous Desynchronization synchronous synchronous C4 Desynchronization synchronous synchronous synchronous C — — Desynchronization synchronous
[0048] Table 1 Synchronization / desynchronization phenomena of four types of motor imagery
[0049] Step (2) normalizes the EEG data.
[0050] In order to eliminate the dimensionality effect between different data groups, the original EEG signal is normalized to facilitate classification. This method uses the Z-Score method for normalization: μ represents the mean value of the original EEG signal amplitude, σ represents the standard deviation of the original EEG signal amplitude, x represents the EEG signal amplitude at a certain moment, and x *is the normalized EEG signal amplitude at that moment; the standardized EEG data conforms to the normal distribution, that is, the mean is 0, the standard deviation is 1, and the data of each channel are at the same order of magnitude, which can improve the accuracy of model classification.
[0051] Step (3) performs wavelet threshold denoising on the original EEG signals of the three channels. Set the noise threshold thr, and compare the wavelet decomposition coefficient WT4(a,τ) obtained after wavelet transform with thr: if the wavelet decomposition coefficient is less than thr, it is considered that the coefficient is mainly caused by noise and needs to be removed; if the wavelet decomposition coefficient is greater than or equal to thr, it is considered that it is caused by the signal and needs to be retained; finally, perform wavelet reconstruction calculation on the wavelet decomposition coefficient after threshold processing to obtain the denoised EEG signal. The specific steps are as follows:
[0052] (3-1) Perform wavelet transform on the EEG signal to obtain a set of wavelet decomposition coefficients: the original EEG signal voltage amplitude sequence normalized by Z-Score Represents the voltage amplitude of the nth original EEG signal, n = 1, 2, ..., N, N represents the number of amplitudes contained in the original EEG signal. The EEG signal sampling frequency used in this embodiment is 250Hz, and 2-6 seconds of data are intercepted in each motor imagery task. Using the Db4 wavelet basis, that is, a finite-length attenuated wavelet basis function, denoted as ψ4((n-τ) / a), the original EEG signal is expanded using a set of orthogonal wavelet bases of different frequencies to obtain the wavelet decomposition coefficients corresponding to the Db4 wavelet basis: Among them, τ is the translation amount, and the scale a controls the expansion and contraction of the wavelet function, which is inversely proportional to the frequency of the wavelet.
[0053] (3-2) Threshold processing of wavelet decomposition coefficients WT4(a,τ) to obtain wavelet estimation coefficients WT4′(a,τ): Using a universal threshold, under the constraints of maximum and minimum estimation, the optimal threshold is σ represents the standard deviation of noise; the decomposed wavelet coefficients are processed as follows using the soft threshold method to obtain the wavelet estimation coefficient WT4′(a,τ): Among them, sgn represents a step function. When the wavelet decomposition coefficient WT4(a,τ)>0, the value of sgn(WT4(a,τ)) is 1; when the wavelet decomposition coefficient WT4(a,τ)<0, the value of sgn(WT4(a,τ)) is -1; when the wavelet decomposition coefficient WT4(a,τ)=0, the value of sgn(WT4(a,τ)) is 0.
[0054] (3-3) Use the wavelet estimation coefficient WT4′(a,τ) to perform wavelet reconstruction and obtain the denoised EEG signal: According to the processed wavelet coefficient WT4′(a,τ) and the scale a and translation τ in the wavelet basis, the original EEG signal is reconstructed. The nth amplitude of the original EEG signal after denoising is
[0055] Step (4) Wavelet packet transform is used to obtain EEG signals in the α and β frequency bands. Wavelet packet transform can decompose both the low-frequency part and the high-frequency part of the signal, avoiding the loss of a large amount of details and edge EEG information, and making the time-frequency analysis of EEG signals more accurate. The specific process is as follows:
[0056] (4-1) Wavelet packet decomposition to calculate wavelet coefficients: For the denoised EEG signal sequence x = {x1, x2, ..., x N}, the Db4 wavelet basis function is used to perform W-layer decomposition according to the binary tree method. The Db4 wavelet basis function corresponding to the μth node (w,μ) in the wth layer is recorded as In this embodiment, the sampling frequency of the EEG signal is 250 Hz. In order to make the extracted data of a specific frequency band have a sufficiently high resolution, the number of wavelet packet decomposition layers W=7 is selected.
[0057] Different wavelet coefficients can be obtained for different nodes (w, μ)
[0058] (4-2) EEG signal reconstruction: According to the attached Figure 4 It can be seen that the frequency range order of each node obtained by wavelet packet transform is not sorted from small to large, but in the order of Gray code. If a node in the n-1th layer is a low-frequency signal, this node is decomposed on the nth layer: the low-frequency band is assigned to the left child node of this node, and the high-frequency band is assigned to the right child node; if a node in the n-1th layer is a high-frequency signal, the high-frequency band of this node is assigned to the left child node of this node, and the low-frequency band is assigned to the right child node; the EEG signal frequency related to motor imagery is distributed in the α (8-13Hz) and β (14-30Hz) frequency bands. For the EEG signals in the α and β frequency bands, select the corresponding node combination U in the binary tree i , i∈(α,β), U i The wavelet coefficients contained in the reconstruct the wavelet basis, and the reconstruction expression is:
[0059] Among them, x i Represents the amplitude of the original EEG signal in frequency band i. According to the frequency distribution of the two frequency bands, the nodes in Table 2 are selected for reconstruction:
[0060] Frequency band name Band frequency Node combination α 8-13Hz (5,3)+(7,10) β 14-30Hz (6,4)+(4,3)+(5,5)+(6,9)+(7,17)
[0061] Table 2 α and β band node combinations
[0062] (4-3) Constructing a two-dimensional matrix: The reconstructed EEG data of the α and β frequency bands of the C3, Cz and C4 channels are constructed into a 6×1048 two-dimensional matrix and used as the input of the convolutional neural network, as shown in the following formula:
[0063]
[0064] S T represents the two-dimensional matrix when the reconstructed EEG signals are arranged in parallel according to channels and frequency bands, x i,j f Represents the voltage amplitude of the jth EEG signal in the i-th channel f frequency band.
[0065] Step (5) Construct a convolutional neural network. The constructed MI-EEG data is classified using a convolutional neural network with a one-dimensional convolution kernel, such as Figure 5 The network structure mainly includes convolutional layers and fully connected layers. Since the convolutional neural network has less input sample data and the pooling layer is easy to destroy the integrity of EEG data, in order to improve the classification accuracy, the network structure of this method does not include the pooling layer.
[0066] (5-1) Convolution layer: Convert the 6×1048 two-dimensional matrix into three 1×1×2×1048 four-dimensional matrices. The first dimension represents a single motor imagery, the second dimension represents a single channel, the third dimension represents the two frequency bands α and β, and the fourth dimension represents the EEG data within 4 seconds in each frequency band. This method performs convolution on the three channels separately. In order to extract the EEG data features in different channels and frequency bands, a one-dimensional convolution kernel is selected and convolution is performed only in time. Assume that the convolution kernel size is 1×q, and the weight of the 1st row and jth column in the convolution kernel is w 1j , the EEG signal amplitude of each element in the time-frequency matrix block corresponding to the convolution kernel is v 1j , then the output after multiplying by the convolution kernel conv a,b is the value in the ath row and bth column of the matrix obtained after the convolution operation.
[0067] Since the distribution of each batch of data after convolution will be different, in order to make the distribution of each batch of data after convolution consistent and avoid gradient disappearance, a batch normalization operation (BatchNormal) is added before the activation layer to make most of the data distributed around 0.
[0068] After batch normalization, each element in the obtained matrix is activated to increase the nonlinearity of the entire network and improve the network's expressiveness. The activation function selects the linear rectifier unit (ReLu) shown below to replace the tanh and sigmoid functions in the traditional neural network to speed up the network training: a,b=max(0,conv a,b ), z a,b Represents the element in the a-th row and b-th column of the convolved matrix.
[0069] (5-2) Fully connected layer: In the neural network model, the fully connected layer can improve the nonlinear mapping ability of the network and limit the size of the network. The local features extracted by the convolutional layer are combined to form a one-dimensional global feature vector, which is used as the input of the fully connected layer. The output vector U of the lth layer in the fully connected layer is l , is the output vector U of the previous layer l-1 Multiplying by the corresponding weight matrix and passing through the response of the activation function, U l =U l-1 W l-1 +b l-1 .U l-1 and b l-1 Represent the weight matrix and bias of the l-1th layer respectively. Then the final motor imagery output O = U r W r +b r r represents the total number of layers from the first input layer of the fully connected layer to the last hidden layer. r , W r 、b r is the output value, weight matrix and bias of the last hidden layer. In order to prevent overfitting, Dropout is added to the first fully connected layer. This embodiment finally uses a fully connected layer with four neurons to output the multi-classification task results.
[0070] (5-3) Overall structure of convolutional neural network: In order to reduce the influence of parameter setting on the accuracy of classification results, the present invention determines the structural parameters of the convolutional neural network after continuous experimental adjustment, as shown in Table 3:
[0071] Number of layers type Kernel size Step Length Output size 1 convolution 1×16 1 1×8×2×1033 2 convolution 1×8 1 1×14×2×1026 3 convolution 1×4 1 1×18×2×1023 4 Fully connected — — 500 5 Fully connected — — 10 6 Fully connected — — 4
[0072] Table 3 Convolutional neural network structure parameters
[0073] Step (6) obtains and trains a convolutional neural network model.
[0074] (6-1) Obtaining training and validation sets: Since the original experimental motor imagery EEG data was relatively small, the data set was expanded using a five-fold cross-validation method. The original EEG data was randomly divided into five parts, one of which was selected as the test set without duplication, and the other four parts were used as training sets to train the model.
[0075] (6-2) Training the convolutional neural network model: The training of the convolutional neural network model includes two processes: forward propagation and back propagation. In the forward propagation stage, the data is transformed by the nonlinear transformation of convolution and activation functions to reach the output layer; the back propagation stage mainly uses the error between the training sample and the known label to adjust and update the weight. It is divided into the following three parts:
[0076] a. The activation function is the key to achieving nonlinearity in forward propagation. Select the ReLu activation function, which is a piecewise linear function. The derivative in the non-negative interval is a constant, and there is no "gradient disappearance" problem;
[0077] b. Back propagation is to optimize the cross entropy loss function to train the convolutional neural network model. During the optimization process, the learning rate is set to 0.01. Since data will generate errors when passing through multiple layers of neurons, and the error size of each layer of neurons is different, the error needs to be back propagated to the network to calculate the contribution of the error of each layer of neurons. The stochastic gradient descent optimization algorithm (SGD) is used to minimize the loss function and update the weights and biases. This method only selects one sample to participate each time, which greatly reduces the amount of calculation. Its loss function is: Among them, h θ (x (i) ) is the predicted value of the i-th sample data, y (i) is the true value of the i-th sample data, m represents the number of sample data points, and J(θ) is the loss function, that is, the sum of square errors of each sample point.
[0078] c. During the training of the convolutional neural network model, there may be overfitting, that is, the model can perfectly fit the training data, but the error on the test data is large. This method sets Dropout in the first fully connected layer with a loss rate of 0.5. This method allows some neurons to stop working with a certain probability, reducing the dependence between neurons and thus reducing overfitting.
[0079] Since the batch size of samples input into the neural network each time affects the performance and convergence speed of the network, a large batch can accelerate convergence but with low accuracy, while a small batch has high accuracy but slow speed. In order to meet the requirements of high accuracy and high speed, a batch size of 24 was selected after multiple experiments. The experimental results show that a batch size of 24 can achieve higher classification accuracy.
[0080] Step (7) Select the final classification model. Perform model training and verification on the corresponding data set, and select the model with the best classification effect during the training process as the final motor imagery EEG data classification model. The model training accuracy on the BCI CompetitionIV Dataset 2a data set is higher than that of other models.
Claims
1. Classification method of motor imagery EEG signals based on one-dimensional convolution kernel, It is characterized in that The method is as follows: Step (1) obtaining motor imagery EEG data: extracting EEG data of three channels, C3, Cz, and C4, from the original EEG signal through an EEG acquisition module based on the 10 / 20 system method for classification; Step (2) using the Z-Score method to standardize the EEG data, and the standardized EEG data conforms to the normal distribution; Step (3) Perform wavelet threshold denoising on the original EEG signals of the three channels, set the noise threshold thr, and transform the wavelet decomposition coefficients WT obtained after wavelet transformation. 4 (a,τ) is compared with thr: if the wavelet decomposition coefficient is less than thr, the wavelet decomposition coefficient is removed; if the wavelet decomposition coefficient is greater than or equal to thr, the wavelet decomposition coefficient is retained; finally, the wavelet decomposition coefficient processed by the threshold is reconstructed by wavelet to obtain the denoised EEG signal; Step (4) wavelet packet transform to obtain EEG signals in α and β frequency bands; Step (5) Constructing a convolutional neural network: using a convolutional neural network with a one-dimensional convolution kernel to classify the constructed MI-EEG data, the network structure includes a convolutional layer and a fully connected layer; Step (6) obtaining and training a convolutional neural network model; (6-1) Obtaining training and validation sets: Expand the data set using the five-fold cross-validation method, randomly divide the original EEG data into five parts, select one part as the test set without duplication, and use the other four parts as the training set to train the model; (6-2) Training the convolutional neural network model: The training of the convolutional neural network model includes two processes: forward propagation and back propagation. In the forward propagation stage, the data is transformed by convolution and activation functions to reach the output layer. In the back propagation stage, the error between the training sample and the known label is used to adjust and update the weights. Step (7) Select the final classification model: Perform model training and verification on the corresponding data set, and select the model with the best classification effect during the training process as the final motor imagery EEG data classification model.
2. The method for classifying motor imagery EEG signals based on a one-dimensional convolution kernel as claimed in claim 1, It is characterized in that The Z-Score data standardization method in step (2) is: μ represents the mean of the original data, σ represents the standard deviation of the original data, x represents the standardized EEG data, and x * The normalized EEG data.
3. The method for classifying motor imagery EEG signals based on a one-dimensional convolution kernel as claimed in claim 2, It is characterized in that Step (3) is specifically: (3-1) Perform wavelet transform on the EEG signal to obtain a set of wavelet decomposition coefficients: the original EEG signal voltage amplitude sequence normalized by Z-Score represents the voltage amplitude of the nth original EEG signal, n = 1, 2, ..., N, N represents the number of amplitudes contained in the original EEG signal; the Db4 wavelet basis is used, that is, a finite length and decaying wavelet basis function, denoted as ψ 4 ((n-τ) / a), the original EEG signal is expanded with a set of orthogonal wavelet bases of different frequencies to obtain the wavelet decomposition coefficients corresponding to the Db4 wavelet base: Among them, τ is the translation amount, and the scale a controls the expansion and contraction of the wavelet function, which is inversely proportional to the frequency of the wavelet; (3-2) Threshold processing wavelet decomposition coefficient WT 4 (a,τ), get the wavelet estimation coefficient WT 4 ′(a,τ): Using a universal threshold, under the constraints of maximum and minimum estimation, the optimal threshold is the noise threshold σ represents the standard variance of noise; the decomposed wavelet coefficients are processed as follows using the soft threshold method to obtain the wavelet estimation coefficient WT 4 ′(a,τ): Among them, sgn represents the step function, when the wavelet decomposition coefficient WT 4 When (a,τ)>0, sgn(WT 4 (a,τ)) is 1; when the wavelet decomposition coefficient WT 4 When (a,τ)<0, sgn(WT 4 (a,τ)) is -1; when the wavelet decomposition coefficient WT 4 When (a,τ)=0, sgn(WT 4 The value of (a,τ)) is 0; (3-3) Using wavelet to estimate coefficients WT 4 ′(a,τ) is reconstructed by wavelet to obtain the denoised EEG signal: According to the processed wavelet coefficient WT 4 ′(a,τ) and the scale a and translation τ in the wavelet basis are used to reconstruct the original EEG signal. The nth amplitude of the original EEG signal after denoising is 4. The method for classifying motor imagery EEG signals based on a one-dimensional convolution kernel as claimed in claim 3, It is characterized in that Step (4) is specifically: (4-1) Wavelet packet decomposition to calculate wavelet coefficients: For the denoised EEG signal sequence x = {x 1 ,x 2 ,...,x N }, the Db4 wavelet basis function is used to perform W-layer decomposition according to the binary tree method. The Db4 wavelet basis function corresponding to the μth node (w,μ) in the wth layer is recorded as For different nodes (w, μ) different wavelet coefficients are obtained (4-2) EEG signal reconstruction: For EEG signals in the α and β frequency bands, select the corresponding node combination U in the binary tree i , i∈(α,β), U i The wavelet coefficients contained in the reconstruct the wavelet basis, and the reconstruction expression is: Among them, x i Indicates the amplitude of the original EEG signal in frequency band i; (4-3) The reconstructed EEG data of the α and β frequency bands of the C3, Cz and C4 channels are constructed into a 6×N two-dimensional matrix and used as the input of the convolutional neural network, where N represents the number of EEG signal amplitudes in each frequency band.
5. The method for classifying motor imagery EEG signals based on a one-dimensional convolution kernel as claimed in claim 4, Features: In step (5), the convolution layer: converts the 6×N two-dimensional matrix into three 1×1×2×N four-dimensional matrices, where the first dimension represents a single motor imagery, the second dimension represents a single channel, the third dimension represents the two frequency bands α and β, and the fourth dimension represents the EEG signal amplitude in each frequency band; uses a three-channel separate convolution method, selects a one-dimensional convolution kernel, and performs convolution only in time; assumes that the convolution kernel size is 1×q, and the weight of the 1st row and jth column in the convolution kernel is w 1j , the EEG signal amplitude of each element in the time-frequency matrix block corresponding to the convolution kernel is v 1j , then the output after multiplying by the convolution kernel conv a,b is the value of the ath row and bth column in the matrix obtained after the convolution operation; A batch normalization operation is added before the activation layer. After batch normalization, each element in the obtained matrix is activated. The activation function selects the linear rectifier unit ReLu as shown below to replace the tanh and sigmoid functions in the traditional neural network: a,b =max(0,conv a,b ), z a,b Represents the element in the ath row and bth column of the convolution matrix; The fully connected layer: combines the local features extracted by the convolutional layer to form a one-dimensional global feature vector, and uses the feature vector as the input of the fully connected layer; the output vector U of the lth layer in the fully connected layer l , is the output vector U of the previous layer l-1 Multiply by the corresponding weight matrix and get through the response of the activation function; A fully connected layer with 4 neurons is used to output the results of the multi-classification task.
6. The method for classifying motor imagery EEG signals based on a one-dimensional convolution kernel as claimed in claim 5, Features: (6-2) Training the convolutional neural network model, specifically including: a. Select the ReLu activation function, which is a piecewise linear function, and the derivative in the non-negative interval is a constant; b. Back propagation, that is, optimizing the cross entropy loss function to train the convolutional neural network model, with the learning rate set to 0.01; its loss function Among them, h θ (x (i) ) is the predicted value of the i-th sample data, y (i) is the true value of the i-th sample data, m represents the number of sample data points, and J(θ) is the sum of square errors of each sample point; c. Dropout is set in the first fully connected layer with a loss rate of 0.5.
