Emotion recognition method integrating interactive conversation context and speaker identity attributes
By combining interactive conversational context and conversational identity attributes, using a combined model of SimCSE and EmoNet, the problem of difficulty in capturing complex contexts and individual differences in the prior art is solved, achieving higher emotion recognition accuracy and applicability.
Patent Information
- Application Number
- CN202411328293.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-09-24
AI Technical Summary
Existing emotion computing technologies are difficult to accurately capture complex contexts and individual differences, especially in longer text and multi-person interaction scenarios, and traditional models are difficult to effectively deal with long-distance dependencies and the complexity of natural language.
A emotion recognition method that combines interactive conversational context and conversationalist identity attributes is proposed. By combining conversational context, participant identity attributes and advanced neural network model, using a combination of SimCSE and EmoNet, it generates emotional embedding features of the discourse, and deeply decomposes and learns through emotion encoder.
It significantly improves the accuracy and applicability of emotion recognition, especially in complex multi-person interaction scenarios, which can capture emotional fluctuations more accurately, enhance the model's ability to capture emotional diversity, and improve the stability and efficiency of model training.
Smart Images

Figure CN118839701B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of emotional computing technology, and in particular relates to an emotion recognition method integrating interactive conversation context and conversation participant identity attributes. Background Art
[0002] Affective computing technology is dedicated to identifying, understanding, processing and simulating human emotions through computer systems. Traditional affective computing technology mainly relies on basic emotional tags and simple text analysis, such as the classification of positive and negative emotions. However, this method often fails to accurately capture the complexity of the context and the differences in emotional expression of individuals in conversations.
[0003] Initial sentiment analysis techniques were usually based on predefined sentiment lexicons and basic natural language processing tools. These techniques use simple vocabulary matching and rule engines to determine the sentiment tendency of text (such as positive or negative). Although this approach is effective when processing simple texts, it ignores the ambiguity of language and sentiment changes in context, limiting its application effect in complex texts. With the development of machine learning and deep learning technologies, sentiment analysis methods have begun to adopt more complex algorithms, such as support vector machines (SVM), convolutional neural networks (CNN), and recurrent neural networks (RNN). These technologies are able to learn patterns of sentiment expression from large-scale data sets and improve the accuracy of sentiment classification. However, these models still have limitations in dealing with individual differences and fine-grained sentiment expressions. In recent years, researchers have begun to focus on the role of semantic context and conversation object attributes in sentiment analysis. Semantic context focuses on the relationship between words in the text and the overall sentence meaning, which helps to solve the ambiguity problem that a single word may bring. Conversation object attributes, such as the user's gender, age, cultural background, etc., are also used to personalize sentiment analysis to improve the accuracy of analysis for specific user groups. However, the above research also faces many technical problems: 1) In longer texts, the dependencies between the context may become complex, and traditional sentiment analysis models may have difficulty effectively capturing these long-distance dependencies. 2) Although semantic context helps solve the problem of polysemy, the complexity of natural language may still lead to ambiguity. For example, the same word may have completely different emotional meanings in different contexts. 3) Different users have a variety of attributes, and how to select and integrate these attributes to build an effective sentiment analysis model is a complex problem. In addition, the mutual influence between different attributes also needs to be considered.
[0004] Based on these background technologies, the present invention proposes a prompt-driven interactive conversation emotion recognition method. This method not only considers the lexical and syntactic information in the text, but also integrates the personal attributes of the dialogue participants to more accurately capture and understand emotional expressions. This method can better adapt to diverse communication scenarios such as online communication, customer service, and social media analysis by finely processing semantic information and individual differences. By providing more accurate and in-depth emotion understanding, the present invention is expected to promote the application and development of emotion computing technology in multiple fields such as business, health monitoring, and human-computer interaction. Summary of the invention
[0005] Purpose of the invention: The present invention provides an emotion recognition method that integrates interactive conversation context and conversation participant identity attributes. The emotion recognition method that combines conversation context, participant identity attributes and advanced neural network model significantly improves the accuracy and applicability of emotion recognition.
[0006] Technical solution: The emotion recognition method of the present invention that integrates interactive conversation context and conversation participant identity attributes specifically includes the following steps:
[0007] (1) Collect interactive conversation records involving multiple people, perform data cleaning, and build a conversation queue of participants ;
[0008] (2) Based on the participant conversation queue and identity attribute information, the dependency relationship between discourse and conversation attributes is modeled and a context-enhanced interactive discourse list is created. Then, a prompt-driven emotion template generator is constructed to generate personalized discourse expressions with enhanced emotion perception based on the content in the above discourse list. ;
[0009] (3) Make the words After numerical processing, the speech is obtained Digital representation of ; then Input the SimCSE model to get the sentiment embedding features of the sentence ;
[0010] (4) Construct the emotion encoder EmoNet, which includes a fully connected layer FC_1, a temporal perception module TAM, a normalization layer NL, a global average pooling layer AL, a fully connected layer FC_2, and a Logits layer; organize all the emotion embedding features e into batches of the same number, where the data of each batch is represented as , the corresponding sentiment label is , B represents the number of samples in a batch;
[0011] (5) Input each batch of data into the EmoNet network in turn, calculate the information entropy loss CE and regularized contrastive learning loss NSCL of each batch of data; merge the loss CE and NSCL into the hybrid contrastive learning loss HSCL, and train the EmoNet network;
[0012] (6) Use the trained EmoNet for sentiment classification. First, preprocess the new input data, then input it into the EmoNet network to obtain the prediction matrix output by the Logits layer, and use the argmax() function to select the corresponding category with the highest probability as the sentiment category of the new input data.
[0013] Furthermore, the real interactive conversation record in step (1) includes the speech, the conversation participant type, the conversation participant name and the conversation participant age.
[0014] Furthermore, the data cleaning described in step (1) includes removing a large amount of unstructured information in the conversation record, including voice, pictures, and emoticons; then deleting meaningless words and stop words, and correcting erroneous information; finally, adding an identifier after each sentence in the conversation as a marker for the end of the speech.
[0015] Furthermore, step (1) of constructing the participant conversation queue includes constructing a list of all interactive conversation utterances according to the order of the sentences in the interactive conversation. , where N is the number of utterances in the conversation; then define each utterance The speaker name is represented by ,in , is the set of names of all participants in the conversation; each utterance The speaker's gender is ,in, ; Then create a conversation queue for the i-th sentence , considering the emotional trend, in the list Perform 4 forward searches before the i-th sentence of At this time, the conversation queue of the i-th sentence ,in, The length of the queue is 5, and the queue uses a first-in-first-out method.
[0016] Furthermore, the implementation process of step (2) is as follows:
[0017] Context-enhanced interactive utterance lists, including definition of speaker age as ,in, , is the set of ages of all participants in the conversation; , , Speaker's name , Speaker gender , speaker age Merge to get a list of utterances containing interactive conversation context , the specific formula is as follows:
[0018] ;
[0019] Build a prompt-driven emotion template generator, including converting lists Enter the emotion template generator, then special tokens <mask>Act as a placeholder, then complete the emotional content to generate a discourse that is highly consistent with emotional logic , specifically:
[0020] .
[0021] Furthermore, it is characterized in that the implementation process of step (3) is as follows:
[0022] Numerical processing: transforming speech As a parameter passed to the tokenizer function in the transformer library, we get The word-level tokenized sequence of ,in yes The single word in the sequence N is mapped to a unique index in the vocabulary of the SimCSE model; then the symbols [CLS] and [SEP] are added before and after the sequence N, and the original text is finally Convert to a digital representation that the model can process , specifically:
[0023] ;
[0024] Obtain sentence embedding features: digital representation of discourse Input the SimCSE model and get Sentence embedding features , l is to obtain the sentence embedding feature: the digital representation of the discourse Input the SimCSE model and get Sentence embedding features , l is The number of elements in , d is the dimension of the feature vector output by the SimCSE model; then filter out the <mask>Labeled vector As discourse The sentiment embedding representation of .
[0025] Furthermore, the implementation process of step (4) is as follows:
[0026] First, define the input data of the emotion encoder EmoNet , b represents the number of samples in the batch, l is a vector The length of the sequence, d is the vector Dimensions of the matrix e Through the fully connected layer FC_1, its weight matrix is and the bias vector is , It is a custom parameter, and the output is obtained after the ReLU activation function , size is ; Then, output Through the timing-aware module TAM, the output remains the same size as ;then, and Add element by element to get mixed features , whose size is ; After regularized NL processing, the standardized output is obtained , size is ; Next, the standardized output The global average pooling layer AL performs global average pooling on the dimension l where the sequence length is located to obtain the global feature representation of each sample , whose size is ; Then, the global feature representation Through the fully connected layer FC_2, its weight matrix is and the bias vector is , after the ReLU activation function, the output is , whose size is ;at last, Through the Logits layer, its weight matrix is and the bias vector is , and get the final prediction matrix , whose size is , is the final number of sentiment categories; input matrix After processing each layer, the prediction matrix is finally obtained , whose size is ;
[0027] The temporal perception module TAM consists of a dilated causal convolutional layer, a regularization layer, a ReLU activation function layer, and a Dropout layer. First, through the dilated causal convolutional layer Encode the input sequence and introduce temporal correlation; then, the regularization layer The output is normalized to improve training stability; then, the ReLU activation function Add nonlinearity to enhance the model's ability to handle complexity; finally, the Dropout layer is applied to reduce overfitting; the whole process is expressed as:
[0028] ;
[0029] in, For the final module output, the same size as the input is maintained, ensuring that the module can effectively process time series data while maintaining the dimensional consistency of the data.
[0030] Furthermore, the implementation process of step (5) is as follows:
[0031] For the prediction matrix , the softmax() function converts the predicted value of each sample into a probability distribution; for the i-th sample, the probability of the j-th category is calculated as follows:
[0032] ;
[0033] For the input matrix , the corresponding true sentiment label matrix is , where the true category of each sample is represented by one-hot encoding, and the calculation formula of the loss function CE is:
[0034] ;
[0035] For each sample in the input matrix e ,and Samples belonging to the same category are positive samples, and other samples are negative samples. First, the scores of positive samples and negative samples are calculated respectively, and then the loss function NSCL is used to calculate the overall loss of samples in a training batch. The calculation formula is as follows:
[0036] ;
[0037] Among them, the function Representation calculation and The cosine similarity between them is used to quantify the similarity between sentiment embedding features; is a scalar parameter, ∈ R+; index i represents the matrix The i-th data in the set The samples in Belonging to the same category, it is called a positive sample; is with A set of negative samples belonging to different categories; represents the score of all positive samples, and Represents the fraction of all negative samples in a batch; is a non-negative small positive number; Representing a collection size;
[0038] According to the loss function Calculate the loss of each sample in a batch and obtain the loss vector After that, B represents the size of the batch, and the total loss of a batch is calculated as follows:
[0039] ;
[0040] in, Represents a very small positive number, which is used to prevent the denominator from being zero and ensure the stability of the calculation; is the indicator function, defined as:
[0041] ;
[0042] According to the calculated CE loss and regularization loss function HSCL, the hybrid contrastive learning loss function HSCL is calculated:
[0043] .
[0044] Furthermore, the emotion categories in step (6) include "neutral", "surprised", "fearful", "sad", "happy", "disgusted", and "angry".
[0045] Beneficial effects: Compared with the prior art, the present invention has the following beneficial effects:
[0046] Traditional emotion recognition methods usually rely on single text analysis or ignore the deep integration of conversation context, resulting in inaccurate emotion recognition or unrealistic contextual response. The present invention integrates interactive conversation context and participant identity attributes, not only analyzes text information, but also combines conversation context and interlocutor identity attributes to more accurately capture emotional fluctuations in conversations, especially in complex multi-person interactive scenarios, which can effectively improve the accuracy and applicability of emotion recognition. The present invention adopts the combination of SimCSE and EmoNet, uses the latest self-supervised learning model SimCSE to generate emotion embedding features of discourse, and then uses EmoNet to embed emotion features of discourse. Net emotion encoder for in-depth decomposition and learning. This combination takes advantage of the advantages of self-supervised learning and emotion encoding, can effectively extract deep-level emotion features from discourse, and brings a qualitative leap to the surface text analysis commonly seen in traditional methods; the present invention innovatively optimizes the learning process of the model by combining information entropy loss and contrastive learning loss, enhances the model's ability to capture emotional diversity, and improves the stability and efficiency of model training; in summary, the present invention significantly improves the accuracy and applicability of emotion recognition, especially in complex and changeable multi-person interactive dialogue scenarios, and has important value for the development of emotion recognition technology and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 is a flow chart of the present invention;
[0048] Figure 2 This is a schematic diagram of the network architecture of EmoNet;
[0049] Figure 3 This is the confusion matrix result of EmoNet for emotion recognition on the MELD dataset. DETAILED DESCRIPTION
[0050] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0051] like Figure 1 As shown, the present invention proposes an emotion recognition method integrating interactive conversation context and conversation participant identity attributes, which specifically includes the following steps:
[0052] Step 1: First, collect chat records from interactive conversations involving multiple people, then clean the data, and finally build a conversation queue.
[0053] Collect records of all interactive conversations involving multiple people, including all utterances, types of participants, names of participants, and ages of participants.
[0054] Perform data cleaning, including removing a large amount of unstructured information in the conversation records, such as voice, pictures, and emoticons. Then delete meaningless words and stop words, and correct erroneous information. Finally, add an identifier after each sentence in the conversation as a marker for the end of the speech;
[0055] An example of historical conversation information after data cleaning is given, as shown in Table 1.
[0056] Table 1 Historical conversation information
[0057] [Anna, 20, female]: Okay, great, that's it. Follow Vince. [Jack, 45, male]: Yeah, but Jason is really sensitive. [Anna, 20, female]: Yes, sensitivity is important, choose him. [Jack, 45, male]: Okay. [Anna, 20, female]: Oh, sure, go with that sissy. [Jack, 45, male]: Jason is not a sissy! [Jack, 45, male]: Oh no no no no no, I mean Chandler.
[0058] Table 1 is an example of a conversation involving multiple people, where the first row indicates that Anna, 20 years old, female, said: "Okay, good, that's it. Follow Vince."
[0059] Constructing a conversation queue, including constructing a list of all interactive conversation utterances based on the order of the sentences in the interactive conversation , where N is the number of all utterances in the conversation. According to Table 1, the utterance list is given Examples of: [Okay, fine, that's it. Go with Vince. Yeah, but Jason is really sensitive. Well, sensitivity is important, pick him. OK. Oh, sure, go with the sissy. Jason is not a sissy! Oh no no no no no, I mean Chandler. ] Then define each utterance The speaker name is represented by ,in , is the set of names of all participants in the conversation. According to Table 1, An example of is ["Anna", "Jack"]. Each utterance The speaker's gender is ,in Then create a conversation queue for the i-th sentence , considering the emotional trend, in the list Perform 4 forward searches before the i-th sentence of At this time, the conversation queue of the i-th sentence ,in The length of is 5, and the queue adopts the first-in-first-out method. According to Table 1, when , Examples are: [Yeah, but Jason is really sensitive. Well, sensitivity is important, pick him. OK. Oh, sure, go with the sissy. Jason is not a sissy!].
[0060] Step 2: Based on the participant conversation queue and identity attribute information, the dependency between utterances and conversation attributes is modeled and a context-enhanced interactive utterance list is created. Then, a prompt-driven emotion template generator is constructed to generate emotion-aware enhanced personalized utterance expressions based on the content in the above utterance list.
[0061] Context-enhanced interactive utterance lists, including definition of speaker age as ,in , is the set of ages of all participants in the conversation. According to Table 1, An example of is ["20", "45"]. , , Speaker's name , Speaker gender , speaker age Merge to get a list of utterances containing interactive conversation context According to Table 1, when , An example of is: [Yes, but Jason is really sensitive. Well, sensitivity is important, pick him. OK. Oh, sure, go with that sissy. Jason is not a sissy! , "Jack", "Male", "45", ""], the specific formula is as follows:
[0062]
[0063] Prompt-driven emotion template generator, including list Enter the emotion template generator, then special tokens <mask>Act as a placeholder, then complete the emotional content to generate a discourse that is highly consistent with emotional logic , specifically:
[0064]
[0065] According to Table 1, when , Examples are:
[0066] This session: Yes, but Jason is really sensitive. Well, sensitivity is important, pick him. OK. Oh, sure, go with the sissy. Jason is not a sissy! Make Jack, male, 45, feel <mask>.
[0067] Step 3: Translate the words After numerical processing, the speech is obtained Digital representation of Then Input the SimCSE model to get the sentence embedding features .
[0068] Numerical processing: transforming speech As a parameter passed to the tokenizer function in the transformer library, we get The word-level tokenized sequence of ,in yes A single word in is mapped to a unique index in the vocabulary of the SimCSE model. Then the symbols [CLS] and [SEP] are added before and after the sequence N, respectively, and the original text is finally Convert to a digital representation that the model can process , specifically:
[0069]
[0070] Obtain sentence embedding features: digital representation of discourse Input the SimCSE model and get Sentence embedding features , where l is The number of elements in is 128. d is the dimension of the feature vector output by the SimCSE model, which is 768. Then filter out the <mask>Labeled vector As discourse The sentiment embedding representation of .
[0071] Step 4: Figure 2 As shown in Figure 1, first, the EmoNet emotion encoder is constructed, including a fully connected layer FC_1, a temporal perception module TAM, a normalization layer NL, a global average pooling layer AL, a fully connected layer FC_2, and a Logits layer. Then, all the emotion embedding features e are organized into batches of the same number, where the data of each batch is represented as , the corresponding sentiment label is , B represents the number of samples in a batch.
[0072] EmoNet emotion encoder: First, define the input matrix of EmoNet , b represents the number of samples in the batch, l is a vector The length of the sequence, d is the vector Here b is 32, l is 128, and d is 768. First, the matrix Through the fully connected layer FC_1, its weight matrix is and the bias vector is , It is a custom parameter, which is set to 1536 here. After the ReLU activation function, the output is , size is Then, output Through the timing-aware module TAM, the output remains the same size as ;then, and Add element by element to get mixed features , whose size is ; After regularized NL processing, the standardized output is obtained , size is Next, the normalized output The global average pooling layer AL performs global average pooling on the dimension l where the sequence length is located to obtain the global feature representation of each sample , whose size is ; Then, the global feature representation Through the fully connected layer FC_2, its weight matrix is and the bias vector is , after the ReLU activation function, the output is , whose size is ;at last, Through the Logits layer, its weight matrix is and the bias vector is , and get the final prediction matrix , whose size is , is the final number of emotion categories, which is set to 7 here, namely: "neutral", "surprised", "fearful", "sad", "happy", "disgusted", "angry". Through these steps, the input matrix After processing each layer, the prediction matrix is finally obtained , whose size is .
[0073] TAM module: The time series perception module consists of a dilated causal convolution layer, a regularization layer, a ReLU activation function layer, and a Dropout layer. First, through the dilated causal convolution layer Encode the input sequence and introduce temporal correlation. Then, the regularization layer The output is normalized to improve training stability. Subsequently, the ReLU activation function Add nonlinearity to enhance the model's ability to handle complexity. Finally, the Dropout layer is applied to reduce overfitting. The whole process is expressed as:
[0074]
[0075] in, For the final module output, the same size as the input is maintained, ensuring that the module can effectively process time series data while maintaining the dimensional consistency of the data.
[0076] Step 5: Sequentially transfer each batch of data Input the EmoNet network and calculate the information entropy loss CE and the normalized contrastive learning loss NSCL (Normalized Supervised Contrasitive Learning) of each batch of data. Finally, the loss CE and NSCL are merged into the hybrid contrastive learning loss HSCL (Hybrid Supervised Contrasitive Learning) to train the EmoNet network.
[0077] Loss function CE: First, the prediction matrix is calculated by the softmax() function The probability distribution of , and then calculate its loss function CE. For the prediction matrix , the softmax() function converts the predicted value of each sample into a probability distribution; for the i-th sample, the probability of the j-th category is calculated as follows:
[0078]
[0079] For the input matrix , the corresponding true sentiment label matrix is , where the true category of each sample is represented by one-hot encoding, and the calculation formula of the loss function CE is:
[0080]
[0081] Regularized loss function NSCL: First, for each sample in the input matrix e ,and Samples belonging to the same category are all positive samples, and other samples are all negative samples. First, calculate the scores of positive samples and negative samples respectively, and then use the loss function NSCL to calculate the overall loss of samples in a training batch. The calculation formula is as follows:
[0082]
[0083] Among them, the function Representation calculation and The cosine similarity between them is used to quantify the similarity between sentiment embedding features; is a scalar parameter, ∈ R+; index i represents the matrix The i-th data in the set The samples in Belonging to the same category, it is called a positive sample; is with A set of negative samples belonging to different categories; represents the score of all positive samples, and Represents the fraction of all negative samples in a batch; is a non-negative small positive number; Representing a collection size.
[0084] According to the loss function Calculate the loss of each sample in a batch and obtain the loss vector After that, B represents the size of the batch, and the total loss of a batch is calculated as follows:
[0085]
[0086] in, Represents a very small positive number, which is used to prevent the denominator from being zero and ensure the stability of the calculation; is the indicator function, defined as:
[0087]
[0088] Hybrid contrastive learning loss function: Based on the calculated CE loss and regularization loss function HSCL, calculate the hybrid contrastive learning loss function HSCL:
[0089] .
[0090] Step 6: Use the trained EmoNet to perform sentiment classification. First, preprocess the newly input data through steps 1 to 3, then input the EmoNet network to obtain the probability distribution of each category in the Logits layer, and use the function argmax() to select the category with the highest probability as the category of the newly input data. Figure 3 The figure shows the confusion matrix result of EmoNet for emotion recognition on the MELD dataset, which clearly shows the correspondence between the prediction results of the classification model and the actual labels; through calculation, the weighted F1 Score of the model is 67.4%.< / mask> < / mask> < / mask> < / mask> < / mask>
Claims
1. An emotion recognition method integrating interactive conversation context and conversation participant identity attributes, characterized in that: The following steps are involved: (1) Collect interactive conversation records involving multiple participants, perform data cleaning, and build participant conversation queues (2) Based on the participant session queue and identity attribute information, modeling dependencies between utterances and conversational attributes, and creating context-enhanced interactive utterance lists; Then, a prompt-driven emotion template generator is constructed, which generates personalized utterance expressions R with enhanced emotion perception based on the content in the above utterance list. i ; (3) The discourse R i After numerical processing, we get the speech R i Digital representation of V i ; Then V i Input the SimCSE model to get the sentiment embedding feature E of the sentence i ; (4) Construct the emotion encoder EmoNet, which includes a fully connected layer FC_1, a temporal perception module TAM, a normalization layer NL, a global average pooling layer AL, a fully connected layer FC_2, and a Logits layer; organize all the emotion embedding features e into batches of the same number, where the data of each batch is represented by e = {e1, e2, …, e B }, the corresponding sentiment label is Y = {y1,y2,…,y B }, B represents the number of samples in a batch; (5) Input each batch of data e into the EmoNet network in turn, calculate the information entropy loss CE and regularized contrastive learning loss NSCL of each batch of data; merge the loss CE and NSCL into the hybrid contrastive learning loss HSCL, and train the EmoNet network; (6) Use the trained EmoNet to perform sentiment classification. First, preprocess the newly input data, then input it into the EmoNet network to obtain the prediction matrix output by the Logits layer, and use the argmax() function to select the corresponding category with the highest probability as the sentiment category of the newly input data. The implementation process of step (4) is as follows: First, define the input data of the emotion encoder EmoNet b represents the number of samples in the batch, l is the vector e i The length of the sequence, d is the vector e i The dimension of matrix e is ; the matrix e passes through the fully connected layer FC_1, and its weight matrix is and the bias vector is h is a custom parameter. After the ReLU activation function, the output is H1=ReLU(eW1+b1), with a size of Then, the output H1 passes through the timing-aware module TAM, and the output remains the same size as Next, H2 and H1 are added element by element to obtain the mixed feature H3, whose size is H3 is processed by regularization NL to obtain the standardized output H4 = LayerNorm (H3), with a size of Next, the standardized output H4 is globally averaged pooled in the dimension l where the sequence length is located through the global average pooling layer AL to obtain the global feature representation of each sample Its size is Then, the global feature representation H5 passes through the fully connected layer FC_2, whose weight matrix is W2∈R h×d and the bias vector is After the ReLU activation function, the output H6 = ReLU (H5W2 + b2) is obtained, and its size is Finally, H6 passes through the Logits layer, and its weight matrix is and the bias vector is Get the final prediction matrix Its size is cl is the final number of emotion categories; the input matrix e is processed by each layer and finally the prediction matrix is obtained Its size is R b×cl ; The temporal perception module TAM consists of a dilated causal convolutional layer, a regularization layer, a ReLU activation function layer, and a Dropout layer. First, the dilated causal convolutional layer f DCC (x) Encode the input sequence and introduce temporal correlation; then, the regularization layer f NL (x′) normalizes the output to improve training stability; then, the ReLU activation function f ReLU (x”) adds nonlinearity to enhance the model’s ability to handle complexity; finally, the Dropout layer f dropout (x”) is applied to reduce overfitting; the whole process is expressed as: H2=f Dropout (f ReLU (f NL (f DCC (H1)))) Among them, H2 is the final module output, which maintains the same size as the input, ensuring that the module effectively processes time series data while maintaining the dimensional consistency of the data.
2. The emotion recognition method integrating interactive conversation context and conversation participant identity attributes according to claim 1 is characterized in that: The interactive conversation record in step (1) includes the speech, the type of the speaker, the name of the speaker and the age of the speaker.
3. The emotion recognition method integrating interactive conversation context and conversation participant identity attributes according to claim 1 is characterized in that: The data cleaning described in step (1) includes removing a large amount of unstructured information in the conversation record, including voice, pictures, and emoticons; then deleting meaningless words and stop words, and correcting erroneous information; finally, adding an identifier after each sentence in the conversation as a marker for the end of the speech.
4. The emotion recognition method integrating interactive conversation context and conversation participant identity attributes according to claim 1, characterized in that: Step (1) of constructing the participant conversation queue includes constructing a list of all interactive conversations according to the order of the sentences in the interactive conversation. i =[u1,u2,…,u N ], where N is the number of all utterances in the conversation; then define each utterance u i The speaker's name is denoted as p(u i )=[p(u1),p(u2),…,p(u N )], where p(u i )∈P, P is the set of names of all participants in the conversation; each utterance u i The speaker's gender is g(u i )={g(u1),g(u2),…,g(u N )}, where g(u i )∈G, G=["male","female"]; then create a conversation queue for the i-th sentence Consider the emotional trend, in the list u i Perform 4 forward searches before the i-th sentence of At this time, the conversation queue of the i-th sentence in, The length of the queue is 5, and the queue uses a first-in-first-out method.
5. The emotion recognition method integrating interactive conversation context and conversation participant identity attributes according to claim 1, characterized in that: The implementation process of step (2) is as follows: Context-enhanced interactive utterance lists, including defining the speaker age as a(u i )={a(u1),a(u2),…,a(u N )}, where a(ui)∈A, A is the set of ages of all participants in the conversation; u i , speaker name p(u i ), speaker gender g(u i ), speaker age a(u i ) to obtain a list of utterances containing interactive conversation contexts The specific formula is as follows: Build a prompt-driven emotion template generator, including converting lists Enter the emotion template generator, then special tokens <mask>Acts as a placeholder, then completes the emotional content to generate a discourse R that is highly consistent with emotional logic i , specifically:< / mask> 6. The emotion recognition method integrating interactive conversation context and conversation participant identity attributes according to claim 1, characterized in that: The implementation process of step (3) is as follows: Numerical processing: convert the speech R i As a parameter, pass it into the tokenizer function in the transformer library to get R i The vocabulary-level tokenization sequence N = [token1, token2, …, token 126 ], where token1 is R i A single word in is mapped to a unique index in the vocabulary of the SimCSE model; Then add the symbols [CLS] and [SEP] before and after the sequence N, and finally convert the original text R i Converted into a digital representation V that the model can process i , specifically: V i =[[CLS],token1,token2,…,token 126 ,[SEP]]; Get sentence embedding features: digital representation of the discourse V i Input the SimCSE model and get V i Sentence embedding features l is V i The number of elements in , d is the dimension of the feature vector output by the SimCSE model; then filter out the <mask>Labeled vector e i As a discourse i The sentiment embedding representation of .< / mask> 7. The emotion recognition method integrating interactive conversation context and conversation participant identity attributes according to claim 1, characterized in that: The implementation process of step (5) is as follows: For the prediction matrix The softmax() function converts the predicted value of each sample into a probability distribution; for the i-th sample, the probability of the j-th category is calculated as follows: For the input matrix e, the corresponding true sentiment label matrix is The true category of each sample is represented by one-hot encoding, and the calculation formula of the loss function CE is: For each sample e in the input matrix e i , and e i Samples belonging to the same category are positive samples, and other samples are negative samples. First, the scores of positive samples and negative samples are calculated respectively, and then the loss function NSCL is used to calculate the overall loss of samples in a training batch. The calculation formula is as follows: Among them, the function Indicates the calculation of e i and e n The cosine similarity between them is used to quantify the similarity between sentiment embedding features; τ is a scalar parameter, τ∈R+; index i represents the i-th data in the matrix e; the samples in the set P(i) and e i Belonging to the same category, it is called a positive sample; e n is with e i A set of negative samples belonging to different categories; represents the score of all positive samples, and represents the fraction of all negative samples in a batch; ε is a non-negative small positive number; |P(i)| represents the size of the set P(i); According to the loss function Calculate the loss of each sample in a batch and obtain the loss vector L = [l1,l2,...,l B ]After that, B represents the size of the batch, and the total loss of a batch is calculated as follows: Among them, ∈ represents a small positive number, which is used to prevent the denominator from being zero and ensure the stability of the calculation; I >α (l) is the indicator function, defined as: According to the calculated CE loss and regularization loss function HSCL, the hybrid contrastive learning loss function HSCL is calculated:
8. The emotion recognition method integrating interactive conversation context and conversation participant identity attributes according to claim 1, characterized in that: The emotion categories in step (6) include "neutral", "surprised", "fearful", "sad", "happy", "disgusted", and "angry".
Citation Information
Patent Citations
Emotion dialogue generation method based on multi-resolution emotion and multi-type knowledge
CN114372135A
Multi-modal sentiment analysis model fusing sentiment resources
CN115577161A