Emotion recognition model generation method, recognition method, device, medium and equipment

By using a combination of pre-trained expression coding models and branch networks in emotion recognition, the interference problem and data imbalance problem of emotion recognition in natural environments are solved, and efficient emotion recognition and lightweight models are achieved, which are suitable for practical application scenarios.

CN114565964BActive Publication Date: 2024-09-27NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210211180.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-03
Publication Date
2024-09-27
Estimated Expiration
2042-03-03

AI Technical Summary

Technical Problem

Existing emotion recognition methods are difficult to handle complex interference factors such as occlusion and lighting in natural environments, and the data imbalance problem leads to poor model generalization performance, making it difficult to be suitable for practical applications.

Method used

A feature extractor based on a pre-trained expression coding model is used, combined with a feature learning branch network and a classification learning branch network, and trained through contrast loss and cross-entropy loss functions to decouple feature learning and classification learning, reduce identity information interference, and pass knowledge Distillation technology enables lightweight models.

Benefits of technology

It effectively reduces the interference of identity information and occlusion information, alleviates the problem of data imbalance, improves the accuracy of emotion recognition and applicability of the model, and reduces computing resource requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114565964B
    Figure CN114565964B
Patent Text Reader

Abstract

The present application provides a method for generating an emotion recognition model, the method comprising: inputting emotion recognition training data into an emotion recognition feature extractor for processing to obtain a first expression coding vector; inputting the first expression coding vector into a feature learning branch network to obtain an expression representation vector; inputting the first expression coding vector into a classification learning branch network to obtain an emotion classification result; obtaining a loss value according to the expression representation vector, the emotion classification result, the emotion label, and a preset loss function, and adjusting the parameters of the emotion recognition feature extractor and the feature learning branch network and the classification learning branch network according to the loss value; when the preset loss function reaches a set convergence condition, retaining the emotion recognition feature extractor and the classification learning branch network to obtain a first emotion recognition model. Accordingly, the present application also provides media and devices related to the method for generating the emotion recognition model, as well as an emotion recognition method and related media and devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of artificial intelligence technology, and in particular relates to a method for generating an emotion recognition model, an emotion recognition method, a device, a medium and a device. Background Art

[0002] Facial expressions are one of the basic ways for humans to express emotions. In different situations, humans use facial expressions to express their inner feelings, and also perceive the emotions of others through facial expressions. Emotion recognition methods based on facial expression visual information have received great attention in many fields, such as human-computer interaction, mental illness diagnosis, and sales psychology. As a basic recognition task, the recognition of basic emotions can provide basic technical support for complex emotion analysis tasks. The basic seven emotions include neutral, happy, sad, surprised, afraid, angry, and disgusted. Although the automatic recognition of basic emotions in laboratory environments has achieved a high accuracy rate, these methods are difficult to handle practical application problems such as occlusion and lighting. The emergence of large-scale facial expression datasets in natural environments has facilitated the implementation of actual emotion recognition. However, dealing with complex interference factors and alleviating the data imbalance problem in the dataset are still considerable challenges. Summary of the invention

[0003] In order to overcome the above-mentioned defects in the prior art, the present application provides a method for generating an emotion recognition model, the method comprising:

[0004] Acquire emotion recognition training data, and input the emotion recognition training data into an emotion recognition feature extractor for processing to obtain a first expression coding vector, wherein the emotion recognition feature extractor is constructed using a pre-trained expression coding model, wherein the expression coding model is used to generate a second expression coding vector, wherein the dimension of the first expression coding vector is higher than the dimension of the second expression coding vector, and the emotion recognition training data includes an expression image and a corresponding emotion label;

[0005] Inputting the first expression encoding vector into the feature learning branch network for processing to obtain an expression representation vector;

[0006] Inputting the first expression coding vector into the classification learning branch network for processing to obtain an emotion classification result;

[0007] Obtaining a loss value according to the expression representation vector, the emotion classification result, the emotion label, and a preset loss function, and adjusting the parameters of the emotion recognition feature extractor and the feature learning branch network and the classification learning branch network according to the loss value;

[0008] When the preset loss function reaches a set convergence condition, a first emotion recognition model is obtained according to the emotion recognition feature extractor, the feature learning branch network and the classification learning branch network.

[0009] According to one aspect of the present application, the method further comprises:

[0010] Iteratively training a preset expression coding model using a plurality of expression tuple training data to obtain the pre-trained expression coding model, each expression tuple training data comprising a target expression sample image, a positive expression image similar to the target expression sample image, and a negative expression sample image dissimilar to the target expression sample image;

[0011] A set number of network layers in the pre-trained expression coding model are intercepted as the emotion recognition feature extractor.

[0012] According to another aspect of the present application, the preset loss function in the method includes a first loss function for a feature learning branch network and a second loss function for a classification learning branch network, the first loss function adopts a contrast loss function, and the second loss function adopts a cross entropy loss function.

[0013] According to another aspect of the present application, the preset loss function in the method also includes a first weight of the first loss function and a second weight of the second loss function, and during the iteration process of the feature learning branch network, the first weight gradually decreases.

[0014] According to another aspect of the present application, the method of acquiring emotion recognition training data includes:

[0015] Obtain initial emotion recognition training data;

[0016] The initial emotion recognition training data is subjected to equalization processing to obtain the emotion recognition training data after equalization processing.

[0017] According to another aspect of the present application, the method of obtaining the first emotion recognition model based on the emotion recognition feature extractor, the feature learning branch network and the classification learning branch network includes: when the preset loss function reaches the set convergence condition, discarding the feature learning branch network, and obtaining the first emotion recognition model based on the retained emotion recognition feature extractor and the classification learning branch network.

[0018] According to another aspect of the present application, the method also includes: constructing a lightweight emotion recognition model, and using the first emotion recognition model as a teacher model and the lightweight emotion recognition model as a student model to iteratively train the lightweight emotion recognition model through knowledge distillation to obtain a second emotion recognition model.

[0019] According to another aspect of the present application, in the method, a cross entropy loss function and a soft target loss function are used to calculate the loss value when iteratively training the lightweight emotion recognition model.

[0020] In addition, the present application provides a method comprising: acquiring a target image to be subjected to emotion recognition; and performing emotion recognition on the target image using a first emotion recognition model or a second emotion recognition model obtained by the aforementioned method for generating an emotion recognition model.

[0021] In addition, the present application provides a device for forming an emotion recognition model, the device comprising:

[0022] A first input module, used to obtain emotion recognition training data, and input the emotion recognition training data into an emotion recognition feature extractor for processing to obtain a first expression coding vector, wherein the emotion recognition feature extractor is constructed using a pre-trained expression coding model, and the expression coding model is used to generate a second expression coding vector, wherein the dimension of the first expression coding vector is higher than the dimension of the second expression coding vector, and the emotion recognition training data includes an expression image and a corresponding emotion label;

[0023] A second input module, used for inputting the first expression encoding vector into a feature learning branch network for processing to obtain an expression representation vector;

[0024] A third input module is used to input the first expression coding vector into the classification learning branch network for processing to obtain an emotion classification result;

[0025] A parameter adjustment module, used to obtain a loss value according to the expression representation vector, the emotion classification result, the emotion label, and a preset loss function, and adjust the parameters of the emotion recognition feature extractor and the feature learning branch network and the classification learning branch network according to the loss value;

[0026] A model acquisition module is used to obtain a first emotion recognition model according to the emotion recognition feature extractor, the feature learning branch network and the classification learning branch network when the preset loss function reaches a set convergence condition.

[0027] In addition, the present application provides an emotion recognition device, which includes: a target acquisition module, used to acquire a target image to be subjected to emotion recognition; an emotion recognition module, which performs emotion recognition on the target image using a first emotion recognition model or a second emotion recognition model obtained by the emotion recognition model generation method as described above.

[0028] In addition, the present application provides one or more computer-readable media storing computer-executable instructions, which, when used by one or more computer devices, enable the one or more computer devices to execute the method for generating an emotion recognition model or the method for emotion recognition as described above.

[0029] The present application also provides a computer device, which includes a memory and a processor, wherein: the memory stores a computer program, and when the processor executes the computer program, the method for generating an emotion recognition model or the method for emotion recognition as described above is implemented.

[0030] The method for generating an emotion recognition model provided in the present application first uses an emotion feature extractor that is constructed based on a pre-trained expression coding model, and performs feature extraction based on expression coding as prior knowledge, so that the extracted features can reduce the interference of identity information and occlusion information; secondly, the feature learning branch network and the classification learning branch network are decoupled in the training of the model, so that the feature learning of minority classes can be effectively assisted in the training process, alleviating the bias problem caused by data imbalance.

[0031] Furthermore, the method for generating the emotion recognition model provided in the present application can also use knowledge distillation technology to compress the model to achieve a lightweight emotion recognition model, making the model suitable for most implementation scenarios.

[0032] The emotion recognition method provided in the present application has similar advantages because the model formed by the emotion recognition model generation method of the present application is adopted. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Other features, objectives and advantages of the present application will become more apparent by reading the detailed description of non-limiting specific embodiments made with reference to the following drawings:

[0034] Figure 1 is a flowchart of a specific implementation method of a method for generating an emotion recognition model according to the present application;

[0035] Figure 2 It is a flowchart of a preferred specific implementation of the newly added steps of the method for generating the emotion recognition model according to the present application;

[0036] Figure 3 It is a schematic diagram of a preferred specific implementation of the preset expression coding model according to the present application;

[0037] Figure 4 is a flowchart of an optional specific implementation method of the method for generating an emotion recognition model according to the present application;

[0038] Figure 5is a flowchart of a specific implementation of the emotion recognition method according to the present application;

[0039] Figure 6 is a structural schematic diagram of a specific implementation of a device for forming an emotion recognition model according to the present application;

[0040] Figure 7 It is a structural schematic diagram of a preferred specific implementation of a newly added module of the device for forming an emotion recognition model according to the present application;

[0041] Figure 8 is a structural schematic diagram of an optional specific implementation of a device for forming an emotion recognition model according to the present application;

[0042] Fig. 9 is a structural schematic diagram of a specific implementation of an emotion recognition device according to the present application;

[0043] Fig.10 It is a schematic diagram of the structure of a typical intelligent terminal for implementing the method for generating an emotion recognition model or the emotion recognition method of the present application;

[0044] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION

[0045] In order to better understand and explain the present application, the present application will be further described in detail below in conjunction with the accompanying drawings. The present application is not limited to these specific implementations. On the contrary, modifications or equivalent replacements made to the present application should be included in the scope of the claims of the present application.

[0046] It should be noted that many specific details are given in the specific embodiments below. Those skilled in the art should understand that the present application can also be implemented without these specific details. In the multiple specific embodiments given below, the principles, structures and components well known in the art are not described in detail in order to highlight the main purpose of the present application.

[0047] Current emotion recognition methods are based on the following two main categories:

[0048] First, emotion recognition based on manual features, which was a commonly used emotion recognition method in the early days. It uses some manually defined visual features to represent human faces, and then uses machine learning classifiers such as support vector machines for classification. Common manual features include local binary patterns (LBP), histogram of oriented gradients (HOG), etc. This type of method is suitable for laboratory environments and cannot achieve accurate recognition effects in complex natural environments. However, methods based on manual features are very sensitive to the selection of manual features, and it is difficult to select reasonable features to deal with variable interference factors in complex natural environments. In addition, manual features tend to focus on certain aspects of the image, resulting in poor generalization performance of the model.

[0049] Second, emotion recognition based on deep learning. Most of these methods build models based on convolutional neural networks, which use the good feature extraction capabilities of convolutional neural networks for image information. Because they can extract robust features, these methods are suitable for dealing with complex occlusion, lighting and other issues. Emotion recognition in natural environments is mostly based on these methods. In response to the challenges of emotion recognition in natural environments, these methods can be divided into:

[0050] (1) Emotion recognition based on attention mechanism: This type of method uses the attention mechanism to reduce the interference of interfering positions in the image and enhance the information strength of effective facial positions, thereby improving the recognition accuracy of the model. This type of method can help alleviate problems such as occlusion in natural environments.

[0051] (2) Emotion recognition based on generative models: One problem with existing datasets is that the identity information and expression information of the data are coupled, which makes the model's judgment easily dependent on the identity information. One solution is to use generative models to help decouple identity and expression and generate more expression images for training. However, the training of such methods requires paired data, which places high demands on the dataset.

[0052] Although the current deep learning-based methods have achieved certain results in emotion recognition in natural environments, there is still room for improvement. The attention-based method requires the network to learn the occluded position and reduce the weight of some information, which puts a lot of learning pressure on the network. At the same time, the generative model-based method has high requirements for paired data, and currently cannot completely solve the interference of the coupling of identity information and expression information. At the same time, the deep learning-based method has high requirements for machine performance. In practical applications, a model size that is too large can easily lead to slow prediction speed and increased latency of the overall system, limiting the implementation of models based on deep learning methods.

[0053] In order to at least solve some of the above problems, this application discloses a method for generating an emotion recognition model, please refer to Figure 1 , Figure 1It is a flowchart of a specific implementation method of the method for generating an emotion recognition model according to the present application, and the method includes:

[0054] Step S100, acquiring emotion recognition training data, and inputting the emotion recognition training data into an emotion recognition feature extractor for processing to obtain a first expression coding vector, wherein the emotion recognition feature extractor is constructed using a pre-trained expression coding model, wherein the expression coding model is used to generate a second expression coding vector, wherein the dimension of the first expression coding vector is higher than the dimension of the second expression coding vector, and the emotion recognition training data includes an expression image and a corresponding emotion label;

[0055] Step S200, inputting the first expression coding vector into a feature learning branch network for processing to obtain an expression representation vector;

[0056] Step S300, inputting the first expression coding vector into a classification learning branch network for processing to obtain an emotion classification result;

[0057] Step S400, obtaining a loss value according to the expression representation vector, the emotion classification result, the emotion label, and a preset loss function, and adjusting the parameters of the emotion recognition feature extractor and the feature learning branch network and the classification learning branch network according to the loss value;

[0058] Step S500, when the preset loss function reaches a set convergence condition, a first emotion recognition model is obtained according to the emotion recognition feature extractor, the feature learning branch network and the classification learning branch network.

[0059] In step S100, emotion recognition training data can adopt various open source emotion recognition data, and emotion recognition data includes expression images and corresponding emotion labels. Exemplarily, emotion recognition training data can use triple training data, and each emotion recognition training data includes a target image, an image with an expression similar to the target image (positive expression image), and an image with an expression different from the target image (negative expression image). In step S100, the purpose of constructing expression coding is to achieve effective representation of fine-grained facial expressions of human beings, so as to embed high-dimensional pixel information into a low-dimensional manifold space, and similar expressions on this manifold have closer vector distances. The pre-trained expression coding model is pre-trained on a data set containing a large number of expression comparison triplets, which can construct a low-dimensional space to represent the fine-grained expressions of human faces. Using it as prior knowledge can provide a good initialization for emotion recognition, which is helpful for emotion recognition tasks. Therefore, constructing an emotion recognition feature extractor using a pre-trained expression coding model can use expression coding as good prior knowledge to help eliminate interference information that is not related to expression, so that the extracted features can reduce the interference of identity information and occlusion information, and thus make the formed model applicable to complex environments rather than limited to laboratory environments.

[0060] Based on the above explanation, please refer to Figure 2 , Figure 2 yes Figure 1 The flowchart of a preferred specific implementation of the method for constructing the emotion recognition feature extractor in step S100 is shown. Preferably, the method for constructing the emotion recognition feature extractor includes:

[0061] Step S110, iteratively training a preset expression coding model using a plurality of expression multi-group training data to obtain a pre-trained expression coding model;

[0062] Step S120, intercepting the network layer set in the pre-trained expression coding model as the emotion recognition feature extractor.

[0063] In step S110, first, a preset expression coding model is constructed, and the expression coding model can adopt various suitable network structures. As an example, in an embodiment of the present application, Figure 3As shown, the preset expression coding model adopts the ResNet50 network structure. Then, the preset expression coding model is iteratively trained using expression tuple training data (such as expression triple training data) to obtain a pre-trained expression coding model. The expression tuple training data can be obtained from a public expression comparison tuple data set. Each expression tuple training data includes three images, a target image (Anchor (A)), a positive image (Positive (P), an image with an expression similar to the target image), and a negative image (Negative (N), an image selected by the annotator that is least similar to the expression of images A and P). In the present application, the annotation of the expression tuple training data can be completely based on human perception, ignoring interference such as identity and posture, so that the obtained target expression coding model can better eliminate interference information that is not related to expression.

[0064] In the present application, during the iterative training process of the preset expression coding model, the parameters of the preset expression coding model are adjusted using a ternary loss function. Figure 3 As shown, the expression triplet training data is input into the preset expression coding model, and a low-dimensional expression coding vector, such as a 16-dimensional expression coding vector, is output through the preset expression coding model. Then, the parameters and weights of the model are adjusted by calculating the ternary loss function, thereby shortening the coding distance between the A and P images, and increasing the coding distance between the A, N images and the P, N images, so that similar expressions have a closer vector distance, thereby ensuring the similarity information of the expressions in the coding space.

[0065] After obtaining the pre-trained expression coding model, that is, completing the training of the preset expression coding model, enter step S120. In step S120, a set number of network layers in the pre-trained expression coding model are intercepted as the emotion recognition feature extractor, and the parameters are initialized to the pre-trained parameters of the expression coding model. As an example, for example, the network part up to the penultimate layer in the pre-trained expression coding model is intercepted, that is, the network part except the last output layer is intercepted as the emotion recognition feature extractor. This is because the dimension of the intermediate features output by the previous network is higher and can retain more expression detail information. The last layer has fewer dimensions, and the retained information is more related to the specific task, which is not conducive to the subsequent emotion recognition tasks of this application. In the present application, since the emotion recognition feature extractor is obtained based on the trained expression coding model and fine-tuned in the emotion recognition task, the emotion recognition feature extractor in the present application can use the expression coding as a priori knowledge to help remove factors unrelated to the expression features, such as identity information, so as to extract only features related to the expression.

[0066] Please continue to refer to Figure 1In step S200, the first expression coding vector is input into the feature learning branch network for processing to obtain the expression representation vector; in step S300, the first expression coding vector is input into the classification learning branch network for processing to obtain the emotion classification result. That is, in the present application, a feature learning branch network and a classification learning branch network are constructed respectively, and the feature learning branch network and the classification learning branch network are used to process the first expression coding vector to obtain the expression representation vector and the emotion classification result respectively. In the present application, since there is a data imbalance problem in the emotion recognition training data set, that is, some expression data are more and some expression data are less, if only the cross entropy loss function such as the loss function used for classification problems is used, it will make it difficult for the network to learn the effective features of the minority class data, so that the prediction accuracy of the minority class data cannot be improved. In order to avoid the model's insufficient ability to learn the features of the minority class and enable the network to learn the robust features of the minority class, the feature learning and classification learning tasks are decoupled in the present application, so the feature learning branch network and the classification learning branch network are constructed respectively to adopt a model structure that separates feature learning and classification learning.

[0067] In the present application, the feature learning branch network is exemplarily composed of multiple fully connected layers, and its output is a low-dimensional expression representation vector, such as a 16-dimensional expression representation vector. In order to enable the network to learn the features of the minority class training data, the feature learning branch network is constrained using a contrast loss function. Specifically, for the input image I, assuming its emotion label is l I , the output of the feature learning branch network is z I , then its contrast loss is:

[0068]

[0069] in, represents the number of images in a batch of training data with the same label as the input image, and τ is the temperature coefficient hyperparameter.

[0070] In the present application, the classification learning branch network is exemplarily composed of multiple fully connected layers, which output the emotion category probability of the image. For the classification learning branch network, a commonly used cross entropy loss function suitable for classification tasks is used for constraint. Specifically, for the input image I, assuming that its emotion label is l I , the output of the classification learning branch network is the probability P of the 7 basic emotion categories I , then its cross entropy loss is: Among them, among them, Indicates the output probability corresponding to the true label l I probability.

[0071] Please continue to refer to Figure 1In step S400, a loss value is obtained according to the expression representation vector, the emotion classification result, the emotion label, and a preset loss function, and the parameters of the emotion recognition feature extractor and the feature learning branch network and the classification learning branch network are adjusted according to the loss value.

[0072] In this application, illustratively, the preset loss function L is: L = alpha * L CL +(1-alpha)*L CE , where alpha is a hyperparameter that gradually decreases during the iterative training process, so that the network can focus on learning a good feature in the early stage of training, especially for the minority classes with a small number in the training data set. Then, on this basis, the network will focus more on learning the classification task in the later stage of training, which not only allows the classification task to be well learned, but also helps to improve the network's learning of minority class features.

[0073] As mentioned above, the public emotion recognition training data set has a data imbalance problem. Therefore, in order to avoid the model's insufficient feature learning ability for the minority class and enable the network to learn the robust features of the minority class, the feature learning and classification learning tasks are decoupled in this application. Accordingly, in the iterative training process, not only is alpha gradually reduced during the iterative training process as described above, so as to focus on feature learning in the early stage of training and focus on classification learning in the later stage of training, but the iterative training is also divided into two stages. In the first stage, the unbalanced emotion recognition training data is directly input into the network for iterative training; in the second stage, the emotion recognition training data is first resampled to balance the batches of images of each expression category, for example, samples of a category with a small number are repeatedly sampled to increase the number of times the category is used. Then the resampled balanced distribution data is sent to the network for iterative training. In other words, the initial emotion recognition training data is first used for iterative training. After a period of training, the emotion recognition training data is resampled (that is, the initial emotion recognition training data is balanced to obtain the balanced emotion recognition training data), and then the resampled emotion recognition training data is used for iterative training.

[0074] Please continue to refer to Figure 1 In step S500, when the preset loss function reaches the set convergence condition, the first emotion recognition model is obtained according to the emotion recognition feature extractor, the feature learning branch network and the classification learning branch network. That is, when the loss value reaches the set threshold (or the loss value is lower than the threshold), the training of the network is stopped, and the first emotion recognition model is obtained according to the emotion recognition feature extractor, the feature learning branch network and the classification learning branch network.

[0075] In one embodiment of the present application, when the first emotion recognition model is obtained according to the emotion recognition feature extractor, the feature learning branch network and the classification learning branch network, the feature learning branch network is discarded. In other words, the first emotion recognition model finally obtained in the present application only includes the emotion recognition feature extractor and the classification learning branch network, and does not have the feature learning branch network.

[0076] It should be understood that the first emotion recognition model obtained by the above implementation still has the problems of large size, long prediction time, and high machine requirements. In order to meet the actual implementation needs, the implementation method of this application can also consider using knowledge distillation technology to obtain a lightweight emotion recognition model without sacrificing the model effect. Please refer to Figure 4 , Figure 4 is a flowchart of an optional specific implementation method of the method for generating an emotion recognition model according to the present application, and Figure 1 The difference of the specific embodiment shown is that after step S500, Figure 4 The optional specific embodiments shown also include:

[0077] Step S600, constructing a lightweight emotion recognition model, and taking the first emotion recognition model as a teacher model and the lightweight emotion recognition model as a student model, the lightweight emotion recognition model is iteratively trained through knowledge distillation to obtain a second emotion recognition model.

[0078] Specifically, the trained first emotion recognition model is first fixed as the teacher model, and then a lightweight emotion recognition model with fewer layers is constructed as the student model. Exemplarily, the lightweight emotion recognition model can adopt a convolution layer + pooling layer structure, which has only 8.3M parameters and a model size of 27MB. When iteratively training the lightweight emotion recognition model, the following loss function is used to adjust the model parameters, L = L CE1 +L soft

[0079] Among them, L CE1 is the cross entropy loss function,

[0080]

[0081] q I is the probability distribution of the output of the lightweight emotion recognition model, p I The probability distribution of the output of the first emotion recognition model.

[0082] In other words, in the process of training the student model, two loss functions are used for constraints, one is the cross entropy loss L CE1, one is to let the output probability distribution q of the student model I The soft target loss L close to the teacher model soft (referred to here as the soft target loss function).

[0083] After the knowledge distillation training is completed, the student model can obtain a prediction accuracy comparable to that of the teacher model, while having a smaller model size and a faster prediction speed. In one embodiment of the present application, the second emotion recognition model obtained by the knowledge distillation training is used as the final emotion prediction model, because lightweight models are very important for actual implementation work, and lightweight models can save a lot of machine costs while ensuring the effect, while obtaining a better user experience.

[0084] This application also discloses an emotion recognition method, please refer to Figure 5 , Figure 5 It is a flowchart of a specific implementation of the emotion recognition method according to the present application, and the method includes:

[0085] Step S700: Acquire a target image for emotion recognition.

[0086] Step S800: Perform emotion recognition on the target image using the first emotion recognition model or the second emotion recognition model obtained by the emotion model generation method of the above-mentioned embodiment of the present application.

[0087] The emotion recognition method disclosed in the present application has similar advantages as those mentioned above, because the emotion recognition model obtained by using the emotion recognition model generation method disclosed in the present application is used, and will not be repeated here.

[0088] This application also discloses a device for forming an emotion recognition model, please refer to Figure 6 , Figure 6 It is a flowchart of a specific implementation of a device for forming an emotion recognition model according to the present application, and the device includes:

[0089] The first input module 100 is used to obtain emotion recognition training data, and input the emotion recognition training data into an emotion recognition feature extractor for processing to obtain a first expression coding vector, the emotion recognition feature extractor is constructed using a pre-trained expression coding model, the expression coding model is used to generate a second expression coding vector, the dimension of the first expression coding vector is higher than the dimension of the second expression coding vector, and the emotion recognition training data includes an expression image and a corresponding emotion label;

[0090] The second input module 200 is used to input the first expression encoding vector into the feature learning branch network for processing to obtain an expression representation vector;

[0091] The third input module 300 is used to input the first expression coding vector into the classification learning branch network for processing to obtain an emotion classification result;

[0092] The parameter adjustment module 400 is used to obtain a loss value according to the expression representation vector, the emotion classification result, the emotion label, and a preset loss function, and adjust the parameters of the emotion recognition feature extractor and the feature learning branch network and the classification learning branch network according to the loss value;

[0093] The model acquisition module 500 is used to obtain a first emotion recognition model according to the emotion recognition feature extractor, the feature learning branch network and the classification learning branch network when the preset loss function reaches a set convergence condition.

[0094] In one embodiment of the present application, Figure 7 As shown, the device also includes:

[0095] The training unit 110 is used to iteratively train a preset expression coding model using a plurality of expression tuple training data to obtain a pre-trained expression coding model.

[0096] The interception unit 120 is used to intercept the network layer set in the pre-trained expression coding model as the emotion recognition feature extractor.

[0097] It should be understood that the first emotion recognition model obtained by the above implementation still has the problems of large size, long prediction time, and high machine requirements. In order to meet the actual implementation needs, the implementation method of this application can also consider using knowledge distillation technology to obtain a lightweight emotion recognition model without sacrificing the model effect. Please refer to Figure 8 , Figure 8 is a schematic diagram of an optional specific implementation of the device for forming an emotion recognition model according to the present application, and Figure 6 The embodiment shown differs in that Figure 8 The optional specific embodiments shown also include:

[0098] The model compression module 600 is used to construct a lightweight emotion recognition model, and use the first emotion recognition model as a teacher model and the lightweight emotion recognition model as a student model to iteratively train the lightweight emotion recognition model through knowledge distillation to obtain a second emotion recognition model.

[0099] This application also discloses an emotion recognition device, please refer to Fig. 9 , Fig. 9 It is a flowchart of a specific implementation of the emotion recognition device according to the present application, and the device includes:

[0100] The target image acquisition module 700 is used to acquire a target image for emotion recognition.

[0101] The emotion recognition module 800 is used to perform emotion recognition on the target image using the first emotion recognition model or the second emotion recognition model obtained by the emotion model generation method of the above-mentioned embodiment of the present application.

[0102] The functions of each module in each device in the implementation mode of the present application can refer to the corresponding description in the above method, and will not be repeated here.

[0103] It should be noted that although the operations of the method of the present application are described in a specific order in the accompanying drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flowchart can be changed in the order of execution. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.

[0104] Please refer to Fig.10 , Fig.10 1 is a schematic diagram of the structure of a typical computer device for executing a specific implementation of the method for calculating the audio and video fitting association of the present invention. More specifically, the above-mentioned audio and video fitting association calculation device can be included as a part of the computer device. The computer device at least includes the following parts: CPU (central processing unit) 501, RAM (random access memory) 502, ROM (read-only memory) 503, system bus 500, hard disk control unit 504, hard disk 505, human-computer interaction external device control unit 506, human-computer interaction external device 507, serial interface control unit 508, serial interface external device 509, parallel interface control unit 510, parallel interface external device 511, display device control unit 512 and display device 513. Among them, CPU 501, RAM 502, ROM 503, hard disk control unit 504, human-computer interaction external device control unit 506, serial interface control unit 508, parallel interface control unit 510 and display device control unit 512 are connected to the system bus 500, and realize communication between each other through the system bus 500. In addition, the hard disk control unit 504 is connected to the hard disk 505; the human-computer interaction external device control unit 506 is connected to the human-computer interaction external device 507, which is typically a mouse, a trackball, a touch screen or a keyboard; the serial interface control unit 508 is connected to the serial interface external device 509; the parallel interface control unit 510 is connected to the parallel interface external device 511; and the display device control unit 512 is connected to the display device 513.

[0105] Fig.10The structural block diagram merely shows the structure of a computer device that can practice various embodiments of the present invention, and is not intended to limit the practice environment of the present invention. In some cases, some devices in the computer device can be added or reduced as needed. For example, Fig.10 The device shown can remove the human-computer interaction external device 507 and the display device 513, and its specific implementation form is only a server that can be accessed by external devices. Fig.10 The computer devices shown can independently implement the operating environment of the present invention, or can be interconnected through a network to provide an operating environment suitable for each specific embodiment of the present invention. For example, each module and / or step of the present invention can be implemented in a distributed manner in each interconnected computer device.

[0106] Accordingly, the present application also discloses one or more computer-readable media storing computer-executable instructions, which, when used by one or more computer devices, enable one or more computer devices to execute the method for generating an emotion recognition model or various specific embodiments of the emotion recognition method as described above, such as Figure 1 The method for generating the emotion recognition model shown. The computer-readable medium can be any available medium that can be accessed by a computer device, and includes volatile and non-volatile media, removable and non-removable media implemented by any method and technology to store information such as computer-readable instructions, data structures, program modules or other data. Computer-readable media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical storage, cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computing device. Any combination of the above should also be included in the scope of computer-readable media.

[0107] Accordingly, the present application also discloses a computer device, the computer device comprising a memory and a processor, wherein: the memory stores a computer program, and the processor implements the method for generating an emotion recognition model or various specific implementations of the emotion recognition method as described above when executing the computer program, for example Figure 1 The generation method of the emotion recognition model shown.

[0108] The method for generating an emotion recognition model or the part of the emotion recognition method involving software logic provided in the present application can be implemented using a programmable logic device, or can be implemented as a computer program product, which enables a computer to execute the method for the demonstration. The computer program product includes a computer-readable storage medium, which contains a computer program logic or code part, and is used to implement the various steps of the above-mentioned part involving software logic. The computer-readable storage medium can be a built-in medium installed in a computer or a removable medium that can be removed from the computer body (such as a hot-swappable storage device). The built-in medium includes, but is not limited to, a rewritable non-volatile memory, such as RAM, ROM, and a hard disk. The removable medium includes, but is not limited to: optical storage media (such as CD-ROM and DVD), magneto-optical storage media (such as MO), magnetic storage media (such as magnetic tape or mobile hard disk), a medium with a built-in rewritable non-volatile memory (such as a memory card), and a medium with a built-in ROM (such as a ROM box).

[0109] Those skilled in the art will appreciate that any computer system with an appropriate programming device can perform the steps of the method of the present application contained in the computer program product. Although most of the specific embodiments described in this specification focus on software programs, alternative embodiments that implement the method provided by the present application in hardware are also within the scope of protection claimed in the present application.

[0110] It is obvious to those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or basic features of the present application. Therefore, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present application is defined by the appended claims rather than the above description, and all changes within the meaning and scope of the equivalent elements of the claims are included in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other parts, units or steps, and the singular does not exclude the plural. Multiple parts, units or devices stated in the claims may also be implemented by one part, unit or device through software or hardware.

[0111] The method for generating an emotion recognition model provided in the present application, firstly, uses an emotion feature extractor based on a pre-trained expression coding model, which extracts features based on expression coding as prior knowledge, so that the extracted features can reduce the interference of identity information and occlusion information; secondly, the feature learning branch network and the classification learning branch network are decoupled in the training of the model, so that the feature learning of minority classes can be effectively assisted in the training process, and the bias problem caused by data imbalance can be alleviated. Furthermore, the method for generating an emotion recognition model provided in the present application can also use knowledge distillation technology to compress the model to achieve a lightweight emotion recognition model, so that the model is suitable for most landing scenarios. The emotion recognition method provided in the present application has similar advantages because it uses the model formed by the method for generating an emotion recognition model of the present application.

[0112] The above disclosure is only a part of the embodiments or specific implementation methods of the present application, which cannot be used to limit the scope of rights of the present application. Equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A method for generating an emotion recognition model, characterized in that: The method comprises: Acquire emotion recognition training data, and input the emotion recognition training data into an emotion recognition feature extractor for processing to obtain a first expression coding vector, wherein the emotion recognition feature extractor is constructed using a pre-trained expression coding model, and an initial expression coding model is iteratively trained using a plurality of expression multi-group training data to obtain the pre-trained expression coding model, wherein each expression multi-group training data includes a target expression sample image, a positive expression image similar to the target expression sample image, and a negative expression sample image dissimilar to the target expression sample image, and a set number of network layers in the pre-trained expression coding model are intercepted as the emotion recognition feature extractor; The expression coding model is used to generate a second expression coding vector, the dimension of the first expression coding vector is higher than the dimension of the second expression coding vector, and the emotion recognition training data includes an expression image and a corresponding emotion label; Inputting the first expression encoding vector into the feature learning branch network for processing to obtain an expression representation vector; Inputting the first expression coding vector into the classification learning branch network for processing to obtain an emotion classification result; Obtaining a loss value according to the expression representation vector, the emotion classification result, the emotion label, and a preset loss function, and adjusting the parameters of the emotion recognition feature extractor and the feature learning branch network and the classification learning branch network according to the loss value; When the preset loss function reaches a set convergence condition, a first emotion recognition model is obtained according to the emotion recognition feature extractor, the feature learning branch network and the classification learning branch network.

2. According to the method for generating an emotion recognition model according to claim 1, the preset loss function includes a first loss function for a feature learning branch network and a second loss function for a classification learning branch network, the first loss function adopts a contrast loss function, and the second loss function adopts a cross entropy loss function.

3. The method for generating an emotion recognition model according to claim 2, wherein: The preset loss function also includes a first weight of the first loss function and a second weight of the second loss function. During the iteration process of the feature learning branch network, the first weight gradually decreases.

4. According to the method for generating an emotion recognition model according to any one of claims 1 to 3, the acquiring of emotion recognition training data comprises: Obtain initial emotion recognition training data; The initial emotion recognition training data is subjected to equalization processing to obtain the emotion recognition training data after equalization processing, wherein the equalization processing includes the step of resampling the initial emotion recognition training data to equalize batches of images of various expression categories.

5. The method for generating an emotion recognition model according to claim 1, wherein the first emotion recognition model is obtained according to the emotion recognition feature extractor, the feature learning branch network and the classification learning branch network, comprising: The feature learning branch network is discarded, and a first emotion recognition model is obtained based on the retained emotion recognition feature extractor and the classification learning branch network.

6. The method for generating an emotion recognition model according to any one of claims 1 to 3, wherein: The method further includes: A lightweight emotion recognition model is constructed, and the first emotion recognition model is used as a teacher model, and the lightweight emotion recognition model is used as a student model to iteratively train the lightweight emotion recognition model through knowledge distillation to obtain a second emotion recognition model.

7. The method for generating an emotion recognition model according to claim 6, wherein: When iteratively training the lightweight emotion recognition model, a cross entropy loss function and a soft target loss function are used to calculate the loss value.

8. An emotion recognition method, the method comprising: Obtain a target image for emotion recognition; A first emotion recognition model is obtained using the method for generating an emotion recognition model described in any one of claims 1 to 5 to perform emotion recognition on the target image, or a second emotion recognition model is obtained using the method for generating an emotion recognition model described in claim 6 or 7 to perform emotion recognition on the target image.

9. A device for forming an emotion recognition model, the device comprising: A first input module is used to obtain emotion recognition training data, and input the emotion recognition training data into an emotion recognition feature extractor for processing to obtain a first expression coding vector, wherein the emotion recognition feature extractor is constructed using a pre-trained expression coding model, and an initial expression coding model is iteratively trained using a plurality of expression multi-group training data to obtain the pre-trained expression coding model, wherein each expression multi-group training data includes a target expression sample image, a positive expression image similar to the target expression sample image, and a negative expression sample image not similar to the target expression sample image, and a set number of network layers in the pre-trained expression coding model are intercepted as the emotion recognition feature extractor, and the expression coding model is used to generate a second expression coding vector, wherein the dimension of the first expression coding vector is higher than that of the second expression coding vector, and the emotion recognition training data includes expression images and corresponding emotion labels; A second input module, used for inputting the first expression encoding vector into a feature learning branch network for processing to obtain an expression representation vector; A third input module is used to input the first expression coding vector into the classification learning branch network for processing to obtain an emotion classification result; A parameter adjustment module, used to obtain a loss value according to the expression representation vector, the emotion classification result, the emotion label, and a preset loss function, and adjust the parameters of the emotion recognition feature extractor and the feature learning branch network and the classification learning branch network according to the loss value; A model acquisition module is used to obtain a first emotion recognition model according to the emotion recognition feature extractor, the feature learning branch network and the classification learning branch network when the preset loss function reaches a set convergence condition.

10. An emotion recognition device, comprising: A target acquisition module, used to acquire a target image to be subjected to emotion recognition; An emotion recognition module is used to perform emotion recognition on the target image by using a first emotion recognition model obtained by the method for generating an emotion recognition model described in any one of claims 1 to 5, or to perform emotion recognition on the target image by using a second emotion recognition model obtained by the method for generating an emotion recognition model described in claim 6 or 7.

11. One or more computer-readable media storing computer-executable instructions, which, when used by one or more computer devices, enable the one or more computer devices to execute the method for generating an emotion recognition model as described in any one of claims 1 to 7 or the emotion recognition method as described in claim 8.

12. A computer device comprising a memory and a processor, wherein: The memory stores a computer program, and when the processor executes the computer program, it implements the method for generating an emotion recognition model according to any one of claims 1 to 7 or the emotion recognition method according to claim 8.