Low-resolution facial expression recognition method based on attention and relative distance alignment
Through the knowledge distillation of the teacher model and the student model, combined with attention and relative distance alignment loss, the applicability problem of low-resolution facial expression recognition is solved, and performance improvement and cost reduction are achieved.
Patent Information
- Application Number
- CN202311259802.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2043-09-26
AI Technical Summary
The prior art has poor applicability in low-resolution facial expression recognition, and super-resolution methods increase computational costs and make it difficult to recover image details.
Using an attention and relative distance alignment method, through knowledge distillation of teacher model and student model, attention alignment loss and relative distance alignment loss are introduced, and the overall loss function is constructed for training to improve the performance of student model.
It improves the performance of low-resolution facial expression recognition, reduces the complexity and cost of training and prediction, and has broad applicability.
Smart Images

Figure CN117315753B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a low-resolution facial expression recognition method, system, storage medium and electronic device based on attention and relative distance alignment. Background Art
[0002] Facial expression recognition involves extracting facial features from static images or image sequences, classifying the expressions into specific categories based on the extracted features, and designing a corresponding classification algorithm. In real-world applications, facial images captured by devices like surveillance cameras and smartphones are often low-quality and low-resolution. Therefore, low-resolution facial expression recognition becomes a critical task.
[0003] For example, patent CN202110055946.8 discloses a low-resolution image facial expression recognition method based on a feature reconstruction model, which adopts a feature-level super-resolution method: first, a feature extractor with fixed parameters is used to extract image features on a low-resolution face image, and then the image features are input into a generative adversarial network to generate corresponding super-resolution features. Finally, the obtained super-resolution features are input into a classifier for classification, thereby predicting the expression category.
[0004] However, super-resolution methods greatly increase the computational cost of training and prediction. In addition, as the image resolution decreases, due to the loss of spatial information, there will be a huge difference between the features of high-resolution images and low-resolution images, and this method is difficult to restore the true details of the image in terms of features. Summary of the Invention
[0005] (1) Technical problems solved
[0006] In response to the shortcomings of the existing technology, the present invention provides a low-resolution facial expression recognition method, system, storage medium and electronic device based on attention and relative distance alignment, which solves the technical problem of poor applicability.
[0007] (2) Technical solution
[0008] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0009] A low-resolution facial expression recognition method based on attention and relative distance alignment introduces knowledge distillation into a teacher model and a student model. The teacher model and the student model adopt the same end-to-end structure. The method includes:
[0010] Obtain a facial expression dataset, the dataset including original images of expressions and their category labels; use the original images as high-resolution images, and obtain low-resolution images corresponding to each high-resolution image;
[0011] Using each of the high-resolution images as an input to a pre-trained teacher model to obtain a first attention map and a first relative distance; and using each of the low-resolution images as an input to a student model to be trained to obtain a second attention map and a second relative distance;
[0012] Constructing an attention alignment loss based on the first and second attention maps;
[0013] constructing a relative distance alignment loss according to the first relative distance and the second relative distance;
[0014] Constructing an overall loss function based on the attention alignment loss and the relative distance alignment loss combined with the cross entropy loss obtained by the category labels;
[0015] The student model is trained using the overall loss function until the model converges;
[0016] The low-resolution image of the facial expression to be recognized is used as the input of the converged model to obtain the facial expression category prediction result.
[0017] Preferably, before using each of the high-resolution images as input to a pre-trained teacher model and using each of the low-resolution images as input to a student model to be trained, the method further comprises:
[0018] The corresponding high-resolution image and low-resolution image are preprocessed, wherein the preprocessing includes at least data enhancement.
[0019] Preferably, the attention alignment loss is expressed as:
[0020]
[0021]
[0022]
[0023] Among them, l AA is the attention alignment loss; M T 、M S Corresponding representation of the first and second attention maps;
[0024] is the attention value of the i-th image at position (h, w);
[0025] Respectively represent the feature map set of N images and the gradient map set obtained after back propagation. N, C, H, and W respectively represent the total number of images, the number of channels, the height and width of the feature map, and i, c, h, and w represent the corresponding indexes.
[0026] represents the possibility that the i-th image belongs to the j-th expression label; E represents the number of expression category labels;
[0027] *T is taken to correspond to the teacher model and the input high-resolution image, *S is taken to correspond to the student model and the input low-resolution image.
[0028] Preferably, the relative distance alignment loss includes a binary relative distance alignment loss and a ternary relative distance alignment loss.
[0029] Preferably, the binary relative distance alignment loss is expressed as:
[0030]
[0031]
[0032] Among them, l 2-RDA represents the binary relative distance alignment loss; d T d s Correspondence indicates the relative distance between the first and second binary; ‖*‖2 indicates the Euclidean distance;
[0033] Represents the expression feature vector corresponding to the i1th image The expression feature vector corresponding to the i2th image The relative distance between
[0034] Preferably, the triple relative distance alignment loss is expressed as:
[0035]
[0036]
[0037] Among them, l 3-RDA represents the triple relative distance alignment loss; D T ,D s Correspondingly represents the relative distance between the first and second ternary; l s represents the smoothed mean absolute error loss function;
[0038] Represents the expression feature vector corresponding to the i1th image The expression feature vector corresponding to the i2th image The facial expression feature vector corresponding to the i3th image The relative distance between them; cos is used to solve Trigonometric functions of angles formed in space.
[0039] Preferably, the cross entropy loss is expressed as:
[0040]
[0041] Among them, l cls Expressed as cross entropy loss; log represents logarithmic function; Indicates the yth i Weight value, y i as the category label of the i-th low-resolution image.
[0042] Preferably, the overall loss function is expressed as:
[0043] l total =l cls +λl AA +αl 2-RDA +βl 3-RDA
[0044] Among them, λ, α, and β are hyperparameters used to balance the weights of various losses.
[0045] A low-resolution facial expression recognition system based on attention and relative distance alignment introduces knowledge distillation into a teacher model and a student model. The teacher model and the student model use the same end-to-end structure. The system includes:
[0046] An acquisition module is used to acquire a facial expression dataset, the dataset including original images of expressions and their category labels; the original images are used as high-resolution images, and low-resolution images corresponding to each high-resolution image are acquired;
[0047] An input module, configured to use each of the high-resolution images as an input of a pre-trained teacher model to obtain a first attention map and a first relative distance; and to use each of the low-resolution images as an input of a student model to be trained to obtain a second attention map and a second relative distance;
[0048] an attention alignment module, configured to construct an attention alignment loss based on the first attention map and the second attention map;
[0049] A relative distance alignment module, configured to construct a relative distance alignment loss based on the first relative distance and the second relative distance;
[0050] A construction module, configured to construct an overall loss function based on the attention alignment loss and the relative distance alignment loss in combination with the cross entropy loss obtained by the category labels;
[0051] A training module, configured to train the student model using the overall loss function until the model converges;
[0052] The prediction module is used to take the low-resolution image of the facial expression to be recognized as the input of the converged model to obtain the facial expression category prediction result.
[0053] A storage medium stores a computer program for low-resolution facial expression recognition based on attention and relative distance alignment, wherein the computer program enables a computer to execute the low-resolution facial expression recognition method as described above.
[0054] An electronic device, comprising:
[0055] One or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, the programs including a method for executing the low-resolution facial expression recognition method as described above.
[0056] (3) Beneficial effects
[0057] The present invention provides a low-resolution facial expression recognition method, system, storage medium, and electronic device based on attention and relative distance alignment. Compared with the existing technology, it has the following advantages:
[0058] This invention introduces knowledge distillation, which involves splitting the model into a teacher and a student. This allows the student model to learn from the capabilities of a pre-trained teacher model, thereby improving its performance on low-resolution facial expression recognition tasks. The teacher and student models utilize the same end-to-end architecture, reducing application complexity and ensuring broad applicability. Furthermore, attention alignment and relative distance alignment are performed only during the training phase, not during actual prediction, significantly reducing prediction costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0060] Figure 1 A technical architecture diagram of a low-resolution facial expression recognition method based on attention and relative distance alignment provided by an embodiment of the present invention;
[0061] Figure 2 A block diagram of a low-resolution facial expression recognition method based on attention and relative distance alignment provided by an embodiment of the present invention;
[0062] Figure 3A schematic diagram of obtaining a feature map provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0063] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0064] The embodiments of the present application solve the technical problem of poor applicability by providing a low-resolution facial expression recognition method, system, storage medium and electronic device based on attention and relative distance alignment.
[0065] The technical solution in the embodiments of the present application is to solve the above technical problems, and the overall idea is as follows:
[0066] like Figure 1 As shown, an embodiment of the present invention introduces a knowledge distillation method to transfer the capabilities of a high-resolution teacher model to a low-resolution student model.
[0067] First, the present invention observes that humans can approximate the location and area of objects in low-resolution images using prior knowledge learned from previously viewed high-resolution images. Therefore, the present invention mimics the human visual system and introduces an attention alignment module. This module uses the attention map obtained from the high-resolution teacher model to guide the student model to focus on expression-related areas in facial images.
[0068] Then, on the one hand, the embodiments of the present invention recognize that due to the large differences between the features of high-resolution and low-resolution facial images, it is not feasible to directly transfer facial features from a high-resolution teacher model to a low-resolution student model. On the other hand, facial expression features vary to a certain extent both within and between classes. Therefore, the embodiments of the present invention introduce a relative distance alignment module to quantify the differences in facial expression features as the relative distance between facial features. By transferring relative distances, this module can help the student model more effectively distinguish the differences between low-resolution facial images.
[0069] In order to better understand the above technical solution, the above technical solution will be described in detail below with reference to the accompanying drawings and specific implementation methods.
[0070] Example:
[0071] like Figure 2As shown, an embodiment of the present invention provides a low-resolution facial expression recognition method based on attention and relative distance alignment, introducing knowledge distillation divided into a teacher model and a student model, and the teacher model and the student model adopt the same end-to-end structure. The method includes:
[0072] S1. Obtain a facial expression dataset, the dataset including original images of expressions and their category labels; use the original images as high-resolution images, and obtain low-resolution images corresponding to each high-resolution image;
[0073] S2. Preprocessing the corresponding high-resolution image and low-resolution image, wherein the preprocessing includes at least data enhancement;
[0074] S3. Using each of the high-resolution images as an input to a pre-trained teacher model to obtain a first attention map and a first relative distance; and using each of the low-resolution images as an input to a student model to be trained to obtain a second attention map and a second relative distance;
[0075] S4. Construct an attention alignment loss based on the first attention map and the second attention map;
[0076] S5. Construct a relative distance alignment loss based on the first relative distance and the second relative distance;
[0077] S6. Constructing an overall loss function based on the attention alignment loss and the relative distance alignment loss and the cross entropy loss obtained by the category labels;
[0078] S7. Using the overall loss function to train the student model until the model converges;
[0079] S8. Using the low-resolution image of the facial expression to be recognized as the input of the converged model to obtain the facial expression category prediction result.
[0080] In this embodiment of the present invention, knowledge distillation, which is divided into a teacher model and a student model, is introduced, enabling the student model to learn the capabilities of a pre-trained teacher model, thereby improving its performance on low-resolution facial expression recognition tasks. The teacher and student models utilize the same end-to-end architecture, reducing application complexity and ensuring broad applicability. Furthermore, attention alignment and relative distance alignment are performed only during the training phase, not during actual prediction, significantly reducing prediction costs.
[0081] The following sections describe the various steps of the above solution in detail:
[0082] In step S1, a facial expression dataset is obtained, which includes original images of expressions and their category labels; the original images are used as high-resolution images, and low-resolution images corresponding to each high-resolution image are obtained.
[0083] In this step, we use the large-scale facial expression dataset RAF-DB (Real-world Affective Faces), which was collected in the wild under real-world conditions. This dataset contains facial images with a resolution of 100×100 pixels. Several original images are selected as high-resolution images.
[0084] To obtain low-resolution facial images that correspond to each high-resolution image, this step also applies bicubic interpolation downsampling to the selected original images, generating corresponding low-resolution images of 50×50, 25×25, and 12×12 pixels at downsampling factors of 2, 4, and 8, respectively. Ensure that the expression labels of the low-resolution images are consistent with those of the high-resolution images.
[0085] In step S2, the corresponding high-resolution image and low-resolution image are preprocessed, and the preprocessing at least includes data enhancement.
[0086] In order to improve the generalization ability of the model, this step uses data enhancement, such as random erasing and random flipping, on both the input high-resolution and low-resolution image pairs.
[0087] It should be noted that, in fact, the embodiment of the present invention does not restrict the network architecture of the teacher model and the student model. When both models have the same end-to-end structure, those skilled in the art can choose as needed. For example, the embodiment of the present invention uses ResNet18 as the backbone network of the teacher model and the student model.
[0088] After determining that the backbone network type is ResNet18, the network requires the input image resolution to be 224×224 pixels. Considering that RAF-DB is selected as the facial expression dataset in step S1, the resolution size of the high-resolution image is 100×100 pixels, and the resolution size of the low-resolution image is 50×50, 25×25, or 12×12 pixels.
[0089] Therefore, this step also requires image preprocessing. Based on the previous information, we can determine that this preprocessing includes adjusting the image resolution. Please note that the facial details of the downsampled low-resolution facial images have already been lost, and adjusting the image resolution here is only to ensure the normal operation of the model.
[0090] In step S3, each of the high-resolution images is used as input of a pre-trained teacher model to obtain a first attention map and a first relative distance; and each of the low-resolution images is used as input of a student model to be trained to obtain a second attention map and a second relative distance.
[0091] First, to facilitate attention alignment in subsequent steps, an attention map must be obtained in this step. While there are many ways to obtain attention maps within a model, this step specifically employs the Grad-CAM method to achieve a flexible and accurate acquisition. Using the gradient map obtained by backpropagation during model training, a weighted summation of the feature map across channels is performed to produce a highly accurate attention map.
[0092] The acquisition process of the attention map specifically includes:
[0093] First, obtain the gradient map of the feature map obtained by backpropagation during model training:
[0094]
[0095] in, Respectively represent the feature map set of N images and the gradient map set obtained after back propagation. N, C, H, and W respectively represent the total number of images, the number of channels, the height and width of the feature map, and i, c, h, and w represent the corresponding indexes. = represents the probability that the i-th image belongs to the j-th expression label; E represents the number of expression category labels. Please note that the acquisition process of the feature map itself is an existing technology, which can be seen in Figure 3 , without further explanation.
[0096] Next, the feature map F * and the gradient map G * The attention map is obtained by weighted summation on the channel. The formula is as follows:
[0097]
[0098] in, is the attention value of the i-th image at position (h, w).
[0099] Here, this step sets the following correspondence: *T is taken to correspond to the teacher model and the input high-resolution image, and *S is taken to correspond to the student model and the input low-resolution image.
[0100] Finally, obtain the first attention map M T and the second attention map M S .
[0101] On the other hand, to facilitate relative distance alignment in subsequent steps, it is also necessary to obtain binary relative distances and ternary relative distances in this step. To quantify the differences between facial images, this step designs binary relative distances to represent the relative differences between two facial images, and ternary relative distances to represent the relative differences between three facial images.
[0102] (1) The process of obtaining the binary relative distance specifically includes:
[0103] For a given pair of facial images, their relative distance can be expressed using the Euclidean distance, as follows:
[0104]
[0105] in, Represents the expression feature vector corresponding to the i1th image The expression feature vector corresponding to the i2th image The relative distance between Please note that the process of obtaining the feature vector itself is a prior art, which can be found in Figure 3 , without further explanation.
[0106] Here, we also use the setting relationship for the symbol * in the previous article to obtain the first binary relative distance corresponding to the teacher model The second binary relative distance corresponding to the student model
[0107] (2) The process of obtaining the three-dimensional relative distance specifically includes:
[0108] For a given triplet of facial images, the angle formed by them in the representation space can be used as their relative distance, as follows:
[0109]
[0110] in, Represents the expression feature vector corresponding to the i1th image The expression feature vector corresponding to the i2th image The facial expression feature vector corresponding to the i3th image The relative distance between them; cos is used to solve Trigonometric functions of angles formed in space.
[0111] Here, we also use the setting relationship for the symbol * in the previous article to obtain the first three-element relative distance corresponding to the teacher model The second ternary relative distance corresponding to the student model
[0112] It is not difficult to understand that the first binary relative distance and the second binary relative distance is a group, corresponding to the first relative distance and the second relative distance, which is convenient for constructing the binary relative distance alignment loss function in the subsequent steps; and the first three-dimensional relative distance and the second ternary relative distance It is another group, which also corresponds to the aforementioned first relative distance and second relative distance, so as to facilitate the construction of the ternary relative distance alignment loss function in the subsequent steps.
[0113] In step S4, an attention alignment loss is constructed based on the first attention map and the second attention map.
[0114] Following step S3, this step allows the teacher model to guide the student model training by reducing the Euclidean distance between the teacher model and the student model's corresponding attention maps, so that the student model learns the teacher model's attention map. To this end, the attention alignment loss is introduced, which is expressed as:
[0115]
[0116] Among them, l AA is the attention alignment loss.
[0117] In step S5, a relative distance alignment loss is constructed according to the first relative distance and the second relative distance.
[0118] Following step S3, in this step, two relative distance alignment losses are constructed, where:
[0119] The binary relative distance alignment loss is defined as:
[0120]
[0121] Among them, l 2-RDA represents the binary relative distance alignment loss; ‖*‖2 represents the Euclidean distance;
[0122] The triple relative distance alignment loss is defined as:
[0123]
[0124] Among them, l 3-RDA represents the triple relative distance alignment loss; l s Represents the smoothed mean absolute error loss (Huber loss) function.
[0125] In step S6, an overall loss function is constructed based on the attention alignment loss and the relative distance alignment loss in combination with the cross entropy loss obtained from the category labels.
[0126] First, add the definition of the cross entropy loss:
[0127]
[0128] Among them, l cls Expressed as cross entropy loss; log represents logarithmic function; represents the yth fully connected layer (FC) i Weight value, y i as the category label of the i-th low-resolution image.
[0129] Then the overall loss function is expressed as:
[0130] l total =l cls +λl AA +αl 2-RDA +βl 3-RDA
[0131] Among them, λ, α, and β are hyperparameters used to balance the weights of various losses.
[0132] In step S7, the student model is trained using the overall loss function until the model converges.
[0133] In step S8, the low-resolution image of the facial expression to be recognized is used as the input of the converged model to obtain the facial expression category prediction result.
[0134] In particular, since the embodiment of the present invention introduces a knowledge distillation structure, the prediction stage performed in this step only uses the student model, and the attention alignment and relative distance alignment operations will not be used in the prediction process, so no additional prediction cost will be generated.
[0135] Moreover, the model proposed in the embodiment of the present invention is end-to-end. In this step, it is only necessary to directly input the low-resolution image of the facial expression to be recognized into the converged student model to output the corresponding expression label prediction result.
[0136] An embodiment of the present invention provides a low-resolution facial expression recognition system based on attention and relative distance alignment, which introduces knowledge distillation divided into a teacher model and a student model. The teacher model and the student model adopt the same end-to-end structure. The system includes:
[0137] An acquisition module is used to acquire a facial expression dataset, the dataset including original images of expressions and their category labels; the original images are used as high-resolution images, and low-resolution images corresponding to each high-resolution image are acquired;
[0138] An input module, configured to use each of the high-resolution images as an input of a pre-trained teacher model to obtain a first attention map and a first relative distance; and to use each of the low-resolution images as an input of a student model to be trained to obtain a second attention map and a second relative distance;
[0139] an attention alignment module, configured to construct an attention alignment loss based on the first attention map and the second attention map;
[0140] A relative distance alignment module, configured to construct a relative distance alignment loss based on the first relative distance and the second relative distance;
[0141] A construction module, configured to construct an overall loss function based on the attention alignment loss and the relative distance alignment loss in combination with the cross entropy loss obtained by the category labels;
[0142] A training module, configured to train the student model using the overall loss function until the model converges;
[0143] The prediction module is used to take the low-resolution image of the facial expression to be recognized as the input of the converged model to obtain the facial expression category prediction result.
[0144] An embodiment of the present invention provides a storage medium storing a computer program for low-resolution facial expression recognition based on attention and relative distance alignment, wherein the computer program enables a computer to execute the low-resolution facial expression recognition method described above.
[0145] An embodiment of the present invention provides an electronic device, including:
[0146] One or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, the programs including a method for executing the low-resolution facial expression recognition method as described above.
[0147] It is understandable that the low-resolution facial expression recognition system based on attention and relative distance alignment, storage medium and electronic device provided in the embodiments of the present invention correspond to the low-resolution facial expression recognition method based on attention and relative distance alignment provided in the embodiments of the present invention. The explanations, examples and beneficial effects of the relevant contents can refer to the corresponding parts in the low-resolution facial expression recognition method, and will not be repeated here.
[0148] In summary, compared with the existing technology, the present invention has the following beneficial effects:
[0149] In this embodiment of the present invention, knowledge distillation, which is divided into a teacher model and a student model, is introduced, enabling the student model to learn the capabilities of a pre-trained teacher model, thereby improving its performance on low-resolution facial expression recognition tasks. The teacher and student models utilize the same end-to-end architecture, reducing application complexity and ensuring broad applicability. Furthermore, attention alignment and relative distance alignment are performed only during the training phase, not during actual prediction, significantly reducing prediction costs.
[0150] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0151] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A low-resolution facial expression recognition method based on attention and relative distance alignment, characterized in that: Introducing knowledge distillation into a teacher model and a student model, wherein the teacher model and the student model adopt the same end-to-end structure; the method includes: Obtain a facial expression dataset, the dataset including original images of expressions and their category labels; use the original images as high-resolution images, and obtain low-resolution images corresponding to each high-resolution image; Using each of the high-resolution images as an input to a pre-trained teacher model to obtain a first attention map and a first relative distance; and using each of the low-resolution images as an input to a student model to be trained to obtain a second attention map and a second relative distance; Constructing an attention alignment loss based on the first and second attention maps; constructing a relative distance alignment loss according to the first relative distance and the second relative distance; Constructing an overall loss function based on the attention alignment loss and the relative distance alignment loss combined with the cross entropy loss obtained by the category labels; The student model is trained using the overall loss function until the model converges; The low-resolution image of the facial expression to be recognized is used as the input of the converged model to obtain the facial expression category prediction result; The attention alignment loss is expressed as: Among them, l AA is the attention alignment loss; M T 、M S Corresponding representation of the first and second attention maps; is the attention value of the i-th image at position (h, w); Respectively represent the feature map set of N images and the gradient map set obtained after back propagation. N, C, H, and W respectively represent the total number of images, the number of channels, the height and width of the feature map, and i, c, h, and w represent the corresponding indexes. represents the possibility that the i-th image belongs to the j-th expression label; E represents the number of expression category labels; *T is taken to correspond to the teacher model and the input high-resolution image, *S is taken to correspond to the student model and the input low-resolution image; The relative distance alignment loss includes a binary relative distance alignment loss and a ternary relative distance alignment loss; The binary relative distance alignment loss is expressed as: Among them, l 2-RDA represents the binary relative distance alignment loss; d T d S Correspondence indicates the relative distance between the first and second binary; ‖*‖2 indicates the Euclidean distance; Represents the expression feature vector corresponding to the i1th image The expression feature vector corresponding to the i2th image The relative distance between The triple relative distance alignment loss is expressed as: Among them, l 3-RDA represents the triple relative distance alignment loss; D T ,D S Correspondingly represents the relative distance between the first and second ternary; l s represents the smoothed mean absolute error loss function; Represents the expression feature vector corresponding to the i1th image The facial expression feature vector corresponding to the i2th image The facial expression feature vector corresponding to the i3th image The relative distance between them; cos is used to solve Trigonometric functions of angles formed in space.
2. The low-resolution facial expression recognition method according to claim 1, wherein Before using each of the high-resolution images as an input of a pre-trained teacher model and using each of the low-resolution images as an input of a student model to be trained, the method further comprises: The corresponding high-resolution image and low-resolution image are preprocessed, wherein the preprocessing includes at least data enhancement.
3. The low-resolution facial expression recognition method according to claim 1, wherein The cross entropy loss is expressed as: Among them, l cls Expressed as cross entropy loss; log represents logarithmic function; Indicates the yth i Weight value, y i as the category label of the i-th low-resolution image.
4. The low-resolution facial expression recognition method as claimed in claim 3, wherein: The overall loss function is expressed as: l total =l cls +λl AA +αl 2-RDA +βl 3-RDA Among them, λ, α, and β are hyperparameters used to balance the weights of various losses.
5. A low-resolution facial expression recognition system based on attention and relative distance alignment, characterized in that: The system is configured to execute the low-resolution facial expression recognition method according to claim 1, introducing knowledge distillation into a teacher model and a student model, wherein the teacher model and the student model adopt the same end-to-end structure; the system comprises: An acquisition module is used to acquire a facial expression dataset, the dataset including original images of expressions and their category labels; the original images are used as high-resolution images, and low-resolution images corresponding to each high-resolution image are acquired; An input module, configured to use each of the high-resolution images as an input of a pre-trained teacher model to obtain a first attention map and a first relative distance; and to use each of the low-resolution images as an input of a student model to be trained to obtain a second attention map and a second relative distance; an attention alignment module, configured to construct an attention alignment loss based on the first attention map and the second attention map; A relative distance alignment module, configured to construct a relative distance alignment loss based on the first relative distance and the second relative distance; A construction module, configured to construct an overall loss function based on the attention alignment loss and the relative distance alignment loss in combination with the cross entropy loss obtained by the category labels; A training module, configured to train the student model using the overall loss function until the model converges; The prediction module is used to take the low-resolution image of the facial expression to be recognized as the input of the converged model to obtain the facial expression category prediction result.
6. A storage medium, characterized in that The computer program stores a low-resolution facial expression recognition method based on attention and relative distance alignment, wherein the computer program enables a computer to execute the low-resolution facial expression recognition method according to any one of claims 1 to 4.
7. An electronic device, characterized in that: include: one or more processors; Memory; and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the programs include instructions for executing the low-resolution facial expression recognition method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Low-resolution image facial expression recognition method based on feature reconstruction model
CN112818764A
Face super-resolution reconstruction method and system based on dual generalized distillation
CN116452424A
Facial expression recognition method and system combined with attention mechanism
US20230298382A1