Facial expression recognition method and system based on facial key point perception and feature diversity
By combining facial key point perception and feature diversity, and utilizing a deep learning network model, the intra-class differences and noise effects in facial expression recognition under natural environments are resolved, achieving higher accuracy and robustness in expression recognition.
Patent Information
- Application Number
- CN202410812231.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2044-06-21
AI Technical Summary
In existing technologies, facial expression recognition suffers from intra-class variance and noise in data collected in natural environments, leading to a decrease in recognition accuracy.
We adopt an expression recognition method based on facial key point perception and feature diversity. By combining a deep learning network model with a feature extractor and a feature diversity module, we utilize facial key point information and multi-view feature extraction. We introduce a diversity loss function for supervision to improve the completeness of feature representation and the generalization ability of the model.
It significantly improves the accuracy and robustness of facial expression recognition in natural environments, and can more flexibly capture the inherent changes in facial expressions under different perspectives and lighting conditions, thereby enhancing the model's generalization performance.
Smart Images

Figure CN118823846B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of facial recognition technology, specifically relating to an expression recognition method and system based on facial key point perception and feature diversity. Background Technology
[0002] Facial expression recognition based on facial keypoint perception and feature diversity utilizes two feature extraction modules: one for extracting all initial features and the other for extracting auxiliary features from facial keypoints. These two feature extraction methods are then fused, aiming to leverage regions of key facial information to assist model training for recognizing and classifying different expressions from facial images. This approach combines deep learning and feature fusion; by fusing features obtained from two different feature extractors and then performing diversity processing, it ensures the model's generalization ability to a certain extent.
[0003] Facial expressions are a crucial form of nonverbal communication, conveying a wealth of emotional information. However, facial expression recognition faces several challenges. Issues such as inter-class similarity, intra-class differences, and the inherent complexity and ambiguity of facial images significantly increase the difficulty of expression recognition. Existing methods typically address some of these issues, but do not solve all of them within a unified framework. This invention primarily addresses the problem of mitigating the impact of intra-class differences and noise on the accuracy of expression recognition in data collected from natural environments. Summary of the Invention
[0004] The technical problem this invention aims to solve is to address the shortcomings of the prior art by providing an expression recognition method and system based on facial key point perception and feature diversity. This method addresses the technical issue of mitigating the impact of intra-class differences on the accuracy of expression recognition in data collected in natural environments. It extracts facial key point information through an auxiliary encoder and combines it with conventional image features to reduce interference from environmental noise and other non-expression features, thereby improving the completeness of feature representation. Simultaneously, the network introduces a feature diversity module to extract multi-view features from the fused features and uses a diversity loss function for supervision, enabling the model to more flexibly capture the inherent changes in facial expressions under different viewpoints and lighting conditions. Ultimately, it demonstrates recognition performance surpassing existing best methods on multiple public datasets.
[0005] The present invention adopts the following technical solution:
[0006] The facial expression recognition method based on facial key point perception and feature diversity includes the following steps:
[0007] S1. Preprocess and augment the training image dataset I;
[0008] S2. Construct a deep learning network model including feature extractor B, a pre-trained Landmark semantic feature extraction module FaceE, a GLT generator module, a feature fusion module, and a feature diversity module. Use feature extractor B and FaceE to extract initial features from the training image dataset I obtained in step S1. X were obtained respectively ir and X land ;
[0009] S3. Use the GLT generator to process the X obtained in step S2. ir and X land Generate a global query token and local key-value tokens, then perform attention fusion on the generated tokens to obtain X. fuse ;
[0010] S4. Utilize the feature diversity module to process the X obtained in step S3. fuse Multi-view features are extracted, and the diverse features are aggregated using diversity loss to obtain the diversity loss function;
[0011] S5. The features aggregated in step S4 are used to predict the results through the facial expression classifier, and the cross-entropy loss is used as the loss function for facial expression classification.
[0012] S6. The diversity loss function obtained in step S4 and the expression classification loss function obtained in step S5 are weighted and summed. The resulting total expression recognition loss is used to train the deep learning network model obtained in step S2. The test image data is input into the feature extractor B and FaceE, and after feature fusion and diversity processing, the data is aggregated and input into the expression classifier to obtain the classification result.
[0013] Preferably, in step S1, the training image dataset I is:
[0014]
[0015] in, Let y represent the i-th facial expression image. i express The label is 'n', where 'n' represents the number of images.
[0016] Preferably, in step S2, IR50 and the pre-trained encoder ResNet50 are used as the backbone network B and FaceE, respectively, to extract initial global features and auxiliary facial key point features from the input expression image X, that is:
[0017] X ir =B(X),X land =FaceE(X)
[0018] Among them, X ir X represents the initial features extracted by backbone network B. land This represents the facial key point auxiliary information extracted by the FaceE auxiliary encoder.
[0019] Preferably, in step S3, attention fusion is performed on the generated token to obtain X. fuse Specifically:
[0020]
[0021] Where, q g ,k,v are abbreviations for global query, local key, and local value, respectively. is the normalization scaling factor to prevent extremely small gradients, and b is the relative position deviation.
[0022] Preferably, the Global token in the GTL generator includes a convolutional layer and a Reshape transformation, the Local token includes a convolutional layer and a LayerNorm layer, B represents the batch size, num_heads represents the number of attention heads, N equals the square of the window size, and dim_head represents the dimension of each head.
[0023] Preferably, in step S4, the diversity loss function L d Specifically:
[0024]
[0025] Where n is the number of feature branches, d is the dimension of each feature vector, and x ij μ represents the j-th eigenvector of the i-th feature branch. j This represents the mean of all feature vectors along the j-th dimension.
[0026] Preferably, in step S5, the expression recognition loss function L ex for:
[0027]
[0028] Among them, X e That is, the facial features obtained after aggregation, y e To predict the distribution, g j l This is a one-hot emoji tag, where 't' represents the tag index. Nex This represents the number of facial expression images.
[0029] Preferably, the predicted distribution y e for:
[0030] y e =SoftMax(W e X e +b e )
[0031] Among them, W e X is a parameter of the neural network. e For the input facial expression features, b e These are the parameters of the neural network.
[0032] Preferably, in step S5, the total loss function L for facial expression recognition is... loss for:
[0033] L loss =L ex +w*L d
[0034] Where w is the weighting coefficient of the feature diversity loss, and L ex For facial expression classification loss, L d This represents the loss of feature diversity.
[0035] Secondly, embodiments of the present invention provide an expression recognition system based on facial key point perception and feature diversity, comprising:
[0036] The data module performs preprocessing and data augmentation on the training image dataset I;
[0037] The extraction module constructs a deep learning network model including a feature extractor B, a pre-trained Landmark semantic feature extraction module FaceE, a GLT generator module, a feature fusion module, and a feature diversity module. Initial features are extracted from the training image dataset I obtained from the data module using feature extractor B and FaceE. X were obtained respectively ir and X land ;
[0038] The fusion module uses the GLT generator to process the X obtained from the extraction module. ir and X land Generate a global query token and local key-value tokens, then perform attention fusion on the generated tokens to obtain X. fuse ;
[0039] The aggregation module utilizes the feature diversity module to process the X obtained from the fusion module. fuse Multi-view features are extracted, and the diverse features are aggregated using diversity loss to obtain the diversity loss function;
[0040] The prediction module uses the features aggregated by the aggregation module to predict the results through the expression classifier, and uses cross-entropy loss as the expression classification loss function.
[0041] The recognition module performs a weighted sum of the diversity loss function obtained from the aggregation module and the expression classification loss function obtained from the prediction module. The resulting total expression recognition loss is used to train the deep learning network model obtained from the extraction module. After the test image data is input into the feature extractor B and FaceE, it undergoes feature fusion, diversity processing, aggregation, and input into the expression classifier to obtain the classification result.
[0042] Thirdly, a computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the above-described expression recognition method based on facial key point perception and feature diversity.
[0043] Fourthly, embodiments of the present invention provide a computer-readable storage medium including a computer program, which, when executed by a processor, implements the steps of the above-described expression recognition method based on facial key point perception and feature diversity.
[0044] Compared with the prior art, the present invention has at least the following beneficial effects:
[0045] This invention proposes an expression recognition method based on facial key point perception and feature diversity. Utilizing a deep learning framework, it addresses the expression recognition problem by modeling expressions using the powerful descriptive capabilities of deep neural networks. The method learns and recognizes seven common expressions (anger, disgust, surprise, happiness, sadness, neutrality, and fear). A significant challenge in expression recognition is the impact of intra-class variability and noise on accuracy. Because different people make the same expression differently, this significantly affects the model's learning of expression information. This invention aims to capture the inherent changes in facial expressions under different viewing angles and lighting conditions as flexibly as possible for expression recognition. This invention not only demonstrates excellent results on data collected in laboratory environments but also exhibits strong robustness to data collected in natural environments. This is because data collected in natural environments typically suffers from objective factors such as occlusion and pose variations that severely impact expression discrimination.
[0046] Furthermore, we collect facial image data containing rich expression variations, from different individuals, and under diverse environmental conditions to provide ample learning material for the deep learning model, ensuring that the model can learn the broad sample distribution required for facial expression recognition. We also ensure that the dataset includes all target expression categories, guaranteeing that the model can recognize all expected expression types after training.
[0047] Furthermore, image pixel values are adjusted to a uniform scale, such as between 0 and 1, to facilitate model processing. Influences such as lighting and skin tone are removed, allowing the model to focus on expression-related morphological changes. Alignment: Through face detection and keypoint localization, geometric correction and cropping are performed on the image to ensure consistent positioning of expression regions within the image, reducing the learning burden on the model regarding head pose changes. Rotation, scaling, and flipping operations are performed on the data to simulate different shooting angles and distances: This simulates noise interference during image acquisition, enhancing the model's robustness.
[0048] Furthermore, the feature extractor B is typically a convolutional neural network (CNN) structure, used to extract primary visual features from the original image, such as edges, textures, and colors. The pre-trained Landmark semantic feature extraction module FaceE utilizes a pre-trained facial keypoint detection model to extract keypoint coordinates and their corresponding local features, providing precise geometric cues for expression changes. Pre-training the model using existing large-scale facial keypoint annotation data allows for rapid acquisition of high-quality facial keypoint features without the need for retraining from scratch. The Global-Local Token Generator (GLT) converts the primary features (X...) into... ir ) and key feature (X land The query token is transformed into a global query token and local key-value tokens, achieving multi-level and multi-granularity feature representation. Through an attention fusion mechanism, the importance of each local feature is dynamically adjusted based on the matching relationship between the query token and the key-value tokens, highlighting salient features related to facial expressions. The feature fusion module fuses primary features and keypoint features using a GLT generator to form a richer facial expression feature representation (X). fuse This approach fully leverages the complementary advantages of multi-source information to improve the accuracy of facial expression recognition. The feature diversity module aims to extract features from multiple perspectives, scales, and modes, increasing the dimensionality and complexity of feature representation to address the inherent diversity in facial expression recognition tasks.
[0049] Furthermore, expression classifiers, such as fully connected layers and softmax layers, map aggregated features to the probability distributions of each expression category, achieving automatic expression classification. Cross-loss, as a standard loss function in supervised learning, measures the difference between the model's predicted probability distribution and the true labels, guiding the model to optimize parameters to reduce prediction errors and improve the accuracy of expression classification.
[0050] Furthermore, the feature diversity loss and expression recognition loss are combined to form a composite loss function, which takes into account the model's performance in both feature diversity learning and expression classification tasks, ensuring a balanced improvement in overall performance. By optimizing the total loss function, the model is guided to improve the diversity of feature extraction, the effectiveness of feature fusion, and the accuracy of expression classification, ensuring that the model's performance in each key aspect is improved. This training strategy, which comprehensively considers multiple losses, helps the model maintain good expression recognition performance in various complex scenarios and enhances its generalization ability on unknown test data.
[0051] It is understandable that the beneficial effects of the second aspect mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here.
[0052] In summary, this invention, through meticulously designed data preprocessing, deep learning network architecture, and loss function ensemble, aims to improve the accuracy, robustness, and generalization ability of facial expression recognition from multiple levels, including data preparation, feature extraction, feature fusion, feature diversity extraction, and expression classification. It overcomes problems such as inter-class similarity, intra-class differences, and non-expression interference in facial expression recognition tasks. Specifically, by introducing facial keypoint semantic features, a GLT generator, and a feature diversity module, the model's understanding and utilization of facial expression details, global structure, and multi-view features are enhanced, improving the precision and generalization performance of facial expression recognition, and thus possessing high potential for widespread application.
[0053] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0054] Figure 1 This is a flowchart of the method of the present invention;
[0055] Figure 2 This is a schematic diagram of the structure of a deep learning network model in an embodiment of the present invention;
[0056] Figure 3 A schematic diagram of a computer device provided in an embodiment of the present invention;
[0057] Figure 4 This is a block diagram of a chip according to an embodiment of the present invention;
[0058] Figure 5 This is a schematic diagram of the GLT generator of the present invention. Detailed Implementation
[0059] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0060] In the description of this invention, it should be understood that the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0061] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0062] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Additionally, the character " / " in this invention generally indicates that the preceding and following objects have an "or" relationship.
[0063] It should be understood that although terms such as first, second, third, etc., may be used in the embodiments of the present invention to describe the preset range, these preset ranges should not be limited to these terms. These terms are only used to distinguish the preset ranges from one another. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.
[0064] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0065] The accompanying drawings illustrate various structural schematic diagrams according to embodiments disclosed in this invention. These drawings are not to scale, and some details have been enlarged for clarity, and some details may have been omitted. The shapes of the various regions and layers shown in the drawings, as well as their relative sizes and positional relationships, are merely exemplary and may deviate from reality due to manufacturing tolerances or technical limitations. Furthermore, those skilled in the art can design regions / layers with different shapes, sizes, and relative positions as needed.
[0066] This invention provides an expression recognition method based on facial key point perception and feature diversity, employing convolutional neural networks, feature fusion, and feature diversity. The IR50-based pre-trained model has wide applications in expression recognition tasks due to its simple structure, reasonable design, and significant performance; many high-performance expression recognition algorithms use this pre-trained model as the basic feature extraction network. The FaceE network, a self-supervised pre-trained network using a mask, is primarily used to extract facial key point features. The key point of this invention is combining the two sets of features, fusing the extracted features, and then applying the feature diversity module to ensure feature diversity. For specific technical solutions, better results can be achieved by replacing the initial feature extraction network with other networks with stronger feature extraction capabilities, or by designing other feature constraint methods to improve performance.
[0067] Please see Figure 1 This invention discloses an expression recognition method based on facial key point perception and feature diversity, comprising the following steps:
[0068] S1. Obtain the training image dataset Preprocessing and data augmentation are performed on the training image dataset;
[0069] in, Let y represent the i-th facial expression image. i express The label is 'n', where 'n' represents the number of images.
[0070] For the input training image dataset, data augmentation is first performed. Different data augmentations are performed for different datasets, generally including but not limited to random horizontal flipping and normalization.
[0071] S2. Construct a deep learning network model including feature extractor B, a pre-trained Landmark semantic feature extraction module FaceE, a GLT generator module, a feature fusion module, and a feature diversity module. Use feature extractor B and FaceE to extract initial features from the training image dataset I obtained in step S1. X were obtained respectively ir and X land .
[0072] Please see Figure 2 This paper proposes a fusion module based on global attention to fuse global and local information generated by GLT; and uses IR50 as the backbone network encoder B to input expression image I. e To extract initial features, FaceE represents the pre-trained model obtained from the mask self-supervised task. The encoder pre-trained through the mask allows image features to be guided by some prior knowledge from salient regions of landmarks. During training, the image backbone is fine-tuned, while the auxiliary encoder, to maintain appropriate facial keypoint feature output, is defined as:
[0073] X ir =B(X),X land =FaceE(X)
[0074] Among them, X ir X represents the initial features extracted by backbone network B. land This represents the facial key point auxiliary information extracted by the FaceE auxiliary encoder.
[0075] S3. Use the GLT generator on X ir and X land Generating global and local tokens facilitates subsequent information fusion;
[0076] query = GLT(X) ir ),key,value = GLT(X land )
[0077] Both parts are processed simultaneously through the GLT generator module to obtain global and local information. The auxiliary encoder acts as the global query—global query tokens containing information across the entire input feature map—providing global context from image features to the representation of the landmark stream. In this way, we facilitate understanding of the context to mitigate intra-class differences and inter-class similarities, while the query representing global information can also interact with the local key and value features obtained through GLT.
[0078] The query, key, and value represent the global and local information obtained by the GLT generator. The feature obtained after fusing these three elements through a fusion network is defined as X. fuse , It is a normalization scaling factor to prevent extremely small gradients.
[0079]
[0080] GLT Generator: In neural network architectures, the input and output data of different layers often have different dimensions. Dimensional adjustment can match these dimensions, ensuring smooth data transmission and processing within the network. During network design, appropriate convolution and reshape operations allow for precise adjustment of the data shape to meet the dimensionality matching requirements between different layers. This enables the network to more flexibly adapt to different types and sizes of input data, enhancing its versatility and generalization ability, and thus strengthening its representation learning capabilities for complex tasks. GLT Generator, for example... Figure 5 As shown, a Global query token containing the entire input feature mapping information, as well as Localkey and value tokens, are generated.
[0081] In the GTL generator, the Global token consists of a convolutional layer and a Reshape transform, while the Local token consists of a convolutional layer and a LayerNorm layer. B represents the batch size, num_heads represents the number of attention heads, N equals the square of the window size, and dim_head represents the dimension of each head. For example, in this invention, the total dimension is 256, and the number of heads is 8, so the dimension of a single attention head, dim_head, is 32.
[0082] S4. The feature diversity module consists of multiple feature branches and a feature diversity loss function.
[0083] Given the fused facial expression features X fuse After multiple feature branch mappings, a set of multi-view features is obtained. This set of features reflects the spatial relationships and structural information between different pixels in a static image. At the same time, the spatially perceptual features obtained through feature aggregation and decomposition can help capture local and global information in the image, improving the model's ability to understand and represent images.
[0084] Diversity loss function L d Primarily used to improve the diversity of features generated by the model, reducing similarity and redundancy between features. It measures the correlation between features by calculating the mean and variance of each feature branch. Calculating the feature mean and variance, along with the final diversity loss, can measure the degree of diversity in the feature representations generated by the model, and optimizing the diversity loss can help the model learn more discriminative and richer feature representations.
[0085] Diversity loss function L d Specifically:
[0086]
[0087] Where n is the number of feature branches, d is the dimension of each feature vector, and x ij μ represents the j-th eigenvector of the i-th feature branch. j Let L represent the mean of all feature vectors along the j-th dimension. The goal of this loss function is to minimize L. d This allows for a wide variety of feature representations between different feature branches, resulting in a set of multi-view features.
[0088] S5. The aggregated features are used to predict the results through an expression classifier, and the cross loss is used as the expression classification loss.
[0089] For a set of multi-view features X1, X2, X3, X4, ... X n After concatenating and aggregating the feature dimensions, classification is performed through a linear layer. Here, cross-entropy loss is used as the loss function L for facial expression recognition. ex :
[0090] X = cat(X1X2,X3,X4,…X) n )
[0091] Input X into the facial expression classifier, and then use X... e This is to ensure the recognition of facial expression information. As shown in the following equation, a SoftMax layer with cross-entropy loss is used for facial expression classification.
[0092] y e =SoftMax(W e X e +b e )
[0093]
[0094] Among them, X e This refers to the facial expression features obtained after aggregation, and the predicted distribution y. e and one-hot emoji tag g j l Constitutes cross-entropy loss (i.e., L) ex ), where t represents the tag index. Nex This represents the number of facial expression images.
[0095] S6. Apply the facial expression classification loss L obtained in step S5. ex and the feature diversity loss L obtained in step S4 d The total loss of facial expression recognition is obtained by weighted summation. The deep learning network model obtained in step S2 is trained using the total loss of facial expression recognition. The test image data is input into feature extractor B and FaceE, and after feature fusion and diversity processing, the data is aggregated and finally input into the facial expression classifier to obtain the classification result.
[0096] Modular feature diversity loss helps enhance the independence between decomposition components. By fusing multiple feature sources, it can fully utilize their respective advantages and compensate for their disadvantages, thereby improving the performance of facial expression recognition. Furthermore, facial expression feature fusion can also help address the complexity and ambiguity of facial images. Many interfering factors exist in facial images, such as changes in illumination, pose variations, and blurring, which can affect the accurate recognition of facial expressions. By fusing multiple features together, the influence of these interfering factors can be mitigated, improving the robustness and stability of facial expression recognition.
[0097] The total loss function L for facial expression recognition loss for:
[0098] L loss =L ex +w*L d
[0099] Where w represents the weighting coefficient of the feature diversity loss, L ex It is an expression classification loss, L d It is a loss of feature diversity.
[0100] By optimizing the total loss L loss The network can effectively extract appropriate facial features and play a positive role in model training.
[0101] In another embodiment of the present invention, an expression recognition system based on facial key point perception and feature diversity is provided. This system can be used to implement the above-mentioned expression recognition method based on facial key point perception and feature diversity. Specifically, the expression recognition system based on facial key point perception and feature diversity includes a data module, an extraction module, a fusion module, an aggregation module, a prediction module, and a recognition module.
[0102] The data module performs preprocessing and data augmentation on the training image dataset I.
[0103] The extraction module constructs a deep learning network model including a feature extractor B, a pre-trained Landmark semantic feature extraction module FaceE, a GLT generator module, a feature fusion module, and a feature diversity module. Initial features are extracted from the training image dataset I obtained from the data module using feature extractor B and FaceE. X were obtained respectively ir and X land ;
[0104] The fusion module uses the GLT generator to process the X obtained from the extraction module. ir and X landGenerate a global query token and local key-value tokens, then perform attention fusion on the generated tokens to obtain X. fuse ;
[0105] The aggregation module utilizes the feature diversity module to process the X obtained from the fusion module. fuse Multi-view features are extracted, and the diverse features are aggregated using diversity loss to obtain the diversity loss function;
[0106] The prediction module uses the features aggregated by the aggregation module to predict the results through the expression classifier, and uses cross-entropy loss as the expression classification loss function.
[0107] The recognition module performs a weighted sum of the diversity loss function obtained from the aggregation module and the expression classification loss function obtained from the prediction module. The resulting total expression recognition loss is used to train the deep learning network model obtained from the extraction module. After the test image data is input into the feature extractor B and FaceE, it undergoes feature fusion, diversity processing, aggregation, and input into the expression classifier to obtain the classification result.
[0108] In another embodiment of the present invention, a terminal device is provided, comprising a processor and a memory. The memory stores a computer program, which includes program instructions. The processor executes the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to achieve a corresponding method flow or corresponding function. The processor described in this embodiment can be used for the operation of an expression recognition method based on facial key point perception and feature diversity, including:
[0109] Preprocessing and data augmentation are performed on the training image dataset I; a deep learning network model is built, including feature extractor B, a pre-trained Landmark semantic feature extraction module FaceE, a GLT generator module, a feature fusion module, and a feature diversity module. Initial features are extracted from the training image dataset I using feature extractor B and FaceE. X were obtained respectively ir and X land Using the GLT generator on X ir and X land Generate a global query token and local key-value tokens, then perform attention fusion on the generated tokens to obtain X. fuse ;Utilizing the feature diversity module for X fuse Multi-view features are extracted and aggregated using diversity loss to obtain a diversity loss function. The aggregated features are then used to predict the results through an expression classifier, using cross-entropy loss as the expression classification loss function. The diversity loss function and the expression classification loss function are weighted and summed, and the resulting total expression recognition loss is used to train the deep learning network model. Test image data is input into feature extractors B and FaceE, and after feature fusion, diversity processing, and aggregation, it is input into the expression classifier to obtain the classification result.
[0110] In another embodiment of the present invention, a storage medium is also provided, specifically a computer-readable storage medium (memory). This computer-readable storage medium is a memory device in a terminal device used to store programs and data. It is understood that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and extended storage media supported by the terminal device. The computer-readable storage medium provides storage space that stores the terminal's operating system. Furthermore, this storage space also stores one or more instructions suitable for loading and execution by a processor. These instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device.
[0111] One or more instructions stored in a computer-readable storage medium can be loaded and executed by a processor to implement the corresponding steps of the expression recognition method based on facial key point perception and feature diversity in the above embodiments; one or more instructions in the computer-readable storage medium are loaded and executed by the processor to perform the following steps:
[0112] Preprocessing and data augmentation are performed on the training image dataset I; a deep learning network model is built, including feature extractor B, a pre-trained Landmark semantic feature extraction module FaceE, a GLT generator module, a feature fusion module, and a feature diversity module. Initial features are extracted from the training image dataset I using feature extractor B and FaceE. X were obtained respectivelyir and X land Using the GLT generator on X ir and X land Generate a global query token and local key-value tokens, then perform attention fusion on the generated tokens to obtain X. fuse ;Utilizing the feature diversity module for X fuse Multi-view features are extracted and aggregated using diversity loss to obtain a diversity loss function. The aggregated features are then used to predict the results through an expression classifier, using cross-entropy loss as the expression classification loss function. The diversity loss function and the expression classification loss function are weighted and summed, and the resulting total expression recognition loss is used to train the deep learning network model. Test image data is input into feature extractors B and FaceE, and after feature fusion, diversity processing, and aggregation, it is input into the expression classifier to obtain the classification result.
[0113] Please see Figure 3 The terminal device is a computer device. In this embodiment, the computer device 60 includes a processor 61, a memory 62, and a computer program 63 stored in the memory 62 and executable on the processor 61. When executed by the processor 61, the computer program 63 implements the fluid composition calculation method in the reservoir stimulation wellbore of this embodiment. To avoid repetition, these details are not elaborated here. Alternatively, when executed by the processor 61, the computer program 63 implements the functions of each model / unit in the fluid composition calculation system in the reservoir stimulation wellbore of this embodiment. To avoid repetition, these details are not elaborated here.
[0114] Computer device 60 can be a desktop computer, laptop, handheld computer, cloud server, or other computing device. Computer device 60 may include, but is not limited to, a processor 61 and a memory 62. Those skilled in the art will understand that... Figure 3 This is merely an example of computer device 60 and does not constitute a limitation on computer device 60. It may include more or fewer components than shown, or combine certain components, or different components. For example, computer device may also include input / output devices, network access devices, buses, etc.
[0115] The processor 61 may be a central processing unit (CPU), or other general-purpose processors, CPUs, graphics processing units (GPUs), digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, quantum computing-based data processing logic units, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0116] The memory 62 can be an internal storage unit of the computer device 60, such as a hard disk or RAM of the computer device 60. The memory 62 can also be an external storage device of the computer device 60, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on the computer device 60.
[0117] Furthermore, the memory 62 may include both internal storage units of the computer device 60 and external storage devices. The memory 62 is used to store computer programs and other programs and data required by the computer device. The memory 62 can also be used to temporarily store data that has been output or will be output.
[0118] Any references to memory, databases, or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0119] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0120] Please see Figure 4 The terminal device 600 is an electronic device, which is manifested in the form of a general-purpose computing device and includes a chip. The components of the electronic device may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including storage unit 620 and processing unit 610), a display unit 640, etc.
[0121] The storage unit stores program code, which can be executed by the processing unit 610 to perform the steps described in the method section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 610 can perform actions such as... Figure 1 The steps are shown in the figure.
[0122] Storage unit 620 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 6201 and / or cache memory 6202, and may further include a read-only memory (ROM) 6203.
[0123] Storage unit 620 may also include a program / utility 6204 having a set (at least one) program module 6205, such program module 6205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0124] Bus 630 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the multiple bus structures.
[0125] Electronic device 600 can also communicate with one or more external devices 700 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 600, and / or with any device that enables electronic device 600 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 650. Furthermore, electronic device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 660. Network adapter 660 can communicate with other modules of electronic device 600 via bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.
[0126] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0127] To verify the effectiveness of this invention, two commonly used facial expression datasets, FERPlus and RAF-DB, were selected for experimental verification.
[0128] This invention offers improved performance compared to existing methods. Table 1 shows the comparative results of accuracy on the FERPlus dataset. It can be seen that the model of this invention achieves a recognition accuracy of 91.12%. The accuracy of FG-AGR differs from our model by only 0.2%, but it differs by 1.33% on the RAF-DB dataset. Overall, the advantages of the model proposed in this chapter are still evident.
[0129] Table 1: Accuracy of Experimental Classification (Unit: %)
[0130]
[0131] For the RAF-DB database, the comparison results are shown in Table 1. Our invention achieved a recognition accuracy of 92.14% on the RAF-DB database. This database is a dataset from a natural environment, containing numerous interfering factors such as occlusion and pose variations, and better represents various situations in real-world facial expression data collection. This demonstrates that our method is robust to spontaneous facial expression databases. It is worth noting that the FFDNet network shares similarities with the content of this chapter, such as the multi-view features and diversity feature loss. However, we utilize features from different sources for subsequent multi-view feature extraction, and the network structures of the feature branches are completely different, as are the calculation methods for diversity feature loss. Despite these differences, we achieved higher performance than FFDNet.
[0132] In summary, this invention presents an expression recognition method and system based on facial keypoint perception and feature diversity. Trained end-to-end, the overall framework design fully considers the comprehensive utilization and diversity of features. In the FER task, different expression categories may have similar feature representations, making accurate differentiation difficult. Feature fusion based on global-local attention helps integrate feature information from different sources and types, improving the model's ability to represent data and enabling it to better understand and express facial expression features. Multiple feature branches decompose complex problems into easier-to-handle sub-problems, simplifying the model structure, reducing computational complexity, and improving model understanding and interpretation. Furthermore, supervising the obtained multi-view features using a feature diversity loss function enhances robustness, making it more adaptable to changes and differences in facial expressions from different individuals, improving the discriminability between different expression categories, and thus enabling more accurate classification and recognition. The model can better handle individual differences and pose variations in facial expressions and reduce dependence on specific conditions. This framework enriches the research content in the field of facial expression recognition and provides new ideas and methods for the application of deep learning in facial expression recognition tasks.
[0133] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0134] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0135] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0136] In the embodiments provided by this invention, it should be understood that the disclosed devices / terminals and methods can be implemented in other ways. For example, the device / terminal embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0137] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0138] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0139] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0140] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0141] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0142] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0143] The above content is only for illustrating the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solution based on the technical concept proposed in this invention shall fall within the scope of protection of the claims of this invention.
Claims
1. An expression recognition method based on facial key point perception and feature diversity, characterized in that, Includes the following steps: S1, the training image dataset Perform preprocessing and data augmentation; S2. Construct a deep learning network model including a feature extractor, a pre-trained Landmark semantic feature extraction module FaceE, a GLT generator module, a feature fusion module, and a feature diversity module. Use the feature extractor and FaceE to extract the training image dataset obtained in step S1. Extracting initial features , FaceE They were obtained respectively and ; S3. Use the GLT generator to process the result obtained in step S2. and Generate a global query token and local key-value tokens, and then perform attention fusion on the generated tokens to obtain... ; S4. Utilize the feature diversity module to process the results obtained in step S3. Multi-view features are extracted, and the diverse features are aggregated using diversity loss to obtain the diversity loss function; S5. The features aggregated in step S4 are used to predict the results through an expression classifier, and cross-entropy loss is used as the expression classification loss function. S6. The diversity loss function obtained in step S4 and the expression classification loss function obtained in step S5 are weighted and summed. The resulting total expression recognition loss is used to train the deep learning network model obtained in step S2. The test image data is input into the feature extractor and FaceE, and after feature fusion and diversity processing, it is aggregated and input into the expression classifier to obtain the classification result.
2. The expression recognition method based on facial key point perception and feature diversity according to claim 1, characterized in that, In step S1, the training image dataset for: in, Indicates the first An emoji image, express The tag, Indicates the number of images.
3. The expression recognition method based on facial key point perception and feature diversity according to claim 1, characterized in that, In step S2, IR50 and the pre-trained encoder ResNet50 are used as the backbone network B and FaceE, respectively, to extract data from the input expression image. To extract initial global features and auxiliary facial key point features, namely: in, This represents the initial features extracted by backbone network B. This represents the facial key point auxiliary information extracted by the FaceE auxiliary encoder.
4. The expression recognition method based on facial key point perception and feature diversity according to claim 1, characterized in that, In step S3, attention fusion is performed on the generated tokens to obtain... Specifically: in, These are abbreviations for global information query, local information key, and local information value, respectively. It is a normalized scaling factor. This is a scaling factor for the attention score to prevent extremely small gradients. This represents the relative positional deviation.
5. The expression recognition method based on facial key point perception and feature diversity according to claim 4, characterized in that, The global token in the GLT generator consists of a convolutional layer and a reshape transform, while the local token consists of a convolutional layer and a LayerNorm layer. m The value represents the batch size, num_heads represents the number of attention heads, N equals the square of the window size, and dim_head represents the dimension of each head.
6. The expression recognition method based on facial key point perception and feature diversity according to claim 1, characterized in that, In step S4, the diversity loss function Specifically: in, n The number of feature branches, d The dimension of each feature vector, Indicates the first i The first feature branch j 1 eigenvector μ j This indicates that all eigenvectors are in the th order. j The mean across each dimension.
7. The expression recognition method based on facial key point perception and feature diversity according to claim 1, characterized in that, In step S5, the facial expression recognition loss function for: in, That is, the facial features obtained after aggregation. To predict the distribution, This is a one-hot emoji tag, where 't' represents the tag index. This represents the number of facial expression images.
8. The expression recognition method based on facial key point perception and feature diversity according to claim 7, characterized in that, Predicted distribution for: in, For neural network parameters, For the input facial expression features, These are the parameters of the neural network.
9. The expression recognition method based on facial key point perception and feature diversity according to claim 1, characterized in that, In step S5, the total loss function for expression recognition for: in, These are the weighting coefficients for the feature diversity loss. For expression classification loss, This represents the loss of feature diversity.
10. An expression recognition system based on facial key point perception and feature diversity, characterized in that, include: The data module is used for the training image dataset. Perform preprocessing and data augmentation; The extraction module constructs a deep learning network model including a feature extractor, a pre-trained Landmark semantic feature extraction module (FaceE), a GLT generator module, a feature fusion module, and a feature diversity module. It uses the feature extractor and FaceE to extract the training image dataset obtained from the data module. Extracting initial features , FaceE They were obtained respectively and ; The fusion module uses the GLT generator to process the data obtained from the extraction module. and Generate a global query token and local key-value tokens, and then perform attention fusion on the generated tokens to obtain... ; The aggregation module utilizes the feature diversity module to optimize the results obtained from the fusion module. Multi-view features are extracted, and the diverse features are aggregated using diversity loss to obtain the diversity loss function; The prediction module uses the features aggregated by the aggregation module to predict the results through the expression classifier, and uses cross-entropy loss as the expression classification loss function. The recognition module performs a weighted sum of the diversity loss function obtained from the aggregation module and the expression classification loss function obtained from the prediction module. The resulting total expression recognition loss is used to train the deep learning network model obtained from the extraction module. The test image data is input into the feature extractor and FaceE, and after feature fusion and diversity processing, it is aggregated and input into the expression classifier to obtain the classification result.
Citation Information
Patent Citations
Rapid pathological image analysis method and device based on magnification alignment Transformer
CN117333442A
Grid self-attention facial expression recognition method based on supervised comparative learning
CN117351550A
