Brain electrical emotion recognition method, system and equipment based on mutual information attention of adjacent channels and medium
By calculating adjacent channel mutual information as attention weight, the noise problem caused by electrode position deviation in EEG emotion recognition is solved, the recognition accuracy is improved, and the information robustness is enhanced.
Patent Information
- Application Number
- CN202410619764.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-05-20
AI Technical Summary
In EEG emotion recognition, the accuracy is reduced due to the influence of noise information caused by electrode position deviation.
By calculating adjacent channel mutual information and using it as attention weight, the influence of noise information is weakened and the accuracy of emotion recognition is improved. Specific steps include obtaining EEG data for preprocessing and channel matrix mapping, calculating the average mutual information between each channel and adjacent channels as the attention weight, and introducing it into the capsule grid for identification.
It improves the accuracy of EEG emotion recognition, enhances the robustness of channel information, and reduces the noise impact caused by electrode position deviation.
Smart Images

Figure CN118568559A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data processing technology, and specifically relates to an electroencephalogram emotion recognition method, system, device and medium based on adjacent channel mutual information attention. Background Art
[0002] Emotions are generated by the brain. No matter how we disguise ourselves in words, expressions or body movements, we cannot change the signals generated by the brain. Therefore, directly judging a person's emotional state through EEG signals is the most accurate method. EEG emotion recognition refers to the method of using specific equipment to collect EEG signals generated by different people when watching some videos with emotional stimulation, and analyzing and processing them, so as to establish a mapping relationship between EEG signals and emotional states. Due to the unforgeability of EEG signals, the use of EEG signals for emotion recognition is of great significance to the study of human emotions and emotion monitoring. In many cases, being able to obtain the true emotional state of the target will have an important impact on the current decision. For example, when doctors diagnose or prescribe medicine for patients, by obtaining the true emotional state of the patient, they can better assist doctors in diagnosis or adjustment of medication. When using multi-electrode equipment to collect EEG signals, there may be inaccurate electrode placement and different head shapes for each person, which will cause some deviations in the electrode collection position compared with the standard model. Specifically, the information is reflected in that a certain electrode position signal under the standard model may be collected by electrodes at other positions. The information collected in this way, coupled with the powerful fitting ability of the neural network, will cause the network to fit a lot of noise information, or fit to an inaccurate feature space, which will lead to a decrease in the accuracy of EEG emotion recognition. Summary of the invention
[0003] In response to the problems existing in the prior art, the present invention provides an EEG emotion recognition method, system, device and medium based on the mutual information attention of adjacent channels. By calculating the mutual information of adjacent channels and taking the mutual information as the channel attention weight, that is, adding the mutual information attention of adjacent channels, the influence of noise information caused by the deviation of electrode position placement is weakened, thereby improving the accuracy of emotion recognition.
[0004] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0005] The method for EEG emotion recognition based on adjacent channel mutual information attention includes the following steps:
[0006] S1, acquiring EEG data, preprocessing the EEG data, mapping the EEG data into a channel matrix, and obtaining channel position information and channel data vector;
[0007] S2, for each channel data vector, calculate the average mutual information between it and the adjacent channel data vector, and use the average mutual information as the attention weight of the channel data vector;
[0008] S3, sends the EEG data with the introduced attention weight into the capsule grid (Capsnet) to complete EEG emotion recognition.
[0009] The S1 is specifically:
[0010] S1.1, the EEG data preprocessing is specifically to divide the EEG emotion data into baseline data and experimental data, and perform baseline removal operation on the experimental data;
[0011] S1.2, perform window processing on the EEG data, the time length of a window is t seconds, and the sampling rate of the EEG signal is fHz;
[0012] S1.3, the EEG data is mapped to a 9×9 channel mapping matrix in combination with the 10-20 international standard lead system. The format of the mapped data is 9×9×(f×t), where the 9×9 matrix represents the channel position information. Each channel consists of an f×t-dimensional vector, which represents the f×t data collected by the channel in one continuous second.
[0013] The S2 is specifically:
[0014] S2.1, for each channel vector in the 9×9 matrix, denoted as a vector, make an m×m rectangular window centered on the channel, and obtain all channel vectors in the m×m window except the channel vector itself, denoted as a b vector set;
[0015] S2.2, calculate the mutual information between vector a and each vector in the set of vector b, and take the average value of the mutual information;
[0016] S2.3, taking the average mutual information calculated in S2.2 as the weight of vector a;
[0017] c j =c j ×NMIA j (1)
[0018]
[0019] Among them, c j Represents a channel vector a vector in a 9×9 matrix, NMIA j represents the attention weight of the adjacent channel mutual information of vector a; n represents the attention weight of vector c jThe number of all other vectors in the m×m window centered on the channel vector. MI(a,b) means calculating the mutual information between the a vector and the b vector. Window(a) means all vectors in the m×m window centered on the a vector, that is, the b vector set.
[0020] In S3, the first convolution kernel size of the Capsnet is 5×5, the second convolution kernel size is 2×2, and the number of iterations of dynamic routing is 3.
[0021] In the S1.3, only the channels contained in the EEG data need to be mapped. For the channels that are not used when collecting the EEG data and the positions without channel information in the matrix, their values are all 0.
[0022] The value range of m in S2.1 is: 9>m>1, where m is an integer.
[0023] The EEG emotion recognition system based on adjacent channel mutual information attention includes:
[0024] The EEG data mapping module acquires the EEG data, pre-processes the EEG data, and performs channel matrix mapping on the EEG data to obtain channel position information and channel data vectors;
[0025] The attention weight acquisition module calculates the average mutual information between each channel data vector and its adjacent channel data vector, and uses the average mutual information as the attention weight of the channel data vector;
[0026] The emotion recognition module feeds the EEG data with attention weights into the capsule grid to complete EEG emotion recognition.
[0027] EEG emotion recognition device based on adjacent channel mutual information attention, including:
[0028] Memory: a computer program for storing the method for EEG emotion recognition based on adjacent channel mutual information attention;
[0029] Processor: used to implement the EEG emotion recognition method based on adjacent channel mutual information attention when executing the computer program.
[0030] A computer-readable storage medium stores a computer program, which, when executed by a processor, can implement an electroencephalogram emotion recognition method based on adjacent channel mutual information attention.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] By introducing the mutual information attention of adjacent channels and utilizing the potential information associations between channels, this association is mined and deployed into the channel attention mechanism, which weakens the noise information caused by the deviation of electrode placement in the signal acquisition stage, improves the robustness of channel information, and improves the accuracy of EEG emotion recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is a flow chart of a method for EEG emotion recognition based on adjacent channel mutual information attention provided by an embodiment of the present invention.
[0034] Figure 2 It is a schematic diagram of the 10-20 international standard lead system used in the embodiment of the present invention.
[0035] Figure 3 It is a schematic diagram of matrix mapping rules when performing 9×9 matrix mapping in combination with a 10-20 international standard lead system provided by an embodiment of the present invention.
[0036] Figure 4 It is a schematic diagram of channel composition information in an example data group provided by an embodiment of the present invention.
[0037] Figure 5 It is a schematic diagram of a matrix mapping relationship on an example data group provided by an embodiment of the present invention.
[0038] Figure 6 It is a schematic diagram of classification experiment results on an example data set provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0040] The application principle of the present invention is described in detail below in conjunction with the accompanying drawings.
[0041] like Figure 1 As shown, the EEG emotion recognition method based on adjacent channel mutual information attention provided by the embodiment of the present invention includes the following steps:
[0042] S1, acquiring EEG data, preprocessing the EEG data, mapping the EEG data into a channel matrix, and obtaining channel position information and channel data vector;
[0043] S2, for each channel data vector, calculate the average mutual information between it and the adjacent channel data vector, and use the average mutual information as the attention weight of the channel data vector;
[0044] S3, sends the EEG data with the introduced attention weight into the capsule grid (Capsnet) to complete EEG emotion recognition.
[0045] The EEG emotion recognition method based on adjacent channel mutual information attention provided by the embodiment of the present invention comprises the following steps:
[0046] S1.1, the EEG data preprocessing is specifically to remove the baseline signal processing of the EEG data, calculate the signal average value of the baseline signal with a length of one second, and subtract the one-second baseline signal in each second of the experimental signal;
[0047] S1.2, perform window processing on the EEG data, so that it is split from a complete EEG emotion data into several EEG emotion data segments with a length of 1 second, and the corresponding label of the complete EEG data is also assigned to each split data segment. The sampling rate of the EEG signal is 128Hz;
[0048] S1.3, use Figure 3 The 9×9 channel matrix shown maps the EEG data in combination with the 10-20 international standard lead system to a 9×9 channel mapping matrix, giving spatial position information to the sequentially distributed channels in the data set. The mapped data format is 9×9×128, where the 9×9 matrix represents the channel position information, and each channel consists of a 128-dimensional vector, which represents the 128 data collected by the channel in one continuous second.
[0049] The S2 is specifically:
[0050] S2.1, for each channel vector in the 9×9 matrix, denoted as a vector, make a 3×3 rectangular window centered on the channel, and obtain all channel vectors in the 3×3 window except the channel vector itself, denoted as a b vector set;
[0051] S2.2, calculate the mutual information between vector a and each vector in the set of vector b, and take the average value of the mutual information;
[0052] S2.3, taking the average mutual information calculated in S2.2 as the weight of vector a;
[0053] c j =c j ×NMIA j (1)
[0054]
[0055] Among them, c j Represents a channel vector a vector in a 9×9 matrix, NMIA j represents the attention weight of the adjacent channel mutual information of vector a; n represents the attention weight of vector cj The number of all other vectors in the 3×3 window centered on the channel vector. MI(a,b) means calculating the mutual information between the a vector and the b vector. Window(a) means all vectors in the 3×3 window centered on the a vector, that is, the b vector set.
[0056] The mutual information calculation does not take into account the mutual information between the vector itself and itself.
[0057] In S3, the first convolution kernel size of the Capsnet is 5×5, the second convolution kernel size is 2×2, and the number of iterations of dynamic routing is 3.
[0058] In the S1.3, only the channels contained in the EEG data need to be mapped. For the channels that are not used when collecting the EEG data and the positions without channel information in the matrix, their values are all 0.
[0059] Example
[0060] The EEG data uses the official preprocessed DEAP dataset, which contains EEG data of 32 subjects, of which each subject contains 40 EEG data collected while watching a movie. Each movie data contains 63 seconds and 32 channels of EEG information, and the sampling rate of the EEG signal is 128Hz. For each 63-second EEG data, the first three seconds are baseline signals, and the last 60 seconds are experimental signals. For each movie, there are four subjects who give scores, which are Valence, Arousal, Dominance, and Liking, and the score distribution of each item is 1-10. The specific implementation steps on this dataset are as follows:
[0061] 1. Remove the baseline of the initial data: The official preprocessed single video data format is 32×8064, which means 32 channels×8064 data, where 8064 means 63×128, representing 63 seconds×128 samples. The first three seconds of each video are the baseline signal. The baseline signal of the first three seconds is divided into three consecutive one-second baseline signals, and the average value is calculated to obtain a baseline signal with a length of one second. Then, for the 60-second experimental signal, it is divided into 60 consecutive experimental signals with a length of one second, and then the baseline signal is subtracted from each experimental signal to obtain the signal after removing the baseline. After this step, the effective data format of a video is 32×7680.
[0062] 2. Window the data: Window the data obtained in the previous step, that is, split 7680 into 60×128, representing 60 continuous one-second signals, each of which is 128 samples long. At this time, the data format of a movie is 32×60×128. Next, standardize the 32 channel information obtained from one sampling, and transpose the data dimension. The transposed data format is 60×32×128, representing 60 seconds×32 channels×128 samples. At this time, a channel data in a one-second data segment can be regarded as a vector with a length of 128.
[0063] The labels that come with DEAP correspond to an entire movie, so when windowing, the labels need to be copied to each data segment. For a movie, DEAP contains four labels: Valence, Arousal, Dominance, and Liking. After copying the labels, for a 60×32×128 data, the corresponding label is 60×4, which means 60 seconds×4 labels. The distribution of each label is 1-10. Here, the labels need to be further processed, that is, the labels greater than 5 are set to 1, and the labels less than or equal to 5 are set to 0.
[0064] 3. Matrix mapping of channels: The names of the 32 EEG channels in the DEAP dataset are as follows: Figure 4 The 10-20 international standard lead system is shown in Figure 2 Next, the 32 EEG channels of the DEAP dataset are mapped into a 9×9 matrix in combination with the distribution of the 10-20 international standard lead system. The mapping matrix is as follows: Figure 5 After mapping, the data format of a movie is 60×9×9×128, which means 60 seconds×(9×9) matrix×128 samples. The 9×9 matrix records the position of 32 channels in the 10-20 international standard lead system.
[0065] 4. Calculate the mutual information of adjacent channels: Next, calculate the mutual information of adjacent channels, taking the AF3 channel as an example. When calculating the mutual information, the data used is the data within the same second, that is, the 9×9×128 data in the above-mentioned data format. Each 9×9 matrix records the position information of the channel, and 128 records a 128-dimensional vector information of the channel. With the AF3 channel as the center, make a 3×3 window, and the channels contained in the window are Fp1, F3, and Fz. These three channels each have a 128-dimensional vector. Next, calculate the mutual information between the AF3 channel vector and the three channel vectors and take the average value. At this point, the adjacent channel mutual information of the channel is obtained.
[0066] The calculated average mutual information is used as a weight to multiply the 128-dimensional vector of the AF3 channel to complete the implementation of the attention mechanism.
[0067] 5. Use Capsnet for model training and classification: The structure of Capsnet used here is the original structure of the model, but the parameter settings are slightly different, as follows:
[0068] 1) The size of the input image is 9×9×128, representing a 9×9 image with 128 channels.
[0069] 2) The convolution kernel size of the input image to the convolution layer is 5×5.
[0070] 3) The convolution kernel size from the convolution layer to the original capsule layer is 2×2.
[0071] 4) The number of routes set when performing dynamic routing is 3.
[0072] like Figure 6 The figure shows the experimental results of the present invention applied to the DEAP dataset. The dot data represents the accuracy of the model on the training set, and the curve data represents the accuracy of the model on the test set. The experiment was set up for 60 epochs, and after the 20th epoch, the accuracy of the test set remained above 95%. Among the 60 epochs, the highest accuracy of the test set reached 96.2%. The above accuracy on the test set shows that the EEG emotion recognition method based on adjacent channel mutual information attention proposed by the present invention is effective.
[0073] The EEG emotion recognition system based on adjacent channel mutual information attention includes:
[0074] The EEG data mapping module acquires the EEG data, pre-processes the EEG data, and performs channel matrix mapping on the EEG data to obtain channel position information and channel data vectors;
[0075] The attention weight acquisition module calculates the average mutual information between each channel data vector and its adjacent channel data vector, and uses the average mutual information as the attention weight of the channel data vector;
[0076] The emotion recognition module feeds the EEG data with attention weights into the capsule grid to complete EEG emotion recognition.
[0077] EEG emotion recognition device based on adjacent channel mutual information attention, including:
[0078] Memory: a computer program for storing the method for EEG emotion recognition based on adjacent channel mutual information attention;
[0079] Processor: used to implement the EEG emotion recognition method based on adjacent channel mutual information attention when executing the computer program.
[0080] A computer-readable storage medium stores a computer program, which, when executed by a processor, can implement an electroencephalogram emotion recognition method based on adjacent channel mutual information attention.
[0081] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An EEG emotion recognition method based on adjacent channel mutual information attention, characterized in that: The following steps are involved: S1, acquiring EEG data, preprocessing the EEG data, mapping the EEG data into a channel matrix, and obtaining channel position information and channel data vector; S2, for each channel data vector, calculate the average mutual information between it and the adjacent channel data vector, and use the average mutual information as the attention weight of the channel data vector; S3, sends the EEG data with the introduced attention weight into the capsule grid to complete EEG emotion recognition.
2. The method for EEG emotion recognition based on adjacent channel mutual information attention according to claim 1 is characterized in that: The S1 is specifically: S1.1, the EEG data preprocessing is specifically to divide the EEG emotion data into baseline data and experimental data, and perform baseline removal operation on the experimental data; S1.2, perform window processing on the EEG data, the time length of a window is t seconds, and the sampling rate of the EEG signal is fHz; S1.3, the EEG data is mapped to a 9×9 channel mapping matrix in combination with the 10-20 international standard lead system. The format of the mapped data is 9×9×(f×t), where the 9×9 matrix represents the channel position information. Each channel consists of an f×t-dimensional vector, which represents the f×t data collected by the channel in one continuous second.
3. The EEG emotion recognition method based on adjacent channel mutual information attention according to claim 2 is characterized in that: The S2 is specifically: S2.1, for each channel vector in the 9×9 matrix, denoted as a vector, make an m×m rectangular window centered on the channel, and obtain all channel vectors in the m×m window except the channel vector itself, denoted as a b vector set; S2.2, calculate the mutual information between vector a and each vector in the set of vector b, and take the average value of the mutual information; S2.3, taking the average mutual information calculated in S2.2 as the weight of vector a; c j =c j ×NMIA j (1) Among them, c j Represents a channel vector a vector in a 9×9 matrix, NMIA j represents the attention weight of the adjacent channel mutual information of vector a; n represents the attention weight of vector c j The number of all other vectors in the m×m window centered on the channel vector, MI(a,b) means calculating the mutual information between the a vector and the b vector, and window(a) means all other vectors in the m×m window centered on the a vector, that is, the b vector set.
4. The method for EEG emotion recognition based on adjacent channel mutual information attention according to claim 3 is characterized in that: In S3, the first convolution kernel size of the Capsnet is 5×5, the second convolution kernel size is 2×2, and the number of iterations of dynamic routing is 3.
5. The method for EEG emotion recognition based on adjacent channel mutual information attention according to claim 2 is characterized in that: In the S1.3, only the channels contained in the EEG data need to be mapped. For the channels that are not used when collecting the EEG data and the positions without channel information in the matrix, their values are all 0.
6. The method for EEG emotion recognition based on adjacent channel mutual information attention according to claim 3 is characterized in that: The value range of m in S2.1 is: 9>m>1, where m is an integer.
7. The EEG emotion recognition system based on adjacent channel mutual information attention is characterized by: include, The EEG data mapping module acquires the EEG data, pre-processes the EEG data, and performs channel matrix mapping on the EEG data to obtain channel position information and channel data vectors; The attention weight acquisition module calculates the average mutual information between each channel data vector and its adjacent channel data vector, and uses the average mutual information as the attention weight of the channel data vector; The emotion recognition module feeds the EEG data with attention weights into the capsule grid to complete EEG emotion recognition.
8. EEG emotion recognition device based on adjacent channel mutual information attention, characterized in that: include, Memory: a computer program for storing the method for EEG emotion recognition based on adjacent channel mutual information attention; Processor: used to implement the EEG emotion recognition method based on adjacent channel mutual information attention when executing the computer program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it can implement an EEG emotion recognition method based on adjacent channel mutual information attention.
Citation Information
Patent Citations
Interactive method and device, electronic equipment and computer readable storage medium
CN110288992A
Multichannel electroencephalogram signal channel selection method based on time-frequency co-melting
CN112515685A
Brain electrical emotion recognition method combining mutual information channel selection and hybrid neural network
CN112932502A
Epilepsy detection method based on channel optimization and dynamic convolutional neural network
CN116172575A
Emotion recognition method and system fusing electroencephalogram and functional near infrared, and medium
CN117609951A
