CN114882566A - Method, device and equipment for training expression recognition model - Google Patents

Method, device and equipment for training expression recognition model Download PDF

Info

Publication number
CN114882566A
CN114882566A CN202210560572.XA CN202210560572A CN114882566A CN 114882566 A CN114882566 A CN 114882566A CN 202210560572 A CN202210560572 A CN 202210560572A CN 114882566 A CN114882566 A CN 114882566A
Authority
CN
China
Prior art keywords
expression
features
identity
loss value
dense block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210560572.XA
Other languages
Chinese (zh)
Inventor
武文琦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202210560572.XA priority Critical patent/CN114882566A/en
Publication of CN114882566A publication Critical patent/CN114882566A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/174Facial expression recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/80Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
    • G06V10/806Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level of extracted features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/172Classification, e.g. identification

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Software Systems (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Human Computer Interaction (AREA)
  • Biomedical Technology (AREA)
  • Mathematical Physics (AREA)
  • Biophysics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Molecular Biology (AREA)
  • Computational Linguistics (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the specification discloses a method, a device and equipment for training an expression recognition model. Obtaining a training sample, wherein the training sample comprises an identity label and an expression label; extracting the identity features of the training samples by adopting a first dense block, and extracting the expression features of the training samples by adopting a second dense block; fusing the expression features and the identity features by adopting a third dense block to generate fused features; performing identity recognition and expression recognition according to the fusion characteristics, and respectively generating an identity recognition result and an expression recognition result; determining a first loss value according to the difference between the identity recognition result and the identity label, and determining a second loss value according to the difference between the expression recognition result and the expression label; fusing the first loss value and the second loss value to determine an overall loss value; and training according to the total loss value to generate a target model. Therefore, feature fusion is realized, and the recognition accuracy of the expressions is improved.

Description

Method, device and equipment for training expression recognition model
Technical Field
The specification relates to the technical field of internet, in particular to a method, a device and equipment for training an expression recognition model.
Background
Human expressions, such as happy, angry, heartburn, etc., are expressed from the face as an expression of a psychological state, so that the psychological state of human can be judged by the expression of the face, and thus expression recognition is widely used in human-computer interaction.
However, in the process of facial expression recognition, the facial expression often presents an unstable and irregular state. Different people express the same expression and show great difference (i.e. intra-class difference), and meanwhile, different expressions have certain similarity (i.e. inter-class similarity). In practice, there are also obvious differences when different people make the same expression, and meanwhile, some people can express different mental states by using the same expression, which brings challenges to accurate classification of expressions.
Based on this, a more accurate training scheme of the expression recognition model is needed to train and obtain the expression recognition model with higher recognition accuracy.
Disclosure of Invention
One or more embodiments of the present specification provide a method, an apparatus, a device, and a storage medium for training an expression recognition model, so as to solve the following technical problems: there is a need for expression recognition models with higher recognition accuracy.
To solve the above technical problem, one or more embodiments of the present specification are implemented as follows:
in a first aspect, an embodiment of the present specification provides a training method for an expression recognition model, which is applied to an initial model including a plurality of dense blocks with the same structure, and the method includes: acquiring a training sample, wherein the training sample comprises an identity label and an expression label; extracting the identity features of the training samples by adopting a first dense block, and extracting the expression features of the training samples by adopting a second dense block; fusing the expression features and the identity features by adopting a third dense block to generate fused features; performing identity recognition and expression recognition according to the fusion characteristics, and respectively generating an identity recognition result and an expression recognition result; determining a first loss value according to the difference between the identity recognition result and the identity label, and determining a second loss value according to the difference between the expression recognition result and the expression label; fusing the first loss value and the second loss value to determine an overall loss value; and training the parameters in the third dense block according to the total loss value to generate a target model.
In a second aspect, an embodiment of the present specification provides an expression recognition model training apparatus, applied to an initial model including a plurality of dense blocks with the same structure, the apparatus including: the system comprises a sample acquisition module, a data acquisition module and a data processing module, wherein the sample acquisition module is used for acquiring a training sample, and the training sample comprises an identity label and an expression label; the feature extraction module is used for extracting the identity features of the training samples by adopting the first dense blocks and extracting the expression features of the training samples by adopting the second dense blocks; the feature fusion module is used for fusing the expression features and the identity features by adopting a third dense block to generate fused features; the recognition module is used for carrying out identity recognition and expression recognition according to the fusion characteristics and respectively generating an identity recognition result and an expression recognition result; the loss determining module is used for determining a first loss value according to the difference between the identity recognition result and the identity label and determining a second loss value according to the difference between the expression recognition result and the expression label; the loss fusion module fuses the first loss value and the second loss value to determine an overall loss value; and the parameter training module is used for training the parameters in the third dense block according to the total loss value to generate a target model.
In a third aspect, embodiments of the present specification provide an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first aspect.
In a fourth aspect, embodiments of the present specification provide a non-volatile computer storage medium having stored thereon computer-executable instructions that, when read by a computer, cause the one or more processors to perform the method of the first aspect.
At least one technical scheme adopted by one or more embodiments of the specification can achieve the following beneficial effects: the method comprises the steps that a training sample is obtained, wherein the training sample comprises an identity label and an expression label; extracting the identity features of the training samples by adopting a first dense block, and extracting the expression features of the training samples by adopting a second dense block; fusing the expression features and the identity features by adopting a third dense block to generate fused features; performing identity recognition and expression recognition according to the fusion characteristics, and respectively generating an identity recognition result and an expression recognition result; determining a first loss value according to the difference between the identity recognition result and the identity label, and determining a second loss value according to the difference between the expression recognition result and the expression label; fusing the first loss value and the second loss value to determine an overall loss value; and training the parameters in the third dense block according to the total loss value to generate a target model. Therefore, the identity characteristics and the expression characteristics are fused, the identity recognition task is used as an auxiliary task of the expression recognition task, the identity characteristics contained in the expression characteristics are enhanced, and the recognition accuracy of the target model for the expression categories is improved.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present specification, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort.
Fig. 1 is a schematic flowchart of a training method for an expression recognition model according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a dense block structure provided by embodiments of the present disclosure;
FIG. 3 is a schematic diagram of a training sample provided in an embodiment of the present disclosure;
FIG. 4 is a schematic structural diagram of an initial model provided in an embodiment of the present disclosure;
FIG. 5 is a schematic structural diagram of a model including pre-training provided in an embodiment of the present disclosure;
FIG. 6 is a schematic structural diagram of a target model provided in an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of a training apparatus for an expression recognition model according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device provided in an embodiment of the present specification.
Detailed Description
The embodiment of the specification provides a method, a device, equipment and a storage medium for training an expression recognition model.
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any inventive step based on the embodiments of the present disclosure, shall fall within the scope of protection of the present application.
As shown in fig. 1, fig. 1 is a flowchart illustrating a method for training an expression recognition model provided in an embodiment of the present specification, and is applied to an initial model including a plurality of dense blocks having the same structure, and specifically includes the following steps:
s101: obtaining a training sample, wherein the training sample comprises an identity label and an expression label.
In an embodiment of the present specification, a dense block is a convolutional neural network with tight junction properties. Multiple dense layers may be included in a dense block, where any two layers are directly connected, the input of each layer is the union of the outputs of all the previous layers (i.e., the input of each layer is the concatenation of the outputs of all the previous layers, where concatenation refers to concatenation at the channel level), and the learned features of this layer are also directly transmitted to all the following layers as input.
In other words, in the dense block referred to in the embodiments of the present description, the number of output channels per layer is not changed, but the number of input channels is increased. For example, for an N-layer dense block, the size of the input initial feature may be a × B × C, and the size of the output feature may be D × E × F, so by the nth layer, the size of the input feature may be a × B × (C × N), and the size of the output feature may still be D × E × F.
This structure of dense blocks can enhance the spread of features, encouraging reuse of features, while also greatly reducing the number of parameters that need to be adjusted during training.
Fig. 2 is a schematic structural diagram of a dense block provided in the embodiment of the present disclosure, as shown in fig. 2. In this schematic, each circle represents a dense layer. The output of the preceding dense layer will affect the input of each of the following dense layers simultaneously.
For example, as an exemplary embodiment, the number of dense layers included in one dense block may be 6. Sequentially comprises the following steps: batch Normalization (BN) layer, ReLU activation function layer, Conv convolution layer with convolution kernel size 1 × 1, Batch Normalization layer, ReLU activation function layer, and Conv convolution layer with convolution kernel size 3 × 3. Each convolutional layer contains 12 filters, all pooling layers except the global average pooling layer have a pooling kernel size of 2 x 2, and the step size is set to 2.
The operation executed by the batch normalization layer is batch normalization operation, namely input feature data is normalized by adopting a preset calculation formula, so that the original offset feature data is pulled back to the 0 mean value again, and the data entering the activation function is distributed in the linear region of the activation function.
In addition, in the embodiment of the present specification, the initial structure of each dense block is the same, that is, each dense block includes a plurality of dense layers with the same number, the same order, and the same function, and the initial values of the parameters to be trained in each dense layer are also the same, so as to facilitate parameter sharing in each dense block.
The training sample is a picture or a group of pictures containing facial expressions, wherein the pictures contain corresponding identity labels and expression labels. As shown in fig. 3, fig. 3 is a schematic diagram of a training sample provided in the embodiment of the present disclosure, where ID1, ID2, and ID3 are identity tags, and "fear", "surprise", and the like are expression tags.
The training samples may be standard size images that are pre-processed. For example, the image may be an image including a face region after face detection, and the size of the image is 48 × 48 pixels.
S103, extracting the identity features of the training samples by adopting the first dense blocks, and extracting the expression features of the training samples by adopting the second dense blocks.
In the embodiment of the specification, at least a first dense block for extracting identity features, a second dense block for extracting expression features and a third dense block for feature fusion are contained in the initial model. The form of the extracted identity features and expression features can be vectors or feature maps.
In addition, it should be noted that the first dense blocks for extracting the identity features may be one or more, a plurality of the first dense blocks are in a serial structure, and the second dense block may also be one or more in serial. Other operations may also be performed on the generated intermediate variables between dense blocks, including such things as batch normalization, convolution and pooling. Fig. 4 is a schematic structural diagram of an initial model provided in an embodiment of the present disclosure, as shown in fig. 4.
In the initial model, the first dense block and the second dense block are identical in structure, but the initial values of the parameters may be different. For example, the parameter in the first dense block may be referred to as a first preset parameter, the parameter in the second dense block may be referred to as a second preset parameter, and the first preset parameter and the second preset parameter have the same meaning and function, but different values.
For example, the first dense block is used to extract the identity feature of the training sample, and therefore, the first dense block may be subjected to pre-training based on identity recognition in advance to obtain the first preset parameter. Extracting the identity features of the training samples by using the first dense block; meanwhile, identity recognition is carried out by adopting a fifth dense block according to the expression characteristics, and a pre-training identity recognition result is generated; pre-training the first dense block and the fifth dense block according to the difference between the pre-training identity recognition result and the identity label to generate an available identity recognition model; determining parameters of a first dense block in the available identification model as the first preset parameters. The first preset parameter obtained in the mode can ensure that the first dense block can extract accurate identity features from the training sample.
Meanwhile, the second dense block is used for extracting the expression features of the training sample, so that the second dense block can be pre-trained in advance based on expression recognition to obtain a second preset parameter. Extracting expression features of the training sample by adopting the second dense block; adopting a fourth dense block to perform expression recognition according to the expression features to generate a pre-training expression recognition result; pre-training the second dense block and the fourth dense block according to the difference between the pre-training expression recognition result and the expression label to generate an available expression recognition model; and determining the parameters of the second dense block in the available expression recognition model as the second preset parameters.
The usable identity recognition model and the usable expression recognition model generated by the pre-training are generally models with recognition accuracy exceeding a certain value for the training sample, for example, a model with recognition accuracy exceeding 95% for an expression may be required to be a usable expression recognition model.
As shown in fig. 5, fig. 5 is a schematic diagram of an architecture including a pre-trained model according to an embodiment of the present disclosure. After the pre-training, the parameters in the first dense block and the second dense block can ensure that the relevant features can be accurately extracted. Therefore, when the initial model is trained, the classification parts in the pre-trained identity recognition model and the pre-trained expression recognition model can be removed, that is, the parts in the dashed box illustrated in fig. 5 are removed, and the first dense block and the second dense block used for feature extraction are reserved.
In the embodiment of the present specification, since the first dense block and the second dense block have the same structure, the sizes of the extracted identity feature and the extracted expression feature are the same, for example, the sizes of the extracted identity feature map and the extracted expression feature map are both W × H × D, where W is the length, H is the width, and D is the number of layers.
In practical applications, if the size of the identity feature map and the size of the expression feature map are different, it is often necessary to perform scaling, interpolation, and other manners to make the size of the identity feature map and the size of the expression feature map the same, and then perform feature concatenation (for example, directly superimposing points of the two feature maps). In the embodiment of the present specification, on the premise that the structures of the first dense block and the second dense block are the same, the extracted features have the same size, which is beneficial to feature splicing and feature fusion between the identity feature map and the expression feature map in the subsequent part.
And S105, fusing the expression features and the identity features by adopting the third dense block to generate fused features.
When the expression features and the identity features are in the form of vectors, splicing can be directly performed, and the spliced vectors are used as the input of the third dense block.
When the expression features and the identity features are in the form of feature graphs, the expression features and the identity features can be spliced to generate spliced features, at the moment, because the expression features and the identity features are the same in size and are W multiplied by H multiplied by D, the spliced features can be generated in a point-to-point direct superposition mode during splicing, and feature fusion is performed by performing operations such as convolution, BN and pooling on the spliced features by using a third dense block to generate fusion features.
As shown in fig. 4, the spliced features may also be batch normalized and pooled prior to feature fusion using the third dense block. The pooling here may be local pooling (i.e., pooling within a channel) or global pooling (i.e., pooling between channels). The third dense block further generates output features from the input features; and sequentially carrying out batch standardization and Global Average Pooling (such as Global Average Pooling (GAP)) on the output features to generate fusion features.
The process of the third dense block generating the output feature according to the input feature is the process of processing data by the dense blocks. In the embodiments of the present specification, the structures of the dense blocks are all the same. For example, the third dense block may likewise be a structure comprising 6 layers as follows: batch Normalization (BN) layer, ReLU activation function layer, Conv convolution layer with convolution kernel size 1 × 1, Batch Normalization layer, ReLU activation function layer, and Conv convolution layer with convolution kernel size 3 × 3. Then the third dense block performs the following operations for the input features, in order: BN processing, activation processing, 1 × 1 convolution processing, BN processing, activation processing, and 3 × 3 convolution processing, and finally output features are generated.
The form of the generated fusion feature is the same as that of the input splicing feature, namely when the form of the input splicing feature is a one-dimensional vector, the fusion feature is also a one-dimensional vector; when the input splicing feature is a feature map with the size of W × H × D, the generated fusion feature is the feature map with the size of W × H × D.
And S107, performing identity recognition and expression recognition according to the fusion characteristics, and respectively generating an identity recognition result and an expression recognition result.
As shown in fig. 4 or fig. 5, constraint-based multitask training, i.e., identity recognition training and expression recognition training, is performed simultaneously in the embodiment of the present specification.
Specifically, expression recognition is used as a main task, and identity recognition is used as an auxiliary task. For the output fusion characteristics, two classification tasks are simultaneously and parallelly entered, wherein one classification task is used for identifying the identity and giving an identity identification result; and the other classification task is used for identifying the expression and giving an expression identification result.
For example, two linear fully-connected layers may be employed for parallel identification. As shown in fig. 4, a first linear fully-connected layer and a second linear fully-connected layer are included. Taking the fusion features as input of a first linear full-connection layer to generate an identity recognition result, wherein the dimensionality of the first linear full-connection layer is the same as the category number of the identity labels; and taking the fusion features as input of a second linear full connection layer to generate an expression recognition result, wherein the dimensionality of the second linear full connection layer is the same as the category quantity of the expression labels.
When the linear full-connection layer is adopted for classified output, the output result is a multi-dimensional vector, the dimensionality of the vector is the category number of the labels, and the value of each dimensionality represents the probability that the identification result is the label corresponding to the dimensionality. For example, assuming that the categories of the emoji labels are 4 in total, the expression recognition result may be generated in the form of (0.1, 0.2, 0.1, 0.9), which respectively represents the probabilities of the expressions of the input image in the four categories.
S109, determining a first loss value according to the difference between the identity recognition result and the identity label, and determining a second loss value according to the difference between the expression recognition result and the expression label.
The first and second penalty values may be calculated separately using, for example, an absolute penalty function, a logarithmic penalty function, a cross-entropy penalty function, or the like.
And S111, fusing the first loss value and the second loss value to determine an overall loss value.
Adding the first loss value and the second loss value to generate an overall loss value; or, the first loss value and the second loss value are weighted and summed by adopting a preset weighting coefficient to generate an overall loss value.
In the embodiment of the present specification, since the extracted identity tag and the expression tag are actually two different classification tasks, the first loss value and the second loss value often have a certain difference in magnitude. Meanwhile, since the expression recognition needs to be emphasized, it is necessary to highlight the second loss value generated by the expression recognition.
Based on this, a super-parameter can be preset as a weight coefficient to perform weighting fusion on the first loss value and the second loss value to determine an overall loss value, wherein the preset weight coefficient (i.e. the super-parameter) is used for restricting the ratio of the weighted first loss value and the weighted second loss value not to exceed a preset ratio.
For example, practical statistics show that the first loss value is often about K times the second loss value in magnitude, and in order to highlight the second loss value generated by expression recognition, it is necessary to restrict the ratio of the weighted first loss value to the weighted second loss value to not exceed 1/2, and the preset weighting coefficient may be 1/2K, so that the total loss value is (1/2K) × the first loss value + the second loss value.
And, during the training process, the magnitudes of the first loss value and the second loss value are generally changed step by step along with the training of the model (for example, the loss values are generally reduced as the model is more precise, wherein the reduced magnitude of the first loss value may be larger). In practical application, training of the target model may be staged, and different hyper-parameters are designed as weight coefficients in each stage based on actual needs, so that the ratio of the weighted first loss value to the weighted second loss value does not exceed a preset ratio, and the loss value of the expression recognition part is highlighted.
And S113, training the parameters in the third dense block according to the total loss value to generate a target model.
After the overall loss value is determined, the target model may be trained, such as by back propagation. In the embodiment of the present specification, the training of the target model mainly includes training of the relevant parameters in the dense blocks, especially training of the parameters in the third dense block, to generate the target model. The trained target model should achieve a certain accuracy in both expression recognition and identity recognition, for example, 95% accuracy in expression recognition and 90% accuracy in identity recognition may be required.
The training of the target model includes training of the relevant parameters in the dense block and training of other relevant parameters.
Training the correlation parameters in the dense blocks includes training the weight parameters of the convolution kernels in the dense blocks. For example, assume a dense block structure comprising 6 layers as follows: batch Normalization (BN) layer, ReLU activation function layer, Conv convolution layer with convolution kernel size 1 × 1, Batch Normalization layer, ReLU activation function layer, and Conv convolution layer with convolution kernel size 3 × 3. Then training for the dense block includes training for parameters in a 1 x 1 convolution kernel and a 3 x 3 convolution kernel therein.
And the training of the target model also comprises the training of other related parameters, wherein the other related parameters comprise parameters of other convolution kernels for feature transfer between various dense layers, related parameters contained between full-connection layers and the like.
Furthermore, it should be noted that the training of the target model and the pre-training are two independent parts. The pre-training process is illustrated by the dashed box in fig. 5, and after the first pre-set parameters in the first dense block are determined by the identification pre-training, the part is removed in the subsequent training. The pre-trained part of the expression recognition is also removed based on the same way.
The generated object model should include at least the aforementioned first dense block, second dense block, third dense block, and fully connected layers for expression recognition. As shown in fig. 6, fig. 6 is a schematic structural diagram of an object model provided in an embodiment of the present disclosure. In the generated target model, a pre-training part is removed, and meanwhile, the identity classification part is only used as an auxiliary task for assisting expression recognition, so that the identity recognition part used for assisting recognition in the training process can be finally removed.
Obtaining a training sample, wherein the training sample comprises an identity label and an expression label; extracting the identity features of the training samples by adopting a first dense block, and extracting the expression features of the training samples by adopting a second dense block; fusing the expression features and the identity features by adopting a third dense block to generate fused features; performing identity recognition and expression recognition according to the fusion characteristics, and respectively generating an identity recognition result and an expression recognition result; determining a first loss value according to the difference between the identity recognition result and the identity label, and determining a second loss value according to the difference between the expression recognition result and the expression label; fusing the first loss value and the second loss value to determine an overall loss value; and training the parameters in the third dense block according to the total loss value to generate a target model. Therefore, the identity characteristics and the expression characteristics are fused, the identity recognition task is used as an auxiliary task of the expression recognition task, the identity characteristics contained in the expression characteristics are enhanced, and the recognition accuracy of the target model for the expression categories is improved.
In one embodiment, since the dense blocks have the same structure, before the target model is trained, the parameters corresponding to the expression recognition part generated in the pre-training process may be migrated to the third dense block. Namely, the parameters of the fourth dense block in the available expression recognition model (namely, the available expression recognition model generated by pre-training) are migrated into the third dense block, and the parameters are determined as the third preset parameters of the third dense block.
Therefore, the first preset parameter, the second preset parameter and the third preset parameter can be used as initial parameters of the target model to train the model, and the training process of the model is accelerated.
When the parameters in the third dense block are trained according to the total loss value, the first preset parameter, the second preset parameter and the third preset parameter may be trained at the same time. However, as described above, the first preset parameter and the second preset parameter are only used for extracting features, and have better performance in extracting features (that is, the identity feature extracted based on the first preset parameter can realize accurate identity recognition, and the expression feature extracted based on the second preset parameter can realize accurate expression recognition).
Therefore, in an embodiment, during the training process for the target model, the first preset parameter in the first dense block and the second preset parameter in the second dense block may also be maintained unchanged, and the third preset parameter in the third dense block is trained only according to the total loss value to generate the target model. Thus, optimized feature fusion is realized while maintaining accurate feature extraction.
After the target model is obtained through the training in the above manner, the model can be used to perform expression recognition and subsequent evaluation on the input image to be recognized. As shown in fig. 6, the target model should contain at least the aforementioned first dense block, second dense block, third dense block, and full connection layer for expression recognition.
Furthermore, for any face image to be recognized, the expression contained therein can be recognized as follows: acquiring a face image to be recognized (namely extracting a partial image containing a face); extracting the identity feature of the facial image to be recognized by adopting the first dense block, and extracting the expression feature of the facial image to be recognized by adopting the second dense block; fusing the expression features and the identity features by adopting a third dense block in the target model to generate fused features; and performing expression recognition according to the fusion characteristics to generate an expression recognition result.
In this process, the parameter value in the first dense block may be a first preset parameter, the value of the parameter in the second dense block may be a second preset parameter, and the parameter in the third dense block may be a value determined when the target model is trained with the third preset parameter as an initial value. That is, as shown in fig. 5, the parameters of the fourth dense block in the available expression recognition model may be migrated into the third dense block, determined as the third preset parameters of the third dense block, and used as the initial values.
Because the first dense block and the second dense block contained in the target model are verified to be capable of accurately extracting features, and the third dense block is verified to be capable of accurately fusing the identity features and the expression features, the features obtained by fusing the target model can be considered as expression of the expression features containing the identity features, so that the accuracy of expression recognition is improved.
In one embodiment, the target model may further include the fully connected layer for identity recognition, which is used for identity recognition based on the fused features. But the part of identity recognition is only used for evaluating the confidence of the expression recognition result by the back end. Performing identity recognition according to the fusion characteristics to generate an identity recognition result; and evaluating the confidence of the expression recognition result according to the accuracy of the identity recognition result, specifically, the accuracy of the identity recognition result is positively correlated with the confidence of the expression recognition result.
For example, the identification result may be accurate or may be erroneous. When the identity recognition result is accurate (or has a high accuracy probability), the confidence of the expression recognition result is considered to be high, that is, the target model accurately distinguishes different users based on the fusion features, and the recognition of different expressions among the same user often has high accuracy; otherwise, when the identity recognition result is wrong, the target model may not accurately distinguish different users based on the fusion features, and at this time, the confidence of the expression recognition result may be low.
Based on the same idea, one or more embodiments of the present specification further provide apparatuses and devices corresponding to the above-described method, as shown in fig. 7 and fig. 8.
In a second aspect, as shown in fig. 7, fig. 7 is a schematic structural diagram of an expression recognition model training apparatus provided in an embodiment of the present specification, applied to an initial model including a plurality of dense blocks with the same structure, where the apparatus includes:
a sample obtaining module 701, configured to obtain a training sample, where the training sample includes an identity tag and an expression tag;
the feature extraction module 703 is configured to extract the identity features of the training samples by using the first dense blocks, and extract the expression features of the training samples by using the second dense blocks;
a feature fusion module 705 for fusing the expression features and the identity features by using a third dense block to generate fused features;
the identification module 707 performs identity identification and expression identification according to the fusion features, and generates an identity identification result and an expression identification result respectively;
a loss determining module 709, configured to determine a first loss value according to a difference between the identity recognition result and the identity tag, and determine a second loss value according to a difference between the expression recognition result and the expression tag;
a loss fusion module 711 for fusing the first loss value and the second loss value to determine an overall loss value;
and a parameter training module 713, which trains the parameters in the third dense block according to the total loss value to generate a target model.
Optionally, the apparatus further includes a pre-training module 715, where the second dense block includes a second preset parameter, and the second preset parameter is obtained based on the following pre-training mode of the pre-training module: extracting expression features of the training sample by adopting the second dense block; adopting a fourth dense block to perform expression recognition according to the expression features to generate a pre-training expression recognition result; pre-training the second dense block and the fourth dense block according to the difference between the pre-training expression recognition result and the expression label to generate an available expression recognition model; and determining the parameters of the second dense block in the available expression recognition model as the second preset parameters.
Optionally, the pre-training module 715 migrates parameters of a fourth dense block in the available expression recognition model into the third dense block, and determines the parameters as third preset parameters of the third dense block.
Optionally, the parameter training module 713 maintains a first preset parameter in the first dense block and a second preset parameter in the second dense block unchanged, and trains a third preset parameter in the third dense block according to the total loss value to generate a target model.
Optionally, the feature fusion module 705 splices the expression features and the identity features to generate spliced features; performing convolution operation and pooling operation on the splicing features in sequence to generate input features of the third dense block; the third dense block generating output features from the input features; and sequentially carrying out batch standardization and global average pooling on the output features to generate fusion features.
Optionally, the identifying module 707 takes the fused feature as an input of a first linear fully-connected layer, and generates an identity identification result, where a dimension of the first linear fully-connected layer is the same as the number of categories of the identity tag; and taking the fusion features as input of a second linear full-connection layer to generate an expression recognition result, wherein the dimensionality of the second linear full-connection layer is the same as the category number of the expression labels.
Optionally, the loss fusion module 711 performs weighted fusion on the first loss value and the second loss value according to a preset weight coefficient to determine an overall loss value, where the preset weight coefficient is used to constrain a ratio of the weighted first loss value and the weighted second loss value not to exceed a preset ratio.
Optionally, the apparatus further comprises an expression recognition module 717 for acquiring a facial image to be recognized; extracting the identity feature of the facial image to be recognized by adopting the first dense block, and extracting the expression feature of the facial image to be recognized by adopting the second dense block; fusing the expression features and the identity features by adopting a third dense block in the target model to generate fused features; and performing expression recognition according to the fusion characteristics to generate an expression recognition result.
Optionally, the apparatus further includes an evaluation module 719, which performs identity recognition according to the fusion features to generate an identity recognition result; and evaluating the confidence of the expression recognition result according to the accuracy of the identity recognition result.
In a third aspect, an embodiment of the present specification further provides an electronic device, as shown in fig. 8, where fig. 8 is a schematic structural diagram of the electronic device provided in the embodiment of the present specification, and the electronic device includes:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first aspect.
In a fourth aspect, based on the same idea, the present specification further provides a non-volatile computer storage medium corresponding to the method described above, and storing computer-executable instructions, which, when read by a computer, cause one or more processors to execute the method according to the first aspect.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical blocks. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: the ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, the present specification embodiments may be provided as a method, system, or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the apparatus, the device, and the nonvolatile computer storage medium, since they are substantially similar to the embodiments of the method, the description is simple, and for the relevant points, reference may be made to the partial description of the embodiments of the method.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above description is merely one or more embodiments of the present disclosure and is not intended to limit the present disclosure. Various modifications and alterations to one or more embodiments of the present description will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement or the like made within the spirit and principle of one or more embodiments of the present specification should be included in the scope of the claims of the present specification.

Claims (11)

1. A training method of an expression recognition model is applied to an initial model containing a plurality of dense blocks with the same structure, and comprises the following steps:
acquiring a training sample, wherein the training sample comprises an identity label and an expression label;
extracting the identity features of the training samples by adopting a first dense block, and extracting the expression features of the training samples by adopting a second dense block;
fusing the expression features and the identity features by adopting a third dense block to generate fused features;
performing identity recognition and expression recognition according to the fusion characteristics, and respectively generating an identity recognition result and an expression recognition result;
determining a first loss value according to the difference between the identity recognition result and the identity label, and determining a second loss value according to the difference between the expression recognition result and the expression label;
fusing the first loss value and the second loss value to determine an overall loss value;
and training the parameters in the third dense block according to the total loss value to generate a target model.
2. The method of claim 1, wherein the second dense block comprises a second preset parameter, and the second preset parameter is obtained based on the following pre-training mode:
extracting expression features of the training sample by adopting the second dense block;
adopting a fourth dense block to perform expression recognition according to the expression features to generate a pre-training expression recognition result;
pre-training the second dense block and the fourth dense block according to the difference between the pre-training expression recognition result and the expression label to generate an available expression recognition model;
and determining the parameters of the second dense block in the available expression recognition model as the second preset parameters.
3. The method of claim 2, further comprising:
and migrating the parameters of a fourth dense block in the available expression recognition model to the third dense block, and determining the parameters as third preset parameters of the third dense block.
4. The method of claim 3, wherein training the parameters in the third dense block according to the overall loss values to generate an object model comprises:
and maintaining a first preset parameter in the first dense block and a second preset parameter in the second dense block unchanged, and training a third preset parameter in the third dense block according to the total loss value to generate a target model.
5. The method of claim 1, wherein fusing the expressive features and the identity features using a third dense block to generate fused features comprises:
splicing the expression features and the identity features to generate spliced features;
performing convolution operation and pooling operation on the splicing features in sequence to generate input features of the third dense block;
the third dense block generating output features from the input features;
and sequentially carrying out batch standardization and global average pooling on the output features to generate fusion features.
6. The method of claim 1, wherein performing identity recognition and expression recognition according to the fusion features to generate an identity recognition result and an expression recognition result respectively comprises:
taking the fusion features as input of a first linear full-connection layer to generate an identity recognition result, wherein the dimensionality of the first linear full-connection layer is the same as the category quantity of the identity labels;
and taking the fusion features as input of a second linear full-connection layer to generate an expression recognition result, wherein the dimensionality of the second linear full-connection layer is the same as the category number of the expression labels.
7. The method of claim 1, wherein fusing the first loss value and the second loss value to determine an overall loss value comprises:
and weighting and fusing the first loss value and the second loss value according to a preset weight coefficient to determine an overall loss value, wherein the preset weight coefficient is used for restricting the ratio of the weighted first loss value to the weighted second loss value not to exceed a preset ratio.
8. The method of claim 1, further comprising:
acquiring a facial image to be recognized;
extracting the identity feature of the facial image to be recognized by adopting the first dense block, and extracting the expression feature of the facial image to be recognized by adopting the second dense block;
fusing the expression features and the identity features by adopting a third dense block in the target model to generate fused features;
and performing expression recognition according to the fusion characteristics to generate an expression recognition result.
9. The method of claim 8, further comprising:
performing identity recognition according to the fusion characteristics to generate an identity recognition result;
and evaluating the confidence of the expression recognition result according to the accuracy of the identity recognition result.
10. An expression recognition model training device applied to an initial model containing a plurality of dense blocks with the same structure, the device comprising:
the system comprises a sample acquisition module, a data acquisition module and a data processing module, wherein the sample acquisition module is used for acquiring a training sample, and the training sample comprises an identity label and an expression label;
the feature extraction module is used for extracting the identity features of the training samples by adopting the first dense blocks and extracting the expression features of the training samples by adopting the second dense blocks;
the feature fusion module is used for fusing the expression features and the identity features by adopting a third dense block to generate fused features;
the recognition module is used for carrying out identity recognition and expression recognition according to the fusion characteristics and respectively generating an identity recognition result and an expression recognition result;
the loss determining module is used for determining a first loss value according to the difference between the identity recognition result and the identity label and determining a second loss value according to the difference between the expression recognition result and the expression label;
the loss fusion module fuses the first loss value and the second loss value to determine an overall loss value;
and the parameter training module is used for training the parameters in the third dense block according to the total loss value to generate a target model.
11. An electronic device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 9.
CN202210560572.XA 2022-05-23 2022-05-23 Method, device and equipment for training expression recognition model Pending CN114882566A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210560572.XA CN114882566A (en) 2022-05-23 2022-05-23 Method, device and equipment for training expression recognition model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210560572.XA CN114882566A (en) 2022-05-23 2022-05-23 Method, device and equipment for training expression recognition model

Publications (1)

Publication Number Publication Date
CN114882566A true CN114882566A (en) 2022-08-09

Family

ID=82678607

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210560572.XA Pending CN114882566A (en) 2022-05-23 2022-05-23 Method, device and equipment for training expression recognition model

Country Status (1)

Country Link
CN (1) CN114882566A (en)

Similar Documents

Publication Publication Date Title
CN111563551B (en) Multi-mode information fusion method and device and electronic equipment
CN113221555B (en) Keyword recognition method, device and equipment based on multitasking model
CN112308113A (en) Target identification method, device and medium based on semi-supervision
CN112417093B (en) Model training method and device
CN116188971A (en) Robot character recognition method, device and storage medium
CN111401062B (en) Text risk identification method, device and equipment
CN110728147B (en) Model training method and named entity recognition method
CN114332873A (en) Training method and device for recognition model
CN111652286A (en) Object identification method, device and medium based on graph embedding
CN113887227A (en) Model training and entity recognition method and device
CN112597301A (en) Voice intention recognition method and device
CN113887206B (en) Model training and keyword extraction method and device
CN116127305A (en) Model training method and device, storage medium and electronic equipment
CN116543264A (en) Training method of image classification model, image classification method and device
CN110033092B (en) Data label generation method, data label training device, event recognition method and event recognition device
CN116151355B (en) Method, device, medium and equipment for model training and service execution
CN116186231A (en) Method and device for generating reply text, storage medium and electronic equipment
CN115456114A (en) Method, device, medium and equipment for model training and business execution
CN114882566A (en) Method, device and equipment for training expression recognition model
CN114117055A (en) Method, device, equipment and readable medium for extracting text entity relationship
CN111598092A (en) Method for determining target area in image, method and device for identifying target
CN115017915B (en) Model training and task execution method and device
CN112287130A (en) Searching method, device and equipment for graphic questions
CN116451808B (en) Model training method and device, storage medium and electronic equipment
CN117874706B (en) Multi-modal knowledge distillation learning method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination