Cross-subject electroencephalogram signal emotion recognition method
Through the supervised contrastive predictive coding method, using positive and negative sample generators and autoregressive models, combined with LSTM and loss functions, the problem of individual differences and reduced accuracy in cross-subject emotion recognition is solved, achieving higher recognition accuracy and better accuracy. Good generalization ability.
Patent Information
- Application Number
- CN202410761424.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-09-13
AI Technical Summary
There are individual differences in cross-subject emotion recognition in the existing technology, which leads to a decrease in recognition accuracy. Traditional methods rely on the assumption of independence and identical distribution, which is difficult to adapt to the characteristic changes of new subjects. Transfer learning and domain generalization technology are used in cross-subject emotion recognition. The accuracy in recognition is limited, especially when training requires part of the test set data.
The supervised contrastive prediction coding method is used to construct differential entropy features through positive and negative sample generators, and the autoregressive model and LSTM are used for coding and regression prediction. The encoder and classifier are trained by combining the probabilistic supervised contrastive loss function and the cross-entropy loss function to achieve Cross-subject emotion recognition.
The accuracy and generalization ability of cross-subject emotion recognition are improved. The experimental results are better than other methods on the SEED data set, especially on the SEED IV data set, which is improved by at least 5%, with higher recognition accuracy and smaller standard deviation. Improved adaptability and stability.
Smart Images

Figure CN118633938A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of deep learning technology, and specifically relates to a method for cross-subject EEG signal emotion recognition. Background Art
[0002] Emotion recognition is a key technology for realizing advanced human-computer interaction. It is widely used in psychology, artificial intelligence, medical care, entertainment services and other fields. It helps to improve the humanization level of machines and improve the experience of human-computer interaction. Compared with non-physiological signals such as facial expressions, body postures and voice, electroencephalogram (EEG) directly reflects brain activity, is not easily affected by the individual's subjective consciousness and will, and has a high temporal resolution. Therefore, it can provide objective and real emotional state information. The recognition rate of EEG signals is usually high, and different emotional states can be distinguished more accurately. Therefore, emotion recognition with the help of EEG signals is of great significance to the development of human-computer interaction. With the development of deep learning, more and more deep learning classification and recognition models have been applied to EEG emotion recognition. They use artificially designed features, such as power spectral density (PSD), differential entropy (DE), or encoded image features such as time-frequency graphs, spectrograms and other input forms, combined with various advanced networks and learning frameworks of deep learning, such as convolutional neural networks, graph neural networks, and transformers based on attention mechanisms. These methods have achieved extremely high accuracy in the field of emotion recognition. At the same time, research shows that compared with image features, using artificially designed DE features as input to deep models will achieve a more stable and higher recognition rate. With the continuous advancement of EEG acquisition technology and signal processing technology, many widely recognized research results have been achieved in emotion recognition using EEG signals.
[0003] Traditional emotion recognition models usually require personalized training for each subject, which requires a large number of experiments and data annotation for each subject. In this case, the accuracy of intra-subject emotion recognition has reached more than 97% since 2022. However, in real applications, we often face new subjects whose emotional characteristics and expressions may be different from those of the subjects in the training set. This is because in the same task, different subjects have different skull shapes and different sensitivities to stimuli, which leads to individual differences in physiological activities between subjects. Therefore, compared with subject independence, it is more challenging to establish a recognition method that is common to all subjects and improve the accuracy of cross-subject emotion recognition. When dealing with cross-subject tasks, traditional machine learning algorithms usually rely on the assumption that training data and test data are independent and identically distributed. However, this assumption often leads to a sharp drop in the performance of trained traditional classifiers in cross-subject tasks. In the work of the past two years, cross-subject emotion recognition is mainly solved by deep learning methods, mainly transfer learning, which includes domain adaptation (DA) and domain generalization (DG). DA uses samples from the training set as the source domain and samples from the test set as the target domain. The model minimizes the data distribution difference between the two domains by transferring the knowledge obtained in the source domain to the target domain. Although the accuracy of this technology can be improved by 20% compared with machine learning, this model must measure the difference between the two domains through samples from part of the test set, that is, the model needs part of the test set data when training, so the model still needs to be retrained for subjects that the network has not seen. Compared with DA, DG is also divided into two domains. Its purpose is to find domain-invariant features in the source domain, and it does not need to access the test set data. It also has outstanding accuracy in cross-subject tasks, so it has attracted more attention from researchers. In addition to transfer learning, Xin ke, Shen et al. first applied contrastive learning to cross-subject emotion recognition. They used contrastive learning to maximize the similarity of positive sample pairs when the subjects were stimulated by the same emotion, and minimized the similarity of negative sample pairs when different stimuli were stimulated. Its accuracy reached 86%, surpassing the transfer learning that has been developed for many years. It can be seen that contrastive learning has great development potential in cross-subject emotion recognition. However, in this study, like most self-supervised contrastive learning, there is only one pair of positive samples. EEG-based emotion recognition is different from recognition tasks in computer vision, and there are fewer emotion categories. Therefore, during training, a large number of pseudo-negative samples will be treated as negative samples and pushed away from anchor samples, affecting the final recognition accuracy. The above previous work shows that there are large differences in emotional expression between subjects, and there must be representations that are invariant to the subjects. However, not accessing the test set data during model training and having high recognition accuracy across subjects are currently challenges. Therefore, exploring emotion recognition methods across subjects is feasible and meaningful. Summary of the invention
[0004] In order to solve the above problems, the present invention proposes a method for cross-subject EEG signal emotion recognition, comprising the following steps:
[0005] S1. Use the positive and negative sample generator to construct the extracted differential entropy features into positive and negative samples;
[0006] S2. Send the differential entropy features of the anchor points and positive and negative samples to the encoder for encoding, map them to the latent space, use the autoregressive model to regress and predict the encoded anchor point samples in the latent space, and train the encoder using the probabilistic supervised contrast loss function. The encoder is trained to complete representation learning by shortening the distance between positive sample pairs and increasing the distance between negative sample pairs. After completing representation learning, the regression model will be discarded.
[0007] S3. Connect the trained encoder to the classifier for fine-tuning and train the classifier through the cross entropy loss function. During this process, the encoder does not perform gradient propagation to complete cross-subject emotion recognition.
[0008] Furthermore, in the constructed positive and negative samples, the positive and negative sample setting strategy of the supervised contrast loss is combined to include the label information of the samples in the design of the positive and negative samples. The positive and negative sample generator generates mini batches as the input of the contrastive learning encoder; I = {+, -×...} is defined to represent the set of emotions. Taking the SEED dataset as an example, it represents the three emotions of happiness, sadness, and neutrality respectively. S = {1, 2, 3, ..., n} represents the set of n subjects. All samples can be labeled as q∈S, k∈I, C represents the number of channels, D represents the feature dimension extracted within a certain time, and H represents the set of all samples in this dataset;
[0009] In a batch, first determine the fixed emotion sample of subject 1 Then, in each experiment, samples with the same emotion of the subjects are taken as positive samples, that is, f + The number of + , p + The number of all experimental clips that represent the dataset that triggers + emotions; the samples of all subjects whose emotions are different from the positive samples in each experiment are taken as negative samples, that is, f - The number of k (k∈I, k≠+);
[0010] In order to fully capture the characteristics of samples in a batch, the mini batch is expanded, one sample is 2s, and 6 consecutive sample sequences are taken. The definition is that the subject is fixed in the process of an experiment, that is, the emotion caused by a stimulus. For example, in the SEED dataset, the average duration of the stimulus is 4 minutes, and it contains 3 emotion classifications. Then 4*60 / (2*6)=20 anchor point samples will be generated. Each anchor point will correspond to N positive samples and 2N negative samples. Their set e={f, f + , f - As a batch, in the next batch, the anchor points and positive and negative samples are reselected until all samples are used as anchor points, completing the training of an epoch.
[0011] Furthermore, a feature extraction network is constructed by contrastive predictive coding design, so that positive sample pairs are close and negative sample pairs are far away;
[0012] First, the nonlinear encoder g enc Map the input sequence x(t) to the latent representation sequence z(t) = g enc (x t ), an autoregressive model g ar Summarizes all z≤t in the latent space and predicts a latent representation c(t)=g ar (z(t)); In contrastive predictive coding learning, the residual structure is used as the encoder g enc To avoid overfitting, anchor samples and positive and negative samples are fed into the encoder in batches to obtain z k (t), the anchor point sample then enters the LSTM regression prediction network g ar The prediction result c(t) is obtained. LSTM is added as a regression model to improve the temporal resolution of the feature. During the prediction process, the network learns the underlying features of the anchor point emotion and obtains the prediction result c t It is a feature representation with fixed-point emotions. The prediction result is the same as the feature z obtained after encoding the positive sample. + (t) forms a positive sample pair; after encoding with the negative sample, the feature z is formed - (t) is a negative sample pair. Finally, the supervisory contrast loss function is used to shorten the distance between the positive sample pairs and increase the distance between the negative sample pairs, thus completing the contrast prediction coding.
[0013] The correct samples are distinguished from a group of noise samples through the NCE loss function, and the model is trained by maximizing the probability of the correct samples and minimizing the probability of the noise samples; in contrastive learning, it trains the model by comparing positive samples and negative samples, as shown in formula (1):
[0014]
[0015] Where m and p are the representation vectors of the sample obtained by the f(·) network, m·p + is the dot product similarity between the anchor point and the positive sample, m·p i is the dot product similarity between the anchor point and other samples, K represents the number of negative samples, and τ is the temperature parameter;
[0016] Combining the idea of contrastive predictive coding CPC, the training of the encoder and the regression model are also included in this loss function. The encoder and the autoregressive model are trained to jointly optimize the loss based on NCE, as shown in formula (2):
[0017]
[0018] c h The anchor point sample h passes through g ar (g enc (x t ))The predicted vector obtained, z q is the positive sample of subject q after g enc (x t ) obtained, A(h)=e\h,z a For samples other than anchor points in a batch, g enc (x t ) obtained; Different from CPC which only takes samples from fixed points as positive samples, by using label information combined with CPC loss, each fixed point can have multiple positive samples, that is, samples with the same label are positive samples, so that contrastive learning is suitable for the case of full supervision, as shown in the following formula (3):
[0019]
[0020] q(h) represents the number of positive samples in the determined anchor point, that is, the number of subjects. The label information generates an embedding space whose compactness will be higher than that in the self-supervised case, which helps the positive samples to be more densely distributed in the embedding space.
[0021] Furthermore, after contrastive learning, the encoder has learned to recognize the underlying logical features. The trained encoder is extracted for the next classification. The input will no longer be a batch of positive and negative sample pairs. The input is a random and disordered sample of the subject. The encoder parameters are determined by the previous stage. In this stage, the encoder parameters are frozen, and only the classification head composed of the fully connected layer and the activation function is trained through the cross entropy loss function.
[0022] The beneficial effects of the present invention are as follows: the experimental results show that the method proposed by the present invention has higher recognition accuracy and smaller standard deviation than most of the current advanced methods. It can be seen that all methods perform better on the SEED dataset than SEED IV. This is because under the same experimental paradigm, the SEED IV dataset belongs to four categories and has a small amount of data. Compared with other methods, especially on the SEED IV dataset with greater challenges, our results are at least 5% higher than the existing methods, which shows that our method is less affected by the recognition category and has better generalization ability. And through the confusion matrix, we have conducted a more detailed analysis of the recognition of each emotion. For categories with strong emotional expressions, our model has better performance, which is consistent with the research of neurocognitive science: that is, strong emotions have more obvious characteristics and similarities between subjects than calm emotions. In our model, LSTM is used to capture the temporal feature correlation and predict related emotions. Therefore, the length and amount of data of the sample will affect the effect of the experiment. Therefore, we have conducted a comparative analysis on the number of samples, indicating that the best effect is achieved when 6 samples are used as minibatch. At the same time, we also performed an ablation analysis on the proposed loss function (S-Info NCE). Compared with the ordinary cross entropy loss function, our loss function can maximize the correlation and difference between samples, so it has a better recognition effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is a model framework diagram based on contrast prediction of the present invention (different shapes represent different subjects, and the same color and filling style represent the same emotion);
[0024] Figure 2 A framework diagram for the positive and negative sample design of the present invention;
[0025] Figure 3 This is a framework diagram for extracting sample features of the present invention;
[0026] Figure 4 This is a structural diagram of the supervised contrast prediction coding model of the present invention (wherein the encoder genc parameters are shared);
[0027] Figure 5 A framework diagram for classifier training of the present invention;
[0028] Figure 6 This is a schematic diagram of the SEED dataset experimental process of the present invention;
[0029] Figure 7 A comparison chart of the performance differences of the methods of the present invention on two data sets;
[0030] Figure 8 This is a confusion matrix diagram for each emotion in each data set of the present invention. DETAILED DESCRIPTION
[0031] In order to make the technical means and objectives of the present invention easy to understand, the present invention is further described below in combination with specific implementation methods. A method for cross-subject EEG signal emotion recognition, the EEG signal emotion recognition based on supervised contrast predictive coding proposed in the present invention consists of three parts: positive and negative sample generator, supervised contrast coding representation and fine-tuning classification, such as Figure 1 As shown in the figure, specifically: first, the extracted differential entropy features are constructed into positive and negative samples using the positive and negative sample generator; then, the differential entropy features of the anchor points and the positive and negative samples are sent to the encoder for encoding, mapped to the latent space, and the autoregressive model is used to regress and predict the encoded anchor point samples in the latent space. The encoder is trained using the probabilistic supervised contrast loss function, and the encoder is trained to complete representation learning by shortening the distance between positive sample pairs and increasing the distance between negative sample pairs. After completing representation learning, the regression model will be discarded; finally, the trained encoder is connected to the classifier for fine-tuning, and the classifier is trained using the cross entropy loss function. During this process, the encoder does not perform gradient propagation to complete cross-subject emotion recognition.
[0032] 1. Positive and negative sample generator
[0033] In the positive and negative samples constructed by the present invention, the positive and negative sample setting strategy of supervised contrast loss is combined, and the label information of the samples is included in the design of positive and negative samples. The purpose of the design of the positive and negative sample generator is to generate mini batches as the input of the contrastive learning encoder. In the positive and negative samples constructed by the present invention, the positive and negative sample setting strategy of supervised contrast loss is combined, and the label information of the samples is included in the design of the positive and negative samples. Define I = {+, -, ×...} to represent the set of emotions. Taking the SEED dataset as an example, they represent the three emotions of happiness, sadness, and neutrality respectively. S = {1, 2, 3, ..., n} represents a set of n subjects, and all samples can be labeled as (q∈S, k∈I, C represents the number of channels, D represents the feature dimension extracted within a certain time, and H represents the set of all samples in this dataset. In a batch, first determine the fixed emotion sample of subject 1. Then, in each experiment, samples with the same emotion of the subjects are taken as positive samples, that is, f + The number of + (p + Represents the number of all experimental clips that trigger +emotions in the dataset). In each experiment, all samples of subjects whose emotions are different from those of the positive samples are taken as negative samples, that is, f - The number of k(k∈I, k≠+). Figure 2 Design for positive and negative samples.
[0034] In order to fully capture the characteristics of the samples in one batch, we will expand the minibatch. Compared with taking one sample in each experiment (one sample 2s), we take 6 consecutive sample sequences. Figure 3 As shown in the figure, in the process of a fixed subject conducting an experiment (i.e., emotions induced by a stimulus), for example, in the SEED dataset, the average duration of the stimulus is 4 minutes, and it contains 3 emotion categories, then 4*60 / (2*6)=20 anchor point samples will be generated, each anchor point will correspond to N positive samples and 2N negative samples, and their set e={f, f + , f -} as a batch. In the next batch, the anchor points and positive and negative samples are reselected until all samples are used as anchor points, completing the training of an epoch.
[0035] 2. Supervised Contrastive Predictive Coding Representation
[0036] The purpose of contrastive predictive coding design is to build a feature extraction network that makes positive sample pairs close and negative sample pairs far apart. First, the nonlinear encoder g enc Map the input sequence x(t) to the latent representation sequence z(t) = g enc (x t ), next, an autoregressive model g ar Summarizes all z≤t in the latent space and predicts a latent representation c(t)=g ar In contrastive predictive coding learning, since the EEG data set is a small-scale data set, in order to avoid overfitting, we use the residual structure as the encoder g enc , the anchor samples and positive and negative samples enter the encoder in batches to get z k (t), the anchor point sample then enters the LSTM regression prediction network g ar The prediction result c(t) is obtained. Considering that the features of the anchor point obtained only through the encoder will have a lower temporal resolution, LSTM is added as a regression model. During the prediction process, the network learns the underlying features of the anchor point emotion, so the prediction result c is obtained. t It is a feature representation with fixed-point emotions. The prediction result is the same as the feature z obtained after encoding the positive sample. + (t) forms a positive sample pair; after encoding with the negative sample, the feature z is formed - (t) is a negative sample pair. Finally, the supervised contrast loss function is used to shorten the distance between the positive sample pair and increase the distance between the negative sample pair to complete the contrast prediction coding. The framework of supervised contrast prediction coding is as follows: Figure 4As shown, a sample of 1s is taken as an example.
[0037] The basic idea of the NCE loss function is to distinguish the correct samples from a set of noise samples and train the model by maximizing the probability of the correct samples and minimizing the probability of the noise samples. In contrastive learning, it trains the model by comparing positive samples and negative samples, as shown in formula (1):
[0038]
[0039] Where m and p are the representation vectors of the sample obtained by the f(·) network, m·p + is the dot product similarity between the anchor point and the positive sample, m·p i is the dot product similarity between the anchor point and other samples, K represents the number of negative samples, and τ is the temperature parameter.
[0040] Combining the idea of contrastive predictive coding CPC (CPC), we also include the training of the encoder and regression model in this loss function. Both the encoder and the autoregressive model are trained to jointly optimize the NCE-based loss, as shown in formula (2).
[0041]
[0042] c h The anchor point sample h passes through g ar (g enc (x t ))The predicted vector obtained, z q is the positive sample of subject q after g enc (x t ) obtained, A(h)=e\h,z a For samples other than anchor points in a batch, g enc (x t ) obtained by the representation vector. Unlike CPC, which only takes samples from fixed points as positive samples, since it contains label information, we use label information combined with CPC loss. Each fixed point can have multiple positive samples, that is, samples with the same label are positive samples, so that contrastive learning is suitable for the case of full supervision, as shown in the following formula (3).
[0043]
[0044] q(h) represents the number of positive samples in the determined anchor point, that is, the number of subjects. Since the label information will generate an embedding space, its compactness will be higher than that in the self-supervised case, which helps the positive samples to have a tighter distribution in the embedding space.
[0045] 3. Fine-tune classification
[0046] After contrastive learning, the encoder has learned to identify the underlying logical features, extract the trained encoder, and use it for the next step of classification. The classification structure is as follows Figure 5 At this point, the input is no longer a batch of positive and negative samples, but random and disordered test samples. The encoder parameters are determined by the previous stage. In this stage, the encoder parameters are frozen, and only the classification head composed of the fully connected layer and the activation function is trained through the cross entropy loss function.
[0047] experiment:
[0048] In our invention, SEED and SEED-IV are used as training datasets. We first introduce the datasets and preprocessing process, then introduce the experimental design scheme and implementation details, then show the experimental results, and finally discuss the results.
[0049] The SEED dataset is a public EEG signal dataset that is widely used in emotion recognition. The dataset contains EEG data of 15 subjects (8 females, with an average age of 23.27 years and a standard deviation of 2.37 years). Each subject was required to conduct three experiments at different times, with an interval of more than one week between sessions. The experimental team prepared movie clips that could induce three emotions in the subjects: positive, neutral, and negative. There were five clips for each emotion, with an average duration of 226 seconds, for a total of 15 movie clips. Each session involved watching 15 movie clips. The experimental process included: 5 seconds of prompt time, 4 minutes of movie clips, 45 seconds of self-assessment time, and 15 seconds of rest time. Figure 6 As shown, corresponding emotions are stimulated through immersive viewing.
[0050] The experimental team used a 10-20 system to collect 62 channels of EEG signals with a sampling frequency of 1000Hz. The public SEED dataset has downsampled the data to 200Hz and performed a 0-75Hz filtering process. At the same time, the public dataset also provides pre-processed experimental data. We selected the differential entropy features that were further smoothed by the linear dynamic system (LDS) method as experimental samples, and used a non-overlapping 1-second time window as a sample. From each sample, we extracted EEG signals of 5 frequency bands (δ: 1-3Hz, θ: 4-7Hz, α: 8-13Hz, β: 14-30Hz, γ: 31-50Hz) and calculated their differential entropy features (DE). Studies have shown that differential entropy (DE) features have stronger discriminative power in emotion recognition. We connect the 62 DE values of the five frequency bands to provide a more stable DE feature to reduce the impact of noise randomness and ensure the number of samples. This paper is consistent with most literature and selects the DE features of adjacent 2s for splicing to obtain samples with a feature vector dimension of 62*10. In order to ensure the processability and consistency of all data sets, we fill the input with 64*10.
[0051] The SEED IV dataset is also an open and widely used EEG signal dataset for emotion recognition. The dataset contains EEG signals of 15 subjects. In each session, movie clips that cause the subjects to have four emotions are set: happy, sad, neutral, and fearful. Each emotion corresponds to four different clips, and each subject watches 24 movie clips in each session.
[0052] The public SEED-IV dataset uses the same preprocessing method as the SEED dataset, and we still choose the same preprocessing method. The only difference is that the SEED-IV dataset uses a non-overlapping 4-second time window as a sample, and calculates the differential entropy features of different frequency bands. Compared with the SEED dataset, the DE features extracted by the SEED-IV dataset contain sufficient time features, and in order to ensure sufficient data volume to train the model, the input is not spliced. The feature dimension of a sample is 62*5, and we fill it to 64*10. Table 1 shows the description of the feature scale and feature dimension of the two datasets.
[0053] Table 1 Dataset description
[0054]
[0055] In the cross-subject experiment, we conducted cross-subject leave-one-out experiments on the SEED and SEED IV datasets. In order to compare with the most advanced experiments, we kept consistent with their experimental settings. Specifically, our experimental test set is the sample of a certain subject, and the training set and validation set are all samples except the test subject. If there are N samples in the dataset, N leave-one-out experiments are required. In order to verify the rationality of the parameter design of our proposed framework, we designed a comparative experiment. In the framework we designed, the number of samples in each minibatch will affect the effect of the experiment. In a minibatch, too many numbers will lead to insufficient total training data, and too few numbers are not conducive to the network capturing potential emotional features. Therefore, the number of samples and the total amount of training data should be considered comprehensively. Experiments have shown that about 10 seconds can represent a person's emotions. In the SEED dataset, the length of one sample is 2 seconds. Therefore, we designed the number of positive (negative) samples in a batch to be 4, 5, 6, 7, and 8 respectively to find the optimal number suitable for our dataset. At the same time, in order to verify the effectiveness of the loss function, we conducted an ablation experiment on the loss function mentioned in the invention.
[0056] The model training in this paper uses Python 3.8 programming language and keras development framework to implement the model. For the encoder, according to the dimension of our input data and the size of the dataset, we designed a network model with a 16-layer residual structure. The parameters of the network model are shown in Table 2. In each residual block, the residual connects two convolutional layers. It should be noted that in Resnet_layer2, Resnet_layer3 and Resnet_layer4, the first layer of the residual module needs to be upgraded through a convolutional layer of size 1×1, M, where M is the same as the number of channels of the residual structure output F(x) of this layer. At the same time, it needs to be downsampled with a step size of 2 so that the residual F(x) and the identity mapping x can be added. The hidden dimension of our regression model LSTM is set to 128, Adam is used as the optimizer, and the learning rate is set to 0.001. When the loss does not decrease for three consecutive times, the learning rate is halved. The batch size is 64, and 80 epochs are trained in the first encoding prediction stage and 40 epochs in the second classification stage.
[0057] Table 2 Encoder network parameter structure
[0058]
[0059]
[0060] In order to prove the effectiveness of our invention, we compared the results of the cross-subject experiment of SEED dataset with the following six specific methods: SVM (Support Vector Machines, SVM), TANN (novel Transferability Attention Neural Network, TANN), CLISA (Contrastive Learning Inter-Subject Alignment, CLISA), MSMRA (Multi-origin and Multi-presentation Adjustment, MSMRA), MS-ADA (Multisource Associate Domain Adaptation, MS-ADA), MGFKD (Multi-domain Geodesic Flow Kernel Dynamic Distribution Alignment, MGFKD). Table 3 lists the accuracy of some methods in each subject in SEED dataset (the data sources listed in Table 3 are the methods of each subject's accuracy given in the corresponding papers). Tables 4 and 5 list the average accuracy and standard deviation across subjects on SEED and SEED IV datasets.
[0061] Table 3 Seed dataset cross-subject accuracy of each method and each subject (%)
[0062]
[0063] Table 4. Average and standard deviation of accuracy of each method across subjects in the Seed dataset
[0064]
[0065] Table 5. Mean and standard deviation of accuracy of each method across subjects in Seed IV dataset
[0066]
[0067] In Table 3, it can be seen that our method has a higher accuracy rate than the other two methods for more subjects. Due to the difference in models, the latent space found by the features extracted by the models is also different, so the performance of subjects on different models is not consistent. In Tables 4 and 5, it can be seen that the average accuracy of this paper on the SEED dataset is 87.82%, with a standard deviation of 5.05%; the average accuracy on the SEED IV dataset is 74.62%, with a standard deviation of 5.31%. It is better than the machine learning, pre-adaptation, contrastive learning, domain transfer, semi-supervised and other methods listed in the article, and the standard deviation is also lower. Compared with the domain adaptation method MS-ADA that needs to access the test set during the training of the network, our method improves by about 1.6% on the SEED dataset and by about 15% on the SEED IV dataset. Compared with CLISA using contrastive learning, the accuracy of the supervised prediction contrastive learning we use is also improved by about 1.4%, and the same conclusion is obtained that the number of categories in the dataset has little effect on the model. Therefore, compared with the advanced cross-subject methods in recent years, our model has higher recognition accuracy.
[0068] Especially on the seed IV dataset, our method’s accuracy exceeds the second-best accuracy by nearly 5%, such as Figure 7 The figure shows the performance differences of each method on the two datasets. Compared with the seed three-category set, seed IV has one more category, which may be the reason for the reduced accuracy of all methods. However, since contrastive learning performs very well in multi-category tasks, this can explain why the number of categories has less impact on our model than other methods.
[0069] In addition, we also analyzed the recognition rate of each emotion in the form of confusion matrix. Figure 8 In the figure, the confusion matrix of our method in the SEED and SEED IV datasets is given, from which we can get the average recognition accuracy for each emotion. It can be seen that in the SEED dataset, the recognition accuracy of positive emotions reached 90.8%, and 7.61% and 1.59% of positive emotions were misidentified as neutral and negative. In the SEED dataset, the model has a stronger classification effect on positive and negative emotions, but a weaker effect on neutral emotions. This phenomenon can be attributed to the complexity of neutral emotions, which are not as strong as positive and negative emotions and do not have too obvious neural patterns. In the SEED IV dataset, the recognition effect of happy and sad emotions is also better than that of neutral emotions.
[0070] At the same time, we conducted a comparative experiment on the number of samples in the minibatch. In the SEED dataset, we randomly selected three subjects 2, 6, and 9, and set different sample numbers 4, 5, 6, 7, and 8 to find the optimal sample number. As shown in Table 6, the three subjects all have the best recognition accuracy when the sample number is 6, which shows that the appropriate sample number and sufficient data volume help the network capture signal features and improve recognition accuracy.
[0071] Table 6 Identification results of different sample sizes of random subjects (%)
[0072]
[0073] In order to verify the effectiveness of the supervised contrast prediction loss function (S-Info NCE), we also conducted an ablation experiment on the loss function of the contrast prediction learning stage. We randomly selected three subjects 2, 6, and 9 and calculated their average accuracy under the two loss functions. As shown in Table 7, the supervised contrast prediction loss function has higher accuracy than the basic cross entropy loss function. This shows that the supervised contrast prediction loss function can promote the diversity and discrimination of feature learning. By maximizing mutual information, it encourages the model to learn to capture the correlation and difference between samples, thereby generating more informative feature representations and improving the accuracy of cross-subject recognition.
[0074] Table 7 Recognition results of different loss functions
[0075]
[0076] The experimental results show that the proposed method has higher recognition accuracy and smaller standard deviation than most of the current advanced methods. It can be seen that all methods perform better on the SEED dataset than SEED IV. This is because under the same experimental paradigm, the SEED IV dataset belongs to four categories and has a small amount of data. Compared with other methods, especially on the more challenging SEED IV dataset, our results are at least 5% higher than the existing methods, which shows that our method is less affected by the recognition category and has better generalization ability. In addition, through the confusion matrix, we conducted a more detailed analysis of the recognition of each emotion. For categories with strong emotional expressions, our model has better performance, which is consistent with the research of neurocognitive science: that is, strong emotions have more obvious characteristics and similarities between subjects than calm emotions. In our model, LSTM is used to capture the temporal feature correlation and predict related emotions. Therefore, the length and amount of data of the sample will affect the effect of the experiment. Therefore, we conducted a comparative analysis of the number of samples, showing that the best effect is achieved when 6 samples are used as minibatch. At the same time, we also performed an ablation analysis on the proposed loss function (S-Info NCE). Compared with the ordinary cross entropy loss function, our loss function can maximize the correlation and difference between samples, so it has a better recognition effect.
[0077] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical solutions and concepts of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A method for cross-subject EEG signal emotion recognition, characterized in that: The steps include: S1. Use the positive and negative sample generator to construct the extracted differential entropy features into positive and negative samples; S2. Send the differential entropy features of the anchor points and positive and negative samples to the encoder for encoding, map them to the latent space, use the autoregressive model to regress and predict the encoded anchor point samples in the latent space, and train the encoder using the probabilistic supervised contrast loss function. The encoder is trained to complete representation learning by shortening the distance between positive sample pairs and increasing the distance between negative sample pairs. After completing representation learning, the regression model will be discarded. S3. Connect the trained encoder to the classifier for fine-tuning and train the classifier through the cross entropy loss function. During this process, the encoder does not perform gradient propagation to complete cross-subject emotion recognition.
2. The method for cross-subject EEG signal emotion recognition as claimed in claim 1, characterized in that: In the constructed positive and negative samples, the positive and negative sample setting strategy of the supervised contrast loss is combined to include the label information of the samples in the design of the positive and negative samples. The positive and negative sample generator generates mini batches as the input of the contrastive learning encoder. Define I = {+, -, ×...} to represent the set of emotions. Taking the SEED dataset as an example, they represent the three emotions of happiness, sadness, and neutrality. S = {1, 2, 3, ..., n} represents the set of n subjects. All samples can be labeled C represents the number of channels, D represents the feature dimension extracted within a certain time, and H represents the set of all samples in this dataset; In a batch, first determine the fixed emotion sample of subject 1 Then, in each experiment, samples with the same emotion of the subjects are taken as positive samples, that is, f + The number of + , p + The number of all experimental clips that represent the dataset that triggers + emotions; the samples of all subjects whose emotions are different from the positive samples in each experiment are taken as negative samples, that is, f - The number of k (k∈I, k≠+); In order to fully capture the characteristics of samples in a batch, the mini batch is expanded, one sample is 2s, and 6 consecutive sample sequences are taken. The definition is that the subject is fixed in the process of an experiment, that is, the emotion caused by a stimulus. For example, in the SEED dataset, the average duration of the stimulus is 4 minutes, and it contains 3 emotion classifications. Then 4*60 / (2×6)=20 anchor point samples will be generated. Each anchor point will correspond to N positive samples and 2N negative samples. Their set e={f, f + , f - As a batch, in the next batch, the anchor points and positive and negative samples are reselected until all samples are used as anchor points, completing the training of an epoch.
3. The method for cross-subject EEG signal emotion recognition as claimed in claim 2, characterized in that: By contrasting predictive coding designs and constructing feature extraction networks, positive sample pairs are brought close together and negative sample pairs are kept far apart; First, the nonlinear encoder g enc Map the input sequence x(t) to the latent representation sequence z(t) = g enc (x t ), an autoregressive model g ar Summarizes all z≤t in the latent space and predicts a latent representation c(t)=g ar (z(t)); In contrastive predictive coding learning, the residual structure is used as the encoder g enc To avoid overfitting, anchor samples and positive and negative samples are fed into the encoder in batches to obtain z k (t), the anchor point sample then enters the LSTM regression prediction network g ar The prediction result c(t) is obtained. LSTM is added as a regression model to improve the temporal resolution of the feature. During the prediction process, the network learns the underlying features of the anchor point emotion and obtains the prediction result c t It is a feature representation with fixed-point emotions. The prediction result is the same as the feature z obtained after encoding the positive sample. + (t) forms a positive sample pair; after encoding with the negative sample, the feature z is formed - (t) is a negative sample pair. Finally, the supervisory contrast loss function is used to shorten the distance between the positive sample pairs and increase the distance between the negative sample pairs, thus completing the contrast prediction coding. The correct samples are distinguished from a group of noise samples through the NCE loss function, and the model is trained by maximizing the probability of the correct samples and minimizing the probability of the noise samples; in contrastive learning, it trains the model by comparing positive samples and negative samples, as shown in formula (1): Where m and p are the representation vectors of the sample obtained by the f(·) network, m·p + is the dot product similarity between the anchor point and the positive sample, m·p i is the dot product similarity between the anchor point and other samples, K represents the number of negative samples, and τ is the temperature parameter; Combining the idea of contrastive predictive coding CPC, the training of the encoder and the regression model are also included in this loss function. The encoder and the autoregressive model are trained to jointly optimize the loss based on NCE, as shown in formula (2): c h The anchor point sample h passes through g ar (g enc (x t ))The predicted vector obtained, z q is the positive sample of subject q after g enc (x t ) obtained, A(h)=e\h,z a For samples other than anchor points in a batch, g enc (x t ) obtained; Different from CPC which only takes samples from fixed points as positive samples, by using label information combined with CPC loss, each fixed point can have multiple positive samples, that is, samples with the same label are positive samples, so that contrastive learning is suitable for the case of full supervision, as shown in the following formula (3): q(h) represents the number of positive samples in the determined anchor point, that is, the number of subjects. The label information generates an embedding space whose compactness will be higher than that in the self-supervised case, which helps the positive samples to be more densely distributed in the embedding space.
4. The method for cross-subject EEG signal emotion recognition as claimed in claim 3, characterized in that: After contrastive learning, the encoder has learned to recognize the underlying logical features. The trained encoder is extracted for the next classification. The input will no longer be a batch of positive and negative sample pairs. The input is a random and disordered sample of the subject. The encoder parameters are determined by the previous stage. In this stage, the encoder parameters are frozen, and only the classification head composed of the fully connected layer and the activation function is trained through the cross entropy loss function.
Citation Information
Cited By
Aero-engine RUL prediction method and device based on MSFormer and domain self-adaption
CN119669678A
A method and apparatus for predicting the RUL of aero-engines based on MSFormer and domain adaptation
CN119669678B
Electroencephalogram signal fatigue detection method and device and computer readable storage medium
CN119700138A
Remote sensing reference image segmentation method based on comparative learning and cross attention
CN119785348A
Cross-domain electroencephalogram emotion recognition method and system based on feature adversarial learning
CN119848617A
