Multi-source-domain adaptive emotion recognition method based on double-flow representation
Through dual-stream representation and contrastive learning methods, the problems of multi-source domain adaptation and inter-view information fusion in EEG emotion recognition are solved, achieving high accuracy and stability of emotion recognition, alleviating domain differences, and enhancing the robustness of the model. .
Patent Information
- Application Number
- CN202410733776.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-10
AI Technical Summary
Existing EEG emotion recognition technology has distribution inconsistency problems when faced with different data collection equipment, environments and individual differences. Traditional methods are difficult to effectively handle multi-source domain adaptation, and ignore the complex interactive relationships and feature fusion between different views. .
A multi-source domain adaptation method based on dual-stream representation is used to generate views through data enhancement, combined with contrastive learning to ensure consistency between views, and a dual-stream representation module is designed to integrate view features, align fine-grained structures, introduce conditional entropy loss, and jointly optimize the loss function to improve performance.
It effectively alleviates domain differences, enhances the stability of the model in the target domain, achieves intra-class convergence and inter-class dispersion, and improves the accuracy and robustness of emotion recognition.
Smart Images

Figure CN118626908A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence, and in particular relates to a multi-source domain adaptive emotion recognition method based on dual-stream representation. Background Art
[0002] Emotion is an important part of human daily life, affecting communication, decision-making and perception. Emotion recognition refers to the use of machine representations such as speech, facial expressions and physiological signals to identify human emotional responses. Recently, emotion recognition based on physiological signals, represented by electroencephalogram (EEG), has attracted much attention due to its objectivity and sensitivity. This makes EEG emotion recognition have broad application prospects in fields such as medicine, psychology research and human-computer interaction. Although EEG emotion recognition technology has many advantages, its development also faces challenges. EEG signals are susceptible to noise interference and are non-stationary, resulting in differences between different individuals. In practical applications, the differences between the source domain and the target domain may come from factors such as different data acquisition devices, different data acquisition environments, and different performances of subjects, resulting in data distribution inconsistency. Traditional machine learning methods often perform poorly in the face of such distribution inconsistency because they assume that training data and test data come from the same distribution. Therefore, current research often combines deep learning and domain adaptation methods to solve these problems.
[0003] Multi-source domain adaptation has always been a research hotspot in the field of emotion recognition, but there are still several problems: First, most algorithms only focus on the information of a single view and ignore the complex interactive relationship between different views; second, how to utilize the complementarity between different views to effectively fuse the features of multiple views; third, not all feature spaces are shared between subjects, and existing methods only focus on the distribution alignment between each pair of subjects, without considering other levels of fine-grained alignment. Summary of the invention
[0004] To solve the above problems, the present invention discloses a multi-source domain adaptation emotion recognition method based on dual-stream representation. Specifically, two views are first generated based on different data enhancement methods to make up for the defect of incomplete information between views. Then, the contrast learning method is combined to ensure the consistency between views. Then, a dual-stream representation module is designed to fuse view features, so as to learn the interactive information between different views and obtain consistency information. In addition, a multi-source domain adaptation method is adopted to align fine-grained structures between subjects and categories, thereby enhancing the similarity between subjects, achieving intra-class convergence and inter-class dispersion, and effectively alleviating domain differences. In order to further reduce the uncertainty of the model in the target domain, conditional entropy loss is also introduced, and the overall performance is improved by jointly optimizing multiple loss functions.
[0005] To achieve the above object, the technical solution of the present invention is as follows:
[0006] A multi-source domain adaptation emotion recognition method based on dual-stream representation includes four stages: data enhancement and feature extraction, dual-stream representation fusion, multi-source domain adaptation, classification and joint optimization. The specific steps are as follows:
[0007] a. Data augmentation and feature extraction
[0008] a.1 Split the EEG signal into M blocks, randomly shuffle their order, and add random noise and scaling factors at each time step. Use strong enhancement and weak enhancement to generate strong images respectively and weak views
[0009] a.2 uses three linear layers as feature extractors, adds batch normalization between each layer, uses RELU as the activation function, and extracts features according to the following formula:
[0010]
[0011] f2=RELU(BN(LN(f1))) (2)
[0012]
[0013] in, Indicates strong and weak views, represents the extracted view features, m∈{s,t}, n∈{S,W}. LN(·) represents a linear layer, and BN(·) represents a normalization layer.
[0014] a.3 and Connect to form a representation matrix c i , calculate the similarity between different views and get the contrast loss It is expressed as follows:
[0015]
[0016] Among them, l represents the similarity between samples, k represents the number of samples, sim(u,v)=u T v / ||u||||v|| represents cosine similarity, represents the indicator function, and τ represents the temperature coefficient.
[0017] b. Dual-stream representation fusion
[0018] b.1 and Mapped into three matrices respectively: query matrix Q S and Q W , key matrix K S and KW , value matrix V S and V W . It is expressed as follows:
[0019]
[0020] Among them, W Q , W K and W V Represents the weight matrix, which is used to transform the strong view features and weak view features Projected to a d-dimensional tensor.
[0021] b.2 In the in-view attention mechanism, Q n , K n and V n As the query matrix, key matrix and value matrix respectively, the normalization factor is introduced First aggregate Q n and K n , and then with V n Multiply them together to get the output representation
[0022]
[0023] In order to further obtain deep features, After another linear layer, and then with the input Perform residual connection to obtain the final output of the in-view attention mechanism
[0024]
[0025] in, Indicates the characteristics of strong and weak views, represents attention and DP(·) represents the drop operation.
[0026] b.3 In the inter-view attention mechanism, Q n As a query, K t and V t As key and value, an association is established between different views by exchanging the Q values of the two views:
[0027]
[0028] Among them, n∈{S,W}, t∈{S,W}-{n}.
[0029] b.4 Perform single view fusion first and filter out and Irrelevant information in:
[0030]
[0031] in, and denote the output of the intra-view attention mechanism and the output of the inter-view attention mechanism after filtering irrelevant information, W denotes the weight matrix, σ(·) denotes the sigmoid function, Represents element-wise product.
[0032] Will and Concatenate them and use a linear layer to obtain the enhanced feature representation
[0033]
[0034] Among them, Concat(·) represents the concatenation operation.
[0035] Use the Softmax function to dynamically learn the weights between each view to obtain multi-view fusion:
[0036]
[0037] c. Multi-source domain adaptation
[0038] c.1 z s and z t Concatenate into the representation matrix z i , calculate the subject distribution alignment loss
[0039]
[0040] c.2 Assign pseudo labels to target samples and align source subjects and target subjects The centroid of each category in , and the class-level feature distribution alignment loss is calculated
[0041]
[0042] Among them, X s and Y s represents the data and labels of the source domain, X t and represents the data and predicted labels of the target domain, and Respectively and The centroid of category k in , dist(u,v)=1-||u||||v|| represents the cosine distance, which is used to calculate the difference between the centroids.
[0043] d. Classification and joint optimization
[0044] d.1 Calculate the classification loss on the source domain using cross entropy loss
[0045]
[0046] Among them, (X s ,Y s ) represents the combination of data from all source subjects, K represents the number of classifications, Represents the indicator function.
[0047] Introduction The loss is used to enhance the inter-class discrimination of the target data, which is expressed as follows:
[0048]
[0049] d.2 The overall objective function is as follows, and the parameters are iteratively updated by optimizing formula (19):
[0050]
[0051] Among them, α, β and γ represent hyperparameters, ω sub and ω sen represents the dynamic weight used to determine the relevance of the mth subject. Here, a m (b m ) and a j (b j ) represents the fitness between the mth subject and the jth subject.
[0052] Beneficial effects of the present invention:
[0053] First, we combine data augmentation and contrastive learning to increase the diversity of training data and ensure that the model maintains consistency when learning representations by maximizing the similarity between different views of the same subject.
[0054] Second, a two-stream representation fusion method is designed to effectively fuse the enhanced multi-view features. This method captures the interaction information within the feature sequences of different views, learns the interaction information between different views, and obtains consistency information.
[0055] Third, fine-grained structures are aligned to strengthen the similarity between subjects, achieve intra-class convergence and inter-class dispersion, effectively alleviate domain differences, and reduce the uncertainty of the model in the target domain. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1It is a flow chart of a multi-source domain adaptive emotion recognition method based on dual-stream representation according to the present invention;
[0057] Figure 2 is a structural diagram of a multi-source domain adaptive emotion recognition method based on dual-stream representation in an embodiment of the present invention;
[0058] Figure 3 is a schematic diagram of the structure of the intra-view attention mechanism in an embodiment of the present invention;
[0059] Figure 4 is a schematic diagram of accuracy values on two data sets in an embodiment of the present invention;
[0060] Figure 5 is a schematic diagram of F1 scores on two data sets in an embodiment of the present invention;
[0061] Figure 6 Schematic diagram of area under the curve values of two data sets in an embodiment of the present invention. DETAILED DESCRIPTION
[0062] The present invention will be further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.
[0063] As shown in the figure, a multi-source domain adaptive emotion recognition method based on dual-stream representation described in the present invention includes the following steps:
[0064] a. Data augmentation and feature extraction
[0065] a.1 Split the EEG signal into M blocks, randomly shuffle their order, and add random noise and scaling factors at each time step. Strong Augmentation and Weak Augmentation are used to generate strong views respectively. and weak views
[0066] a.2 uses three linear layers as feature extractors, adds batch normalization between each layer, uses RELU as the activation function, and extracts features according to the following formula:
[0067]
[0068] f2=RELU(BN(LN(f1))) (2)
[0069]
[0070] in, Indicates strong and weak views, represents the extracted view features, m∈{s,t}, n∈{S,W}. LN(·) represents a linear layer, and BN(·) represents a normalization layer.
[0071] a.3 and Connect to form a representation matrix c i , calculate the similarity between different views and get the contrast loss It is expressed as follows:
[0072]
[0073] Among them, l represents the similarity between samples, k represents the number of samples, sim(u,v)=u T v / ||u||v|| represents cosine similarity, represents the indicator function, and τ represents the temperature coefficient.
[0074] b. Dual-stream representation fusion
[0075] b.1 and Mapped into three matrices respectively: query matrix Q S and Q W , key matrix K S and K W , value matrix V S and V W . It is expressed as follows:
[0076]
[0077] Among them, W Q , W k and W V Represents the weight matrix, which is used to transform the strong view features and weak view features Projected to a d-dimensional tensor.
[0078] b.2 In the in-view attention mechanism, Q n , K n and V n As the query matrix, key matrix and value matrix respectively, the normalization factor is introduced First aggregate Q n and K n , and then with V n Multiply them together to get the output representation
[0079]
[0080] In order to further obtain deep features, After another linear layer, and then with the input Perform residual connection to obtain the final output of the in-view attention mechanism
[0081]
[0082] in, Indicates the characteristics of strong and weak views, represents attention and DP(·) represents the drop operation.
[0083] b.3 In the inter-view attention mechanism, Q n As a query, K t and V t As key and value, an association is established between different views by exchanging the Q values of the two views:
[0084]
[0085] Among them, n∈{S,W}, t∈{S,W}-{n}.
[0086] b.4 Perform single view fusion and filter out and Irrelevant information in:
[0087]
[0088] in, and denote the output of the intra-view attention mechanism and the output of the inter-view attention mechanism after filtering irrelevant information, W denotes the weight matrix, σ(·) denotes the sigmoid function, Represents element-wise product.
[0089] Will and Concatenate them and use a linear layer to obtain the enhanced feature representation
[0090]
[0091] Among them, Concat(·) represents the concatenation operation.
[0092] Use the Softmax function to dynamically learn the weights between each view to obtain multi-view fusion:
[0093]
[0094] c. Multi-source domain adaptation
[0095] c.1 z s and zt Concatenate into the representation matrix z i , calculate the subject distribution alignment loss
[0096]
[0097] c.2 Assign pseudo labels to target samples and align source subjects and target subjects The centroid of each category in , and the class-level feature distribution alignment loss is calculated
[0098]
[0099] Among them, X s and Y s represents the data and labels of the source domain, X t and represents the data and predicted labels of the target domain, and Respectively and The centroid of category k in , dist(u,v)=1-||u||||v|| represents the cosine distance, which is used to calculate the difference between the centroids.
[0100] d. Classification and joint optimization
[0101] d.1 Calculate the classification loss on the source domain using cross entropy loss
[0102]
[0103] Among them, (X s ,Y s ) represents the combination of data from all source subjects, K represents the number of classifications, Represents the indicator function.
[0104] Introduction The loss is used to enhance the inter-class discrimination of the target data, which is expressed as follows:
[0105]
[0106] d.2 The overall objective function is as follows, and the parameters are iteratively updated by optimizing formula (19):
[0107]
[0108] Among them, α, β and γ represent hyperparameters, ω sub and ω sem represents the dynamic weight used to determine the relevance of the mth subject. Here, a m (b m ) and a j (b j ) represents the fitness between the mth subject and the jth subject.
[0109] For the embodiment of the present invention, the experimental analysis is performed as follows:
[0110] The proposed method is implemented using PyTorch 1.7.0 and trained using NVIDIA TITAN V100 GPU on Linux operating system. In the classification task, two representative evaluation indicators are selected, namely accuracy and standard deviation:
[0111]
[0112] Among them, TP means predicting the positive class as the positive class, TN means predicting the negative class as the negative class, FP means predicting the negative class as the positive class, and FP means predicting the positive class as the negative class. i is the accuracy of the sample, μ is the mean of the population, and n is the number of samples in the population.
[0113] In order to verify the effectiveness of the proposed method MSDA-ACLDP, MSDA-ACLDP and other existing methods are compared on two public sentiment datasets SEED and SEED-IV. The results are shown in Table 1.
[0114] Table 1 Performance comparison of different algorithms on SEED and SEED-IV (%)
[0115]
[0116] It can be seen that MSDA-ACLDP performs well in comparison with other multi-source domain adaptation algorithms and achieves more excellent performance. Compared with existing methods, MSDA-ACLDP not only takes individual differences into account, but also effectively reduces domain differences and learns common features by enhancing contrastive learning and two-stream representation fusion. This fully demonstrates the effectiveness of the proposed method combining data enhancement, contrastive learning, and two-stream representation fusion. In addition, the experimental results of the embodiments of the present invention on indicators such as accuracy, F1 score, and area under the curve in each conversation task on two datasets are given, as shown in Figure 2. Figure 4 , Figure 5 , Figure 6 shown.
[0117] In summary, compared with other advanced multi-source domain adaptation methods, the method proposed in the present invention is effective. By combining data enhancement and contrastive learning, the present invention increases the diversity of training data, allowing the model to learn more discriminative feature representations. By fusing features from different views, the model is constrained to maintain consistency when learning representations. Fine-grained structures are aligned to reduce differences between subjects and categories, effectively alleviating the differences between source and target domains, and enabling the model to better adapt to various complex data distributions and task scenarios.
[0118] In summary, the beneficial effects of the present invention are:
[0119] First, we combine data augmentation and contrastive learning to increase the diversity of training data and ensure that the model maintains consistency when learning representations by maximizing the similarity between different views of the same subject.
[0120] Second, a two-stream representation fusion method is designed to effectively fuse the enhanced multi-view features. This method captures the interaction information within the feature sequences of different views, learns the interaction information between different views, and obtains consistency information.
[0121] Third, fine-grained structures are aligned to strengthen the similarity between subjects, achieve intra-class convergence and inter-class dispersion, effectively alleviate domain differences, and reduce the uncertainty of the model in the target domain.
[0122] It should be noted that the above content only illustrates the technical idea of the present invention and cannot be used to limit the protection scope of the present invention. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications all fall within the protection scope of the claims of the present invention.
Claims
1. A multi-source domain adaptation emotion recognition method based on dual-stream representation, comprising four steps of data enhancement and feature extraction, dual-stream representation fusion, multi-source domain adaptation, classification and joint optimization, characterized in that: (1) Data enhancement and feature extraction: Generate two views based on strong enhancement and weak enhancement, extract private features within the view, and combine contrast loss Compute the similarity between views; (2) Two-stream representation fusion: Based on the intra-view and inter-view attention mechanisms, the features of different views are fused in two steps; (3) Multi-source domain adaptation: align different subjects and categories at a fine-grained level and calculate the corresponding loss function and (4) Classification and joint optimization: Output the sentiment category through the classifier and calculate the classification loss and conditional entropy loss Optimize the overall objective function.
2. The multi-source domain adaptation emotion recognition method based on dual-stream representation according to claim 1 is characterized in that: The data enhancement and feature extraction described in step (1) are specifically as follows: a.1 Split the EEG signal into M blocks, randomly shuffle their order, and add random noise and scaling factors at each time step; Use strong enhancement and weak enhancement to generate strong views respectively and weak views a.2 uses three linear layers as feature extractors, adds batch normalization between each layer, uses RELU as the activation function, and extracts features according to the following formula: f2=RELU(BN(LN(f1))) (2) in, Indicates strong and weak views, represents the extracted view features, m∈{s,t}, n∈{S,W}; LN(·) represents the linear layer, BN(·) represents the normalization layer; a.3 The characteristics of strong and weak views and Connect into a representation matrix ci, calculate the similarity between different views, and get the contrast loss It is expressed as follows: in, represents the similarity between samples, k represents the number of samples, sim(u,v)=u T v / ||u||||v|| represents cosine similarity, represents the indicator function, and τ represents the temperature coefficient.
3. The multi-source domain adaptation emotion recognition method based on dual-stream representation according to claim 1 is characterized in that: The dual-stream representation fusion described in step (2) is specifically as follows: b.1 and Mapped into three matrices respectively: query matrix Q S and Q W , key matrix K S and K W , value matrix V S and V W ; It is expressed as follows: Among them, W Q , W K and W V Represents the weight matrix, which is used to and Projected to a d-dimensional tensor; b.2 In the in-view attention mechanism, Q n , K n and V n As the query matrix, key matrix and value matrix respectively, the normalization factor is introduced First aggregate Q n and K n , and then with V n Multiply them together to get the output representation In order to further obtain deep features, After another linear layer, and then with the input Perform residual connection to obtain the final output of the in-view attention mechanism in, Represents the characteristics of strong and weak views, represents attention, DP(·) represents the discard operation; b.3 In the inter-view attention mechanism, Q n As a query, K t and V t As key and value, an association is established between different views by exchanging the Q values of the two views: Among them, n∈{S,W}, t∈{S,W}-{n}; b.4 Perform single view fusion first and filter out the output of the attention mechanism within the view and the output of the inter-view attention mechanism Irrelevant information in: in, and denote the output of the intra-view attention mechanism and the output of the inter-view attention mechanism after filtering irrelevant information, W denotes the weight matrix, σ(·) denotes the sigmoid function, represents element-wise product; Will and Concatenate them and use a linear layer to obtain the enhanced feature representation Among them, Concat(·) represents the concatenation operation; Use the Softmax function to dynamically learn the weights between each view to obtain multi-view fusion:
4. The multi-source domain adaptation emotion recognition method based on dual-stream representation according to claim 1 is characterized in that: The multi-source domain adaptation described in step (3) is specifically as follows: c.1 z s and z t Concatenate into the representation matrix z i , calculate the subject distribution alignment loss c.2 Assign pseudo labels to target samples and align source subjects and target subjects The centroid of each category in , and the class-level feature distribution alignment loss is calculated Among them, X s and Y s represents the data and labels of the source domain, X t and represents the data and predicted labels of the target domain, and Respectively and The centroid of category k in , dist(u,v)=1-||u||||v|| represents the cosine distance, which is used to calculate the difference between the centroids.
5. The multi-source domain adaptation emotion recognition method based on dual-stream representation according to claim 1 is characterized in that: The classification and joint optimization described in step (4) are specifically as follows: d.1 Calculate the classification loss on the source domain using cross entropy loss Among them, (X s ,Y s ) represents the combination of data from all source subjects, K represents the number of classifications, represents the indicator function; Introduction The loss is used to enhance the inter-class discrimination of the target data, which is expressed as follows: d.2 The overall objective function is as follows, and the parameters are iteratively updated by optimizing formula (19): Among them, α, β and γ represent hyperparameters, ω sub and ω sem represents the dynamic weight used to determine the relevance of the mth subject; Here, a m (b m ) and a j (b j ) represents the fitness between the mth subject and the jth subject.
Citation Information
Cited By
Hybrid multi-source domain adaptive method and system for image sentiment classification
CN119006937A
