Expression recognition method and device

By combining global and local feature information to recognize facial expressions in complex scenes, it solves the problem of inaccurate recognition caused by blocked faces or improper postures, and improves the accuracy and user experience of expression recognition.

CN114612987BActive Publication Date: 2024-09-06SHENZHEN XUMI YUNTU SPACE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the existing technology, in complex scenes, key parts of the human face are blocked or the complete human face cannot be collected due to different body postures, resulting in inaccurate facial expression recognition.

Method used

By obtaining the image to be recognized, extracting image feature maps, determining global feature information and local feature information, and combining the two to identify expression types, restore more image details of facial expressions.

Benefits of technology

It improves the accuracy of facial expression recognition results and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114612987B
    Figure CN114612987B
Patent Text Reader

Abstract

The present disclosure provides a method and device for facial expression recognition. The method includes: obtaining an image to be recognized; obtaining an image feature map of the image to be recognized based on the image to be recognized; determining global feature information and local feature information based on the image feature map; and determining the expression type of the image to be recognized based on the global feature information and the local feature information. Since the global feature information of the image to be recognized reflects the overall information of the face, and the local feature information of the image to be recognized reflects the detailed information of each area of ​​the face, more image detail information of facial expressions can be restored by effectively combining the local feature information and the global feature information. In this way, the expression type of the image to be recognized determined based on the global feature information and the local feature information is more accurate, that is, the accuracy of the expression type recognition result corresponding to the image to be detected can be improved, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to an expression recognition method and device. Background Art

[0002] With the development of image processing technology, image recognition technology has been applied in more and more scenarios. Current image recognition technology has achieved good results in recognizing facial expressions. However, in complex scenarios, such as when key parts of the face are blocked, or when the entire face cannot be captured due to different body postures (such as sideways), facial expressions cannot be recognized or the recognition results are inaccurate. Therefore, a new solution for facial expression recognition is urgently needed. Summary of the invention

[0003] In view of this, the embodiments of the present disclosure provide an expression recognition method, apparatus, computer device and computer-readable storage medium to solve the problem in the prior art that in complex scenarios, such as when key parts of the face are blocked, or when the complete face cannot be captured due to different body postures (such as sideways), resulting in the inability to recognize facial expressions or inaccurate recognition results of facial expressions.

[0004] In a first aspect of an embodiment of the present disclosure, a method for facial expression recognition is provided, the method comprising:

[0005] Obtain an image to be recognized;

[0006] Obtaining an image feature map of the image to be identified according to the image to be identified;

[0007] Determining global feature information and local feature information according to the image feature map;

[0008] The expression type of the image to be recognized is determined according to the global feature information and the local feature information.

[0009] According to a second aspect of the present disclosure, there is provided an expression recognition device, the device comprising:

[0010] An image acquisition module, used for acquiring an image to be identified;

[0011] A first feature acquisition module, used for obtaining an image feature map of the image to be identified according to the image to be identified;

[0012] A second feature acquisition module, used to determine global feature information and local feature information according to the image feature map;

[0013] The expression type determination module is used to determine the expression type of the image to be recognized based on the global feature information and the local feature information.

[0014] According to a third aspect of an embodiment of the present disclosure, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0015] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0016] Compared with the prior art, the disclosed embodiment has the following beneficial effects: the disclosed embodiment can first obtain an image to be identified; then, based on the image to be identified, an image feature map of the image to be identified can be obtained; then, based on the image to be identified, global feature information and local feature information can be determined; finally, based on the global feature information and the local feature information, the expression type of the image to be identified can be determined. Since the global feature information of the image to be identified reflects the overall information of the face, and the local feature information of the image to be identified reflects the detailed information of each area of ​​the face, more image detail information of facial expressions can be restored by effectively combining the local feature information and the global feature information. In this way, the expression type of the image to be identified determined based on the global feature information and the local feature information is more accurate, that is, the accuracy of the expression type recognition result corresponding to the image to be detected can be improved, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 is a schematic diagram of an application scenario of an embodiment of the present disclosure;

[0019] Figure 2 is a flow chart of the expression recognition method provided by an embodiment of the present disclosure;

[0020] Figure 3 is a schematic diagram of a network architecture of an expression recognition model provided by an embodiment of the present disclosure;

[0021] Figure 4 is a flow chart of the GoF modulation process provided by an embodiment of the present disclosure;

[0022] Figure 5is a schematic diagram of the network architecture of the Local-Global Attention structure provided by an embodiment of the present disclosure;

[0023] Figure 6 is a schematic diagram of a network architecture of a global model provided by an embodiment of the present disclosure;

[0024] Figure 7 is a schematic diagram of the network architecture of the Split-Attention module provided in an embodiment of the present disclosure;

[0025] Figure 8 is a schematic diagram of the network architecture of the weight layer provided in an embodiment of the present disclosure;

[0026] Fig. 9 is a block diagram of an expression recognition device provided by an embodiment of the present disclosure;

[0027] Fig.10 is a schematic diagram of a computer device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.

[0029] A method and device for facial expression recognition according to an embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0030] In the prior art, in complex scenes, for example, key parts of the face are blocked, or due to different body postures (such as sideways), the complete face cannot be captured, resulting in the inability to recognize facial expressions or inaccurate recognition results. Therefore, a new solution for facial expression recognition is urgently needed.

[0031] In order to solve the above problems. The present invention provides an expression recognition method. In this method, since the method provided by this embodiment first obtains the image to be recognized; then, the image feature map of the image to be recognized can be obtained according to the image to be recognized; then, the global feature information and the local feature information can be determined according to the image feature map; finally, the expression type of the image to be recognized can be determined according to the global feature information and the local feature information. Since the global feature information of the image to be recognized reflects the overall information of the face, and the local feature information of the image to be recognized reflects the detailed information of each area of ​​the face, more image detail information of the facial expression can be restored by effectively combining the local feature information and the global feature information. In this way, the expression type of the image to be recognized determined according to the global feature information and the local feature information is more accurate, that is, the accuracy of the expression type recognition result corresponding to the image to be detected can be improved, thereby improving the user experience.

[0032] For example, the embodiments of the present invention can be applied to Figure 1 The application scenario shown in FIG. 1 includes a terminal device 1 and a server 2 .

[0033] The terminal device 1 can be hardware or software. When the terminal device 1 is hardware, it can be various electronic devices that have the functions of acquiring and storing images and support communication with the server 2, including but not limited to smart phones, tablet computers, laptops, digital cameras, monitors, video recorders, and desktop computers; when the terminal device 1 is software, it can be installed in the above electronic devices. The terminal device 1 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present disclosure are not limited to this. Furthermore, various applications can be installed on the terminal device 1, such as image acquisition applications, image storage applications, instant messaging applications, etc.

[0034] Server 2 may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with it, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. Server 2 may be a single server, or a server cluster composed of several servers, or a cloud computing service center, which is not limited in the embodiments of the present disclosure.

[0035] It should be noted that the server 2 can be hardware or software. When the server 2 is hardware, it can be various electronic devices that provide various services for the terminal device 1. When the server 2 is software, it can be multiple software or software modules that provide various services for the terminal device 1, or it can be a single software or software module that provides various services for the terminal device 1, and the embodiments of the present disclosure are not limited to this.

[0036] The terminal device 1 and the server 2 can be connected to each other through a network. The network can be a wired network connected by coaxial cable, twisted pair and optical fiber, or a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present disclosure.

[0037] Specifically, the user can determine the image to be detected through the terminal device 1, and send the image to be detected to the server 2. After the server 2 receives the image to be detected, the server 2 can extract the image feature map of the image to be identified. Then, the server 2 can determine the global feature information and the local feature information based on the image feature map. Next, the server 2 can determine the expression type of the image to be identified based on the global feature information and the local feature information. In this way, since the global feature information of the image to be identified reflects the overall information of the face, and the local feature information of the image to be identified reflects the detailed information of each area of ​​the face, more image detail information of the facial expression can be restored through the effective combination of the local feature information and the global feature information. In this way, the expression type of the image to be identified determined according to the global feature information and the local feature information is more accurate, that is, the accuracy of the expression type recognition result corresponding to the image to be detected can be improved, thereby improving the user experience.

[0038] It should be noted that the specific types, quantities and combinations of the terminal devices 1, the server 2 and the network can be adjusted according to the actual needs of the application scenario, and the embodiments of the present disclosure are not limited to this.

[0039] It should be noted that the above application scenarios are only shown for the purpose of facilitating the understanding of the present disclosure, and the embodiments of the present disclosure are not limited in this respect. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.

[0040] Figure 2 It is a flow chart of an expression recognition method provided by an embodiment of the present disclosure. Figure 2 An expression recognition method can be composed of Figure 1 The terminal device and / or server executes. Figure 2 As shown, the expression recognition method includes:

[0041] S201: Acquire an image to be recognized.

[0042] In this embodiment, the image or video frame that needs to be recognized by expression can be referred to as an image to be recognized. Among them, the face that needs to be recognized by expression can be referred to as a target face.

[0043] As an example, the terminal device may provide a page through which the user can upload an image and click a preset button to trigger expression recognition of the image. At this time, the image can be used as the image to be recognized. Of course, the user can also obtain the image to be recognized by taking a photo using the terminal device. In addition, the user also needs to determine the target face to be recognized, or the system presets the target face to be recognized.

[0044] S202: Obtaining an image feature map of the image to be identified according to the image to be identified.

[0045] After the image to be identified is acquired, an image feature map of the image to be identified can be extracted for the image to be identified. It can be understood that the image feature map of the image to be identified is a complete feature map extracted from the image to be identified, which can reflect the overall image feature information of the image to be identified.

[0046] S203: Determine global feature information and local feature information according to the image feature map.

[0047] Due to complex scenes, such as when the key parts of the face are blocked, or due to different body postures (such as sideways), the complete face cannot be collected, which leads to the inability to recognize the facial expression type or the inaccurate recognition of the facial expression type. In order to solve the above problems, in this embodiment, after obtaining the image feature map of the image to be recognized, the global feature information and local feature information of the target face in the image feature map can be determined according to the image feature map. Among them, the global feature information of the image to be recognized can reflect the overall information of the face, that is, the global feature information of the image to be recognized can be understood as the global information of the target face, such as the overall information of skin color, contour, distribution of facial organs, etc.; the local feature information of the image to be recognized can reflect the detailed information of each area of ​​the face, that is, the local feature information describes the detailed features of the target face, such as organ characteristics, facial singular features, similar to scars, moles, dimples, etc. It can be understood that the global feature information is used for rough matching, and the local feature information is used for fine matching. Therefore, more image detail information of facial expressions can be restored by effectively combining local feature information and global feature information.

[0048] S204: Determine the expression type of the image to be recognized according to the global feature information and the local feature information.

[0049] In this embodiment, after determining the global feature information and the local feature information, the global feature information and the local feature information can be used to restore more image detail information of facial expressions, so that the expression type of the target face can be determined using the restored image detail information of facial expressions. In this way, the expression type of the image to be identified determined based on the global feature information and the local feature information can be made more accurate, thereby improving the accuracy of the expression type recognition result corresponding to the image to be detected.

[0050] Compared with the prior art, the disclosed embodiment has the following beneficial effects: the disclosed embodiment can first obtain an image to be identified; then, based on the image to be identified, an image feature map of the image to be identified can be obtained; then, based on the image to be identified, global feature information and local feature information can be determined; finally, based on the image feature map, the expression type of the image to be identified can be determined. Since the global feature information of the image to be identified reflects the overall information of the face, and the local feature information of the image to be identified reflects the detailed information of each area of ​​the face, more image detail information of the facial expression can be restored by effectively combining the local feature information and the global feature information. In this way, the expression type of the image to be identified determined based on the global feature information and the local feature information is more accurate, that is, the accuracy of the expression type recognition result corresponding to the image to be detected can be improved, thereby improving the user experience. In other words, in the process of identifying the expression type, while paying attention to the local features, the contextual information of the global features is introduced, which can also significantly improve the recognition performance.

[0051] Next, an implementation of S202 "obtaining an image feature map of the image to be identified based on the image to be identified" will be introduced. In this embodiment, Figure 2 The corresponding method can be applied to expression recognition models (such as Figure 3 As shown), the expression recognition model may include a first neural network model, and S202 "obtaining an image feature map of the image to be recognized according to the image to be recognized" may include the following steps:

[0052] The image to be recognized is input into a first neural network model to obtain an image feature map of the image to be recognized.

[0053] The first neural network model includes a plurality of first convolution modules, which are connected in sequence, and each first convolution module includes a filter, a batch normalization layer, an MP model and an activation function. Figure 3As shown, the first neural network model includes three first convolution modules, wherein each first convolution module includes a filter (such as a GC module), a batch normalization layer (ie, BN layer), an MP model (ie, MP, Max Pooling) and an activation function (ie, ReLU).

[0054] Wherein, GC module is the convolution kernel with Gabor filter added, it should be emphasized that, in the present embodiment, GC module can be called GoF (i.e. Gabor direction filter modulated by Gabor filter on conventional convolution kernel), GoF can enhance the robustness of network to direction and scale change (direction invariance and scale invariance). It should be noted that Gabor filter has good characteristics, it can not only keep the frequency domain information in the image, but also has strong robustness to geometric transformations such as direction and size, and existing convolution neural network does not have this characteristic, so Gabor filter is suitable for facial expression recognition under the scene of frequent changes in direction and size, on the other hand, facial expression recognition is more focused on local features such as nose and mouth compared with other human face tasks, and Gabor filter can extract more abundant local features compared with traditional convolution neural network. It can be understood that after GC module introduces Gabor filter, on the one hand, it can enhance the robustness of network to direction and scale change, on the other hand, it reduces the number of network layers, so it reduces the model forward reasoning time.

[0055] In this embodiment, the modulation process of GoF is as follows:

[0056] Gabor filters have U direction and V scale. In order to incorporate steerable properties into GCN, the direction information is encoded in the learned filter, while the scale information is embedded in different convolutional layers. Since the Gabor filter in GoF captures the direction and scale information, the corresponding convolution function is enhanced.

[0057] The filter learned by the back-propagation algorithm is called a learning filter. Unlike standard convolutional neural networks, the filters learned in GCN are three-dimensional because they need to encode directional channels. Assume that the size of the learning filter is N×W×W, where W×W is the size of the filter and N represents the channel. If the weight of each layer in the traditional CNN is represented as C out ×C in ×W×W, then GCN is represented by C out ×C in ×N×W×W,C out and C inDenote the channels of the output and input feature maps, respectively. In order to keep the number of channels of the feature map consistent during the forward convolution process, N is chosen to be U, the number of directions of the Gabor filter used to modulate this learning filter. Based on a given scale V, GoF is obtained through the modulation process. For the Vth dimension, define:

[0058] Among them, Ci,o is a learning filter. G(u,v) represents a set of Gabor filters with different directions and scales, and o is the element-by-element product operation between G(u,v) and each 2D filter. The modulation process is as above Figure 4 As shown, GoF is then defined as:

[0059]

[0060] In GoF, the value of v increases with the number of layers, which means that the scale of Gabor filters in GoF changes according to the number of layers. At each scale, the size of GoF is U×N×W×W. However, since Gabor filters are given, only N×W×W learning filters are saved, which shows that enhanced functionality can be obtained through this modulation without increasing the number of parameters.

[0061] Next, an implementation method of S203 "determining global feature information and local feature information according to the image feature map" will be introduced. In this embodiment, Figure 2 The corresponding method can be applied to the expression recognition model, such as Figure 3 As shown, the expression recognition model includes a Local-Global Attention structure; Figure 5 As shown, the Local-Global Attention structure includes a global model and a local model, and S203 "determining global feature information and local feature information according to the image feature map" may include the following steps:

[0062] S203a: Input the image feature map into a global model to obtain global feature information.

[0063] Figure 5 The conv and Feature layers in are as follows Figure 6 As shown, the global model includes the first convolutional layer, the H-Sigmoid activation function layer (i.e. Figure 6 F in ), Channel Attention Module (CAM, i.e. Figure 6 Channel attention in ), spatial attention module (Spartial Attention Module, SAM, i.e. Figure 6It can be understood that the channel attention module and the spatial attention module can understand a CBAM attention structure.

[0064] Specifically, the image feature map can be input into the first convolution layer to obtain a first feature map. Then, the first feature map can be input into the H-Sigmoid activation function layer to obtain a second feature map. It should be noted that the H-Sigmoid activation function layer can avoid exponential operations, so the calculation speed can be improved. Then, the second feature map can be input into the channel attention module to obtain a channel attention map; it should be noted that the function of the channel attention module is to learn a weight for each channel, and then multiply the weight by the corresponding channel, that is, the features of different channels in the second feature map are multiplied by their corresponding weights to obtain the channel attention map. Next, the channel attention map can be input into the spatial attention module to obtain a spatial attention map; the spatial attention module is used to perform attention calculation on the channel attention map in the feature map space (i.e., the width and height dimensions), that is, a weight is learned for each local area in the channel attention map, and then the weight is multiplied by the channel attention map to obtain the spatial attention map. Finally, the spatial attention map can be input into the second convolution layer to obtain the global feature information.

[0065] S203b: Input the image feature map into a local model to obtain local feature information.

[0066] In this embodiment, if Figure 5 As shown, the local model may include N local feature extraction convolutional layers (i.e., conv layers and feature layers, where k and N are the same value) and an attention module, where N is a positive integer greater than 1;

[0067] In this embodiment, N local image blocks may be generated according to the image feature map. For example, random cropping may be performed on the image feature map to obtain N different local image blocks, wherein each local image block contains local information of different regions. Then, each local image block may be input into each local feature extraction convolution layer to obtain N local feature maps, that is, each local feature extraction convolution layer outputs a local feature map.

[0068] Then, the N local feature maps can be input into the attention module to obtain local feature information. It should be noted that, in this embodiment, the attention module can be a Split-Attention module. Figure 7 As shown, the attention module may include a pooling layer (i.e. Figure 7Global Pooling in), the second convolution module (i.e. Figure 7 Conv+BN+ReLU in, that is, the second convolution module includes a convolution layer, a BN layer and a ReLU function layer), N third convolution layers (i.e. Figure 7 Conv layer in ) and normalization layer (i.e. Figure 7 Specifically, Figure 7 As shown, the N local feature maps can be fused to obtain a fused feature map. The fused feature map is input into the pooling layer to obtain a pooling feature map. The pooling feature map is input into the second convolution module to obtain a processed local feature map. The processed local feature maps are respectively input into each third convolution layer to obtain N sub-local feature maps, that is, the processed local feature maps are input into each independent third convolution layer for processing, and each sub-local feature map is extracted. For each sub-local feature map, the sub-local feature map is input into the normalization layer to obtain the weight value corresponding to the sub-local feature map, and, according to the weight value corresponding to the sub-local feature map and the local feature map, the local feature map corresponding to the sub-local feature map is obtained; that is, the normalization layer is used to perform r-Softmax operation on the sub-local feature map to obtain the weight value corresponding to the sub-local feature map, and then the local feature map corresponding to the sub-local feature map and the weight value corresponding to the sub-local feature map are multiplied to obtain the processed local feature map corresponding to the sub-local feature map. The N local feature maps (i.e., the processed local feature maps) are fused to obtain local feature information.

[0069] Next, an implementation of S204 "determining the expression type of the image to be recognized according to the global feature information and the local feature information" will be introduced. In this embodiment, S204 may include the following steps:

[0070] S204a: Input the global feature information into a first global average pooling layer to obtain global pooling feature information.

[0071] In this embodiment, if Figure 5 As shown, the global model is also connected to the first global average pooling layer (i.e. Figure 5 After the global feature information is extracted, the global feature information can be subjected to global average pooling (GAP) processing by a first global average pooling layer to obtain global pooling feature information.

[0072] S204b: Input the local feature information into a second global average pooling layer to obtain local pooling feature information.

[0073] In this embodiment, if Figure 5As shown, the local model is also connected to a second global average pooling layer (i.e. Figure 5 After extracting the local feature information, the local feature information can be subjected to global average pooling (Global Average Pooling, GAP) processing through a second global average pooling layer to obtain local pooling feature information.

[0074] S204c: Input the global pooling feature information and the local pooling feature information into a fully connected layer to obtain the expression type of the image to be recognized.

[0075] In this embodiment, after obtaining the global pooling feature information and the local pooling feature information, the global pooling feature information and the local pooling feature information may be fused to obtain fused pooling feature information. Then, the fused pooling feature information is input into the fully connected layer (i.e. Figure 3 FC in the fully connected layer to obtain the expression type of the image to be recognized output by the fully connected layer.

[0076] It should be noted that, in one implementation of this embodiment, Figure 3 As shown, the expression recognition model may also include a weight layer (i.e. Figure 3 Weight branch in Figure 8 As shown, the weight layer includes two fully connected layers (i.e. Figure 8 FC1 and FC2 in) and a Sigmoid activation layer (i.e. Figure 8 Specifically, Figure 2 The corresponding methods also include:

[0077] Step 1: Input the global pooling feature information and the local pooling feature information into the weight layer to obtain the true weight value of the expression type of the image to be recognized.

[0078] Among them, the true weight value of the expression type of the image to be identified is used to characterize the probability that the expression type is the true expression type corresponding to the image to be identified. In one implementation, the true weight value can be a weight value between 0 and 1. It can be understood that the larger the true weight value of the expression type of the image to be identified, the greater the probability that the expression type is the true expression type corresponding to the image to be identified. Conversely, the smaller the true weight value of the expression type of the image to be identified, the smaller the probability that the expression type is the true expression type corresponding to the image to be identified.

[0079] Step 2: Determine the expression type detection result corresponding to the image to be recognized according to the true weight value of the expression type of the image to be recognized and the expression type of the image to be recognized.

[0080] In this embodiment, if the true weight value of the expression type of the image to be identified meets the preset conditions, for example, the true weight value of the expression type of the image to be identified is greater than a preset threshold, then the expression type of the image to be identified can be used as the expression type detection result corresponding to the image to be identified. Wherein, the preset threshold can be pre-set, for example, it can be set by the user according to actual needs. On the contrary, if the true weight value of the expression type of the image to be identified does not meet the preset conditions, for example, the true weight value of the expression type of the image to be identified is less than or equal to the preset threshold, then the expression type of the image to be identified can be not used as the expression type detection result corresponding to the image to be identified, and the expression type detection result corresponding to the image to be identified can be determined as no result.

[0081] It should be noted that there is an annotation uncertainty problem in the existing facial expression recognition data set. On the one hand, this uncertainty is caused by the subjectivity of the annotator, so the same picture will be different after being annotated by different annotators. On the other hand, it is due to the ambiguity of facial expression pictures, that is, an expression picture may contain several different expressions. In addition, factors such as occlusion, illumination, and picture quality may also affect the annotation results. Training with these uncertainly annotated data is not only not conducive to learning effective expression features, but also causes the phenomenon of non-convergence in the early stage of network training. Therefore, in this embodiment, the loss function of Attention Weighted Loss is used to train the weight layer. Specifically, after extracting the features, a weight branch (i.e., weight layer) is added to learn a weight for each sample. This weight represents the degree of certainty of the current sample. Then, when calculating the loss, the loss of the training sample will be weighted according to the calculated weight.

[0082] During the model training process, if the weight value calculated by the weight layer is less than the preset training value, it means that the certainty of the current training sample is very low, so it is not conducive to the optimization of the network, so these samples can be filtered by manually set thresholds, and the weight value calculated by the weight layer is greater than or equal to the preset training value, and the higher the value, the stricter the certainty requirement, and some samples between certainty and uncertainty will be eliminated; and the lower the weight value, the more samples that contribute to the loss, and do not use samples with low certainty (that is, the weight value calculated by the weight layer is less than the preset training value) to participate in the loss calculation, which can significantly improve the accuracy of facial expression recognition. After filtering the training samples, the features of all samples and their corresponding weights can be obtained, so after calculating the cross entropy for each sample, these weights can be weighted and summed, or another weighting method can be used, that is, the calculated weights and the obtained sample features are weighted, and then the weighted features are used for loss calculation.

[0083] It should be noted that after adding a weight layer (i.e., adding a weight branch) to the emotion recognition model, the certainty of each sample is learned through this branch, and then the Attention Weighted Loss can be used. By introducing the learned uncertainty into the Attention Weighted Loss, the influence of uncertainty annotation on the facial expression recognition training process can be suppressed.

[0084] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.

[0085] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.

[0086] Fig. 9 Schematic diagram of the expression recognition device provided by the embodiment of the present disclosure. Fig. 9 As shown, the expression recognition device comprises:

[0087] An image acquisition module 901 is used to acquire an image to be recognized;

[0088] A first feature acquisition module 902, configured to obtain an image feature map of the image to be identified based on the image to be identified;

[0089] A second feature acquisition module 903, used to determine global feature information and local feature information according to the image feature map;

[0090] The expression type determination module 904 is used to determine the expression type of the image to be recognized according to the global feature information and the local feature information.

[0091] In some embodiments, the method is applied to an expression recognition model, and the expression recognition model includes a first neural network model; a first feature acquisition module 902, specifically used to:

[0092] Inputting the image to be recognized into a first neural network model to obtain an image feature map of the image to be recognized;

[0093] Among them, the first neural network model includes several first convolution modules, the several first convolution modules are connected in sequence, and each first convolution module includes a filter, a batch normalization layer, an MP model and an activation function.

[0094] In some embodiments, the method is applied to an expression recognition model, and the expression recognition model includes a global model and a local model; the second feature acquisition module 903 is specifically used to:

[0095] Inputting the image feature map into a global model to obtain global feature information;

[0096] The image feature map is input into a local model to obtain local feature information.

[0097] In some embodiments, the global model includes a first convolutional layer, an H-Sigmoid activation function layer, a channel attention module, a spatial attention module and a second convolutional layer; the second feature acquisition module 903 is specifically used to:

[0098] Inputting the image feature map into the first convolutional layer to obtain a first feature map;

[0099] Inputting the first feature map into the H-Sigmoid activation function layer to obtain a second feature map;

[0100] Inputting the second feature map into the channel attention module to obtain a channel attention map;

[0101] Inputting the channel attention map into the spatial attention module to obtain a spatial attention map;

[0102] The spatial attention map is input into the second convolutional layer to obtain the global feature information.

[0103] In some embodiments, the local model includes N local feature extraction convolution layers and an attention module, where N is a positive integer greater than 1; the second feature acquisition module 903 is specifically used to:

[0104] Generate N local image blocks according to the image feature map;

[0105] Input each local image block into each local feature extraction convolution layer to obtain N local feature maps;

[0106] The N local feature maps are input into the attention module to obtain local feature information.

[0107] In some embodiments, the attention module includes a pooling layer, a second convolution module, N third convolution layers and a normalization layer; the second feature acquisition module 903 is specifically used to:

[0108] Fusing the N local feature maps to obtain a fused feature map;

[0109] Inputting the fused feature map into the pooling layer to obtain a pooling feature map;

[0110] Inputting the pooled feature map into the second convolution module to obtain a processed local feature map;

[0111] Inputting the processed local feature maps into each third convolutional layer respectively to obtain N sub-local feature maps;

[0112] For each sub-local feature map, the sub-local feature map is input into a normalization layer to obtain a weight value corresponding to the sub-local feature map; according to the weight value corresponding to the sub-local feature map and the local feature map, a local feature map corresponding to the sub-local feature map is obtained;

[0113] N local feature maps are fused to obtain local feature information.

[0114] In some embodiments, the expression type determination module 904 is used to:

[0115] Inputting the global feature information into a first global average pooling layer to obtain global pooling feature information;

[0116] Inputting the local feature information into a second global average pooling layer to obtain local pooling feature information;

[0117] The global pooling feature information and the local pooling feature information are input into a fully connected layer to obtain the expression type of the image to be recognized.

[0118] In some embodiments, the expression recognition model further includes a weight layer; the weight layer includes two fully connected layers and a Sigmoid activation layer; the device further includes a result determination module for:

[0119] Inputting the global pooling feature information and the local pooling feature information into the weight layer to obtain a true weight value of the expression type of the image to be recognized; the true weight value of the expression type of the image to be recognized is used to characterize the probability that the expression type is the true expression type corresponding to the image to be recognized;

[0120] According to the true weight value of the expression type of the image to be recognized and the expression type of the image to be recognized, a detection result of the expression type corresponding to the image to be recognized is determined.

[0121] Compared with the prior art, the embodiment of the present disclosure has the following beneficial effects: the expression recognition device provided by the embodiment of the present disclosure includes: an image acquisition module 901, which is used to acquire an image to be recognized; a first feature acquisition module 902, which is used to obtain an image feature map of the image to be recognized based on the image to be recognized; a second feature acquisition module 903, which is used to determine global feature information and local feature information based on the image feature map; an expression type determination module 904, which is used to determine the expression type of the image to be recognized based on the global feature information and the local feature information. Since the global feature information of the image to be recognized reflects the overall information of the face, and the local feature information of the image to be recognized reflects the detailed information of each area of ​​the face, more image detail information of the facial expression can be restored by effectively combining the local feature information and the global feature information. In this way, the expression type of the image to be recognized determined based on the global feature information and the local feature information is more accurate, that is, the accuracy of the expression type recognition result corresponding to the image to be detected can be improved, thereby improving the user experience.

[0122] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.

[0123] Fig.10 Schematic diagram of a computer device 10 provided in an embodiment of the present disclosure. Fig.10 As shown, the computer device 10 of this embodiment includes: a processor 1001, a memory 1002, and a computer program 1003 stored in the memory 1002 and executable on the processor 1001. When the processor 1001 executes the computer program 1003, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 1001 executes the computer program 1003, the functions of each module / module in the above-mentioned device embodiments are implemented.

[0124] Exemplarily, the computer program 1003 may be divided into one or more modules / modules, which are stored in the memory 1002 and executed by the processor 1001 to complete the present disclosure. The one or more modules / modules may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 1003 in the computer device 10.

[0125] The computer device 10 may be a desktop computer, a notebook, a PDA, a cloud server, or other computer devices. The computer device 10 may include, but is not limited to, a processor 1001 and a memory 1002. Those skilled in the art will appreciate that Fig.10It is only an example of the computer device 10 and does not constitute a limitation of the computer device 10. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.

[0126] The processor 1001 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0127] The memory 1002 may be an internal storage module of the computer device 10, for example, a hard disk or memory of the computer device 10. The memory 1002 may also be an external storage device of the computer device 10, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 10. Further, the memory 1002 may also include both an internal storage module of the computer device 10 and an external storage device. The memory 1002 is used to store computer programs and other programs and data required by the computer device. The memory 1002 may also be used to temporarily store data that has been output or is to be output.

[0128] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional modules and modules is used as an example for illustration. In actual applications, the above-mentioned function allocation can be completed by different functional modules and modules as needed, that is, the internal structure of the device can be divided into different functional modules or modules to complete all or part of the functions described above. The functional modules and modules in the embodiment can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. In addition, the specific names of the functional modules and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present disclosure. The specific working process of the modules and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0129] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0130] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.

[0131] In the embodiments provided in the present disclosure, it should be understood that the disclosed apparatus / computer equipment and methods can be implemented in other ways. For example, the apparatus / computer equipment embodiments described above are merely schematic, for example, the modules or the division of modules are only a logical function division, and there may be other division methods in actual implementation, multiple modules or components may be combined or may be integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection of the apparatus or module, which may be electrical, mechanical or other forms.

[0132] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0133] In addition, each functional module in each embodiment of the present disclosure may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0134] If the integrated module / module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present disclosure implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.

[0135] The above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be included in the protection scope of the present disclosure.

Claims

1. A method for facial expression recognition, characterized in that: Applied to an expression recognition model, the expression recognition model includes a global model and a local model; the global model is further connected to a first global average pooling layer, and the local model is further connected to a second global average pooling layer; the expression recognition model also includes a weight layer; the method includes: Obtain an image to be recognized; Obtaining an image feature map of the image to be identified according to the image to be identified; Inputting the image feature map into a global model to obtain global feature information; and inputting the image feature map into a local model to obtain local feature information; Determine the expression type detection result of the image to be recognized according to the global feature information and the local feature information; including: Inputting the global feature information into a first global average pooling layer to obtain global pooling feature information; Inputting the local feature information into a second global average pooling layer to obtain local pooling feature information; Inputting the global pooling feature information and the local pooling feature information into a fully connected layer to obtain the expression type of the image to be recognized; Inputting the global pooling feature information and the local pooling feature information into the weight layer to obtain a true weight value of the expression type of the image to be recognized; the true weight value of the expression type of the image to be recognized is used to characterize the probability that the expression type is the true expression type corresponding to the image to be recognized; According to the true weight value of the expression type of the image to be recognized and the expression type of the image to be recognized, a detection result of the expression type corresponding to the image to be recognized is determined.

2. The method according to claim 1, characterized in that The expression recognition model also includes a first neural network model; the image feature map of the image to be recognized is obtained according to the image to be recognized, including: Inputting the image to be recognized into a first neural network model to obtain an image feature map of the image to be recognized; Among them, the first neural network model includes several first convolution modules, the several first convolution modules are connected in sequence, and each first convolution module includes a filter, a batch normalization layer, an MP model and an activation function.

3. The method according to claim 1, characterized in that The global model includes a first convolutional layer, an H-Sigmoid activation function layer, a channel attention module, a spatial attention module and a second convolutional layer; the image feature map is input into the global model to obtain global feature information, including: Inputting the image feature map into the first convolutional layer to obtain a first feature map; Inputting the first feature map into the H-Sigmoid activation function layer to obtain a second feature map; Inputting the second feature map into the channel attention module to obtain a channel attention map; Inputting the channel attention map into the spatial attention module to obtain a spatial attention map; The spatial attention map is input into the second convolutional layer to obtain the global feature information.

4. The method according to claim 1, characterized in that: The local model includes N local feature extraction convolution layers and an attention module, wherein N is a positive integer greater than 1; the image feature map is input into the local model to obtain local feature information, including: Generate N local image blocks according to the image feature map; Input each local image block into each local feature extraction convolution layer to obtain N local feature maps; The N local feature maps are input into the attention module to obtain local feature information.

5. The method according to claim 4, characterized in that The attention module includes a pooling layer, a second convolution module, N third convolution layers and a normalization layer; the N local feature maps are input into the attention module to obtain local feature information, including: Fusing the N local feature maps to obtain a fused feature map; Inputting the fused feature map into the pooling layer to obtain a pooling feature map; Inputting the pooled feature map into the second convolution module to obtain a processed local feature map; Inputting the processed local feature maps into each third convolutional layer respectively to obtain N sub-local feature maps; For each sub-local feature map, the sub-local feature map is input into a normalization layer to obtain a weight value corresponding to the sub-local feature map; according to the weight value corresponding to the sub-local feature map and the local feature map, a local feature map corresponding to the sub-local feature map is obtained; N local feature maps are fused to obtain local feature information.

6. The method according to claim 1, characterized in that The weight layer includes two fully connected layers and one Sigmoid activation layer.

7. An expression recognition device, characterized in that: Applied to an expression recognition model, the expression recognition model includes a global model and a local model; the global model is further connected to a first global average pooling layer, and the local model is further connected to a second global average pooling layer; the expression recognition model also includes a weight layer; the device includes: An image acquisition module, used for acquiring an image to be identified; A first feature acquisition module, used for obtaining an image feature map of the image to be identified according to the image to be identified; A second feature acquisition module is used to input the image feature map into a global model to obtain global feature information; and input the image feature map into a local model to obtain local feature information; An expression type determination module is used to determine the expression type detection result of the image to be identified based on the global feature information and the local feature information; the module comprises: inputting the global feature information into a first global average pooling layer to obtain global pooling feature information; inputting the local feature information into a second global average pooling layer to obtain local pooling feature information; inputting the global pooling feature information and the local pooling feature information into a fully connected layer to obtain the expression type of the image to be identified; inputting the global pooling feature information and the local pooling feature information into the weight layer to obtain the true weight value of the expression type of the image to be identified; the true weight value of the expression type of the image to be identified is used to characterize the probability that the expression type is the true expression type corresponding to the image to be identified; and determining the expression type detection result corresponding to the image to be identified based on the true weight value of the expression type of the image to be identified and the expression type of the image to be identified.

8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.