A motor imagery electroencephalogram signal classification method and system
By processing EEG signals through multi-head attention layers and convolutional layers, combined with preprocessing and the LightGBM algorithm, the problems of data quality and noise handling are solved, improving the accuracy and adaptability of motor imagery EEG signal classification.
Patent Information
- Application Number
- CN202411174988.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-08-26
AI Technical Summary
Existing methods for classifying motor imagery EEG signals have shortcomings in terms of data quality and noise handling, which affect the accuracy and adaptability of classification.
Multi-head attention layers and convolutional layers are used to process EEG signals. Preprocessing, feedforward network layers and fully connected layers are combined. Through preprocessing steps such as filtering, time segmentation and downsampling, combined with the LightGBM classification algorithm, the data quality and the generalization ability of the classification model are improved.
It improves the accuracy and adaptability of EEG signal classification, enabling a better understanding of the characteristics and meaning of EEG signals, adapting to noise and redundant information, and enhancing the reliability of classification results.
Smart Images

Figure CN119538019B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the research field of EEG signal classification and recognition, and in particular to a motor imagery EEG signal classification method and system. Background Art
[0002] Motor imagery EEG signals are detected by recording a subject's brain activity, specifically electroencephalogram (EEG) signals, to detect when they imagine specific movements without actually performing them. Motor imagery EEG signal classification is a key research topic in the field of brain-computer interfaces (BCIs). By converting a subject's motor imagery into control signals, direct interaction between a person and a computer or external device can be achieved, thus expanding the application scope and potential of BCI technology.
[0003] In the field of rehabilitation medicine, motor imagery EEG signal classification can be used to assist patients with rehabilitation training. For example, for patients with motor impairments or motor dysfunction, brain-computer interface technology can be used to promote the regeneration and functional recovery of damaged neurons through motor imagery. Motor imagery EEG signal classification also has application value in areas such as assistive device control and virtual reality interaction. Summary of the Invention
[0004] The present invention obtains raw EEG data and preprocesses the raw EEG data, thereby improving the quality and usability of the raw EEG data to facilitate subsequent analysis and interpretation; the EEG data is input into a multi-head attention layer and a convolution layer for processing. The multi-head attention layer can help the motor imagery EEG signal classification model focus on the correlation between different time points or different brain regions, thereby better understanding the characteristics of the EEG signal, and the convolution layer can help the motor imagery EEG signal classification model better understand the meaning and characteristics of the EEG data.
[0005] A motor imagery EEG signal classification method, comprising:
[0006] Step S1: Collect EEG signals to obtain raw EEG data.
[0007] Step S2: The power spectral density of the original EEG data is obtained by calculation, and the frequency domain features in the original EEG data are extracted according to the obtained power spectral density to obtain frequency domain feature data. The original EEG data and the frequency domain feature data are input into the motor imagery EEG signal classification model, and the motor imagery EEG signal classification result is output.
[0008] The motor imagery EEG signal classification model includes a preprocessing layer, a first feedforward network layer, a multi-head attention layer, a convolutional layer, a second feedforward network layer, and a fully connected layer. The preprocessing layer is used to preprocess the raw EEG data to construct the first-level EEG data. Specifically, it includes the following steps:
[0009] The raw EEG data is input into the preprocessing layer, and the first-level EEG data is obtained through filtering, time segmentation, re-referencing, downsampling and artifact removal operations.
[0010] Preferably, the first feedforward network layer is composed of a first normalization unit, a first linear unit, a first Swish activation function unit, a first Dropout unit, a second linear unit, a second Dropout unit, and a first residual connection unit; the first feedforward network layer is used to extract features from the primary EEG data to construct the secondary EEG data, specifically including the following steps;
[0011] The first-level EEG data is input into the first-layer normalization unit, which performs layer normalization processing on the first-level EEG data and outputs the feedforward network normalized data;
[0012] Inputting the normalized data into a first linear unit, the first linear unit performs a linear transformation on the normalized data and outputs first linear transformation data;
[0013] Inputting the linear transformation data into a first Swish activation function unit, the first Swish activation function unit calculates the linear transformation data to obtain first Swish activation function data;
[0014] The Swish activation function data is input to the first Dropout unit, which randomly sets part of the activation function data to zero with a certain probability and outputs the first Dropout operation data;
[0015] Inputting the Dropout operation data into the second linear unit, the second linear unit performs a linear transformation on the Dropout operation data and outputs second linear transformation data;
[0016] Inputting the second linear transformation data into a second Dropout unit, the second Dropout unit randomly sets part of the second linear transformation data to zero with a certain probability, and outputs second Dropout operation data;
[0017] The residual connection unit performs a semi-residual connection on the first-level EEG data and the second Dropout operation data to obtain the second-level EEG data.
[0018] Preferably, the secondary EEG data and the frequency domain feature data are fused to obtain fused feature data, the fused feature data is input into the multi-head attention layer, and the tertiary EEG data is output, which specifically includes the following steps:
[0019] The multi-head attention layer uses multiple queries to split the fused feature data into h sub-matrices in parallel, performs an attention calculation on each sub-matrix to obtain an output matrix, and finally splices the h output matrices together to obtain the final output matrix.
[0020] Preferably, the convolution layer includes a second normalization unit, a first point convolution unit, a Glu activation function unit, a one-dimensional depth-separable convolution unit, a batch normalization unit, a second Swish activation function unit, a second point convolution unit, a third Dropout unit, and a second residual connection unit; inputting the three-level EEG data into the convolution layer to obtain the four-level EEG data specifically includes the following steps:
[0021] The three-level EEG data is input into the second-layer normalization unit, and the second-layer normalization unit performs layer normalization operation on the three-level EEG data and outputs convolution normalized data;
[0022] Inputting the convolution normalized data into the first point convolution unit, the first point convolution unit performs a point convolution operation on the convolution normalized data and outputs first point convolution data;
[0023] The first point convolution data is input to the Glu activation function unit, which calculates the first point convolution data:
[0024] Output Glu activation function data;
[0025] Input the Glu activation function data into the one-dimensional depth-separable convolution unit, which performs a one-dimensional depth-separable convolution operation on the Glu activation function data and outputs one-dimensional depth data;
[0026] The one-dimensional depth data is input to the batch normalization unit, and the batch normalization unit performs a batch normalization operation on the one-dimensional depth data and outputs batch normalized data;
[0027] The batch normalized data is input to the second Swish activation function unit, which calculates the batch normalized data:
[0028] Output the second Swish activation function data;
[0029] Inputting the second Swish activation function data into the second point convolution unit, the second point convolution unit performs a point convolution operation on the second Swish activation function data, and outputs second point convolution data;
[0030] The second point convolution data is input to the third Dropout unit, and the third Dropout unit randomly sets part of the second point convolution data to zero with a certain probability, and outputs the third Dropout operation data;
[0031] The second residual connection unit adds the three-level EEG data to the third Dropout operation data to obtain the four-level EEG data.
[0032] Preferably, the second feedforward network layer is used to perform feature extraction on the four-level EEG data to construct five-level EEG data, and the specific steps are the same as those of the first feedforward network layer.
[0033] Preferably, the fully connected layer is used to integrate the five-level EEG data to construct the final EEG data.
[0034] LightGBM is selected as the classification algorithm for the motor imagery EEG signal classification model, which is improved from the gradient boosting decision tree.
[0035] The final EEG data is input into the classifier, and the classifier outputs the classification result of the motor imagery EEG signal.
[0036] Preferably, the training of the motor imagery EEG signal classification model includes the following steps:
[0037] Obtain several labeled motor imagery data samples, organize the motor imagery data samples into a motor imagery training set, initialize the motor imagery EEG signal classification model, and set relevant parameters, input the motor imagery training set into the motor imagery EEG signal classification model for training, and judge whether the training conditions are met. If the training conditions are met, output the trained motor imagery EEG signal classification model; otherwise, continue to train the motor imagery EEG signal classification model through the training set.
[0038] A motor imagery EEG signal classification system, comprising:
[0039] The EEG data acquisition module is used to obtain raw EEG data.
[0040] The frequency domain feature data acquisition module is used to input the original EEG data into the frequency domain feature data acquisition module and output frequency domain feature data.
[0041] The motor imagery EEG signal classification module is used to send the original EEG data to the motor imagery EEG signal classification module for processing and output the motor imagery EEG signal classification results.
[0042] The present invention has the following advantages:
[0043] 1. The present invention obtains raw EEG data and preprocesses the raw EEG data to improve the quality and usability of the raw EEG data for subsequent analysis and interpretation; the EEG data is input into the multi-head attention layer and the convolution layer for processing. The multi-head attention layer can help the motor imagery EEG signal classification model focus on the correlation between different time points or different brain regions, so as to better understand the characteristics of the EEG signal. The convolution layer can help the motor imagery EEG signal classification model better understand the meaning and characteristics of the EEG data.
[0044] 2. The present invention extracts features from EEG data through the first feedforward network layer and the second feedforward network layer, uses half-step residual connections in the two feedforward networks, and uses residual connections in the multi-head attention layer and the convolutional layer. The residual connections can improve the generalization ability of the motor imagery EEG signal classification model, enabling it to better adapt to the noise and redundant information in the EEG data. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 This is a schematic diagram of the structure of the motor imagery EEG signal classification system used in an embodiment of the present invention. DETAILED DESCRIPTION
[0046] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0047] Example 1
[0048] A motor imagery EEG signal classification method, comprising:
[0049] Step S1: Use the OPENBCI EEG cap to collect EEG signals. Before collecting experimental data, observe the impedance of each electrode of the OPENBCI EEG cap through the OPENBCI-GUI software, adjust the impedance of each electrode, and reduce it to below 1000KΩ before starting experimental collection. The experimental paradigm is presented in the Psychopy software. Connect the acquisition program and the Psychopy that presents the experimental paradigm through pylsl, so that real-time data can be sent and received on one device, eliminating the waiting time error between the two. That is, at a certain time point, the data automatically labeled in the previous time period is sent to the receiving end to obtain the labeled original EEG data.
[0050] Step S2: Calculate the power spectrum density of the original EEG data. The principle of power spectrum density function is: power spectrum density S(f) is a function mapping with f as the independent variable, reflecting how much power the signal has at the frequency component f. Assume a random signal process x(t), and define a cutoff value , so the truncated process of the random process x It can be defined as:
[0051]
[0052] Define the energy of a signal:
[0053]
[0054] Then the average power P of x(t) is given by time averaging:
[0055]
[0056] From this, we can see that in stationary processes, there may be a problem where power is finite but energy is infinite. This is because energy is the integral of power, and stationary signals last infinitely long. This is why the power spectral density function is used instead of the energy spectral density function. According to Parseval's theorem, which states that energy is equal from both the time domain and frequency domain perspectives, we can obtain:
[0057]
[0058] here is The form obtained by Fourier transform, and the time of the random process is limited to a finite time [ ], which makes the Fourier transform in the random process no longer restricted. It should also be noted that Is a random variable. To obtain the final average power value of the whole, we also need to Find its expected value:
[0059]
[0060] Then pass Taking the limit as it approaches infinity, we can get the average power of the original random process:
[0061]
[0062] Finally, the integrand of the previous formula is extracted separately and defined as s(f), which is the power spectral density function:
[0063]
[0064] The frequency domain features in the original EEG data are extracted according to the obtained power spectral density to obtain frequency domain feature data. The original EEG data and the frequency domain feature data are input into the motor imagery EEG signal classification model to output the motor imagery EEG signal classification results.
[0065] The motor imagery EEG signal classification model includes a preprocessing layer, a first feedforward network layer, a multi-head attention layer, a convolutional layer, a second feedforward network layer, and a fully connected layer. The preprocessing layer is used to preprocess the raw EEG data to construct the first-level EEG data. Specifically, it includes the following steps:
[0066] The raw EEG data is input into the preprocessing layer and undergoes filtering, time segmentation, re-referencing, downsampling and artifact removal operations. Filtering is to retain the frequency bands that are highly correlated with motor imagery; time segmentation is to delete the time periods that are irrelevant to motor imagery in the entire experimental paradigm and retain the time periods with the most information during imagination; re-referencing is to eliminate the noise frequency bands whose frequencies are close to those correlated with motor imagery; downsampling is to save computational effort and speed up model convergence; artifact removal is to remove interference from other physiological signals such as electromyography and eye movements; and primary EEG data is obtained.
[0067] The first feedforward network layer is composed of a first normalization unit, a first linear unit, a first Swish activation function unit, a first Dropout unit, a second linear unit, a second Dropout unit, and a first residual connection unit; the first feedforward network layer is used to extract features from the first-level EEG data to construct the second-level EEG data, specifically including the following steps;
[0068] The first-level EEG data is input into the first-layer normalization unit, which performs layer normalization processing on the first-level EEG data and outputs the feedforward network normalized data;
[0069] Inputting the normalized data into a first linear unit, the first linear unit performs a linear transformation on the normalized data and outputs first linear transformation data;
[0070] The linear transformation data is input to the first Swish activation function unit, which calculates the linear transformation data according to the following formula:
[0071]
[0072] in Represents linear transformation data, the first Swish activation function unit outputs the calculation result to obtain the first Swish activation function data;
[0073] The Swish activation function data is input to the first Dropout unit, which randomly sets part of the activation function data to zero with a certain probability and outputs the first Dropout operation data;
[0074] Inputting the Dropout operation data into the second linear unit, the second linear unit performs a linear transformation on the Dropout operation data and outputs second linear transformation data;
[0075] Inputting the second linear transformation data into a second Dropout unit, the second Dropout unit randomly sets part of the second linear transformation data to zero with a certain probability, and outputs second Dropout operation data;
[0076] The residual connection unit performs a semi-residual connection on the first-level EEG data and the second Dropout operation data to obtain the second-level EEG data.
[0077] The secondary EEG data and frequency domain feature data are fused to obtain fused feature data, which is then fed into the multi-head attention layer to output the tertiary EEG data. The specific steps include:
[0078] The multi-head attention layer uses multiple queries to split the fused feature data into h sub-matrices in parallel, performs an attention calculation on each sub-matrix, and obtains an output matrix. Finally, the h output matrices are spliced together to obtain the final output matrix. The calculation formula is as follows:
[0079]
[0080]
[0081] Assume the input matrix is dimensional matrix, then , and All dimensional query matrix, key matrix, and value matrix, is the weight parameter matrix of the linear projection (the weight parameter matrix starts from random initialization and is then updated through the backpropagation algorithm and training data. During training, the model adjusts these weight matrices according to the gradient of the loss function to maximize convergence), Denotes the corresponding i-th attention head. Each attention head is calculated by the corresponding Q, K, V:
[0082]
[0083] Different from the self-attention mechanism, the obtained attention scores are used to perform a weighted summation of each value to obtain the attention output of each head. This step encourages the model to consider the trade-offs between different heads when paying attention to different parts of the input sequence. Finally, the h output matrices are concatenated and multiplied by the linear transformation. The matrix gets the final output matrix of the multi-head attention.
[0084] The convolution layer includes a second normalization unit, a first point convolution unit, a Glu activation function unit, a one-dimensional depth-separable convolution unit, a batch normalization unit, a second Swish activation function unit, a second point convolution unit, a third Dropout unit, and a second residual connection unit. The three-level EEG data is input into the convolution layer to obtain the four-level EEG data, which specifically includes the following steps:
[0085] The three-level EEG data is input into the second-layer normalization unit, and the second-layer normalization unit performs layer normalization operation on the three-level EEG data and outputs convolution normalized data;
[0086] The convolution normalized data is input to the first point convolution unit. Point convolution is a regular convolution with a unique convolution kernel size. It performs small calculations on each specific point in the data, making the model algorithm more focused, focusing on individual points rather than the whole. The first point convolution unit performs a point convolution operation on the convolution normalized data and outputs the first point convolution data.
[0087] The first point convolution data is input to the Glu activation function unit, Glu stands for Gated Linear Unit, which is the gated linear unit function. The calculation process is: first input vector X through two independent convolution layers to obtain the corresponding vectors A and B. Assume , Then vector B passes through the sigmoid activation function, and the B vector becomes a value between 0 and 1, which can control whether the information is passed. Finally, the values obtained by the sigmoid function of vector A and B are multiplied one by one. The Glu activation function unit calculates the first point convolution data according to the following formula:
[0088]
[0089] Output Glu activation function data;
[0090] The Glu activation function data is input to the one-dimensional depth-separable convolution unit. The depth convolution is different from the conventional convolution operation. One convolution kernel is only responsible for one channel, and one channel is only convolved by one convolution and then all channels are combined with point convolution as the output feature. The one-dimensional depth-separable convolution unit performs a one-dimensional depth-separable convolution operation on the Glu activation function data and outputs one-dimensional depth data.
[0091] The one-dimensional depth data is input to the batch normalization unit. Batch normalization calculates the mean and variance and then standardizes the output. It converts the input value of any neural unit in each layer of the neural network into a standard normal distribution with an expected value of 0 and a variance of 1. The distribution with a large offset is forcibly converted into a standard normal distribution through mapping. The batch normalization unit performs batch normalization on the one-dimensional depth data and outputs batch normalized data.
[0092] The batch normalized data is input into the second Swish activation function unit, which calculates the batch normalized data according to the following formula:
[0093]
[0094] Output the second Swish activation function data;
[0095] Inputting the second Swish activation function data into the second point convolution unit, the second point convolution unit performs a point convolution operation on the second Swish activation function data, and outputs second point convolution data;
[0096] The second point convolution data is input to the third Dropout unit, and the third Dropout unit randomly sets part of the second point convolution data to zero with a certain probability, and outputs the third Dropout operation data;
[0097] The second residual connection unit adds the three-level EEG data to the third Dropout operation data to obtain the four-level EEG data.
[0098] The second feedforward network layer is used to extract features from the four-level EEG data to construct five-level EEG data. The specific steps are the same as those of the first feedforward network layer.
[0099] The fully connected layer is used to integrate the five-level EEG data to construct the final EEG data.
[0100] LightGBM is selected as the classification algorithm for the motor imagery EEG signal classification model, which is improved from the gradient boosting decision tree.
[0101] The final EEG data is input into the classifier, and the classifier outputs the classification result of the motor imagery EEG signal.
[0102] Preferably, the training of the motor imagery EEG signal classification model includes the following steps:
[0103] Obtain several labeled motor imagery data samples, organize the motor imagery data samples into a motor imagery training set, initialize the motor imagery EEG signal classification model, and set relevant parameters, input the motor imagery training set into the motor imagery EEG signal classification model for training, and judge whether the training conditions are met. If the training conditions are met, output the trained motor imagery EEG signal classification model; otherwise, continue to train the motor imagery EEG signal classification model through the training set.
[0104] Example 2
[0105] A motor imagery EEG signal classification system, such as Figure 1 Shown, including:
[0106] The EEG data acquisition module is used to obtain raw EEG data.
[0107] The frequency domain feature data acquisition module is used to input the original EEG data into the frequency domain feature data acquisition module and output frequency domain feature data.
[0108] The motor imagery EEG signal classification module is used to send the original EEG data to the motor imagery EEG signal classification module for processing and output the motor imagery EEG signal classification results.
[0109] Example 3
[0110] A motor imagery EEG signal classification device comprises a memory and a processor, wherein the memory stores a computer program, and the computer program can be executed by the processor to implement the motor imagery EEG signal classification method as described above.
[0111] Example 4
[0112] The fourth embodiment of the present invention further provides a computer-readable storage medium storing a computer program, wherein the computer program can be executed by a processor of a device where the computer-readable storage medium is located to implement the above-mentioned motor imagery EEG signal classification method.
[0113] For example, the computer programs described in Embodiments 3 and 4 of the present invention may be divided into one or more modules, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the processing device. For example, the system described in Embodiment 2 of the present invention.
[0114] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the classification method, and utilizes various interfaces and lines to connect the various parts of the classification method.
[0115] The memory can be used to store the computer program and / or module, and the processor implements various functions of an error correction method by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function (such as a sound playback function, a text conversion function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, text message data, etc.). In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0116] Wherein, if the implemented module is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by a computer program to instruct the relevant hardware. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of each of the above-mentioned method embodiments. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0117] It should be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art can understand and implement the present invention without inventive work.
[0118] The above are only preferred embodiments of the present invention. The protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention.
Claims
1. A motor imagery EEG signal classification method, characterized in that: include: Step S1: Collect EEG signals to obtain raw EEG data; Step S2: obtaining the power spectral density of the original EEG data by calculation, extracting the frequency domain features in the original EEG data according to the obtained power spectral density to obtain frequency domain feature data, inputting the original EEG data and the frequency domain feature data into the motor imagery EEG signal classification model, and outputting the motor imagery EEG signal classification result; The motor imagery EEG signal classification model includes a preprocessing layer, a first feedforward network layer, a multi-head attention layer, a convolutional layer, a second feedforward network layer, and a fully connected layer. The preprocessing layer is used to preprocess the raw EEG data to construct the first-level EEG data. Specifically, it includes the following steps: The raw EEG data is input into the preprocessing layer, and after filtering, time segmentation, re-referencing, downsampling and artifact removal operations, the first-level EEG data is obtained; The first feedforward network layer is composed of a first normalization unit, a first linear unit, a first Swish activation function unit, a first Dropout unit, a second linear unit, a second Dropout unit, and a first residual connection unit; the first feedforward network layer is used to extract features from the first-level EEG data to construct the second-level EEG data; Fuse the secondary EEG data and frequency domain feature data to obtain fused feature data, input the fused feature data into the multi-head attention layer, and output the tertiary EEG data; The convolution layer includes a second normalization unit, a first point convolution unit, a Glu activation function unit, a one-dimensional depth-separable convolution unit, a batch normalization unit, a second Swish activation function unit, a second point convolution unit, a third Dropout unit, and a second residual connection unit. The three-level EEG data is input into the convolution layer to obtain the four-level EEG data. The second feedforward network layer is used to extract features from the four-level EEG data to construct five-level EEG data. The specific steps are the same as those of the first feedforward network layer. The fully connected layer is used to integrate the five-level EEG data to construct the final EEG data; The final EEG data is input into the classifier, and the classifier outputs the classification result of the motor imagery EEG signal.
2. The method for classifying motor imagery EEG signals according to claim 1, wherein: The first feedforward network layer is used to extract features from the primary EEG data to construct the secondary EEG data, which specifically includes the following steps: The first-level EEG data is input into the first-layer normalization unit, which performs layer normalization processing on the first-level EEG data and outputs the feedforward network normalized data; Inputting the normalized data into a first linear unit, the first linear unit performs a linear transformation on the normalized data and outputs first linear transformation data; Inputting the linear transformation data into a first Swish activation function unit, the first Swish activation function unit calculates the linear transformation data to obtain first Swish activation function data; The Swish activation function data is input to the first Dropout unit, which randomly sets part of the activation function data to zero with a certain probability and outputs the first Dropout operation data; Inputting the Dropout operation data into the second linear unit, the second linear unit performs a linear transformation on the Dropout operation data and outputs second linear transformation data; Inputting the second linear transformation data into a second Dropout unit, the second Dropout unit randomly sets part of the second linear transformation data to zero with a certain probability, and outputs second Dropout operation data; The residual connection unit performs a semi-residual connection on the first-level EEG data and the second Dropout operation data to obtain the second-level EEG data.
3. The method for classifying motor imagery EEG signals according to claim 2, wherein: The fused feature data is input into the multi-head attention layer to output the three-level EEG data. The specific steps include the following: The multi-head attention layer uses multiple queries to split the fused feature data into h sub-matrices in parallel, performs an attention calculation on each sub-matrix to obtain an output matrix, and finally splices the h output matrices together to obtain the final output matrix.
4. The method for classifying motor imagery EEG signals according to claim 3, wherein: Input the three-level EEG data into the convolutional layer to obtain the four-level EEG data, which specifically includes the following steps: The three-level EEG data is input into the second-layer normalization unit, and the second-layer normalization unit performs layer normalization operation on the three-level EEG data and outputs convolution normalized data; Inputting the convolution normalized data into the first point convolution unit, the first point convolution unit performs a point convolution operation on the convolution normalized data and outputs first point convolution data; The first point convolution data is input to the Glu activation function unit, which calculates the first point convolution data: Output Glu activation function data; Input the Glu activation function data into the one-dimensional depth-separable convolution unit, which performs a one-dimensional depth-separable convolution operation on the Glu activation function data and outputs one-dimensional depth data; The one-dimensional depth data is input to the batch normalization unit, and the batch normalization unit performs a batch normalization operation on the one-dimensional depth data and outputs batch normalized data; The batch normalized data is input to the second Swish activation function unit, which calculates the batch normalized data: Output the second Swish activation function data; Inputting the second Swish activation function data into the second point convolution unit, the second point convolution unit performs a point convolution operation on the second Swish activation function data, and outputs second point convolution data; The second point convolution data is input to the third Dropout unit, and the third Dropout unit randomly sets part of the second point convolution data to zero with a certain probability, and outputs the third Dropout operation data; The second residual connection unit adds the three-level EEG data to the third Dropout operation data to obtain the four-level EEG data.
5. The method for classifying motor imagery EEG signals according to claim 4, wherein: LightGBM is selected as the classification algorithm for the motor imagery EEG signal classification model, which is improved from the gradient boosting decision tree.
6. The method for classifying motor imagery EEG signals according to claim 5, wherein: The training of the motor imagery EEG signal classification model includes the following steps: Obtain several labeled motor imagery data samples, organize the motor imagery data samples into a motor imagery training set, initialize the motor imagery EEG signal classification model, and set relevant parameters, input the motor imagery training set into the motor imagery EEG signal classification model for training, and judge whether the training conditions are met. If the training conditions are met, output the trained motor imagery EEG signal classification model; otherwise, continue to train the motor imagery EEG signal classification model through the training set.
7. A motor imagery EEG signal classification system, characterized in that: The system applies a motor imagery EEG signal classification method according to any one of claims 1 to 6, comprising: EEG data acquisition module, used to obtain raw EEG data; The frequency domain feature data acquisition module is used to input the original EEG data into the frequency domain feature data acquisition module and output the frequency domain feature data; The motor imagery EEG signal classification module is used to send the original EEG data to the motor imagery EEG signal classification module for processing and output the motor imagery EEG signal classification results.
Citation Information
Patent Citations
Electroencephalogram visual classification method based on time-frequency domain fusion Transform
CN114298216A
Epilepsy type detection method combining eye movement and electroencephalogram
CN116019461A