Emotion recognition method based on electroencephalogram feature fusion and double-stage attention mechanism
By employing EEG feature fusion and a two-stage attention mechanism, this method addresses the issues of single feature dimensions and insufficient modal interaction in EEG emotion recognition. It achieves efficient fusion of multimodal information and adaptation to individual differences, thereby improving the accuracy and robustness of emotion recognition. This approach is applicable to human-computer interaction and mental health monitoring.
Patent Information
- Application Number
- CN202511520144.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-05-01
AI Technical Summary
Existing methods for EEG emotion recognition suffer from limited feature dimensions and insufficient modal interaction, making it difficult to achieve unified integration of frequency-time-space features, and they also exhibit poor adaptability to individual differences.
An emotion recognition method based on EEG feature fusion and a two-stage attention mechanism is adopted, including preprocessing, two-stage attention feature fusion, two-branch three-dimensional convolution feature extraction and classification output. The feature correlation is enhanced by bidirectional and unidirectional attention mechanisms, and cross-entropy loss function and regularized training are combined.
It improves the accuracy and robustness of emotion recognition, achieves efficient fusion of multimodal information and adaptation to individual differences, and is suitable for human-computer interaction and mental health monitoring.
Smart Images

Figure CN121943308A_ABST
Abstract
Description
An Emotion Recognition Method Based on EEG Feature Fusion and Two-Stage Attention Mechanism Technical Field
[0001] This invention belongs to the field of emotion recognition technology, specifically relating to an emotion recognition method based on EEG feature fusion and a two-stage attention mechanism. It is particularly suitable for processing EEG signals with high temporal resolution and individual variability, achieving efficient and accurate emotional state classification. Background Technology
[0002] Emotion, as a complex manifestation of physiological and psychological responses, plays a crucial role in regulating individual behavior and decision-making. The identification and analysis of emotional states has gradually developed into an important interdisciplinary research direction involving neuroscience, cognitive science, psychology, and computer science, demonstrating broad potential in applications such as healthcare, intelligent education, and digital entertainment. Electroencephalography (EEG), due to its millisecond-level temporal resolution and non-invasive acquisition characteristics, has become a key tool in emotional state research and related clinical diagnosis. For example, in psychological state assessment, EEG signals provide objective and stable physiological indicators, assisting physicians in accurately judging patients' emotional states, thereby developing more personalized and adaptive treatment strategies. In EEG emotion recognition research, effectively selecting and extracting discriminative emotional features remains a core technical challenge. Existing methods mostly focus on single-modal features, such as differential entropy (DE) and power spectral density (PSD). However, these features are usually extracted on an independent channel basis, neglecting the spatial correlation and functional interaction between multi-channel EEG signals, which is crucial for revealing the brain network mechanisms of emotional responses. Although recent studies have attempted to fuse multiple EEG features and leverage deep learning models to improve recognition performance, most methods still face two key limitations: First, feature construction is often limited to a single dimension such as the frequency or time domain, failing to achieve a unified integrated representation of frequency-time-space features; second, in the feature fusion stage, existing methods mostly employ direct concatenation or linear weighting strategies, making it difficult to fully capture the complementary relationships and deep interactions between different feature modalities. Therefore, developing a more expressive and flexible multimodal feature fusion framework, combined with an efficient and scalable model architecture, has become an urgent need in this field. Summary of the Invention
[0003] The purpose of this invention is to provide an emotion recognition method and system based on EEG feature fusion and a two-stage attention mechanism, so as to solve the problems of single emotion feature dimension, insufficient modal interaction and poor adaptability to individual differences in the prior art.
[0004] This invention is achieved through the following technical solution:
[0005] An emotion recognition method based on EEG feature fusion and a two-stage attention mechanism includes the following steps:
[0006] Step 1, EEG signal processing: Preprocessing of EEG signals, including removing non-EEG channels, filtering and suppressing noise, correcting artifacts, extracting stimulus-related test segments, downsampling, and channel rearrangement.
[0007] Step 2, Two-stage attention feature fusion: Within each selected frequency band, a two-stage attention mechanism is used to fuse EEG features to generate fused features for emotion classification.
[0008] Step 3, Dual-branch feature extraction: Perform dual-branch 3D convolution processing on the fused features to extract multi-scale spatial-spectral-temporal features, and splice them along the channel dimension to form unified features.
[0009] Step 4, Classification and Output: Input the unified features into the classifier, and generate the sentiment category prediction results through flattening and fully connected layers.
[0010] Furthermore, step 1 specifically involves...
[0011] From the acquired raw EEG signals, EEG channels and non-EEG channels are identified, and non-EEG channels, except for the stimulus-labeled channel, are removed. The EEG signals are then filtered, including notch filtering to eliminate power frequency interference and bandpass filtering to suppress low-frequency drift and high-frequency noise. The processing formula is as follows:
[0012]
[0013] In the formula: x c (t) represents the original signal of the c-th channel; For power frequency notch filters; For bandpass filters; * indicates convolution operation.
[0014] Further, step 2 specifically involves: within each preset frequency band, taking differential entropy (DE), power spectral density (PSD), and differential entropy asymmetry (DEASM) features as inputs. First, the first-stage bidirectional attention fusion is performed, where DE and PSD are bidirectionally correlated and added to obtain intermediate fused features. The calculation formula is as follows:
[0015]
[0016] In the formula: D k P is the DE characteristic matrix of the k-th frequency band; k Let be the PSD feature matrix of the k-th frequency band; d is the feature dimension; softmax(·) is the normalization function; F kThese are the intermediate fusion features obtained in the first stage.
[0017] Then, the second phase of unidirectional attention enhancement is performed, with F... k Using DEASM as the key, the final frequency band-level fusion features are obtained by retrieving information:
[0018]
[0019] In the formula: A k G is the DEASM characteristic matrix of the k-th frequency band; k This refers to the fusion features output in the second stage.
[0020] G in each frequency band k Stacking along the frequency band dimension forms a global fusion tensor for subsequent feature extraction:
[0021] Z = [G1, G2, ..., G] K ]
[0022] In the formula: K represents the number of frequency bands. Preferably, to improve the numerical consistency between different samples and channels, the fusion tensor is Min-Max normalized to obtain standardized fusion features:
[0023]
[0024] Where: min c,5 With max c,t These represent the sample-by-sample minimum and maximum value operations for the channel and time dimensions, respectively; As input for the next step.
[0025] Furthermore, step 3 specifically involves: organizing the fused features into a three-dimensional tensor, denoted as X.
[0026] Performing the first parallel branch of 3D convolution, normalization, nonlinear activation, and pooling yields U. A The calculation is as follows:
[0027] U A =Pool(σ(BN(X*W)) A )))
[0028] In the formula: W A σ is the first branch of the 3D convolution kernel; BN(·) is the 3D batch normalization; σ(·) is the non-linear activation function; Pool(·) is the 3D pooling; * represents the 3D convolution operation.
[0029] Performing the second parallel branch of 3D convolution, normalization, nonlinear activation, and pooling yields U. B The calculation is as follows:
[0030] U B =Pool(σ(BN(X*W)) B )))
[0031] In the formula: W B This is the 3D convolution kernel for the second branch; the other symbols are the same as before.
[0032] For U B Perform trilinear interpolation and adjust to be consistent with U A With the same spatial-bandwidth-time dimensions, we obtain
[0033]
[0034] In the formula: Represents the trilinear interpolation operator; size(U) A ) indicates the target size.
[0035] In the channel dimension, U A and By splicing the components, we obtain the fused representation U:
[0036]
[0037] In the formula: Concat(·) represents the splicing operation in the channel dimension.
[0038] Perform 3D convolution, normalization, nonlinear activation, and pooling on U to obtain the output feature V:
[0039] V = Pool(σ(BN(U*W)) R )))
[0040] In the formula: W R A 3D convolution kernel is used for refinement; V represents the output feature of this step.
[0041] Furthermore, step 4 specifically involves...
[0042] The classification module includes a global average pooling layer, a flattening layer, and a fully connected layer, and its output is a probability vector for the emotion category. The calculation formula is as follows:
[0043]
[0044] In the formula: V represents the unified feature; Mean τ (·) denotes the averaging operation along the time dimension or segment dimension; Flatten(·) denotes flattening; W and b are the weights and biases of the fully connected layer, respectively; The predicted probability is for class M.
[0045] Furthermore, the predicted category Obtained through maximum value index operation:
[0046]
[0047] In the formula: This is the category index corresponding to the prediction result.
[0048] Furthermore, the training process employs a cross-entropy loss function, the loss function of which is:
[0049]
[0050] In the formula: B is the batch size; M is the number of categories; y i,c Let be the true indicator of the i-th sample in class c; This corresponds to the predicted probability.
[0051] Furthermore, the loss function can be modified by introducing a regularization term, resulting in:
[0052]
[0053] In the formula: λ is the regularization coefficient; Θ is the set of model parameters.
[0054] Furthermore, the parameters are iteratively updated using the Adam optimizer, and the learning rate employs a piecewise decay strategy, with the update formula being:
[0055] η e =η0·γ [e / s]
[0056] In the formula: η0 is the initial learning rate; γ is the decay factor; s is the decay step size; e is the current training round.
[0057] Preferably, the training parameters are set as follows: learning rate η0 = 2 × 10 -4 The regularization coefficient λ = 1 × 10 -4 The batch size is B = 32, the maximum number of training epochs is E = 50, the learning rate decay factor is γ = 0.2, and the decay step size is s = 10. Preferably, K = 10-fold cross-validation is used to evaluate performance, and the optimal parameters are saved when the accuracy on the validation set improves.
[0058] Compared with the prior art, the beneficial effects of the present invention are:
[0059] 1. This invention integrates spatial, spectral, and temporal multimodal information of EEG signals and extracts multi-scale features through a two-stage attention mechanism and a two-branch three-dimensional convolutional structure. This overcomes the problems of single feature dimension and insufficient modal interaction in traditional methods and improves the discriminativeness and robustness of feature representation.
[0060] 2. In the classification stage, this invention adopts global average pooling, flattening and fully connected structure, and combines cross-entropy loss function and regularized training, which significantly improves the accuracy and generalization ability of emotion recognition, and provides more reliable and efficient technical support for applications such as human-computer interaction, mental health monitoring and intelligent education. Attached Figure Description
[0061] Figure 1 is a flowchart of the method of the present invention;
[0062] Figure 2 is a schematic diagram of the two-stage attention mechanism structure of the present invention;
[0063] Figure 3 is a schematic diagram of the feature fusion dual-branch three-dimensional convolution feature extraction structure of the present invention. Detailed Implementation
[0064] To make the objectives, technical solutions, and beneficial effects of this invention clearer, the invention will be further described below with reference to the accompanying drawings and specific embodiments. However, it should be understood that the following embodiments are only for explaining the invention and do not constitute a limitation thereof.
[0065] This invention provides an emotion recognition method based on EEG feature fusion and a two-stage attention mechanism. By preprocessing, fusing features, and extracting multi-scale features from the raw EEG signals, a deep-level modeling of the effective information in the EEG signals can be achieved, thereby improving the accuracy and robustness of emotion recognition. The method flow is shown in Figure 1, and mainly includes the following steps:
[0066] Step 1: Processing EEG signals:
[0067] From the acquired raw EEG signals, the first step is to identify and remove EEG channels from non-EEG channels, especially removing channels that do not contain valid EEG information, such as all non-EEG channels except for the stimulus labeling channel. For noise removal, a series of filtering techniques are employed, including:
[0068] Notch filtering: To effectively suppress power frequency interference, a notch filter is used to suppress specific power frequency signals. This filter can remove 50Hz (or 60Hz) power interference signals, which can affect the quality of EEG signals.
[0069] Bandpass filtering: The signal is further subjected to bandpass filtering, which aims to remove low-frequency drift and high-frequency noise through a combination of low-pass and high-pass filters. The frequency range of the bandpass filter is usually set between low frequencies (e.g., 1Hz) and high frequencies (e.g., 50Hz) to preserve the effective information in the EEG signal.
[0070] Rereference operation: By performing a rereference operation on the EEG signal, the consistency of signals between different channels is improved. The Common Average Reference (CAR) method is often used to ensure the consistency of signals in different electrode channels, thereby improving data quality.
[0071] The processing formula is shown below:
[0072]
[0073] Step 2: Two-stage attention feature fusion:
[0074] In a further step 2, we will process the feature fusion and enhancement of the EEG signals. Specifically, within each preset frequency band, we extract three key features: differential entropy (DE), power spectral density (PSD), and differential entropy asymmetry (DEASM), and use these features as inputs to participate in subsequent feature fusion and enhancement processing.
[0075] Phase 1: Bidirectional Attention Fusion
[0076] In the first stage, we fuse DE and PSD features using a bidirectional attention mechanism to enhance their relevance in emotion recognition. First, the DE and PSD features are weighted and fused separately using the bidirectional attention mechanism to obtain an intermediate fused feature. The calculation formula for this process is as follows:
[0077]
[0078] Where: DE k The characteristic matrix representing the differential entropy of the k-th frequency band; PSD k This represents the power spectral density feature matrix of the k-th frequency band; d is the dimension of the feature; the normalization function (Normalize()) standardizes the feature. These are the intermediate fusion features obtained in the first stage.
[0079] The core objective of this stage is to extract the potential correlation between DE and PSD through a bidirectional attention mechanism, thereby obtaining fusion features with stronger discriminative power for emotion recognition.
[0080] Phase Two: Enhancement of Unidirectional Attention
[0081] In the second stage, we further apply a unidirectional attention mechanism to enhance the expressive power of the features. By using DEASM features as query information and the intermediate fused features obtained in the first stage as key information, the final band-level fused features are obtained after weighted processing by the unidirectional attention mechanism. The calculation formula for this process is as follows:
[0082]
[0083] DEASM k The differential entropy asymmetry characteristic matrix represents the k-th frequency band; This represents the intermediate fusion characteristics of the first stage; This is the final band-level fusion feature output in the second stage.
[0084] Stacking and standardization of fusion features
[0085] Subsequently, we stack the final fused features from all frequency bands along the frequency band dimension to form a unified fusion tensor, which contains multimodal information from different frequency bands. The formula for this process is as follows:
[0086]
[0087] Where K represents the total number of frequency bands. To further improve the numerical consistency between different samples and channels, we perform Min-Max normalization on the fusion tensor. This normalization ensures that the feature values of each sample and channel are within a uniform scale range, avoiding learning instability caused by excessive numerical differences. The formula for this step is:
[0088]
[0089] This indicates an unnormalized feature; and These represent the sample-by-sample minimum and maximum values in the channel and time dimensions, respectively; These are the normalized fused features. Through this normalization step, we can provide more consistent and standardized input for subsequent feature extraction, ensuring that the model can be trained and predicted stably and efficiently.
[0090] Step 3, Dual-branch feature extraction:
[0091] 1. Feature processing and 3D convolution processing
[0092] After converting the fused features into a 3D tensor, we input it into a 3D convolutional network with two parallel branches to extract spatial, spectral, and temporal information.
[0093] First parallel branch:
[0094] In the first parallel branch, we first apply 3D convolution to process the fused features, using a convolution kernel W1 to extract multi-scale spatial-spectral-temporal features. Then, we perform batch normalization on the convolution results to eliminate bias between different samples. Next, we introduce nonlinearity using a nonlinear activation function (such as ReLU) to enhance the model's expressive power. Finally, we apply 3D pooling to reduce the dimensionality of the features, decreasing computation while preserving important spatial-spectral-temporal features.
[0095] The calculation formula for this process is:
[0096] F I =Pool(Activation(BatchNorm(Conv3D(X fusion ,W1))))
[0097] Where: Conv3D represents a three-dimensional convolution operation;
[0098] W1 is the 3D convolution kernel of the first branch; BatchNorm is the 3D batch normalization; Activation is the non-linear activation function (such as ReLU); Pool is the 3D pooling operation; F1 is the feature output of the first branch.
[0099] Second parallel branch:
[0100] In the second parallel branch, the process is similar to the first branch, except that a different convolutional kernel W2 is used to perform the same 3D convolution, normalization, non-linear activation, and pooling processing on the fused features. The specific calculation formula is as follows:
[0101] F2=Pool(Activation(BatchNorm(Conv3D(X fusion ,W2))))
[0102] Where: W2 is the 3D convolution kernel of the second branch; other symbols are the same as those of the first branch.
[0103] 2. Trilinear interpolation adjustment size
[0104] After feature extraction from both branches is complete, we need to unify the feature sizes to facilitate subsequent fusion operations. Specifically, we use trilinear interpolation to adjust the output features of the first and second branches to the same spatial-frequency-temporal dimensions. This ensures the spatial and temporal consistency of the features from the two branches.
[0105] The formula for trilinear interpolation is:
[0106] F interp =TrilinearInterp(F1,F2,TargetSize)
[0107] F1 and F2 are the features of the first and second branches, respectively; TargetSize is the target size, ensuring that the output features of the two branches have the same spatial, bandwidth, and temporal dimensions; F interp This represents the output feature after interpolation.
[0108] 3. Feature splicing and fusion
[0109] After resizing, the next step is to concatenate the features from the two branches along the channel dimension. By concatenating along the channel dimension, we fuse the features extracted from the two branches together, forming a richer feature representation, which provides comprehensive information for subsequent model processing.
[0110] The formula for the splicing operation is:
[0111] F concat =[F1|F2]
[0112] Wherein: F concat This indicates splicing along the channel dimension. [··] represents the fused feature after splicing.
[0113] By concatenating the features, we combine the multi-scale features from two parallel branches into a more comprehensive feature representation, providing more discriminative features for emotion recognition tasks.
[0114] 4. Final Feature Extraction
[0115] F after splicing concat The input will then be fed into a further 3D convolutional layer for refined feature extraction. This process refines the features using a 3D convolutional kernel (W3) to improve the model's emotion recognition capabilities. The calculation formula for this process is as follows:
[0116] F final =Pool(Activation(BatchNorm(Conv3D(F conca t, W3))))
[0117] Where: W3 is the 3D convolution kernel used for thinning; F ftnal This is the final output feature.
[0118] Step 4, Classification and Output: In step 4, we designed a classification module, which includes a global average pooling layer, a flattening layer and a fully connected layer, to convert the extracted features into a predicted probability vector of the emotion category.
[0119] 1. Classification Module
[0120] First, the fused features are processed through a global average pooling layer, calculating the average value of the features along the time or segment dimension to generate a global feature representation. Global average pooling effectively reduces dimensionality and performs global processing on the features. Then, the pooled features are flattened into a one-dimensional vector by a flattening layer before being input into a fully connected layer. The fully connected layer performs a linear transformation on the flattened features to generate the corresponding sentiment category prediction probability. The specific calculation formula is as follows:
[0121] P = Softmax(W·F) uniform +b)
[0122] Wherein: F uniform denoted as a unified feature; W and b are the weights and biases of the fully connected layer, respectively; P is the predicted probability of the sentiment category, representing the probability distribution of each category.
[0123] 2. Category Prediction
[0124] The final sentiment category prediction result is obtained by performing a maximum index operation on the predicted probability vector. The specific calculation formula is as follows:
[0125]
[0126] in: This is the index of the predicted category, i.e., the sentiment category predicted by the model.
[0127] 3. Loss Function and Optimization
[0128] To train the model, we use the cross-entropy loss function, which measures the difference between the predicted probability and the true label. The formula for calculating the cross-entropy loss function is:
[0129]
[0130] Where: N is the batch size; M is the number of emotion categories; y i,c p represents the true indicator (label) of the i-th sample in class c; i,c The predicted probability of the i-th sample in class c is given by the model.
[0131] The specific implementation of the present invention will be described in detail below with reference to specific embodiments.
[0132] Example 1: Validation of the effectiveness of an emotion recognition method based on EEG feature fusion and a two-stage attention mechanism;
[0133] The method proposed in this invention can extract emotion features at multiple scales, thereby improving the accuracy of emotion recognition. On the publicly available EEG datasets DEAP, SEED, and SEED-IV, the model of this invention achieved emotion recognition accuracies of 99.19%, 99.71%, and 99.41%, respectively (see Table 1).
[0134] Table 1. Comparison of the emotion recognition accuracy of the proposed model with the current state-of-the-art model on public datasets.
[0135] DEAPSEED-IV: Accuracy of this invention's model: 99.19%, 99.71%, 99.41%; Current highest level: 98.50%, 97.59%, 88.63% surface
[0136] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements should also be considered within the scope of protection of the present invention. The above modifications and improvements will not affect the implementation effect of the present invention or the practicality of the patent.
Claims
1. An emotion recognition method based on EEG feature fusion and a two-stage attention mechanism, characterized in that, Includes the following steps: A: EEG signal processing involves preprocessing EEG signals, including removing non-EEG channels, filtering and suppressing noise, correcting artifacts, extracting stimulus-related test segments, downsampling, and channel rearrangement. B: Two-stage attention feature fusion: Within each selected frequency band, a two-stage attention mechanism is used to fuse EEG features to generate fused features for emotion classification. C: Dual-branch feature extraction, performing dual-branch 3D convolution processing on the fused features to extract multi-scale spatial-spectral-temporal features, and splicing them along the channel dimension to form unified features; D: Classification and Output. The unified features are input into the classifier, and the emotion category prediction results are generated through flattening and fully connected layers.
2. The method according to claim 1, wherein, The EEG signal filtering process in step A includes eliminating power frequency interference through notch filtering and suppressing low-frequency drift and high-frequency noise through bandpass filtering.
3. The method according to claim 1, wherein, The two-stage attention mechanism in step B includes: the first stage is bidirectional attention fusion, which uses differential entropy (DE) and power spectral density (PSD) for bidirectional correlation; the second stage is unidirectional attention enhancement, which uses differential entropy asymmetry (DEASM) features for weighted processing.
4. The method according to claim 1, wherein, The bi-branch 3D convolution processing in step C includes: performing 3D convolution, batch normalization, non-linear activation and pooling on the fused features, further adjusting the size through trilinear interpolation, and splicing the features of the two branches along the channel dimension.
5. The method according to claim 1, wherein, The classifier in step D includes a global average pooling layer, a flattening layer, and a fully connected layer, and its output is a predicted probability vector of the sentiment category.
6. The method according to claim 1, wherein, The classification result is obtained through maximum index operation, representing the predicted sentiment category.
7. The method according to claim 1, wherein, During training, the cross-entropy loss function is used, and the Adam optimizer is used for parameter updates. The learning rate adopts a segmented decay strategy. An emotion recognition method based on EEG feature fusion and a two-stage attention mechanism is characterized by comprising: an EEG signal processing module for preprocessing EEG signals, including removing non-EEG channels, filtering and suppressing noise, correcting artifacts, extracting stimulus-related test segments, downsampling, and channel rearrangement; a two-stage attention fusion module for fusing EEG features using a two-stage attention mechanism within each selected frequency band to generate fused features for emotion classification; a two-branch feature extraction module for performing two-branch 3D convolution processing on the fused features to extract multi-scale spatial-spectral-temporal features and splicing them along the channel dimension to form unified features; and a classification module for inputting the unified features into a classifier and generating emotion category prediction results through flattening and fully connected layers.
8. The method according to claim 1, wherein, The two-stage attention fusion module includes a bidirectional attention mechanism and a unidirectional attention mechanism, which are used to perform bidirectional correlation fusion of DE and PSD and weighted enhancement of DEASM features, respectively.
Citation Information
Cited By
Prosthetic control method based on motion intent recognition
CN122251164A
A Prosthetic Control Method Based on Motion Intent Recognition
CN122251164B
