Motor imagery electroencephalogram signal classification method and system

By preprocessing the original EEG data and using the multi-head attention layer and convolutional layer for feature extraction, the problem of low data quality and feature extraction efficiency in the prior art is solved, and more accurate classification and recognition of electroencephalogram signals is achieved.

CN119538019AActive Publication Date: 2025-02-28XIAMEN UNIV
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411174988.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2025-02-28
Estimated Expiration
2044-08-26

AI Technical Summary

Technical Problem

The prior art has problems with low data quality and feature extraction efficiency in the classification and identification of motor imagination EEG signals, and it is difficult to effectively understand the characteristics and meaning of EEG signals.

Method used

By obtaining the original EEG data for preprocessing, the data quality is improved; the data is input into the multi-headed attention layer and the convolutional layer for processing, the multi-headed attention layer is used to pay attention to the correlation between different time points or brain regions, and the convolutional layer understands the meaning and characteristics of EEG data.

Benefits of technology

The data quality and feature extraction efficiency of the classification model of the motor imagination EEG signal are improved, the model's understanding of EEG signals is enhanced, and the accuracy of classification recognition is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119538019A_ABST
    Figure CN119538019A_ABST
Patent Text Reader

Abstract

The invention relates to the field of electroencephalogram signal classification and recognition research, in particular to a motor imagery electroencephalogram signal classification method and system. A motor imagery electroencephalogram signal classification system comprises an electroencephalogram data acquisition module, a frequency domain characteristic data acquisition module and a motor imagery electroencephalogram signal classification module. According to the method, the original electroencephalogram data are obtained and preprocessed, so that the quality and availability of the original electroencephalogram data are improved, and subsequent analysis and interpretation are facilitated; electroencephalogram data are input into a multi-head attention layer and a convolutional layer for processing, and the multi-head attention layer can help a motor imagery electroencephalogram signal classification model to pay attention to correlation between different time points or different brain regions, so that the characteristics of electroencephalogram signals are better understood; the convolutional layer can help the motor imagery electroencephalogram signal classification model to better understand the meaning and characteristics of electroencephalogram data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the research field of electroencephalogram (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 refer to detecting the activity of imagining a specific movement without actually performing the movement by recording the subject's brain activity, especially electroencephalogram (EEG) signals. Motor imagery EEG signal classification is one of the important research contents in the field of brain-computer interface. By converting the subject's motor imagination into control signals, direct interaction between people and computers or external devices can be achieved, thus expanding the application scope and potential of brain-computer interface technology.

[0003] In the field of rehabilitation medicine, motor imagery EEG signal classification can be used to help rehabilitation patients with rehabilitation training. For example, for patients with motor impairment or motor dysfunction, brain-computer interface technology can be used to promote the regeneration and functional recovery of damaged neurons through motor imagery. At the same time, motor imagery EEG signal classification has application value in the fields of auxiliary equipment 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 availability of the raw EEG data for 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, so as to better understand 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 original EEG data.

[0007] Step S2: obtain the power spectral density of the original EEG data by calculation, extract the frequency domain features in the original EEG data according to the obtained power spectral density, obtain frequency domain feature data, input the original EEG data and the frequency domain feature data into the motor imagery EEG signal classification model, and output the motor imagery EEG signal classification result.

[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 original EEG data to construct the first-level EEG data, which specifically includes the following steps:

[0009] The raw EEG data are input into the preprocessing layer, and the primary EEG data are 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 original EEG data to construct secondary EEG data, specifically including the following steps;

[0011] The first-level EEG data is input into the first-layer normalization unit, and the first-layer normalization unit performs layer normalization processing on the first-level EEG data and outputs feedforward network normalized data;

[0012] The normalized data is input into a first linear unit, the first linear unit performs a linear transformation on the normalized data, and outputs first linear transformation data;

[0013] The linear transformation data is input into a first Swish activation function unit, and 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, and the first Dropout unit randomly sets part of the activation function data to zero with a certain probability, and outputs the first Dropout operation data;

[0015] The Dropout operation data is input into a second linear unit, and 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 primary EEG data and the second Dropout operation data to obtain the secondary 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 a layer normalization operation on the three-level EEG data and outputs convolution normalized data;

[0022] Inputting the convolution normalized data into a 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, and the Glu activation function unit calculates the first point convolution data:

[0024] Output Glu activation function data;

[0025] Inputting the Glu activation function data into a one-dimensional depth-separable convolution unit, 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;

[0026] The one-dimensional depth data is input into a 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 into 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 third-level EEG data to the third Dropout operation data to obtain the fourth-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] The classification algorithm of the motor imagery EEG signal classification model selects LightGBM as the classification algorithm, 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, 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 acquire 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 the 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 availability of the raw EEG data for 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, 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 connection can improve the generalization ability of the motor imagery EEG signal classification model, so that it can 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 the experimental collection. The software presenting the experimental paradigm is Psychopy software. Connect the collection program and the Psychopy presented by the experimental paradigm through pylsl, so that real-time sending and receiving of data can be achieved 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 original EEG data with labels added.

[0050] Step S2: The power spectrum density of the original EEG data is obtained by calculation. The principle of power spectrum density function: the power spectrum density S(f) is a function mapping with f as the independent variable, reflecting how much power the signal has on the frequency component f. Assuming a random signal process x(t), and defining a truncation value t0, the truncation process of the random process x is 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 find that in the stationary process, there may be a problem that power is limited but energy is infinite. Because energy is the integral of power, and the stationary signal will last for an infinite time, this is why the power spectrum density function is used instead of the energy spectrum density function. According to Parseval's theorem, that is, energy is equal from the perspective of time domain and frequency domain, we can get:

[0057]

[0058] here Is The form obtained by Fourier transform, and the time of the random process is limited to a finite time [-t0, t0], 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] By taking the limit when t0 tends to 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, and the motor imagery EEG signal classification result is output.

[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 original EEG data to construct the first-level EEG data, which specifically includes the following steps:

[0066] The original EEG data is input into the preprocessing layer, and then goes through filtering, time segmentation, re-referencing, downsampling and artifact removal operations. Filtering is to retain the frequency bands with a relatively high correlation with motor imagery; time segmentation is to delete the time periods that are not related 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 the correlation 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 original EEG data to construct secondary EEG data, specifically including the following steps;

[0068] The first-level EEG data is input into the first-layer normalization unit, and the first-layer normalization unit performs layer normalization processing on the first-level EEG data and outputs feedforward network normalized data;

[0069] The normalized data is input 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, and the first Swish activation function unit calculates the linear transformation data according to the following formula:

[0071] f(x)=x·sigmoid(βx)

[0072] Wherein x represents linear transformation data, and the first Swish activation function unit outputs the calculated result to obtain the first Swish activation function data;

[0073] The Swish activation function data is input to the first Dropout unit, and the first Dropout unit randomly sets part of the activation function data to zero with a certain probability, and outputs the first Dropout operation data;

[0074] The Dropout operation data is input into a second linear unit, and 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 primary EEG data and the second Dropout operation data to obtain the secondary EEG data.

[0077] The secondary EEG data and the frequency domain feature data are fused to obtain fused feature data, which is input into the multi-head attention layer to output the tertiary EEG data. Specifically, the 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] MultiHead(X)=MultiHead(Q, K, V)=Concat(head1...head h )W O

[0080]

[0081] Assuming the input matrix is ​​an n×d dimensional matrix, then and are all d×d-dimensional query matrices, key matrices, and value matrices, W O is the weight parameter matrix of the linear projection (the weight parameter matrix starts with random initialization and is then updated through the back-propagation algorithm and training data. During training, the model adjusts these weight matrices according to the gradient of the loss function to maximize convergence), head i Denotes the corresponding i-th attention head. Each attention head is calculated by the corresponding Q, K, V:

[0082]

[0083] Unlike 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 W through a linear transformation. O The matrix obtains the final output matrix of 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 a 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. A small calculation is performed 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 as follows: first, the input vector X passes through two independent convolution layers to obtain the corresponding vectors A and B. Assume that A = X·W+b, B = X·W+c. Then vector B passes through the sigmoid activation function, and when the B vector becomes a value between 0 and 1, it can control whether the information passes. Finally, the values ​​obtained by the sigmoid function of vectors 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] GLU(X)=A⊙σ(B)=(X·W+b)⊙σ(X·W+c)

[0089] Output Glu activation function data;

[0090] The Glu activation function data is input into the one-dimensional depth-separable convolution unit. The depth convolution is different from the conventional convolution operation. One convolution kernel is responsible for only one channel, and one channel is convolved by only one convolution and then all channels are combined with point convolution as output features. 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. After batch normalization calculates the mean and variance and then standardizes the output, the input value of any neural unit in each layer of the neural network is converted 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, and the second Swish activation function unit calculates the batch normalized data according to the following formula:

[0093] f(x)=x·sigmoid(βx)

[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 third-level EEG data to the third Dropout operation data to obtain the fourth-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] The classification algorithm of the motor imagery EEG signal classification model selects LightGBM as the classification algorithm, 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, 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 As shown, including:

[0106] The EEG data acquisition module is used to acquire 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 the 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 motor imagery EEG signal classification method as described above.

[0113] Exemplarily, the computer program described in Embodiment 3 and Embodiment 4 of the present invention may be divided into one or more modules, and the one or more modules are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to 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 uses 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 realizes 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.), 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.), 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 devices.

[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 such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. 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, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), 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 schematic, 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 on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying 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 may understand and implement it without paying any creative effort.

[0118] The above are only preferred implementations 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: Collecting 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, obtaining the 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 original EEG data to construct the first-level EEG data, which specifically includes the following steps: The raw EEG data are input into the preprocessing layer, and the primary EEG data are obtained through filtering, time segmentation, re-referencing, downsampling and artifact removal operations.

2. A motor imagery EEG signal classification method according to claim 1, characterized in that: 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 original EEG data to construct secondary EEG data, specifically including the following steps; The first-level EEG data is input into the first-layer normalization unit, and the first-layer normalization unit performs layer normalization processing on the first-level EEG data and outputs feedforward network normalized data; The normalized data is input into a first linear unit, the first linear unit performs a linear transformation on the normalized data, and outputs first linear transformation data; The linear transformation data is input into a first Swish activation function unit, and 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, and the first Dropout unit randomly sets part of the activation function data to zero with a certain probability, and outputs the first Dropout operation data; The Dropout operation data is input into a second linear unit, and 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 primary EEG data and the second Dropout operation data to obtain the secondary EEG data.

3. A motor imagery EEG signal classification method according to claim 2, characterized in that: The secondary EEG data and the frequency domain feature data are fused to obtain fused feature data, which is input into the multi-head attention layer to output the tertiary EEG data. Specifically, the steps include: 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, characterized in that: 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: The three-level EEG data is input into the second-layer normalization unit, and the second-layer normalization unit performs a layer normalization operation on the three-level EEG data and outputs convolution normalized data; Inputting the convolution normalized data into a 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, and the Glu activation function unit calculates the first point convolution data: Output Glu activation function data; Inputting the Glu activation function data into a one-dimensional depth-separable convolution unit, 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; The one-dimensional depth data is input into a 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 into 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 third-level EEG data to the third Dropout operation data to obtain the fourth-level EEG data.

5. A motor imagery EEG signal classification method according to claim 4, characterized in that: 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.

6. A motor imagery EEG signal classification method according to claim 5, characterized in that: The fully connected layer is used to integrate the five-level EEG data to construct the final EEG data; The classification algorithm of the motor imagery EEG signal classification model selects LightGBM as the classification algorithm, which is improved from the gradient boosting decision tree; The final EEG data is input into the classifier, and the classifier outputs the classification result of the motor imagery EEG signal.

7. The method for classifying motor imagery EEG signals according to claim 6, characterized in that: 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, 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.

8. A motor imagery EEG signal classification system, characterized in that: The system uses a motor imagery EEG signal classification method as described in any one of claims 1 to 7 above, including: An EEG data acquisition module, used to acquire raw EEG data; A 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; 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

  • Multi-dimensional motor imagery electroencephalogram signal classification method based on multi-head attention

    CN116269442A

  • Classification method for motor imagery electroencephalogram signals

    CN117860271A

  • Motor imagery electroencephalogram signal classification method based on multi-scale convolution and self-attention

    CN118349906A