Emotion recognition method and related device
By obtaining multiple reference modal matching features of the current sentence and its associated sentences, and combining the recognition task features to verify the emotion recognition results, the problem of low accuracy of emotion recognition in the existing technology is solved, and higher accuracy and robustness are achieved. Great sex.
Patent Information
- Application Number
- CN202410847010.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-10-29
AI Technical Summary
Existing emotion recognition technology has low accuracy and is difficult to achieve robustness in multi-modal information fusion and machine learning or deep learning methods.
By obtaining the modal features of multiple reference modal matches of the current sentence and its associated sentences, and combining the features of the first and second recognition tasks, the emotion recognition results are verified and the accuracy of emotion recognition is improved.
Through feature fusion of different recognition tasks, the accuracy of emotion recognition and task accuracy are improved, and the robustness of the emotion recognition model is enhanced.
Smart Images

Figure CN118862901A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of emotion recognition, and in particular to an emotion recognition method and related devices. Background Art
[0002] In the process of conversation, emotion recognition of sentences is a key technology, which helps to understand the emotional state of the speaker and thus communicate better. In recent years, with the development of artificial intelligence and natural language processing technology, emotion recognition technology mainly integrates information from one or more modalities and then uses machine learning or deep learning methods to perform a single emotion recognition task. This method results in low robustness of emotion recognition.
[0003] In view of this, how to propose an emotion recognition method with higher accuracy has become an urgent problem to be solved. Summary of the invention
[0004] The main technical problem solved by the present application is to provide an emotion recognition method and related devices, which can improve the accuracy of emotion recognition.
[0005] In order to solve the above technical problems, a technical solution adopted in the present application is: to provide an emotion recognition method, including: obtaining a current sentence and its corresponding associated sentences, determining the modal features of the current sentence matching multiple reference modalities; obtaining a first reference feature of the associated sentence matching a first recognition task, and a second reference feature matching a second recognition task, and based on the modal features of the current sentence, the first reference feature and the second reference feature, obtaining a first recognition feature of the current sentence matching the first recognition task, and a second recognition feature matching the second recognition task; wherein the first reference feature is the first recognition feature of the associated sentence, and the second reference feature is the second recognition feature of the associated sentence; based on the first recognition feature, obtaining the emotion category corresponding to the current sentence, and based on the second recognition feature, obtaining the emotion conversion information corresponding to the current sentence.
[0006] To solve the above technical problems, another technical solution adopted in the present application is: to provide an electronic device, comprising: a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the emotion recognition method mentioned in the above technical solution.
[0007] In order to solve the above technical problems, another technical solution adopted in the present application is: providing a computer-readable storage medium on which program instructions are stored, and when the program instructions are executed by a processor, the emotion recognition method mentioned in the above technical solution is implemented.
[0008] The beneficial effects of the present application are as follows: Different from the prior art, the emotion recognition method proposed in the present application obtains the modal features of the current sentence matching multiple reference modalities, and determines the first recognition feature of the current sentence matching the first recognition task and the second recognition feature of the current sentence matching the second recognition task based on the current sentence and its corresponding associated sentences. Thus, the accuracy of emotion recognition is improved by verifying the results obtained from different recognition tasks. In addition, the first recognition feature is integrated with some features of the execution process of the second recognition task, and the second recognition feature is integrated with some features of the execution process of the first recognition task, that is, by associating the first recognition task with the second recognition task, the accuracy of executing the first recognition task and the second recognition task is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0010] Figure 1 It is a flowchart of an embodiment of the emotion recognition method of the present application;
[0011] Figure 2 is a flowchart of step S101 corresponding to another implementation manner;
[0012] Figure 3 is a flowchart of step S101 corresponding to another implementation manner;
[0013] Figure 4 is a flowchart of an implementation method corresponding to step S102;
[0014] Figure 5 It is a structural schematic diagram of an embodiment of the emotion recognition model of the present application;
[0015] Figure 6 It is a flowchart of an implementation method of the emotion recognition model training method of the present application;
[0016] Figure 7 It is a structural schematic diagram of an embodiment of the electronic device of the present application;
[0017] Figure 8 It is a structural schematic diagram of an implementation method of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments, and different embodiments can be adaptively combined. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0019] See also Figure 1 , Figure 1 : is a flow chart of an embodiment of an emotion recognition method of the present application, the method comprising:
[0020] S101: Obtain a current sentence and its corresponding associated sentences, and determine modal features that match the current sentence with multiple reference modalities.
[0021] In one embodiment, conversation data of multiple speakers during a conversation is obtained, a current sentence is identified from the conversation data, and a related sentence corresponding to the current sentence is determined, wherein the conversation data is video data.
[0022] Specifically, the most recently recognized sentence in the conversation process is used as the current sentence. In addition, in response to each sentence in the conversation process corresponding to a timestamp, an associated sentence corresponding to the current sentence is determined according to the timestamp, that is, at least one sentence that is closer to the current sentence in the time dimension is used as the associated sentence.
[0023] Further, according to the determined current sentence, the modal content of each reference modality corresponding to the current sentence is extracted from the video data, and the modal content is feature extracted to obtain the corresponding initial features. According to the initial features, the modal features matching the current sentence and the corresponding reference modality are obtained.
[0024] In one implementation scenario, the above-mentioned multiple reference modalities include text modality, image modality and audio modality. The modality content corresponding to the text modality is text, which can be obtained by performing text recognition on the current sentence; the modality content corresponding to the image modality is the image frame corresponding to the current sentence in the video data; the modality content corresponding to the audio modality is the audio segment corresponding to the current sentence in the video data.
[0025] In another embodiment, the above-mentioned multiple reference modalities may also be parts of text modality, image modality and audio modality.
[0026] S102: Obtaining a first reference feature of the associated sentence matching the first recognition task and a second reference feature of the associated sentence matching the second recognition task, based on the modal feature of the current sentence, the first reference feature and the second reference feature, obtaining a first recognition feature of the current sentence matching the first recognition task and a second recognition feature of the current sentence matching the second recognition task. The first reference feature is the first recognition feature of the associated sentence, and the second reference feature is the second recognition feature of the associated sentence.
[0027] In one embodiment, a first reference feature of the associated sentence matching the first recognition task is obtained, and a second reference feature of the associated sentence matching the second recognition task is obtained.
[0028] Further, based on the modal feature, the first reference feature and the second reference feature of the current sentence, the first recognition feature and the second recognition feature corresponding to the current sentence are obtained, wherein the first recognition feature is integrated with some features during the execution of the second recognition task, and the second recognition feature is integrated with some features during the execution of the first recognition task.
[0029] S103: Based on the first recognition feature, obtain the emotion category corresponding to the current sentence, and based on the second recognition feature, obtain the emotion conversion information corresponding to the current sentence.
[0030] In one embodiment, a first recognition task is performed using a first recognition feature corresponding to the current sentence to obtain an emotion category corresponding to the current sentence, and a second recognition task is performed using second recognition features corresponding to the current sentence and the historical sentences of the speaker corresponding to the current sentence to obtain emotion conversion information corresponding to the current sentence.
[0031] In one implementation scenario, in response to a plurality of pre-set candidate emotion categories, a first similarity score between a current sentence and each candidate emotion category is calculated by using a first recognition feature, and the candidate emotion category corresponding to the largest first similarity score is used as the emotion category corresponding to the current sentence.
[0032] Furthermore, each sentence spoken by the speaker corresponding to the current sentence is matched with a timestamp, and the sentence corresponding to the timestamp closest to the timestamp of the current sentence is used as the historical sentence, that is, the previous sentence spoken by the speaker corresponding to the current sentence is used as the historical sentence. The second recognition feature of the current sentence is fused with the second recognition feature of the historical sentence to obtain a fused feature. In response to a plurality of candidate emotion conversion information being preset, the second similarity score between the fused feature and each candidate emotion conversion information is calculated, and the candidate emotion conversion information corresponding to the largest second similarity score is used as the emotion conversion information corresponding to the current sentence. The emotion conversion information is used to indicate the conversion of the emotion category when the speaker expresses the historical sentence and the current sentence.
[0033] The emotion recognition method proposed in the present application obtains the modal features of the current sentence matching multiple reference modalities, and determines the first recognition feature of the current sentence matching the first recognition task and the second recognition feature of the current sentence matching the second recognition task based on the current sentence and its corresponding associated sentences. Thus, the accuracy of emotion recognition is improved by using the results obtained from different recognition tasks for verification. In addition, the first recognition feature is integrated with some features of the execution process of the second recognition task, and the second recognition feature is integrated with some features of the execution process of the first recognition task, that is, by associating the first recognition task with the second recognition task, the accuracy of executing the first recognition task and the second recognition task is improved.
[0034] See also Figure 2 , Figure 2 1 is a flowchart of another embodiment of step S101. Specifically, the process of obtaining the current statement and its corresponding associated statement in step S101 includes:
[0035] S201: Acquire dialogue data between different speaking parties, and acquire a current sentence based on the dialogue data.
[0036] In one embodiment, conversation data of multiple speakers during a conversation is obtained, a current sentence is identified from the conversation data, and a speaker and a timestamp corresponding to the current sentence are determined. The speaker corresponding to the current sentence is determined based on the timbre, and the timestamp corresponding to the current sentence can be determined based on the start time or end time of the corresponding speaker expressing the current sentence.
[0037] S202: Based on the speaker of the current sentence and the timestamp of the current sentence, a first related sentence and a second related sentence are obtained, and the first related sentence and the second related sentence are used as associated sentences. The first related sentence and the current sentence belong to the same speaker, the second related sentence and the current sentence belong to different speakers, and the timestamp of the second related sentence is between the timestamp of the current sentence and the timestamp of the first related sentence.
[0038] In one embodiment, at least one first related sentence is selected from a plurality of dialogue sentences before the current sentence, and the first related sentence and the current sentence belong to the same speaker. And, according to the corresponding timestamp, the dialogue sentence between the first related sentence and the current sentence is used as the second related sentence. The first related sentence and the second related sentence are used as associated sentences.
[0039] In a specific application scenario, the sentences spoken by multiple speakers are sorted in the order of timestamps to obtain a sentence sequence {X1, Y1, X2, Y2, Y3, X3}, where sentence X3 is the current sentence, sentences X1, X2 and X3 belong to the first speaker, and sentences Y1, Y2 and Y3 belong to the second speaker. Then, sentence X2 is used as the first related sentence, and sentences Y2 and Y3 are used as the second related sentences to obtain the associated sentences corresponding to the current sentence.
[0040] The above scheme selects the first related sentence and the second related sentence as associated sentences, so that when performing emotion recognition of the current sentence, the related sentences of different speakers are combined, thereby improving the recognition accuracy.
[0041] See also Figure 3 , Figure 3 is a flowchart corresponding to another implementation of step S101. Specifically, the process of determining the modal features of the current sentence matching multiple reference modalities in step S101 includes:
[0042] S301: Obtain initial features of the current sentence matching the reference modality.
[0043] In one implementation, based on the determined current sentence, the modal content of each reference modality corresponding to the current sentence is extracted from the video data, and feature extraction is performed on the modal content to obtain corresponding initial features.
[0044] In a specific application scenario, multiple reference modalities include text modality, image modality, and audio modality. The modal content corresponding to the text modality is text, which can be obtained by performing text recognition on the current sentence. The corresponding initial features are obtained by performing feature extraction on the modal content corresponding to the text modality; similarly, feature extraction is performed on the modal content corresponding to the image modality and the modal content corresponding to the audio modality to obtain the corresponding initial features.
[0045] S302: Based on the initial features and the modal features of the associated sentences matching the reference modality, obtain reference features matching the reference modality.
[0046] In one embodiment, based on the initial features matching the reference modality, reference personality features matching the current sentence with multiple candidate personalities are obtained. Based on the reference personality features and the modality features matching the associated sentence with each reference modality, corresponding reference features are obtained.
[0047] Specifically, the initial modality of the current sentence matching each reference modality is input into the personality model, so that the personality model outputs the reference personality features of the current sentence matching multiple candidate personalities. For each associated sentence, the reference personality features corresponding to the associated sentence are obtained, and the attention score corresponding to each reference modality is determined based on the reference personality features corresponding to the current sentence and the associated sentence. Furthermore, for each reference modality, the corresponding reference feature is obtained based on the modality features corresponding to the associated sentence and the corresponding attention score.
[0048] In one implementation scenario, the specific calculation formula of the reference feature is as follows:
[0049]
[0050] in, represents the attention score corresponding to the reference modality ξ, represents the weight vector, p i represents the reference personality trait corresponding to the current sentence i, p j Indicates the reference personality traits corresponding to the associated sentence, represents the reference feature corresponding to the reference modality ξ, represents the modal feature matching the associated sentence j with the reference modality ξ, Indicates an adjustable parameter.
[0051] In a specific application scenario, the above multiple candidate personalities include openness, conscientiousness, introversion, agreeableness, and emotional stability. That is, the reference personality trait p of the current sentence in the above formula is i Including features corresponding to the above five candidate personalities. In addition, the process of using the personality model to obtain reference personality features that match the current sentence with multiple candidate personalities can refer to the prior art and will not be elaborated in detail here.
[0052] S303: Based on all reference features, obtain the modal features that match the current sentence with each reference modality.
[0053] In one embodiment, for each reference modality, reference features of all associated sentences corresponding to the current sentence are fused to obtain modality features matching the current sentence with each reference modality.
[0054] The specific calculation formula is as follows:
[0055]
[0056] in, Represents the modal features that match the current sentence i with the reference modality ξ.
[0057] The above scheme improves the richness of the modal features of the current sentence by combining the personality characteristics of the speaker corresponding to the current sentence, so as to help improve the accuracy of subsequent emotion recognition.
[0058] See also Figure 4 , Figure 4 is a flow chart of an implementation method corresponding to step S102. Specifically, the implementation process of step S102 includes:
[0059] S401: Based on the modal features corresponding to the current sentence, a first processing feature matching the first recognition task and a second processing feature matching the second recognition task are obtained.
[0060] In one embodiment, in order to improve the accuracy of the subsequent execution of the first recognition task and the second recognition task, after obtaining the modal features that match the current sentence with each reference modality, each modal feature corresponding to the current sentence is processed to obtain a first processing feature that matches each reference modality and a second processing feature that matches each reference modality. The first processing feature is used to perform the first recognition task, and the second processing feature is used to perform the second recognition task.
[0061] Specifically, the process of processing the modal features includes mapping the modal features to the target dimension first, thereby extracting features related to the first recognition task as the first processing features, and extracting the modal features under the target dimension to obtain features related to the second recognition task as the second processing features.
[0062] In one implementation scenario, see Figure 5 , Figure 5 It is a structural diagram of an embodiment of the emotion recognition model of the present application. The emotion recognition method proposed in the present application is implemented by using the emotion recognition model, which includes a first recognition network 10 and a second recognition network 20. The modal features corresponding to the current sentence are input into the above-mentioned first recognition network 10, so as to process the modal features using the first recognition network 10, and obtain a first processing feature matching each reference modality. And, the modal features corresponding to the current sentence are input into the above-mentioned second recognition network 20, so as to process the modal features using the second recognition network 20, and obtain a second processing feature matching each reference modality.
[0063] In addition, it should be noted that Figure 5 Only part of the structure of the emotion recognition model is schematically drawn. However, in actual applications, the emotion recognition model also includes a modal feature extraction network, which is used to determine the modal features that match the current sentence with multiple reference modalities. The specific determination process can refer to the corresponding implementation method above.
[0064] In a specific application scenario, when the multiple reference modalities include an audio modality a, an image modality v, and a text modality t, the modality feature corresponding to each reference modality is input into the first recognition network 10 to obtain a first processing feature matching the audio modality a. The first processed feature matched to the image modality v and the first processed feature matching the text modality t Similarly, by inputting the modal features corresponding to each reference modality into the second recognition network 20, a second processing feature matching the audio modality a is obtained. The second processed feature matched to the image modality v and the second processing feature matching the text modality t
[0065] In another embodiment, the process of processing the modal features can also be to preferentially concatenate the modal features corresponding to the current sentence with the corresponding supplementary features to obtain concatenated features, and extract the concatenated features to obtain first processing features related to the first recognition task and second processing features related to the second recognition task. Each reference modality is matched with a supplementary feature, and the supplementary feature is obtained based on the initial features of the current sentence and the initial features of the associated sentence.
[0066] In one implementation scenario, the supplementary features are obtained by inputting the initial features of the current sentence matching each reference modality and the initial features of the associated sentence matching each reference modality into a pre-built encoder for encoding. The encoder includes GRU (Gate Recurrent Unit) and FC (Fully Connected Layers).
[0067] S402: Based on the second processing feature, obtain a first associated feature for a first recognition task, and based on the first processing feature, obtain a second associated feature for a second recognition task.
[0068] In one embodiment, to achieve association between different recognition tasks, the attention mechanism is used to extract the second processing feature to obtain the first associated feature for the first recognition task. Similarly, the attention mechanism is used to extract the first processing feature to obtain the second associated feature for the second recognition task.
[0069] Specifically, taking any reference modality as the target modality, the first associated feature matching the target modality is extracted, and the first associated feature matching the target modality is used for the first recognition task. Also, the second associated feature matching the target modality is extracted, and the second associated feature matching the target modality is used for the first recognition task.
[0070] In one implementation scenario, the second processed feature matching the target modality is input into the first recognition network 10 to obtain the first associated feature related to the first recognition task, and the first processed feature matching the target modality is input into the second recognition network 20 to obtain the second associated feature related to the second recognition task.
[0071] In a specific implementation scenario, please continue to refer to Figure 5 , in response to the target modality being the audio modality a, the second processing feature corresponding to the current sentence m is Input to the first recognition network 10, so that the first recognition network 10 uses the attention mechanism to extract the corresponding first associated features. And the first processing feature corresponding to the audio modality a The information is input to the second recognition network 20 so that the second recognition network 20 extracts the corresponding second correlation feature.
[0072] It should be noted that the target mode may be any reference mode, that is, through the above process, the first associated feature and the second associated feature matching each reference mode can be obtained.
[0073] S403: Acquire a first recognition feature of the current sentence based on the first processing feature, the first association feature, and the first reference feature.
[0074] In one embodiment, in response to the target modality being any reference modality, a first identification feature matching the target modality is obtained based on a first processing feature matching the target modality, a first association feature matching the target modality, a first processing feature matching the reference modality, and a first reference feature matching the target modality.
[0075] In one implementation scenario, a first processing feature matching the target modality, a first association feature matching the target modality, a first processing feature matching the reference modality, and a first reference feature matching the target modality are input into a first fusion subnetwork in a first recognition network 10 to obtain a first recognition feature matching the target modality.
[0076] Specifically, for the input first processing feature that matches the target modality, the first fusion sub-network uses the attention mechanism to extract corresponding features from the first associated feature that matches the target modality, the first processing feature that matches the reference modality, and the first reference feature that matches the target modality, and the first fusion sub-network fuses the extracted features to obtain the first recognition feature that matches the current sentence with the target modality. This method fuses the first processing feature of the current sentence in the target modality with the first reference feature of the associated sentence, fuses the first processing feature of the current sentence that matches the target modality with the first processing feature in other reference modalities, and fuses the first processing feature of the current sentence in the target modality with the first associated feature obtained through another recognition task, so that the accuracy of the subsequent first recognition task is higher when the first recognition feature is obtained.
[0077] The specific calculation formula of the first identification feature is as follows:
[0078]
[0079] in, express and The attention score between them, i represents the current sentence, j represents the related sentence, ψ represents the first recognition task in this embodiment, es represents the second recognition task, represents the parameterized weight vector, Indicates an adjustable parameter.
[0080] In a specific application scenario, please continue to refer to Figure 5 In response to the current sentence m corresponding to the associated sentence n1, the associated sentence n2 and the associated sentence n3, for the audio modality a, the first recognition network 10 matches the first reference feature of the audio modality a to each of the above associated sentences and Extraction is performed to obtain the corresponding first extraction feature; and the first recognition network 10 processes the first processing feature corresponding to the audio mode a The first processed feature matched to the image modality v and the first processed feature matching the text modality t Extract them respectively to obtain the second extracted features matching the image modality v and the text modality t, and extract the first processed features corresponding to the audio modality a. The first associated feature, the first extracted feature and the second extracted feature are fused to obtain the first recognition feature of the current sentence m matching the audio modality a
[0081] It should be noted that, in response to the target modality being any reference modality, the first recognition feature corresponding to each reference modality can be obtained through the above steps. Among them, the first recognition feature corresponding to each reference modality not only integrates the first processing feature of the current sentence matching other reference modalities, but also integrates the first reference feature of the associated sentence in the corresponding reference modality, and the first associated feature obtained from the second processing feature used for the second recognition task. The first recognition feature obtained by the above scheme helps to improve the accuracy of performing the first recognition task.
[0082] In another embodiment, in order to further enrich the amount of information contained in the first recognition feature, the first associated feature matching all reference modalities, the first processing feature matching the reference modality, and the first reference feature matching all reference modalities can also be used as candidate features, and the candidate features are input into the first fusion subnetwork in the first recognition network 10, so that the first fusion subnetwork extracts corresponding extracted features from the candidate features according to the first processing feature matching the current sentence with the target modality, and obtains the first recognition feature matching the target modality by fusing the first processing feature matching the current sentence with the target modality with the extracted feature.
[0083] S404: Acquire a second recognition feature of the current sentence based on the second processing feature, the second association feature and the first reference feature.
[0084] In one embodiment, in response to the target modality being any reference modality, a second identification feature matching the target modality is obtained based on a second processing feature matching the target modality, a second association feature matching the target modality, a second processing feature matching the reference modality, and a second reference feature matching the target modality.
[0085] In one implementation scenario, the second processing feature matching the target modality, the second association feature matching the target modality, the second processing feature matching the reference modality, and the second reference feature matching the target modality are input into the second fusion subnetwork in the second recognition network 20 to obtain the second recognition feature matching the target modality. The specific implementation process can refer to the corresponding implementation method above, which will not be repeated here.
[0086] It should be noted that, in practical applications, the above step S403 and step S404 may be executed simultaneously.
[0087] In another embodiment, in response to obtaining the first recognition feature and the second recognition feature corresponding to the current sentence and each reference modality through the above corresponding embodiments, the first recognition feature corresponding to the current sentence and each reference modality is input into the first classification network in the first recognition network 10, so that the first classification network predicts the emotion category corresponding to the current sentence according to the first recognition feature. And, the second recognition feature corresponding to the current sentence and each reference modality is input into the second classification network in the second recognition network 20, so that the second classification network predicts the emotion conversion information corresponding to the current sentence according to the second recognition feature.
[0088] Specifically, the first classification network fuses the first recognition features of the current sentence matching multiple reference modalities to obtain a first target feature, and determines the emotion category corresponding to the current sentence from multiple candidate emotion categories through the first target feature. And, the second classification network fuses the second recognition features of the current sentence matching multiple reference modalities to obtain a second target feature, and predicts the emotion conversion information corresponding to the current sentence based on the second target feature.
[0089] The above scheme obtains the corresponding emotion category by performing the first recognition task on the current sentence, and obtains the corresponding emotion conversion information by performing the second recognition task on the current sentence, so that the recognition results obtained by different recognition tasks form a reference basis, which is helpful to detect the accuracy of recognition.
[0090] See also Figure 6 , Figure 6 This is a flow chart of an embodiment of the emotion recognition model training method of the present application. Specifically, the training method includes:
[0091] S501: Acquire a reference training sample, and construct a corresponding comparative training sample based on the reference training sample; wherein the reference training sample includes a corresponding reference training label, and the reference training label includes emotion conversion information of the corresponding reference training sample.
[0092] In one embodiment, a plurality of reference training samples are obtained, wherein each reference training sample includes a corresponding reference training label, and the reference training label may be obtained by annotation by relevant technical personnel, and the reference training label includes emotion conversion information corresponding to the reference training sample.
[0093] Furthermore, a plurality of comparative training samples are obtained so that sample pairs can be subsequently constructed according to the comparative training samples and reference training samples for comparative learning.
[0094] S502: Obtain predicted training labels of comparative training samples, and obtain comparative loss of the emotion recognition model based on reference training labels corresponding to reference training samples and predicted training labels corresponding to comparative training samples.
[0095] In one embodiment, the reference training sample and the comparative training sample are respectively input into the emotion recognition model, so as to obtain the second recognition features respectively corresponding to the reference training sample and the comparative training sample by using the second recognition network.
[0096] Furthermore, according to the similarity between the second identification features respectively corresponding to the reference training sample and the comparison training sample, the predicted training label corresponding to the comparison training sample is determined.
[0097] Furthermore, based on the reference training sample and the comparison training sample, multiple sample pairs are constructed, and a pseudo label matching each sample pair is determined. The pseudo label is obtained based on the reference training label of the reference training sample and the predicted training label of the comparison training sample in the corresponding sample pair; in response to the reference training label and the predicted training label respectively containing the emotion conversion information of the corresponding training sample, the pseudo label is used to characterize the consistency relationship between the corresponding reference training sample and the comparison training sample. For example, when the reference training label of the reference training sample is<sad,happy> , and the predicted training labels of the matched contrast training samples are<sad,neutral> , then the reference training sample and the comparison training sample are given a pseudo label that is consistent with the previous label.
[0098] It should be noted that the rules for constructing sample pairs can be determined by obtaining specified instructions from relevant technical personnel, and the specified instructions include the consistency of front and back labels, the opposite front and back labels, the consistency of front labels and the consistency of back labels, etc.
[0099] Furthermore, the contrast loss is calculated based on the pseudo labels of the sample pairs using a predetermined loss function. The specific calculation formula of the contrast loss is as follows:
[0100]
[0101] Among them, L1 represents the contrast loss, represents the number of sample pairs, o i,λ and i+1,λ represents a set of sample pairs, 1 [i≠j] ∈(0,1) represents the indicator function, Also represents the indicator function, β j Represents the weight value, z i Indicates [o i,λ ∥o i+1,λ ]’s pseudo-label; express Based on [o i,λ ∥o i+1,λ ]and It is determined by the cosine similarity between them, and τ is an adjustable parameter.
[0102] S503: Adjusting parameters in the emotion recognition model based on contrast loss until a preset convergence condition is met.
[0103] In one embodiment, in response to the reference training labels corresponding to the multiple reference training samples containing emotion categories and emotion conversion information, the multiple reference training samples are input into a first recognition network in an emotion recognition model to obtain a first recognition result, and a first loss is calculated based on the first recognition result and the emotion categories in the reference training labels; and the multiple reference training samples are input into a second recognition network in the emotion recognition model to obtain a second recognition result, and a second loss is calculated based on the second recognition result and the emotion conversion information in the reference training labels.
[0104] Furthermore, the sum of the first loss, the second loss and the above-mentioned contrast loss is taken as the total loss of the emotion recognition model, and the total loss is used to adjust the parameters in the emotion recognition model until the model converges or reaches a preset training round, and the training is stopped to obtain the trained emotion recognition model.
[0105] See also Figure 7 , Figure 7 : is a structural diagram of an embodiment of an electronic device of the present application. The electronic device comprises: a memory 30 and a processor 40 coupled to each other. The memory 30 stores program instructions, and the processor 40 is used to execute the program instructions to implement the emotion recognition method mentioned in any of the above embodiments. Specifically, the electronic device includes but is not limited to: a desktop computer, a laptop computer, a tablet computer, a server, etc., which are not limited here. In addition, the processor 40 can also be called a CPU (Center Processing Unit). The processor 40 may be an integrated circuit chip with signal processing capabilities. The processor 40 may also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. In addition, the processor 40 may be implemented by an integrated circuit chip.
[0106] See also Figure 8 , Figure 8It is a structural diagram of an embodiment of a computer-readable storage medium of the present application. The computer-readable storage medium 50 stores program instructions 60 that can be executed by a processor. When the program instructions 60 are executed by the processor, the emotion recognition method mentioned in any of the above embodiments is implemented.
[0107] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0108] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0109] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0110] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0111] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An emotion recognition method, characterized in that: include: Acquire a current sentence and its corresponding associated sentences, and determine modal features of the current sentence that match multiple reference modalities; Acquire a first reference feature of the associated sentence that matches a first recognition task, and a second reference feature that matches a second recognition task, and acquire a first recognition feature of the current sentence that matches the first recognition task, and a second recognition feature that matches the second recognition task based on the modal feature of the current sentence, the first reference feature, and the second reference feature; wherein the first reference feature is the first recognition feature of the associated sentence, and the second reference feature is the second recognition feature of the associated sentence; Based on the first recognition feature, the emotion category corresponding to the current sentence is obtained, and based on the second recognition feature, the emotion conversion information corresponding to the current sentence is obtained.
2. The method according to claim 1, characterized in that: The step of acquiring, based on the modal feature of the current sentence, the first reference feature, and the second reference feature, a first recognition feature of the current sentence that matches the first recognition task and a second recognition feature that matches the second recognition task comprises: Based on the modal feature corresponding to the current sentence, obtaining a first processing feature matching the first recognition task and a second processing feature matching the second recognition task; Based on the second processing feature, obtaining a first associated feature for the first recognition task, and based on the first processing feature, obtaining a second associated feature for the second recognition task; Based on the first processing feature, the first association feature and the first reference feature, obtaining a first recognition feature of the current sentence; and, A second recognition feature of the current sentence is acquired based on the second processing feature, the second association feature, and the second reference feature.
3. The method according to claim 2, characterized in that The method is implemented using an emotion recognition model, the emotion recognition model includes a first recognition network and a second recognition network, when any of the reference modalities is a target modality, obtaining a first associated feature for the first recognition task based on the second processing feature, and obtaining a second associated feature for the second recognition task based on the first processing feature, including: The second processing feature matching the target modality is input into the first recognition network to obtain the first associated feature related to the first recognition task, and the first processing feature matching the target modality is input into the second recognition network to obtain the second associated feature related to the second recognition task.
4. The method according to claim 3, characterized in that The acquiring the first recognition feature of the current sentence based on the first processing feature, the first association feature and the first reference feature includes: Inputting a first processing feature matching the target modality, a first association feature matching the target modality, a first processing feature matching the reference modality, and a first reference feature matching the target modality into a first fusion subnetwork in the first recognition network to obtain a first recognition feature matching the target modality; The acquiring the second recognition feature of the current sentence based on the second processing feature, the second association feature and the second reference feature includes: A second processing feature matching the target modality, a second association feature matching the target modality, a second processing feature matching the reference modality, and a second reference feature matching the target modality are input into a second fusion subnetwork in the second recognition network to obtain a second recognition feature matching the target modality.
5. The method according to claim 3, characterized in that: The training process of the emotion recognition model includes: Acquire a reference training sample, and construct a corresponding comparative training sample based on the reference training sample; wherein the reference training sample includes a corresponding reference training label, and the reference training label includes emotion conversion information corresponding to the reference training sample; Obtaining the predicted training label of the comparison training sample, and obtaining the contrast loss of the emotion recognition model based on the reference training label corresponding to the reference training sample and the predicted training label corresponding to the comparison training sample; Parameters in the emotion recognition model are adjusted based on the contrast loss until a preset convergence condition is met.
6. The method according to claim 1, characterized in that The obtaining of the current statement and its corresponding associated statements includes: Acquire dialogue data between different speaking objects, and acquire the current sentence based on the dialogue data; Based on the speaking object described in the current sentence and the timestamp of the current sentence, a first related sentence and a second related sentence are obtained, and the first related sentence and the second related sentence are used as the associated sentences; wherein the first related sentence and the current sentence belong to the same speaking object, the second related sentence and the current sentence belong to different speaking objects, and the timestamp of the second related sentence is between the timestamp of the current sentence and the timestamp of the first related sentence.
7. The method according to claim 1, characterized in that The determining of the modal features of the current sentence matching the multiple reference modalities includes: Acquire initial features of the current sentence matching the reference modality; Based on the initial feature and the modal feature of the associated sentence matching the reference modality, obtaining a reference feature matching the reference modality; Based on all the reference features, a modality feature matching the current sentence with each of the reference modalities is obtained.
8. The method according to claim 7, characterized in that The acquiring, based on the initial feature and the modal feature of the associated sentence matching the reference modality, a reference feature matching the reference modality, comprises: Based on the initial features matched with the reference modality, obtaining reference personality features matching the current sentence with a plurality of candidate personalities; Based on the reference personality features and the modality features of the associated sentences matching each of the reference modalities, the corresponding reference features are acquired.
9. An electronic device, characterized in that: include: A memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the emotion recognition method according to any one of claims 1-8.
10. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the emotion recognition method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Dialogue emotion recognition method combining character clues and emotion uncertainty
CN120277215A
