Facial expression recognition method based on multi-granularity perception and label distribution learning
Through multi-grained perception and label distribution learning methods, combined with global perceptual attention module and gradual training, the problems of inconsistency and ambiguity of expression image labels in the natural environment are solved, more accurate facial expression recognition is achieved, and the model's robustness is enhanced Sex and representational ability.
Patent Information
- Application Number
- CN202410928567.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-07-11
AI Technical Summary
The existing facial expression recognition technology has limited model learning ability and is difficult to accurately classify, and most methods ignore global context information and differences. Integration of granularity characteristics.
A face expression recognition method for multi-grained perception and tag distribution learning is proposed. By segmenting the images into different granularity levels, using global perceptual attention module and progressive training method, the low-level fine-grained and high-level semantic information are integrated to construct multi-grainedness. Local features and label distributions are used to enhance the representation and robustness of the model.
It effectively improves the accuracy and robustness of expression recognition, can better locate multi-grained discrimination areas, reduces the impact of blur and noise, and enhances the recognition ability of composite emotions.
Smart Images

Figure CN118898864A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer vision, and in particular relates to a facial expression recognition method using multi-granularity perception and label distribution learning. Background Art
[0002] Facial expressions play a vital role in interpersonal communication. By controlling facial expressions, people can profoundly enrich their interactions with each other. At present, facial expression recognition technology has significant application value in the fields of emotional human-computer interaction such as medical robots, safe driving, criminal psychology analysis and distance education, and has become an important research direction in the field of computer vision.
[0003] In recent years, with the development of deep learning, methods based on convolutional neural networks (CNNs) have performed well in facial expression recognition (FER) and have dominated FER research. The excellent performance of these deep networks is mainly due to the support of large-scale FER datasets. Usually, a single facial image in these datasets is annotated as one of several basic expressions in order to train FER models. However, the different definitions of the same expression image category by people from different backgrounds, coupled with the uncertainty caused by the ambiguity of wild facial images themselves, often lead to inconsistent and inaccurate labels of expression images, which has a serious impact on the learning ability of FER models.
[0004] In addition, emotions in the real world are not just single emotions in a controlled environment, but exist in the form of a composite of basic and complex emotions, so different expressions often have certain similarities in natural environments. People may have different emotional perceptions of the same image, especially on images with high uncertainty, which are difficult to classify accurately. However, there are quite a lot of ambiguous expression images in large-scale expression datasets, which makes it difficult for the model to learn the emotional features of a specific category from them, thus affecting the performance of deep networks. Therefore, compared with a single label, the emotion distribution can better represent the multiple emotions contained in a single image because it considers the composite of multiple emotions, thereby alleviating the impact of ambiguity. However, most expression datasets currently only provide a single label for expression images, and it is quite difficult to manually annotate the label distribution on large-scale datasets. This leads to insufficient supervision during training, which makes the performance of many FER models reach a bottleneck.
[0005] On the other hand, there is a common problem of large inter-class similarity in expression images, which also brings uncertainty to expression images. Due to the subtle differences between some categories, the prediction of expressions of different categories is easily confused, which hinders the network from learning robust emotional features. Due to the visual similarity of these expression images, different categories can often only be distinguished by fine-grained local differences. Existing work uses attention-based methods to enhance the representation ability of features and extract local features with key discriminative properties to distinguish similar expressions. However, these methods only focus on the local features of expressions and ignore the importance of the global contextual information of expressions. Therefore, some methods propose to fuse the local features of expressions with global features to further enhance the representation ability of expression features. In addition, most existing methods for extracting local features divide the image into four specific parts and extract local features from parts with a fixed, single granularity level. However, most methods focus on using deep features containing high-level semantic information for recognition, lacking the effective integration of information of different granularities and levels, thus hindering further improvements. Considering the uniqueness of the FER task, differences in subtle parts such as complex textures can also provide key discriminative information for FER. Moreover, features at different levels contain information of different granularities. By using the fusion learning of low-level detailed information and high-level abstract semantic information, the network can better locate the multi-granularity discrimination area of expression and enhance the representation ability of the model. Therefore, making full use of the implicit complementary advantages of features at different levels and different granularity levels can effectively improve the performance of FER. In order to solve the above problems, the present invention proposes a facial expression recognition method with multi-granularity perception and label distribution learning.
[0006] Application publication number CN117746484A, a micro-expression recognition method and system with multi-granularity cognitive enhancement of facial features, belongs to the field of emotional computing technology. The method includes data acquisition, multi-dimensional preprocessing, multi-granularity global feature extraction, multi-granularity local feature extraction, multi-granularity cognitive enhancement and feature classification. A multi-dimensional preprocessing method is used for data preprocessing. A multi-granularity global / local feature extraction method is used to obtain coarse / fine-grained feature vectors respectively, and transfer learning is introduced when extracting multiple local features. In the process of multi-granular cognitive enhancement, the global feature vector of the face is extracted by the channel attention module, and then weighted to the local feature vector, aiming to use the global coarse-grained features of the face to provide guidance for the fine-grained features of the local features; the final feature vector obtained is used as the input component of the classification model for model training to obtain the classification model. The system is implemented based on the above method, and can monitor and feedback students' emotional changes in the classroom in real time.
[0007] This patent obtains features of different granularities through the extraction methods of global features and local features. Most methods for extracting local features divide the image into four areas at only one block size level, extract local features of the four areas, and then concatenate the feature vectors. This results in learning discriminative features from only one granularity level when extracting local features, and the discriminative areas of wild expressions usually have different sizes, so the local features learned from only one granularity level are weakly robust. We divide the input image into three blocks of different sizes from the perspective of different granularities, and use a progressive training method to use the fine-grained features extracted by the shallow network as a guide for the coarse-grained features extracted by the deep network, and fuse the expression features of different granularities to obtain multi-granularity local discriminative features to deal with the problem of expression misrecognition caused by the small inter-class difference of expression images. In addition, micro-expressions and macro-expressions often have the problem of uncertainty of expression, and micro-expressions are even more obvious. Existing data sets often use single labels as image annotations, while expressions in real scenes are ambiguous and usually appear in the form of a composite of multiple expressions. Then using only a single label as supervision is not sufficient, so we proposed a multi-granularity-aware label distribution construction module, which uses the characteristics of the constructed label distribution with different sentiment distributions to fully supervise the learning of the network, so that the model can learn more robust sentiment features. Summary of the invention
[0008] The present invention aims to solve the above problems of the prior art. A method for facial expression recognition based on multi-granularity perception and label distribution learning is proposed. The technical solution of the present invention is as follows:
[0009] A method for facial expression recognition using multi-granularity perception and label distribution learning, comprising the following steps:
[0010] Step 1: Before each image is input into the network for feature extraction, it is segmented into three images of different granularity levels, and the image blocks are randomly shuffled;
[0011] Step 2: Input the three facial expression images with different granularities after data enhancement into the last three layers of the basic network, follow the procedure of inputting the coarse-grained images into the deep network to extract the coarse-grained facial expression features, and inputting the fine-grained images into the shallow network to extract the fine-grained facial expression features. Meanwhile, input the coarse-grained facial expression features into the global perception attention module (GPAM) to extract the global facial expression features.
[0012] Step 3: A progressive training method is used for the multi-granularity features extracted at different granularity stages. First, the fine-grained image is input into the low-level network for training through classification loss, and then the larger granularity image is gradually input into the next stage of the basic network until the deepest network. The whole process is trained three times, and finally the different granularity features obtained by progressive training are spliced to obtain multi-granularity local features.
[0013] Step 4: Fuse the fused multi-granularity local expression features with the global perception expression features, and finally obtain the final prediction distribution through a fully connected layer and normalization processing; calculate the granularity similarity between the different granularity features obtained by the previous progressive training and the multi-granularity fusion features respectively, so as to construct the label distribution; finally, use the constructed label distribution as a supervision signal, design a distribution loss, and train the overall network; and integrate all the output predictions of the network as the final prediction for expression classification.
[0014] Furthermore, the step 1 divides each image into three images of different granularity levels before inputting it into the network for feature extraction, and randomly shuffles the image blocks, specifically including the following steps:
[0015] A1. Use the face detection alignment network MTCNN to detect the key points of the face in the facial expression image. The face detection alignment network MTCNN is a multi-task convolutional neural network composed of three sub-networks (P-Net, R-Net, O-Net), each of which has different tasks. P-Net is responsible for generating candidate windows, R-Net is responsible for filtering out incorrect candidate windows, and O-Net is responsible for locating the key points of the face and fine-tuning the face frame. These three sub-networks work together to achieve efficient and accurate face detection. It is usually used to pre-process the images of the face dataset, that is, face detection and alignment operations), and align the facial expression images and crop them into input images I of size 224×224;
[0016] A2. Input image I into a puzzle generator, where the granularity of each image is n=1, 2, 4, that is, divide the image into images of different granularity with block sizes of 1×1, 2×2, and 4×4, shuffle each block, and reconstruct the image to obtain 3 enhanced expression images I1, I2, and I3 of different granularity with a size of 224×224.
[0017] Furthermore, the step 2 specifically includes:
[0018] B1. Obtain enhanced images at three granularity levels and use them as inputs to the last three stages of the backbone network. The backbone network feature extractor is represented as F, which contains L stages. The intermediate feature map output by the feature extractor F is represented as where l∈[1,L], H l ,W l ,C l Respectively represent the height, width and number of channels of the output feature map of stage l;
[0019] B2, F l Input to convolution block B lThe feature representation is obtained in:
[0020]
[0021] Where B(·) contains a 1x1 and 3x3 convolutional layer; then, the above features are pooled and the feature vector is represented as v l ;
[0022] B3. Finally, the global perception attention module is introduced to enhance the final multi-granularity fusion features; a dual-branch attention structure is used, namely the channel attention branch and the spatial attention branch; the feature vector output by the feature extractor F after StageL is represented as V L ; First, V L The channel attention map calculated in two parallel branches is expressed as The spatial attention map is represented as The channel attention consists of global average pooling and two fully connected layers; the spatial attention consists of two 1×1 depthwise separable convolutions and two 3×3 dilated convolutions. The calculation process of the entire global perception attention is as follows:
[0023] M c (V L )=GAP(FC(FC(V L ))) (2)
[0024]
[0025] M(V l )=σ(M c (V l )+M s (V l )) (4)
[0026] where σ is the sigmoid function; finally, the global feature map can be calculated as:
[0027]
[0028] The function of global average pooling is to add all the pixel values of the feature map and find the average value to get a value, which is used to represent the corresponding feature map.
[0029] Furthermore, the step 3 specifically includes the following steps:
[0030] C1. Input the expression feature vectors of different granularities into a classifier consisting of two fully connected layers with BatchNorm and ELU activation functions to generate the predicted probability y L-2 ,y L-1 ,yL ;
[0031] C2. For the training of the output of each stage, the cross entropy between the true label y and the predicted probability distribution is used as the classification loss, and the calculation formula is as follows:
[0032]
[0033] Where N is the number of training images, C is the number of categories, and y i,k Indicates that the i-th image belongs to the label of the k-th class, is the probability of belonging to the kth class predicted in the lth stage, where the probability refers to the probability of belonging to the kth category; the final total cross entropy loss is calculated as:
[0034]
[0035] C3. In order to further utilize feature fusion, the intermediate layer feature vectors v obtained at different stages of progressive training are connected l To obtain the multi-granularity fusion vector, the formula is as follows:
[0036] v concat =concat[v L-2 , v L-1 , v L ] (8).
[0037] Furthermore, the step 4 specifically includes the following steps:
[0038] D1. Enhanced global features and multi-granularity fusion vector v concat Afterwards, the final multi-granularity fusion feature is calculated as:
[0039]
[0040] D2. After inputting the multi-granularity fusion features into a fully connected layer and a normalized softmax layer, the final prediction is y concat ;
[0041] D3. After obtaining the probability distribution of the final output, similarly supervised by the original label, the classification loss is defined as follows:
[0042]
[0043] in, is the probability that the final stage prediction of the i-th sample belongs to the k-th class.
[0044] Furthermore, step 4 constructs a label distribution with rich information for each expression image as supervision, which specifically includes the following steps:
[0045] E1. Calculate multi-granularity fusion features V concat With each {v L-2 ,v L-1 ,v L The cosine similarity of} is s a , where a∈[L-2,L], the specific formula is as follows:
[0046]
[0047] in <V concat ,v a > is V concat and v a The dot product of , a is the index;
[0048] E2, then, get each v a The corresponding cosine similarity s a After that, normalization is performed as follows:
[0049]
[0050] E3, according to the average cosine similarity s a And the probability distribution of each stage {y L-2 ,y L-1 ,y L}, the final label distribution is constructed by the following formula
[0051]
[0052] where i∈[L-2,L]. l represents the logit probability {y L-2 ,y L-1 ,y L}Soft probability distribution obtained through a softmax layer transformation.
[0053] Furthermore, the step 4 performs supervised training on the final predicted distribution of the model and the constructed distribution by designing distribution loss, which specifically includes the following steps:
[0054] F1. After obtaining the constructed label distribution, the label distribution training is performed on the multi-granularity fusion features of the final output. The purpose is to minimize the difference between the constructed label distribution and the predicted probability distribution. The distribution loss is obtained by the following formula:
[0055]
[0056] Where i is the index of a sample in a mini-batch.
[0057] Furthermore, the losses are added together to obtain the final total loss L total , including:
[0058] G1. Through the joint action of each module, the total loss function of the entire framework can be expressed as:
[0059] L total =(λ1L dl +λ2L cl )+αL ce (15)
[0060] Where λ1 and λ2 are weighted ramp functions that vary with the number of epochs, and the calculation formula is as follows:
[0061]
[0062] Where α represents the balance parameter, β represents the current epoch index, and E is the epoch threshold.
[0063] An electronic device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a method for recognizing facial expressions by multi-granularity perception and label distribution learning as described in any one of the above is implemented.
[0064] A non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the facial expression recognition method of multi-granularity perception and label distribution learning as described in any one of the items.
[0065] The advantages and beneficial effects of the present invention are as follows:
[0066] The present invention mainly targets the challenges brought by inconsistent labels of expression datasets and the inherent ambiguity of expressions in real-world scenarios. By utilizing multi-granularity hierarchical feature fusion and label distribution learning, a facial expression recognition method with multi-granularity perception and label distribution learning is designed. The advantage of the present invention is that through a hierarchical fusion strategy, low-level detailed features and high-level semantic information are integrated together, thereby enhancing the model's ability to recognize and distinguish subtle differences in expressions. The proposed global perception attention module further captures comprehensive contextual information and improves the robustness of feature representation. In addition, a dynamic label distribution learning module is introduced to generate a detailed emotion distribution for each sample, effectively reducing the impact of fuzzy and noisy labels and improving the accuracy of expression recognition in real-world scenarios.
[0067] 1. Most existing facial expression methods rely on extracting information from high-level features, or extracting features from low-level features and then using attention mechanisms for enhancement, ignoring the complementarity of features at different granularity levels. While neurons in deeper layers of the network contain rich semantic information, as the depth increases, it inevitably leads to the loss of low-level information (such as texture, edge connections, etc.). From another perspective, the existing FER method extracts local features from predetermined image blocks. A more conventional approach is to divide the image into 4 image blocks as the input of the network, and then extract local features. However, only one level of local features can be obtained from a fixed image block, while facial features of smaller granularity are ignored. The difference of the present invention is that a multi-granularity hierarchical feature fusion learning strategy is designed, which uses the fusion learning of low-level detailed information and high-level abstract semantic information to enable the network to better locate the multi-granularity discrimination area of the expression image. Then, we use the global perception attention module to efficiently extract the global context information in the expression image and further enhance the multi-granularity fusion features.
[0068] 2. Most expressions in real scenes are uncertain and appear in the form of a combination of multiple emotions, so misidentification often occurs. The present invention designs a multi-granularity-aware label distribution construction module and introduces label distribution learning to alleviate the negative impact of fuzzy expressions on model learning in the wild environment. Because features of different granularities contain different information, fine-grained features contain a lot of texture information, which can effectively suppress the influence of external factors such as illumination and occlusion. The goal of the present invention is to simultaneously utilize the different granularity information of the low and high layers of the network to reconstruct the target label distribution with high fidelity, so that the network can learn knowledge from both fine-grained features and coarse-grained features, while effectively avoiding the negative impact of expression uncertainty on label distribution construction and discriminative feature extraction. Finally, the constructed label distribution is used as the supervision of the network output, so that the network can extract richer emotional features and make more accurate recognition of uncertain expressions in real scenes. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 It is a schematic diagram of the overall network model structure of a preferred embodiment provided by the present invention. DETAILED DESCRIPTION
[0070] The following will describe the technical solutions in the embodiments of the present invention in detail in conjunction with the accompanying drawings in the embodiments of the present invention. The described embodiments are only part of the embodiments of the present invention.
[0071] The technical solution of the present invention to solve the above technical problems is:
[0072] As attached Figure 1 As shown, a facial expression recognition method with multi-granularity perception and label distribution learning includes the following steps:
[0073] 1. As attached Figure 1 As shown in the figure, before each image is input into the network for feature extraction, it is segmented into three images of different granularity levels, and the image blocks are randomly shuffled, which specifically includes the following steps:
[0074] A1. Detect facial key points of facial expression images through the face detection and alignment network MTCNN, align the facial expression images, and crop them into input images of 224×224 size;
[0075] A2. Input the image into a puzzle generator, where the granularity of each image is n=1, 2, 4, that is, divide the image into images of different granularity with block sizes of 1×1, 2×2, and 4×4, shuffle each block, and reconstruct the image to obtain 3 expression images of different granularity with a size of 224×224 after enhancement.
[0076] 2. As attached Figure 1 As shown, the three facial expression images with different granularities after data enhancement are input into the last three layers of the basic network, and the coarse-grained images are input into the deep network to extract the coarse-grained facial expression features, and the fine-grained images are input into the shallow network to extract the fine-grained facial expression features. At the same time, the coarse-grained facial expression features are input into the global perception attention module (GPAM) to extract the global facial expression features. Specifically, the following steps are included:
[0077] B1. Obtain enhanced images at three granularity levels and use them as inputs to the last three stages of the backbone network. The backbone network feature extractor is represented as F, which contains L stages. The intermediate feature map output by the feature extractor F is represented as where l∈[1,L], H l ,W l ,C l Respectively represent the height, width and number of channels of the output feature map of stage l;
[0078] B2, F l Input to convolution block B l The feature representation is obtained in:
[0079]
[0080] Where B(·) contains a 1x1 and 3x3 convolution layer. Then, we pool the above features and get the feature vector represented as v l ;
[0081] B3. Finally, a global perception attention module is introduced to highlight the global features of the expression and enhance the final multi-granularity fusion features. A dual-branch attention structure is used, namely the channel attention branch and the spatial attention branch. As mentioned above, the feature vector output by the feature extractor F after StageL is represented as V L First, set V L The channel attention map calculated in two parallel branches is expressed as The spatial attention map is represented as The channel attention consists of global average pooling and two fully connected layers. The spatial attention consists of two 1×1 depthwise separable convolutions and two 3×3 dilated convolutions. The calculation process of the entire global perception attention is as follows:
[0082] M c (V L )=GAP(FC(FC(V L ))) (2)
[0083]
[0084] M(V l )=σ(M c (V l )+M s (V l )) (4)
[0085] Where σ is the sigmoid function. Finally, the global feature map can be calculated as:
[0086]
[0087] 3. As attached Figure 1 As shown in the figure, the multi-granularity features extracted at different granularity stages are trained using a progressive training method. First, the fine-grained image is input into the low-level network for training through classification loss, and then the larger granularity image is gradually input into the next stage of the basic network until the deepest network. The whole process is trained three times, and finally the different granularity features obtained by progressive training are spliced to obtain multi-granularity local features, which specifically includes the following steps:
[0088] C1. Input the expression feature vectors of different granularities into a classifier consisting of two fully connected layers with BatchNorm and ELU activation functions to generate the predicted probability y L-2 ,y L-1 ,y L .
[0089] C2. For the training of the output of each stage, we use the cross entropy between the true label y and the predicted probability distribution as the classification loss, calculated as follows:
[0090]
[0091] Where N is the number of training images, C is the number of categories, and y i,k Indicates that the i-th image belongs to the label of the k-th class, is the probability of belonging to the kth class predicted in the lth stage. It should be clear that due to progressive training, all parameters used in the current prediction will be optimized, which can help each stage in the model work together. The final total cross entropy loss can be calculated as:
[0092]
[0093] C3. In order to further utilize feature fusion, the intermediate layer feature vectors v obtained at different stages of progressive training are connected l To obtain the multi-granularity fusion vector, the formula is as follows:
[0094] v concat =concat[v L-2 , v L-1 ,v L ] (8)
[0095] 4. As attached Figure 1 As shown in the figure, the fused multi-granularity local expression features are fused with the global perception expression features, and finally the final prediction distribution is obtained through a fully connected layer and normalization. The different granularity features obtained by the previous progressive training are respectively calculated for the granularity similarity with the multi-granularity fusion features to construct the label distribution. Finally, the constructed label distribution is used as a supervision signal, a distribution loss is designed, and the overall network is trained. Specifically, the following steps are included:
[0096] D1. Enhanced global features and multi-granularity fusion vector v concat Afterwards, the final multi-granularity fusion feature can be calculated as:
[0097]
[0098] Among them, N is the total number of training samples and c is the category center.
[0099] D2. After inputting the multi-granularity fusion features into a fully connected layer and a normalization layer (softmax), the final prediction is y concat ;
[0100] D3. After obtaining the probability distribution of the final output, similarly supervised by the original label, the classification loss is defined as follows:
[0101]
[0102] in, is the probability that the final stage prediction of the i-th sample belongs to the k-th class;
[0103] 5. As attached Figure 1 As shown in Figure 1, the network constructs a label distribution with rich information for each expression image as supervision, which specifically includes the following steps:
[0104] E1. Calculate multi-granularity fusion features V concat With each {v L-2 ,v L-1 ,v L The cosine similarity of} is s a , where a∈[L-2,L], the specific formula is as follows:
[0105]
[0106] in <V concat ,v a > is V concat and v a The dot product of , a is the index;
[0107] E2, then, get each v a The corresponding cosine similarity s a After that, normalization is performed as follows:
[0108]
[0109] E3, according to the average cosine similarity s a And the probability distribution of each stage {y L-2 ,y L-1 ,y L}, the final label distribution is constructed by the following formula :
[0110]
[0111] where i∈[L-2,L].
[0112] 6. As attached Figure 1 As shown, the final predicted distribution of the model and the constructed distribution are supervised by the designed distribution loss, and the final total loss L of the model is designed. total The specific steps include:
[0113] F1. After obtaining the constructed label distribution, the label distribution training is performed on the multi-granularity fusion features of the final output. The purpose is to minimize the difference between the constructed label distribution and the predicted probability distribution. The L2 paradigm is one of the effective measurements. Therefore, the distribution loss can be obtained as follows:
[0114]
[0115] Where i is the index of a sample in a mini-batch.
[0116] F2. Through the joint action of each module, the total loss function of the entire framework can be expressed as:
[0117] L total =(λ1L dl +λ2L cl )+αL ce (15)
[0118] Where λ1 and λ2 are weighted ramp functions that vary with the number of epochs, and the calculation formula is as follows:
[0119]
[0120] Where α represents the balance parameter, β represents the current epoch index, and E is the epoch threshold.
[0121] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions.
[0122] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules 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 disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0123] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0124] The above embodiments should be understood to be only used to illustrate the present invention and not to limit the protection scope of the present invention. After reading the contents of the present invention, technicians can make various changes or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.
Claims
1. A facial expression recognition method based on multi-granularity perception and label distribution learning, characterized in that: The following steps are involved: Step 1: Before each image is input into the network for feature extraction, it is segmented into three images of different granularity levels, and the image blocks are randomly shuffled; Step 2: Input the three facial expression images with different granularities after data enhancement into the last three layers of the basic network, follow the procedure of inputting the coarse-grained images into the deep network to extract the coarse-grained facial expression features, and inputting the fine-grained images into the shallow network to extract the fine-grained facial expression features. Meanwhile, input the coarse-grained facial expression features into the global perception attention module (GPAM) to extract the global facial expression features. Step 3: A progressive training method is used for the multi-granularity features extracted at different granularity stages. First, the fine-grained image is input into the low-level network for training through classification loss, and then the larger granularity image is gradually input into the next stage of the basic network until the deepest network. The whole process is trained three times, and finally the different granularity features obtained by progressive training are spliced to obtain multi-granularity local features. Step 4: Fuse the fused multi-granularity local expression features with the global perception expression features, and finally obtain the final prediction distribution through a fully connected layer and normalization processing; calculate the granularity similarity between the different granularity features obtained by the previous progressive training and the multi-granularity fusion features respectively, so as to construct the label distribution; finally, use the constructed label distribution as a supervision signal, design a distribution loss, and train the overall network; and integrate all the output predictions of the network as the final prediction for expression classification.
2. The method for facial expression recognition based on multi-granularity perception and label distribution learning according to claim 1, characterized in that: The step 1 divides each image into three images of different granularity levels before inputting them into the network for feature extraction, and randomly shuffles the image blocks, specifically including the following steps: A1. Use the face detection alignment network MTCNN to detect the key points of the face in the facial expression image. The face detection alignment network MTCNN is a multi-task convolutional neural network composed of three sub-networks P-Net, R-Net, and O-Net. Each sub-network has different tasks. P-Net is responsible for generating candidate windows, R-Net is responsible for filtering out incorrect candidate windows, and O-Net is responsible for locating the key points of the face and fine-tuning the face frame. These three sub-networks work together to achieve efficient and accurate face detection, which is used to pre-process the images of the face dataset, namely face detection and alignment operations, and align the facial expression images and crop them into input images I of size 224×224; A2. Input image I into a puzzle generator, where the granularity of each image is n=1, 2, 4, that is, divide the image into images of different granularity with block sizes of 1×1, 2×2, and 4×4, shuffle each block, and reconstruct the image to obtain 3 enhanced expression images I1, I2, and I3 of different granularity with a size of 224×224.
3. The method for facial expression recognition based on multi-granularity perception and label distribution learning according to claim 2, characterized in that: The step 2 specifically includes: B1. Obtain enhanced images at three granularity levels and use them as inputs to the last three stages of the backbone network. The backbone network feature extractor is represented as F, which contains L stages. The intermediate feature map output by the feature extractor F is represented as where l∈[1,L], H l ,W l ,C l Respectively represent the height, width and number of channels of the output feature map of stage l; B2, F l Input to convolution block B l The feature representation is obtained in: Where B(·) contains a 1x1 and 3x3 convolutional layer; then, the above features are pooled and the feature vector is represented as v l ; B3. Finally, the global perception attention module is introduced to enhance the final multi-granularity fusion features; a dual-branch attention structure is used, namely the channel attention branch and the spatial attention branch; the feature vector output by the feature extractor F after StageL is represented as V L ; First, V L The channel attention map calculated in two parallel branches is expressed as The spatial attention map is represented as The channel attention consists of global average pooling and two fully connected layers; the spatial attention consists of two 1×1 depthwise separable convolutions and two 3×3 dilated convolutions. The calculation process of the entire global perception attention is as follows: M c (In L )=GAP(FC(FC(V L ))) (2) M(V l )=σ(M c (In l )+M s (In l )) (4) where σ is the sigmoid function; finally, the global feature map can be calculated as: GAP stands for global average pooling, which adds up all pixel values of the feature map and obtains a value, which is used to represent the corresponding feature map.
4. The method for facial expression recognition based on multi-granularity perception and label distribution learning according to claim 3, characterized in that: The step 3 specifically includes the following steps: C1. Input the expression feature vectors of different granularities into a classifier consisting of two fully connected layers with BatchNorm and ELU activation functions to generate the predicted probability y L-2 ,y L-1 ,y L ; C2. For the training of the output of each stage, the cross entropy between the true label y and the predicted probability distribution is used as the classification loss, and the calculation formula is as follows: Where N is the number of training images, C is the number of categories, and y i,k Indicates that the i-th image belongs to the label of the k-th class, is the probability of belonging to the kth class predicted in the lth stage, where the probability refers to the probability of belonging to the kth category; the final total cross entropy loss is calculated as: C3. In order to further utilize feature fusion, the intermediate layer feature vectors v obtained at different stages of progressive training are connected l To obtain the multi-granularity fusion vector, the formula is as follows: in concat =concat[v L-2 ,in L-1 ,in L ] (8).
5. The method for facial expression recognition based on multi-granularity perception and label distribution learning according to claim 4, characterized in that: The step 4 specifically comprises the following steps: D1. Enhanced global features and multi-granularity fusion vector v concat Afterwards, the final multi-granularity fusion feature is calculated as: D2. After inputting the multi-granularity fusion features into a fully connected layer and a normalized softmax layer, the final prediction is y concat ; D3. After obtaining the probability distribution of the final output, similarly supervised by the original label, the classification loss is defined as follows: in, is the probability that the final stage prediction of the i-th sample belongs to the k-th class.
6. The method for facial expression recognition based on multi-granularity perception and label distribution learning according to claim 5, characterized in that: Step 4 constructs a label distribution with rich information for each expression image as supervision, which specifically includes the following steps: E1. Calculate multi-granularity fusion features V concat With each {v L-2 ,v L-1 ,v L The cosine similarity of} is s a , where a∈[L-2,L], the specific formula is as follows: in <V concat ,v a > is V concat and v a The dot product of , a is the index; E2, then, get each v a The corresponding cosine similarity s a After that, normalization is performed as follows: E3, according to the average cosine similarity s a And the probability distribution of each stage {y L-2 ,y L-1 ,y L }, the final label distribution is constructed by the following formula where i∈[L-2,L], p l represents the logit probability {y L-2 ,y L-1 ,y L }Soft probability distribution obtained through a softmax layer transformation.
7. The method for facial expression recognition based on multi-granularity perception and label distribution learning according to claim 6, characterized in that: Step 4 performs supervised training on the final predicted distribution of the model and the constructed distribution by designing distribution loss, which specifically includes the following steps: F1. After obtaining the constructed label distribution, the label distribution training is performed on the multi-granularity fusion features of the final output. The purpose is to minimize the difference between the constructed label distribution and the predicted probability distribution. The distribution loss is obtained by the following formula: Where i is the index of a sample in a mini-batch.
8. The method for facial expression recognition based on multi-granularity perception and label distribution learning according to claim 7, characterized in that: Add the losses together to get the final total loss L total , specifically including: G1. Through the joint action of each module, the total loss function of the entire framework can be expressed as: L total =(λ1L dl +λ2L cl )+αL ce (15) Where λ1 and λ2 are weighted ramp functions that vary with the number of epochs, and the calculation formula is as follows: Where α represents the balance parameter, β represents the current epoch index, and E is the epoch threshold.
9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for facial expression recognition using multi-granularity perception and label distribution learning as described in any one of claims 1 to 8 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for facial expression recognition using multi-granularity perception and label distribution learning as described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Fine-grained expression classification method based on small sample learning
CN112861626A
Method for classifying similar faces of different countries based on deep learning fusion model
CN117079325A
Facial feature multi-granularity cognitive enhancement micro-expression recognition method and system
CN117746484A
Image generation using one or more neural networks
US20220012858A1
Cited By
Method for reducing multi-modal characteristic quantity of large model based on multi-level coding
CN119559477A
Efficient two-step multi-scale feature extraction method
CN121214196A
An efficient two-step multi-scale feature extraction method
CN121214196B
