Emotion recognition model training, voice interaction method, device, equipment and medium

By iteratively updating the parameters of the emotion recognition model, combining the sample output vector and the classification output vector, the problem of low accuracy of emotion recognition in the prior art is solved, and more efficient and more accurate emotion recognition model training is achieved.

CN114120978BActive Publication Date: 2025-04-25CHINA PING AN LIFE INSURANCE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111432654.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-29
Publication Date
2025-04-25
Estimated Expiration
2041-11-29

AI Technical Summary

Technical Problem

In the prior art, the accuracy of emotion recognition is low, mainly because emotion recognition is subjective, and different data will affect the model training results.

Method used

By obtaining the text set to be identified, input it into the preset recognition model, determining the sample output vector and the classification output vector, combining the sample emotion label and the predicted emotion label, calculating the predicted loss value, and iteratively update the model parameters until the convergence condition is reached, forming a high-accurate emotion recognition model.

Benefits of technology

The training efficiency and accuracy of the emotion recognition model are improved, and the accuracy of emotion level prediction is improved by learning the characteristics of emotion categories.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114120978B_ABST
    Figure CN114120978B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence technology, and discloses an emotion recognition model training, voice interaction method, device, equipment and medium. The method inputs a text to be recognized into a preset recognition model, determines a sample output vector through the preset recognition model; determines a classification output vector and a predicted emotion label according to the sample output vector through the preset recognition model; determines a predicted emotion level label according to the sample output vector and the classification output vector through the preset recognition model; determines a predicted emotion level label according to the sample output vector and the classification output vector through the preset recognition model; determines a predicted loss value of the preset recognition model according to the sample emotion label, the predicted emotion label, the sample emotion level label and the predicted emotion level label; when the predicted loss value does not reach a preset convergence condition, iteratively updates the initial parameters in the preset recognition model until the predicted loss value reaches the convergence condition, and records the preset recognition model after convergence as the emotion recognition model. The present invention improves the training efficiency and accuracy of the emotion recognition model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of prediction model technology, and in particular to an emotion recognition model training, voice interaction method, device, equipment and medium. Background Art

[0002] With the development of artificial intelligence technology, emotion recognition has become a very interesting and popular research issue in natural language processing. For example, in the scenario of human-computer interaction, it is often necessary to adjust the machine's interaction method according to the current emotion of the person, such as the language and action of the reply.

[0003] In the prior art, emotion recognition is often carried out by mining emotions in texts through machine learning and deep learning methods. However, emotion recognition is often subjective, that is, different data used to train machine learning models or deep learning models will affect the results of emotion recognition, thereby resulting in a low accuracy rate of the final emotion recognition results. Summary of the invention

[0004] The embodiments of the present invention provide an emotion recognition model training, voice interaction method, device, equipment and medium to solve the problem of low emotion recognition accuracy in the prior art.

[0005] An emotion recognition model training method, comprising:

[0006] Obtain a set of texts to be recognized; the set of texts to be recognized contains at least one text to be recognized; wherein one of the texts to be recognized is associated with a sample emotion label and a sample emotion level label;

[0007] Inputting the text to be recognized into a preset recognition model including initial parameters, so as to determine a sample output vector corresponding to the text to be recognized through the preset recognition model;

[0008] Determine, by means of the preset recognition model, a classification output vector corresponding to the text to be recognized and a predicted emotion label according to the sample output vector;

[0009] Determining a predicted emotion level label corresponding to the text to be recognized by the preset recognition model according to the sample output vector and the classification output vector;

[0010] Determining a prediction loss value of the preset recognition model according to the sample emotion label, the predicted emotion label, the sample emotion level label, and the predicted emotion level label;

[0011] When the predicted loss value does not reach the preset convergence condition, the initial parameters in the preset recognition model are iteratively updated until the predicted loss value reaches the convergence condition, and the preset recognition model after convergence is recorded as the emotion recognition model.

[0012] A voice interaction method, comprising:

[0013] Acquire target voice data of a target user, and perform voice recognition on the target voice data to obtain a target text corresponding to the target voice data;

[0014] Inputting the target text into an emotion recognition model to perform emotion recognition on the target text through the emotion recognition model to obtain an emotion recognition result and an emotion level result corresponding to the target text; the emotion recognition model is obtained according to the above-mentioned emotion recognition model training method;

[0015] According to the target text, the emotion recognition result and the emotion level result, reply voice data is generated, and the reply voice data is sent to the target user.

[0016] An emotion recognition model training device, comprising:

[0017] The module for acquiring texts to be recognized is used to acquire a set of texts to be recognized; the set of texts to be recognized contains at least one text to be recognized; wherein one text to be recognized is associated with a sample emotion label and a sample emotion level label;

[0018] A text processing module, used for inputting the text to be recognized into a preset recognition model including initial parameters, so as to determine a sample output vector corresponding to the text to be recognized through the preset recognition model;

[0019] An emotion prediction module, used to determine a classification output vector corresponding to the text to be recognized and a predicted emotion label according to the sample output vector through the preset recognition model;

[0020] An emotion level prediction module, used to determine a predicted emotion level label corresponding to the text to be recognized according to the sample output vector and the classification output vector through the preset recognition model;

[0021] A loss determination module, used to determine the predicted loss value of the preset recognition model according to the sample emotion label, the predicted emotion label, the sample emotion level label and the predicted emotion level label;

[0022] The model training module is used to iteratively update the initial parameters in the preset recognition model when the predicted loss value does not reach the preset convergence condition, until the predicted loss value reaches the convergence condition, and record the preset recognition model after convergence as the emotion recognition model.

[0023] A voice interaction device, comprising:

[0024] A voice data acquisition module is used to acquire target voice data of a target user, and perform voice recognition on the target voice data to obtain a target text corresponding to the target voice data;

[0025] An emotion recognition module, used for inputting the target text into an emotion recognition model, so as to perform emotion recognition on the target text through the emotion recognition model, and obtain an emotion recognition result and an emotion level result corresponding to the target text; the emotion recognition model is obtained according to the above-mentioned emotion recognition model training method;

[0026] The voice data generating module is used to generate reply voice data according to the target text, the emotion recognition result and the emotion level result, and send the reply voice data to the target user.

[0027] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned emotion recognition model training method when executing the computer program, or implements the above-mentioned voice interaction method when executing the computer program.

[0028] A computer-readable storage medium stores a computer program, which implements the above-mentioned emotion recognition model training method when executed by a processor, or implements the above-mentioned voice interaction method when executed by a processor.

[0029] The above-mentioned emotion recognition model training, voice interaction method, device, equipment and medium, the emotion recognition model training method evaluates the emotion level to be recognized by using the classification output vector obtained when the emotion classification of the text to be recognized and the sample output vector obtained by the text processing module performing vector conversion on the text to be recognized. In this way, the emotion level can learn the characteristics of the emotion category, thereby improving the accuracy of predicting the emotion level of the text to be recognized, thereby making the training efficiency of the emotion recognition model higher and the accuracy higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0031] Figure 1 is a schematic diagram of an application environment of an emotion recognition model training method in one embodiment of the present invention;

[0032] Figure 2is a flow chart of an emotion recognition model training method in one embodiment of the present invention;

[0033] Figure 3 is a flow chart of step S30 in the emotion recognition model training method in one embodiment of the present invention;

[0034] Figure 4 is a flow chart of step S302 in the emotion recognition model training method in one embodiment of the present invention;

[0035] Figure 5 is a principle block diagram of an emotion recognition model training device in one embodiment of the present invention;

[0036] Figure 6 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] The emotion recognition model training method provided by the embodiment of the present invention can be applied as follows: Figure 1 Specifically, the emotion recognition model training method is applied in an emotion recognition model training system, and the emotion recognition model training system includes: Figure 1 The client and server shown in the figure communicate with each other through the network to solve the problem of low accuracy of emotion recognition in the prior art. The client, also known as the user end, refers to a program corresponding to the server that provides local services to customers. The client can be installed on, but not limited to, various personal computers, laptops, smart phones, tablets, and portable wearable devices. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0039] In one embodiment, as shown in FIG. X, a monitoring data configuration method is provided, and the method is applied in Figure 1 The server in the example is used as an example to illustrate the process, including the following steps:

[0040] S10: Obtain a set of texts to be recognized; the set of texts to be recognized contains at least one text to be recognized; wherein one text to be recognized is associated with a sample emotion label and a sample emotion level label.

[0041] It can be understood that the text to be recognized can be obtained by collecting voice interaction texts such as those in intelligent robots, or by crawling text data in different platforms. In this embodiment, the text to be recognized is preferably an English text. The sample emotion label is obtained by manual annotation. For example, assuming that the text to be recognized is a voice interaction text, the sample emotion label corresponding to the text to be recognized is the current emotion of the speaker (such as the user). The sample emotion level label refers to the level of emotion corresponding to the sample emotion label corresponding to the text to be recognized. For example, assuming that the sample emotion level label indicates level 2 and the sample emotion label is humor, the emotion represented in the text to be recognized can be characterized as humorous emotion, and the level of humorous emotion is level 2. Further, the sample emotion level label can be confirmed in a set level order. For example, level 1 humor represents that the humorous emotion in the text to be recognized is weak, and level 5 humor represents that the humorous emotion in the text to be recognized is strong, so that the current emotion of the text to be recognized and the degree of emotion can be better reflected.

[0042] S20: Inputting the text to be recognized into a preset recognition model including initial parameters, so as to determine a sample output vector corresponding to the text to be recognized through the preset recognition model.

[0043] It can be understood that the preset recognition model proposed in this embodiment is used to predict the emotion category and determine the emotion level of the text to be recognized. Among them, the preset recognition model includes a text processing module, an emotion prediction module and an emotion level assessment module. The text processing module is used to perform vector conversion on the text to be recognized, so that the emotion prediction module or the emotion level assessment module can identify the emotion features in the text to be recognized. The emotion prediction module is used to classify the emotion of the text to be recognized, that is, to determine which type of emotion (for example, humor, anger, etc.) the emotion features in the text to be recognized specifically belong to. The emotion level assessment module is used to determine the degree of emotion in the text to be recognized. For example, when the text to be recognized is a humorous emotion type, the emotion level assessment module can determine the degree of humor of the text to be recognized.

[0044] It can be understood that the text processing module in the preset recognition model is constructed based on the BERT model, but the difference from the BERT model is that the text processing module of this embodiment adds a perturbation embedding layer, that is, by adding tiny perturbations to the text to be recognized, the loss of the preset recognition model is increased, and then the initial parameters of the preset recognition model are optimized through the loss. Finally, the trained preset recognition model can more accurately distinguish different types of emotions, and can also distinguish the same type of emotions into different emotion levels.

[0045] Furthermore, the text processing module is used to convert the text to be recognized into a sample output vector. Specifically, after obtaining the text to be recognized and the preset recognition model, the text to be recognized is input into the preset recognition model, and then the text to be recognized is converted into a text vector by the text processing module in the preset recognition model, thereby generating a sample output vector corresponding to the text to be recognized and recognizable by the emotion prediction module or emotion rating module in the preset recognition model.

[0046] S30: Determine a classification output vector corresponding to the text to be recognized and a predicted emotion label according to the sample output vector through the preset recognition model.

[0047] It can be understood that the emotion prediction module in the preset recognition model has a bidirectional neural network and a classification network. The bidirectional neural network can learn the context information corresponding to each word of the text to be recognized in the sample output vector, so as to improve the accuracy of emotion prediction; the classification network is used to classify the emotion category of the text to be recognized according to the vector output by the bidirectional neural network, and then obtain the predicted emotion label. Among them, the predicted emotion label is the emotion of the text to be recognized predicted by the emotion prediction module, such as humorous emotion, angry emotion, and the predicted emotion label may be the same as or different from the sample emotion label.

[0048] Specifically, after the text processing module of the preset recognition model performs text vector conversion on the text to be recognized and obtains the sample output vector, the sample output vector is input into the emotion prediction module, and then the predicted emotion label corresponding to the text to be recognized and the classification output vector are determined by the bidirectional neural network and the classification network in the emotion prediction module. Among them, the classification output vector is obtained by the emotion prediction module performing vector processing on the sample output vector.

[0049] S40: Determine a predicted emotion level label corresponding to the text to be recognized according to the sample output vector and the classification output vector through the preset recognition model.

[0050] It can be understood that in the process of the emotion prediction module performing emotion prediction based on the sample output vector, a classification output vector for emotion classification will be generated, and then the classification output vector and the sample output vector can be used for prediction when determining the predicted emotion level label in the text to be identified, thereby improving the accuracy of the emotion level prediction.

[0051] Specifically, after the emotion prediction module determines the predicted emotion label and the classification output vector corresponding to the text to be recognized based on the sample output vector, the classification output vector obtained by the emotion prediction module based on the sample output vector is obtained, and then the emotion level assessment module determines the predicted emotion level label corresponding to the text to be recognized based on the sample output vector and the classification output vector.

[0052] S50: Determine the prediction loss value of the preset recognition model according to the sample emotion label, the predicted emotion label, the sample emotion level label and the predicted emotion level label.

[0053] Specifically, after determining the predicted emotion label and the predicted emotion level label corresponding to the text to be recognized, the emotion label prediction loss can be determined according to the sample emotion label and the predicted emotion label, and the emotion level label prediction loss can be determined according to the sample emotion level label and the predicted emotion level label. Then, the emotion label prediction loss and the emotion level label prediction loss are linearly superimposed to obtain the prediction loss value of the preset recognition model.

[0054] S60: When the predicted loss value does not reach a preset convergence condition, iteratively update the initial parameters in the preset recognition model until the predicted loss value reaches the convergence condition, and record the preset recognition model after convergence as an emotion recognition model.

[0055] It can be understood that the convergence condition can be the condition that the predicted loss value is less than the set threshold, that is, when the predicted loss value is less than the set threshold, the training is stopped; the convergence condition can also be the condition that the predicted loss value is very small after 10,000 calculations and will not decrease anymore, that is, when the predicted loss value is very small after 10,000 calculations and will not decrease, the training is stopped and the preset recognition model after convergence is recorded as the emotion recognition model.

[0056] Furthermore, after determining the prediction loss value of the preset recognition model based on the sample emotion label, the predicted emotion label, the sample emotion level label and the predicted emotion level label, when the prediction loss value does not reach the preset convergence condition, the initial parameters of the preset recognition model are adjusted according to the prediction loss value, and the text to be recognized is re-input into the preset recognition model after the initial parameters are adjusted, so that when the prediction loss value of the text to be recognized reaches the preset convergence condition, another text to be recognized in the text set to be recognized is selected, and the above steps S30 to S60 are executed to obtain the prediction loss value corresponding to the text to be recognized, and when the prediction loss value does not reach the preset convergence condition, the initial parameters of the preset recognition model are adjusted again according to the prediction loss value, so that the prediction loss value of the text to be recognized reaches the preset convergence condition.

[0057] In this way, after the preset recognition model is trained with all the texts to be recognized in the text set to be recognized, the results output by the preset recognition model can continue to approach the accurate results, making the recognition accuracy higher and higher, until the prediction loss values ​​of all the texts to be recognized reach the preset convergence conditions, and the preset recognition model after convergence is recorded as the emotion recognition model.

[0058] In this embodiment, the emotion level to be recognized is assessed by using the classification output vector obtained when the emotion classification of the text to be recognized and the sample output vector obtained by the text processing module through vector conversion of the text to be recognized. In this way, the emotion level can learn the characteristics of the emotion category, thereby improving the accuracy of predicting the emotion level of the text to be recognized, thereby making the training efficiency of the emotion recognition model higher and the accuracy higher.

[0059] In one embodiment, obtaining a set of texts to be recognized includes:

[0060] A text set to be trained is obtained; the training text set contains at least one text to be trained.

[0061] It can be understood that the texts to be trained in the text set to be trained can be obtained by collecting voice interaction texts in intelligent robots, or crawling text data in different platforms.

[0062] Obtain a preset text dictionary; the preset text dictionary includes at least one basic text word and a word association table corresponding to the basic text word.

[0063] It can be understood that the preset text dictionary can be a WordNet dictionary in the NLTK module of python. The preset text dictionary includes at least one basic text word and a word association table corresponding to the basic text word. Exemplarily, assuming that the text to be trained is an English text, the basic text word can be such as be, and the corresponding word association table includes words such as am, is, are, etc. That is, the basic text word is the most basic morphological word, and the words in the word association table associated with it are complex words obtained by transforming the basic text word, such as adjective modification transformation, adverb modification transformation, etc. in English words.

[0064] The text to be trained is segmented to obtain at least one word of the text to be trained corresponding to the text to be trained.

[0065] It can be understood that the word segmentation process can be performed by using a common dictionary, or other word segmentation models based on a neural network. For a text to be trained, it contains multiple words, so after the training text is segmented, each word obtained is the word of the text to be trained.

[0066] The to-be-trained text word is searched from the preset text dictionary, and the basic text word corresponding to the word association table to which the to-be-trained text word belongs is recorded as the to-be-replaced word.

[0067] Specifically, after performing word segmentation processing on the text to be trained and obtaining at least one text word to be trained corresponding to the text to be trained, the text word to be trained is searched from a preset text dictionary, and if the text word to be trained matches any basic text word, the matched basic text word is directly recorded as the word to be replaced, or the text word to be trained does not need to be replaced (because the matching of the text word to be trained and the basic text word indicates that the word form of the text word to be trained is already the most basic form);

[0068] Furthermore, if the to-be-trained text word does not match any of the basic text words, a query is performed from the word association table associated with each basic text word, and the basic text word corresponding to the word association table having a word matching the to-be-trained text word is recorded as the to-be-replaced word;

[0069] Furthermore, if the words in the text to be trained do not match all the words in the preset text dictionary (including all basic text words and all words in the word association table), an exception is prompted, and then the words in the text to be trained are checked to determine whether the words in the text to be trained are the result of an error occurring during the word segmentation process of the training text, so that the words in the text to be trained are corrected.

[0070] The words of the text to be trained are replaced with the words to be replaced, and the replaced text to be trained is recorded as the text to be recognized, and all the text to be recognized are recorded as the text set to be recognized.

[0071] Specifically, after searching the preset text dictionary for the text words to be trained and recording the basic text words corresponding to the word association table to which the text words to be trained belong as words to be replaced, the text words to be trained are replaced with the words to be replaced. At this time, all the words in the text to be trained are basic text words, and then the replaced text to be trained is recorded as text to be recognized, and all texts to be recognized are recorded as a text set to be recognized.

[0072] In this embodiment, each word in the text to be trained is stemmed through a preset text dictionary, so that each word in the text to be trained has the most basic meaning, and then when emotion recognition is performed on the text to be recognized later, the influence of complex words on emotion recognition is reduced, thereby improving the accuracy of emotion recognition.

[0073] In one embodiment, if Figure 3 As shown, the preset recognition model includes a text processing module; in step S30, that is, inputting the text to be recognized into the preset recognition model including initial parameters, so as to determine the sample output vector corresponding to the text to be recognized through the preset recognition model, including:

[0074] S301: Perform word segmentation processing on the text to be recognized to obtain at least one word of the text to be recognized corresponding to the text to be recognized.

[0075] It can be understood that the word segmentation process can be performed by using a segmentation method such as Jieba, a common dictionary, or other segmentation models based on neural networks. For a text to be recognized, it contains multiple words. Therefore, after the text to be recognized is segmented, each word obtained is the word of the text to be recognized.

[0076] S302: embedding the text words to be recognized into word vectors through the vector embedding unit in the text processing module to obtain sample word vectors corresponding to each of the text words to be recognized.

[0077] It can be understood that word vector embedding is a method of converting the words of the text to be recognized into word vectors. In the present embodiment, four different methods of word vector embedding are performed on each word of the text to be recognized, thereby adding adversarial disturbance to each text to be recognized. The adversarial disturbance is almost the same for manual recognition, while for the preset recognition model, it can identify the difference between the features of the text to be recognized after adding the adversarial disturbance and the features of the text to be recognized without adding the adversarial disturbance, thereby improving the prediction loss of the preset recognition model, so that the preset recognition model can more accurately distinguish the slight differences between the features of each different emotion, thereby improving the recognition accuracy of the preset recognition model.

[0078] In one embodiment, if Figure 4 As shown, in step S302, that is, embedding the word vectors of the text words to be recognized by the vector embedding unit in the text processing module to obtain sample word vectors corresponding to each of the text words to be recognized, including:

[0079] S3021: Perform tag embedding on the text word to be recognized to obtain a tag embedding vector corresponding to the text word to be recognized.

[0080] It can be understood that tag embedding is a method of converting each word of the text to be recognized into a word vector of fixed dimension. Exemplarily, the fixed dimension is 768 dimensions. Specifically, after the text to be recognized is segmented to obtain at least one word of the text to be recognized corresponding to the text to be recognized, the words of the text to be recognized are tag-embedded to obtain a tag embedding vector of fixed dimension corresponding to each word of the text to be recognized.

[0081] S3022: Perform segment embedding on the text words to be recognized to obtain segment embedding vectors corresponding to the text words to be recognized.

[0082] It can be understood that the text to be recognized may contain one sentence, two sentences or three sentences, etc. Therefore, when converting the text to be recognized into a vector, each sentence needs to be distinguished, so segmented embedding is an embedding method used to distinguish different sentences in the text to be recognized. Specifically, after the text to be recognized is segmented to obtain at least one text word to be recognized corresponding to the text to be recognized, the sentences in the text to be recognized are distinguished by using [CLS] and [SEP], for example: [CLS] each text word to be recognized in sentence 1 [SEP] each text word to be recognized in sentence 2, and each text word to be recognized is segmented and embedded, and finally a segmented embedding vector corresponding to each text word to be recognized is obtained.

[0083] S3023: Perform position embedding on the text word to be recognized to obtain a position embedding vector corresponding to the text word to be recognized.

[0084] It is understandable that the text to be recognized may contain the same words, but different words may have different meanings at different positions, which leads to different features corresponding to the words to be recognized at different positions. Therefore, through position embedding, each word to be recognized can have the features at its position, that is, the features of the previous and next words to be recognized can be learned in association. Specifically, after the text to be recognized is segmented to obtain at least one word to be recognized corresponding to the text to be recognized, each word to be recognized is positionally embedded, so that the position embedding vector corresponding to the word to be recognized has the features at the corresponding text position.

[0085] S3024: Perform perturbation embedding on the text word to be recognized to obtain a perturbation embedding vector corresponding to the text word to be recognized.

[0086] It can be understood that in this embodiment, perturbation embedding is proposed, that is, perturbation features are added in the process of converting the text words to be recognized into vectors. The perturbation features cannot be accurately recognized when emotion recognition is performed manually, but the preset recognition model can automatically identify whether to add perturbation features after training, thereby improving the emotion feature recognition ability of the preset recognition model, thereby improving the accuracy of emotion recognition.

[0087] S3025: Determine a sample word vector corresponding to the text word to be recognized based on the tag embedding vector, segment embedding vector, position embedding vector and perturbation embedding vector corresponding to the same text word to be recognized.

[0088] Specifically, after determining the tag embedding vector, segment embedding vector, position embedding vector and perturbation embedding vector corresponding to each text word to be recognized, the tag embedding vector, segment embedding vector, position embedding vector and perturbation embedding vector belonging to the same text word to be recognized are linearly superimposed to obtain the sample word vector corresponding to each text word to be recognized.

[0089] S303: Perform word vector processing on the sample word vector by the vector processing unit in the text processing module to obtain a sample output vector corresponding to the text to be recognized.

[0090] It can be understood that the vector processing unit in this embodiment can adopt a language representation model such as a BERT model or an ALBERT model. After the word vectors of the text words to be recognized are embedded by the vector embedding unit in the text processing module to obtain sample word vectors corresponding to each of the text words to be recognized, the sample word vectors are processed by the vector processing unit in the text processing module, that is, the language representation of the context information in the sample word vectors is integrated, so that the finally generated sample output vector can learn the contextual semantic features in the text to be recognized when it is input into the emotion prediction module for emotion recognition, thereby improving the accuracy of emotion prediction.

[0091] In one embodiment, the preset recognition model includes an emotion prediction module; in step S40, that is, determining the classification output vector corresponding to the text to be recognized and the predicted emotion label according to the sample output vector by the preset recognition model, includes:

[0092] The sample output vector is processed by a bidirectional neural network in the emotion prediction module to obtain a hidden layer vector corresponding to the sample output vector.

[0093] It can be understood that the bidirectional neural network is a forward LSTM (Long Short-Term Memory) network and a backward LSTM network. The forward LSTM network is used to learn the positive context sequence relationship between each word vector in the sample output vector; the backward LSTM network is used to learn the reverse context sequence relationship between each word vector in the sample output vector, which can improve the accuracy of emotion recognition.

[0094] Specifically, after the text to be recognized is input into a preset recognition model to determine the sample output vector corresponding to the text to be recognized through the text processing module, the sample output vector is processed by the bidirectional neural network in the emotion prediction module to obtain a forward hidden layer vector and a reverse hidden layer vector corresponding one-to-one to each word vector in the sample output vector, and then a hidden layer vector is generated based on the forward hidden layer vector and the reverse hidden layer vector corresponding one-to-one to each word vector.

[0095] A classification output vector corresponding to the hidden layer vector is obtained through a classification network in the emotion prediction module according to the hidden layer vector.

[0096] The predicted emotion label is determined according to the classification output vector.

[0097] Specifically, the sample output vector is processed by the bidirectional neural network in the emotion prediction module to obtain a hidden layer vector corresponding to the sample output vector, and the probability of the emotion category corresponding to the sample output vector is determined by the classification network in the emotion prediction module, that is, the classification output vector. At this time, the classification output vector represents the probability of each emotion type to be identified, and then the emotion type with the highest probability is determined as the predicted emotion label. For example, assuming that the probability of the text to be identified belonging to the humorous type is the highest, the predicted emotion label is the humorous emotion label.

[0098] In one embodiment, a voice interaction method is proposed, and the method is applied in Figure 1 Taking the server in as an example, the method includes the following steps:

[0099] The target voice data of the target user is acquired, and voice recognition is performed on the target voice data to obtain a target text corresponding to the target voice data.

[0100] It can be understood that the target voice data can be the voice data of the target user when using the intelligent voice system. For example, when the target user is talking to the intelligent robot, the voice data of the target user can be collected, and then voice recognition is performed on the target voice data. For example, voice recognition is performed on the target voice data through hidden Markov method, neural network model, etc., and then the target voice data is converted into text data to obtain the target text.

[0101] The target text is input into an emotion recognition model to perform emotion recognition on the target text through the emotion recognition model to obtain an emotion recognition result and an emotion level result corresponding to the target text; the emotion recognition model is obtained according to the above-mentioned emotion recognition model training method.

[0102] Specifically, after acquiring the target voice data of the target user and performing voice recognition on the target voice data to obtain the target text corresponding to the target voice data, the target text is input into the emotion recognition model to determine the text output vector corresponding to the target text through the text processing module in the emotion recognition model, determine the emotion recognition result corresponding to the target text according to the text output vector through the emotion prediction module in the emotion recognition model, and determine the emotion level result according to the text output vector and the emotion recognition result through the emotion level assessment module in the emotion recognition model.

[0103] According to the target text, the emotion recognition result and the emotion level result, reply voice data is generated, and the reply voice data is sent to the target user.

[0104] Specifically, after the target text is input into the emotion recognition model to perform emotion recognition on the target text through the emotion recognition model and obtain the emotion recognition result and emotion level result corresponding to the target text, the answer text corresponding to the target text is first determined, and then the answer text is adjusted according to the emotion recognition result and the emotion level result, and then reply voice data is generated according to the adjusted answer text, and the reply voice data is sent to the target user.

[0105] In this embodiment, emotion recognition is performed based on the target text corresponding to the target voice data of the target user through an emotion recognition model to determine the current emotional state of the target user, and then the reply text is adjusted based on the emotion recognition result and the emotion level result. Then, the reply voice data generated by the adjusted reply text can be more in line with the current emotional state of the target user, thereby improving the accuracy of voice interaction.

[0106] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0107] In one embodiment, an emotion recognition model training device is provided, and the emotion recognition model training device corresponds to the emotion recognition model training method in the above embodiment. Figure 5 As shown, the emotion recognition model training device includes a to-be-recognized text acquisition module 10, a text processing module 20, an emotion prediction module 30, an emotion level prediction module 40, a loss determination module 50 and a model training module 60. The functional modules are described in detail as follows:

[0108] The to-be-recognized text acquisition module 10 is used to acquire a to-be-recognized text set; the to-be-recognized text set contains at least one to-be-recognized text; wherein one to-be-recognized text is associated with a sample emotion label and a sample emotion level label;

[0109] A text processing module 20, used for inputting the text to be recognized into a preset recognition model including initial parameters, so as to determine a sample output vector corresponding to the text to be recognized through the preset recognition model;

[0110] The emotion prediction module 30 is used to determine the classification output vector corresponding to the text to be recognized and predict the emotion label according to the sample output vector through the preset recognition model;

[0111] The emotion level prediction module 40 is used to determine the predicted emotion level label corresponding to the text to be recognized according to the sample output vector and the classification output vector through the preset recognition model;

[0112] A loss determination module 50, for determining a predicted loss value of the preset recognition model according to the sample emotion label, the predicted emotion label, the sample emotion level label and the predicted emotion level label;

[0113] The model training module 60 is used to iteratively update the initial parameters in the preset recognition model when the predicted loss value does not reach the preset convergence condition, until the predicted loss value reaches the convergence condition, and record the preset recognition model after convergence as the emotion recognition model.

[0114] For the specific definition of the emotion recognition model training device, please refer to the definition of the emotion recognition model training method above, which will not be repeated here. The various modules in the above-mentioned emotion recognition model training device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0115] In one embodiment, a voice interaction device is provided, comprising:

[0116] A voice data acquisition module is used to acquire target voice data of a target user, and perform voice recognition on the target voice data to obtain a target text corresponding to the target voice data;

[0117] An emotion recognition module, used for inputting the target text into an emotion recognition model, so as to perform emotion recognition on the target text through the emotion recognition model, and obtain an emotion recognition result and an emotion level result corresponding to the target text; the emotion recognition model is obtained according to the above-mentioned emotion recognition model training method;

[0118] The voice data generating module is used to generate reply voice data according to the target text, the emotion recognition result and the emotion level result, and send the reply voice data to the target user.

[0119] For the specific definition of the voice interaction device, please refer to the definition of the voice interaction method above, which will not be repeated here. Each module in the above-mentioned voice interaction device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0120] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the data used by the emotion recognition model training method or the voice interaction method in the above-mentioned embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an emotion recognition model training method is implemented, or when the computer program is executed by the processor, a voice interaction method is implemented.

[0121] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the emotion recognition model training method in the above embodiment is implemented when the processor executes the computer program, or the voice interaction method in the above embodiment is implemented when the processor executes the computer program.

[0122] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the emotion recognition model training method in the above embodiment is implemented, or when the computer program is executed by a processor, the voice interaction method in the above embodiment is implemented.

[0123] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0124] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0125] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for training an emotion recognition model, characterized in that: include: Obtain a set of texts to be recognized; the set of texts to be recognized contains at least one text to be recognized; wherein one of the texts to be recognized is associated with a sample emotion label and a sample emotion level label; Inputting the text to be recognized into a preset recognition model including initial parameters, so as to determine a sample output vector corresponding to the text to be recognized through the preset recognition model; Determine, by means of the preset recognition model, a classification output vector corresponding to the text to be recognized and a predicted emotion label according to the sample output vector; Determining a predicted emotion level label corresponding to the text to be recognized by the preset recognition model according to the sample output vector and the classification output vector; Determining a prediction loss value of the preset recognition model according to the sample emotion label, the predicted emotion label, the sample emotion level label, and the predicted emotion level label; When the predicted loss value does not reach a preset convergence condition, iteratively updating the initial parameters in the preset recognition model until the predicted loss value reaches the convergence condition, and recording the preset recognition model after convergence as an emotion recognition model; The step of obtaining a text set to be recognized includes: Acquire a text set to be trained; the training text set contains at least one text to be trained; Acquire a preset text dictionary; the preset text dictionary includes at least one basic text word and a word association table corresponding to the basic text word; Performing word segmentation processing on the text to be trained to obtain at least one word of the text to be trained corresponding to the text to be trained; Searching the text word to be trained from the preset text dictionary, and recording the basic text word corresponding to the word association table to which the text word to be trained belongs as the word to be replaced; The words of the text to be trained are replaced with the words to be replaced, and the replaced text to be trained is recorded as the text to be recognized, and all the text to be recognized are recorded as the text set to be recognized.

2. The method according to claim 1, characterized in that The preset recognition model includes a text processing module; the step of inputting the text to be recognized into the preset recognition model including initial parameters to determine a sample output vector corresponding to the text to be recognized through the preset recognition model includes: Performing word segmentation processing on the text to be recognized to obtain at least one word of the text to be recognized corresponding to the text to be recognized; The vector embedding unit in the text processing module embeds the text words to be recognized into word vectors to obtain sample word vectors corresponding to each of the text words to be recognized; The sample word vector is processed by the vector processing unit in the text processing module to obtain a sample output vector corresponding to the text to be recognized.

3. The method according to claim 2, characterized in that The embedding of the to-be-recognized text words by the vector embedding unit in the text processing module to obtain sample word vectors corresponding to each of the to-be-recognized text words includes: Performing tag embedding on the text word to be recognized to obtain a tag embedding vector corresponding to the text word to be recognized; Performing segment embedding on the text words to be recognized to obtain segment embedding vectors corresponding to the text words to be recognized; Performing position embedding on the text word to be recognized to obtain a position embedding vector corresponding to the text word to be recognized; Performing perturbation embedding on the text word to be recognized to obtain a perturbation embedding vector corresponding to the text word to be recognized; A sample word vector corresponding to the text word to be recognized is determined based on the tag embedding vector, the segment embedding vector, the position embedding vector and the perturbation embedding vector corresponding to the same text word to be recognized.

4. The method according to claim 1, characterized in that The preset recognition model includes an emotion prediction module; the step of determining the classification output vector corresponding to the text to be recognized and predicting the emotion label according to the sample output vector by the preset recognition model includes: Performing vector information processing on the sample output vector through a bidirectional neural network in the emotion prediction module to obtain a hidden layer vector corresponding to the sample output vector; Obtaining a classification output vector corresponding to the hidden layer vector through a classification network in the emotion prediction module according to the hidden layer vector; The predicted emotion label is determined according to the classification output vector.

5. A voice interaction method, characterized in that: include: Acquire target voice data of a target user, and perform voice recognition on the target voice data to obtain a target text corresponding to the target voice data; Inputting the target text into an emotion recognition model to perform emotion recognition on the target text through the emotion recognition model to obtain an emotion recognition result and an emotion level result corresponding to the target text; The emotion recognition model is obtained according to the emotion recognition model training method according to any one of claims 1 to 4; According to the target text, the emotion recognition result and the emotion level result, reply voice data is generated, and the reply voice data is sent to the target user.

6. An emotion recognition model training device, characterized in that: The emotion recognition model training device comprises: The module for acquiring texts to be recognized is used to acquire a set of texts to be recognized; the set of texts to be recognized contains at least one text to be recognized; wherein one text to be recognized is associated with a sample emotion label and a sample emotion level label; A text processing module, used for inputting the text to be recognized into a preset recognition model including initial parameters, so as to determine a sample output vector corresponding to the text to be recognized through the preset recognition model; An emotion prediction module, used to determine a classification output vector corresponding to the text to be recognized and a predicted emotion label according to the sample output vector through the preset recognition model; An emotion level prediction module, used to determine a predicted emotion level label corresponding to the text to be recognized according to the sample output vector and the classification output vector through the preset recognition model; A loss determination module, used to determine the predicted loss value of the preset recognition model according to the sample emotion label, the predicted emotion label, the sample emotion level label and the predicted emotion level label; A model training module, used for iteratively updating the initial parameters in the preset recognition model when the predicted loss value does not reach the preset convergence condition, until the predicted loss value reaches the convergence condition, and recording the preset recognition model after convergence as the emotion recognition model; The step of obtaining a text set to be recognized includes: Acquire a text set to be trained; the training text set contains at least one text to be trained; Acquire a preset text dictionary; the preset text dictionary includes at least one basic text word and a word association table corresponding to the basic text word; Performing word segmentation processing on the text to be trained to obtain at least one word of the text to be trained corresponding to the text to be trained; Searching the text word to be trained from the preset text dictionary, and recording the basic text word corresponding to the word association table to which the text word to be trained belongs as the word to be replaced; The words of the text to be trained are replaced with the words to be replaced, and the replaced text to be trained is recorded as the text to be recognized, and all the text to be recognized are recorded as the text set to be recognized.

7. A voice interaction device, characterized in that: include: A voice data acquisition module is used to acquire target voice data of a target user, and perform voice recognition on the target voice data to obtain a target text corresponding to the target voice data; An emotion recognition module, used for inputting the target text into an emotion recognition model, so as to perform emotion recognition on the target text through the emotion recognition model, and obtain an emotion recognition result and an emotion level result corresponding to the target text; The emotion recognition model is obtained according to the emotion recognition model training method according to any one of claims 1 to 4; The voice data generating module is used to generate reply voice data according to the target text, the emotion recognition result and the emotion level result, and send the reply voice data to the target user.

8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the emotion recognition model training method as described in any one of claims 1 to 4 is implemented, or when the processor executes the computer program, the voice interaction method as described in claim 5 is implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by the processor, the emotion recognition model training method as described in any one of claims 1 to 4 is implemented, or when the computer program is executed by the processor, the voice interaction method as described in claim 5 is implemented.

Citation Information

Patent Citations

  • Emotion interaction method and device, computer readable storage medium and computer equipment

    CN108334583A

  • Text emotion analysis method and device and storage medium

    CN108717406A

  • Multi-mark emotion intensity prediction method based on hierarchical convolutional neural network

    CN110472245A