Small sample-based facial beauty evaluation method, device and medium
By using a small-sample face beauty evaluation method, and combining convolutional neural networks and attention mechanisms with residual modules and dynamic loss functions, the problem of insufficient generalization ability in traditional methods is solved, and a more efficient beauty evaluation is achieved.
Patent Information
- Application Number
- PCT/CN2024/124261
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-05-30
- Filing Date
- 2024-10-11
- Publication Date
- 2025-12-04
AI Technical Summary
Traditional methods for evaluating facial beauty lack consideration for individual aesthetic preferences and differences. Their reliance on feature extraction methods leads to insufficient generalization ability and low computational efficiency and accuracy.
A small-sample face beauty evaluation method is adopted. By using convolutional neural networks and attention mechanisms, combined with residual modules and dynamic loss functions, the model is trained to learn general features from a small number of samples, thereby improving the model's generalization ability.
The model can quickly adapt to new classification tasks, reduce overfitting, and improve computational efficiency and accuracy.
Smart Images

Figure CN2024124261_04122025_PF_FP_ABST
Abstract
Description
Small sample face beauty evaluation method, device and medium TECHNICAL FIELD
[0001] Embodiments of the present application relate to the field of image processing, and particularly relate to a small sample face beauty evaluation method, device and medium. BACKGROUND
[0002] Traditional face beauty evaluation methods are mainly based on feature analysis, facial proportion, machine learning and the like, but these methods often do not take into account individual aesthetic preferences and differences, only consider a limited set of facial features, and are highly dependent on feature extraction methods, resulting in less than ideal results when generalized to new data sets, and lack of universality. Convolutional neural networks can extract complex structure, texture and shape information of the face, thereby improving the modeling ability of beauty. The traditional face beauty prediction task still has the following problems. First, the collection and calibration of input data require a lot of manpower and resources, and the lack of effective supervision information leads to problems such as model fitting and insufficient generalization ability; second, the features extracted by the convolutional neural network still contain a lot of redundant information unrelated to the face, which reduces the computational efficiency and accuracy of the model.
[0003] SUMMARY
[0004] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
[0005] The purpose of the present application is to at least partially solve one of the technical problems existing in the related art. The embodiments of the present application provide a small sample face beauty evaluation method, device and medium, which can learn general features from a small number of samples and improve the generalization ability.
[0006] In an embodiment of the first aspect of the present application, a small sample face beauty evaluation method comprises:
[0007] obtaining a face image to be evaluated;
[0008] inputting the face image to be evaluated into a trained evaluation model to evaluate the face beauty, and obtaining an evaluation result;
[0009] training the evaluation model, comprising:
[0010] obtaining a training face image;
[0011] dividing the training face image into a support set and a query set of multiple categories;
[0012] inputting the support set into the evaluation model to obtain target network parameters, and migrating the target network parameters to the evaluation model to obtain a first training model;
[0013] inputting the query set into the first training model to obtain a loss function value, and adjusting target network parameters of the first training model according to the loss function value to obtain a trained evaluation model.
[0014] According to certain embodiments of the first aspect of the application, the evaluation model comprises a residual module, the residual module comprising a first convolutional layer, a second convolutional layer and an attention layer; data processing by the residual module comprises:
[0015] obtaining an input of the first convolutional layer according to an input of the residual module;
[0016] performing convolution on the input of the first convolutional layer by the first convolutional layer to obtain an output of the first convolutional layer;
[0017] performing convolution on the output of the first convolutional layer by the second convolutional layer to obtain an output of the second convolutional layer;
[0018] performing residual connection on the input of the first convolutional layer and the output of the second convolutional layer to obtain a residual connection result;
[0019] performing attention mechanism-based calculation on the residual connection result by the attention layer to obtain an output of the attention layer;
[0020] obtaining an output of the residual module according to the output of the attention layer.
[0021] According to certain embodiments of the first aspect of the application, the performing attention mechanism-based calculation on the residual connection result by the attention layer to obtain an output of the attention layer comprises:
[0022] calculating a first attention weight of the input of the attention layer in the height and width of the spatial dimension;
[0023] calculating a second attention weight of the input of the attention layer in the channel dimension and the width of the spatial dimension;
[0024] calculating a third attention weight of the input of the attention layer in the channel dimension and the height of the spatial dimension;
[0025] averaging the first attention weight, the second attention weight and the third attention weight to obtain the output of the attention layer.
[0026] According to certain embodiments of the first aspect of the application, the calculating a first attention weight of the input of the attention layer in the height and width of the spatial dimension comprises:
[0027] performing fusion pooling on the input of the attention layer to reduce the number of channels to obtain a first sub-result;
[0028] performing convolution and normalization on the first sub-result to reduce the number of channels to obtain a second sub-result;
[0029] performing activation function calculation on the second sub-result to obtain a third sub-result;
[0030] fusing the third sub-result and the input of the attention layer to obtain a first attention weight;
[0031] The fusion pooling is splicing an average pooling result and a maximum pooling result.
[0032] According to certain embodiments of the first aspect of the application, the calculation of the second attention weight of the input of the attention layer in the channel dimension and the height of the spatial dimension includes:
[0033] rotating the input of the attention layer along an axis of the height of the spatial dimension by a preset angle to obtain a fourth sub-result;
[0034] performing fusion pooling on the fourth sub-result to reduce the number of channels to obtain a fifth sub-result;
[0035] performing convolution and normalization on the fifth sub-result to reduce the number of channels to obtain a sixth sub-result;
[0036] performing activation function calculation on the sixth sub-result to obtain a seventh sub-result;
[0037] fusing the seventh sub-result and the fourth sub-result, and rotating along an axis of the height of the spatial dimension by a preset angle to obtain a second attention weight;
[0038] The fusion pooling is splicing an average pooling result and a maximum pooling result.
[0039] According to certain embodiments of the first aspect of the application, the calculation of the third attention weight of the input of the attention layer in the channel dimension and the width of the spatial dimension includes:
[0040] rotating the input of the attention layer along an axis of the width of the spatial dimension by a preset angle to obtain an eighth sub-result;
[0041] performing fusion pooling on the eighth sub-result to reduce the number of channels to obtain a ninth sub-result;
[0042] performing convolution and normalization on the ninth sub-result to reduce the number of channels to obtain a tenth sub-result;
[0043] performing activation function calculation on the tenth sub-result to obtain an eleventh sub-result;
[0044] fuse the eleventh sub-result and the eighth sub-result, and rotate a preset angle along an axis of a high dimension of space to obtain a third attention weight;
[0045] The fusion pooling is splicing an average pooling result and a maximum pooling result.
[0046] According to certain embodiments of the first aspect of the application, the loss function value is represented as: wherein L paramSmoot hL1 is a loss function value, N is the number of training face images in a batch, y i is a true value of the i-th training face image, is a predicted value of the i-th training face image, and a is a dynamic parameter that dynamically changes according to the category.
[0047] According to certain embodiments of the first aspect of the application, the dynamic parameter is represented as: wherein a max is a maximum value of the dynamic parameter, a min is a minimum value of the dynamic parameter, and n e is the number of categories.
[0048] Embodiments of the second aspect of the application are an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the small sample face beauty evaluation method as described above when executing the computer program.
[0049] Embodiments of the third aspect of the application are a computer storage medium, storing computer executable instructions, and the computer executable instructions are used to execute the small sample face beauty evaluation method as described above.
[0050] The above scheme has at least the following beneficial effects: by task division of the training face images, support sets and query sets of multiple categories are obtained; the support sets are input to the evaluation model for training to obtain target network parameters, and the target network parameters are migrated to the evaluation model to obtain a first training model; the query sets are input to the first training model for verification to obtain a loss function value, and the target network parameters of the first training model are adjusted according to the loss function value to obtain a trained evaluation model; it can help the model to quickly learn general features from a small amount of samples, so that the model can adapt to new classification tasks faster, thereby improving the generalization ability of the model and reducing the occurrence of overfitting. BRIEF DESCRIPTION OF DRAWINGS
[0051] The accompanying drawings are used to provide a further understanding of the technical scheme of the application, and constitute a part of the specification, and are used together with the embodiments of the application to explain the technical scheme of the application, and do not constitute a limitation on the technical scheme of the application.
[0052] Fig. 1 is a step diagram of a small sample face beauty evaluation method;
[0053] Fig. 2 is a step diagram of training an evaluation model;
[0054] Fig. 3 is a structural diagram of a residual module;
[0055] Fig. 4 is a structural diagram of an attention layer. DETAILED DESCRIPTION
[0056] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0057] It should be noted that although the functional modules are divided in the device schematic diagram, and the logical sequence is shown in the flowchart, in some cases, the steps shown or described can be executed in a manner different from the module division in the device or the sequence in the flowchart. The terms "first", "second", etc. in the specification, claims or above-described drawings are used to distinguish similar objects, and do not necessarily describe a specific sequence or chronological order.
[0058] The embodiments of the present application are further described below in combination with the drawings.
[0059] The embodiments of the present application provide a small sample face beauty evaluation method.
[0060] Referring to Fig. 1, the small sample face beauty evaluation method includes the following steps:
[0061] Step S110, obtaining a face image to be evaluated;
[0062] Step S120, inputting the face image to be evaluated into a trained evaluation model to perform face beauty evaluation, and obtaining an evaluation result.
[0063] Referring to Fig. 2, the training of the evaluation model includes the following steps:
[0064] Step S210, obtaining a training face image;
[0065] Step S220, performing task division on the training face image to obtain a support set and a query set of multiple categories;
[0066] Step S230, inputting the support set into the evaluation model to perform training to obtain target network parameters, and migrating the target network parameters to the evaluation model to obtain a first training model;
[0067] Step S240, input the query set to the first training model for verification to obtain a loss function value, adjust the target network parameter of the first training model according to the loss function value to obtain a trained evaluation model.
[0068] For step S210, the training face image can be obtained from a large online image database, such as a large scale Asia facial beauty database (LSAFBD) and the like.
[0069] The training face image is subjected to face detection, key point detection, rotation alignment and the like pretreatment operation. The pretreated face image is subjected to rotation, flip, random clipping and the like data enhancement operation, so as to achieve the purpose of expanding the data set and improving the generalization ability of the model.
[0070] For step S220, the training face image is divided into a meta training set and a meta test set according to a certain proportion. For example, the proportion of the meta training set and the meta test set is 8:2. The meta training set is denoted as D train , and the meta test set is denoted as D test .
[0071] For step S230, the meta training set and the meta test set are subjected to task division, n categories of samples are randomly extracted, k+m instances of each category of sample are randomly extracted to form a support set, and the remaining instances of each category are together to form a query set. The support set is denoted as , and the query set is denoted as
[0072] For steps S230 and S240, the support set of the meta training task is input to the evaluation model for training. Specifically, one instance of each category in the support set is randomly selected to form training data, and the training data is input to the evaluation model for training. The query set in the meta training task is input to the evaluation model trained by the support set for face beauty degree prediction. Specifically, an instance is randomly selected from the query set, and the evaluation model is used to determine which category it belongs to. This determination process can actually be regarded as a query process. Given the support set, as long as the model can accurately query which category in the support set it belongs to, the model performance is proved to be good. The parameters of the evaluation model are adjusted through the loss function value. The above process is repeated until all meta training tasks are completed, and the best meta learning network parameter is obtained. The parameter is applied in the meta test task, and the meta learning network parameter is fine-tuned through the meta test set in the meta test task.
[0073] The evaluation model is based on a convolutional neural network ResNet34. ResNet34 builds a network through residual blocks and residual connections, which breaks through the depth of the network and effectively prevents the problem of gradient disappearance caused by too deep network, improves the expression ability and performance of the model. However, the receptive field of the convolutional neural network has certain limitations. In the process of extracting image features by the convolution kernel, a large amount of redundant information is often mixed, and it is difficult to efficiently extract useful local features of the face. The evaluation model adds an attention layer based on the convolutional neural network ResNet34, combines channel attention and spatial attention, and enhances the feature representation ability of the convolution kernel.
[0074] The convolutional neural network ResNet34 is composed of 34 convolutional layers, including 18 residual modules.
[0075] The input layer of ResNet34 is a normal convolutional layer, which includes 64 convolution kernels, each with a size of 7x7, a step of 2, and a padding of 3. The role of this layer is to reduce the size of the input image by half and extract some low-level features.
[0076] Referring to FIG. 3, for the residual module, the residual module includes a first convolutional layer, a second convolutional layer and an attention layer; data processing is performed through the residual module, including the following steps:
[0077] The input of the first convolutional layer is obtained according to the input of the residual module; the output of the first convolutional layer is obtained by convolving the input of the first convolutional layer through the first convolutional layer; the output of the second convolutional layer is obtained by convolving the output of the first convolutional layer through the second convolutional layer; the residual connection result is obtained by performing residual connection on the input of the first convolutional layer and the output of the second convolutional layer; the output of the attention layer is obtained by performing attention mechanism-based calculation on the residual connection result through the attention layer; and the output of the residual module is obtained according to the output of the attention layer. The convolution kernel size of the first convolutional layer is 3x3, the step is 1, and the padding is 1; the convolution kernel size of the second convolutional layer is also 3x3, the step is 1, and the padding is 1. The role of the residual connection is to add the output of the previous layer directly to the input of the next layer. In this way, the information of the previous layer can be preserved and passed to the next layer.
[0078] Referring to FIG. 4, for the attention layer, the information interaction of the spatial dimension and the channel dimension is considered, and it is not limited to single channel attention or spatial attention. The attention layer is composed of three parallel branches. The first branch is responsible for calculating the attention weight of the spatial dimension and the height, calculating the first attention weight of the input of the attention layer on the height and the width of the spatial dimension; the second branch is responsible for calculating the attention weight of the channel dimension and the width of the spatial dimension, calculating the second attention weight of the input of the attention layer on the width of the channel dimension and the spatial dimension; the third branch is responsible for calculating the attention weight of the channel dimension and the height of the spatial dimension, calculating the third attention weight of the input of the attention layer on the height of the channel dimension and the spatial dimension; and finally, the first attention weight, the second attention weight and the third attention weight are averaged to obtain the output of the attention layer. This method can effectively realize the interaction of dimension information and enhance the feature representation ability of the convolutional neural network.
[0079] The first branch of the attention layer performs fusion pooling on the input of the attention layer to reduce the number of channels to obtain a first sub-result; performs convolution and normalization on the first sub-result to reduce the number of channels to obtain a second sub-result; performs activation function calculation on the second sub-result to obtain a third sub-result; and fuses the third sub-result with the input of the attention layer to obtain the first attention weight. Specifically, an input tensor X with a shape of CxHxW is fused and pooled to reduce the number of channels of the tensor X to 2 to obtain a tensor X1 with a shape of 2xHxW; then, after convolution and normalization operations are performed on the tensor X1 using an n*n convolution kernel, a tensor X2 with a shape of 1xHxW is obtained; finally, the tensor X2 is input into a sigmoid activation layer to generate attention weights, and the weights are fused with the original tensor X to obtain the first attention weight.
[0080] The second branch of the attention layer rotates the input of the attention layer by a preset angle along the axis of the height of the spatial dimension to obtain a fourth sub-result; performs fusion pooling on the fourth sub-result to reduce the number of channels to obtain a fifth sub-result; performs convolution and normalization on the fifth sub-result to reduce the number of channels to obtain a sixth sub-result; performs activation function calculation on the sixth sub-result to obtain a seventh sub-result; fuses the seventh sub-result with the fourth sub-result, and rotates the fourth sub-result by a preset angle along the axis of the height of the spatial dimension to obtain the second attention weight. Specifically, an input tensor X' with a shape of WxHxC is rotated by 90° counterclockwise along the H axis, and fusion pooling is performed to reduce the number of channels of the tensor X'1 to 2 to obtain a tensor X'1 with a shape of 2xHxC; then, after convolution and normalization operations are performed on the tensor X'1 using an n*n convolution kernel, a tensor X'2 with a shape of 1xHxC is obtained; finally, the tensor X'2 is input into a sigmoid activation layer to generate attention weights, and the weights are fused with the tensor X' rotated by 90° clockwise along the H axis to obtain the second attention weight.
[0081] The third branch of the attention layer rotates the input of the attention layer by a preset angle along the axis of the width of the spatial dimension to obtain an eighth sub-result; the eighth sub-result is subjected to fusion pooling to reduce the number of channels to obtain a ninth sub-result; the ninth sub-result is subjected to convolution and normalization to reduce the number of channels to obtain a tenth sub-result; the tenth sub-result is subjected to activation function calculation to obtain an eleventh sub-result; the eleventh sub-result is fused with the eighth sub-result, and the eighth sub-result is rotated by a preset angle along the axis of the height of the spatial dimension to obtain the third attention weight. Specifically, an input tensor X" with a shape of HxCxW is input, the tensor X" is rotated by 90° counterclockwise along the W axis, and the number of channels of the tensor X"1 is reduced to 2 through fusion pooling to obtain a tensor X"1 with a shape of 2xHxC; then, an n*n convolution kernel is used for convolution and normalization operation to obtain a tensor X"2 with a shape of 1xHxC, and finally, the tensor X'2 is input into a sigmoid activation layer to generate an attention weight, and the weight is fused with the tensor X" rotated by 90° clockwise along the W axis to obtain the third attention weight.
[0082] wherein the fusion pooling is a splicing of an average pooling result and a maximum pooling result, and the dimension of the tensor is reduced to two; the fusion pooling is represented as: Z-Pool(X)=[MaxPool(X),AvgPool(X)].
[0083] A global average pooling layer is added after the last residual module of the ResNet34. The role of this layer is to average pool the output of the last residual module to obtain a global feature. This feature contains the information of the entire image and can be used for classification and other tasks.
[0084] A fully connected layer is added after the global average pooling layer. The role of this layer is to map the global feature to the class score. In the ResNet34, the output size of the fully connected layer is 1000, corresponding to 1000 categories in the image dataset.
[0085] Through the attention module, the network can focus on specific facial feature regions when processing face images, enhance the attention to important details in the image, and make the local perception ability of the model stronger; suppress the redundant information in the image, and improve the robustness of the network; in addition, the problem of separate calculation of channel attention and spatial attention in the conventional attention mechanism is solved; the introduced dimension information interaction concept can effectively enhance the representation ability of the convolution kernel to generate features.
[0086] For the loss function, in the convolutional neural network training process, the role of the loss function is to measure the error between the true value and the current predicted value. The loss function value is represented as: wherein L ParamSmoot hL1wherein, N is the number of training face images in a batch, y i is the true value of the i-th training face image, is the predicted value of the i-th training face image, and a is a dynamic parameter that varies dynamically according to the class. The dynamic parameter is represented as: wherein, a max is the maximum value of the dynamic parameter, a min is the minimum value of the dynamic parameter, and n e is the number of classes. The value of a is between 1 and n e .
[0087] The loss function is improved from the SmoothL1 loss function, which uses a quadratic term only when the absolute value of the error is less than 1, and generally uses the absolute error in other cases; therefore, the SmoothL1 loss function is less sensitive than the loss function and effectively prevents the occurrence of gradient explosion; on the basis of the SmoothL1 loss function, a dynamic parameter a is introduced, which is dynamically reduced according to the parabolic law as the meta-training task changes, so that the robust loss function can be adjusted accordingly during training. The loss function is more adaptive to changes in data distribution and tasks during meta-training, and is more helpful in capturing the characteristics of the data set and improving the generalization performance of the model.
[0088] The dynamically adjusted loss function can effectively reduce the impact of uneven data set distribution on model training, and help the model better cope with complex and unbalanced data in real-world tasks; and can effectively resist outliers in the data set and suppress the influence of outliers on the model.
[0089] Embodiments of the present application provide an electronic device. The electronic device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the small sample face beauty evaluation method described above.
[0090] The electronic device can be any intelligent terminal including a computer.
[0091] In general, for the hardware structure of the electronic device, the processor can be implemented in the form of a general CPU (Central Processing Unit), a microprocessor, an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits, etc., for executing related programs to implement the technical solutions provided by the embodiments of the present application.
[0092] The memory can be implemented in the form of read only memory (ROM), static storage device, dynamic storage device or random access memory (RAM), etc. The memory can store an operating system and other application programs, and when the technical solutions provided by the embodiments of the present specification are implemented by software or firmware, the related program codes are saved in the memory and are called and executed by the processor to execute the method of the embodiments of the present application.
[0093] The input / output interface is used to realize information input and output.
[0094] The communication interface is used to realize the communication interaction between the device and other devices, and the communication can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0095] The bus transmits information between various components (such as the processor, the memory, the input / output interface and the communication interface) of the device. The processor, the memory, the input / output interface and the communication interface realize the communication connection between each other in the device through the bus.
[0096] The embodiments of the present application provide a computer storage medium. The computer storage medium stores computer executable instructions for executing the small sample face beauty evaluation method as described above.
[0097] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium. In the foregoing description of this specification, references to terms such as "one embodiment," "another embodiment," or "some embodiments," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of this application. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0098] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0099] The units described above 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.
[0100] Furthermore, the functional units in the various embodiments of this application 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.
[0101] If the integrated 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, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0102] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above 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 between each other may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms. Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.
[0103] The above is a detailed description of the preferred embodiments of this application, but this application is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.
Claims
1. A small sample face beauty evaluation method, characterized in that, The method comprises: obtaining a face image to be evaluated; inputting the face image to be evaluated into a trained evaluation model to evaluate the beauty of the face and obtain an evaluation result; training the evaluation model, comprising: obtaining a training face image; dividing the training face image into a support set and a query set of multiple categories; inputting the support set into the evaluation model to obtain target network parameters, and migrating the target network parameters to the evaluation model to obtain a first training model; inputting the query set into the first training model to obtain a loss function value, and adjusting the target network parameters of the first training model according to the loss function value to obtain a trained evaluation model.
2. The small sample face beauty evaluation method according to claim 1, characterized in that, The evaluation model comprises a residual module, and the residual module comprises a first convolutional layer, a second convolutional layer and an attention layer; data processing through the residual module comprises: obtaining the input of the first convolutional layer according to the input of the residual module; convolving the input of the first convolutional layer through the first convolutional layer to obtain the output of the first convolutional layer; convolving the output of the first convolutional layer through the second convolutional layer to obtain the output of the second convolutional layer; residual connecting the input of the first convolutional layer and the output of the second convolutional layer to obtain a residual connection result; calculating the residual connection result through the attention layer based on an attention mechanism to obtain the output of the attention layer; obtaining the output of the residual module according to the output of the attention layer.
3. The small sample face beauty evaluation method according to claim 2, characterized in that, The calculation of the output of the attention layer based on the attention mechanism through the attention layer comprises: calculating a first attention weight of the input of the attention layer in the height and width of the spatial dimension; calculating a second attention weight of the input of the attention layer in the channel dimension and the width of the spatial dimension; calculating a third attention weight of the input of the attention layer in the channel dimension and the height of the spatial dimension; averaging the first attention weight, the second attention weight and the third attention weight to obtain the output of the attention layer.
4. The small sample face beauty evaluation method according to claim 3, characterized in that, The calculation of the first attention weight of the input of the attention layer in the height and width of the spatial dimension comprises: performing fusion pooling on the input of the attention layer to reduce the number of channels to obtain a first sub-result; convolving and normalizing the first sub-result to reduce the number of channels to obtain a second sub-result; performing activation function calculation on the second sub-result to obtain a third sub-result; fusing the third sub-result and the input of the attention layer to obtain the first attention weight; wherein the fusion pooling is a splicing average pooling result and a maximum pooling result.
5. The small sample face beauty evaluation method according to claim 3, characterized in that, The calculation of the second attention weight of the input of the attention layer in the channel dimension and the width of the spatial dimension comprises: rotating the input of the attention layer along the axis of the height of the spatial dimension by a preset angle to obtain a fourth sub-result; performing fusion pooling on the fourth sub-result to reduce the number of channels to obtain a fifth sub-result; convolving and normalizing the fifth sub-result to reduce the number of channels to obtain a sixth sub-result; performing activation function calculation on the sixth sub-result to obtain a seventh sub-result; fusing the seventh sub-result and the fourth sub-result, and rotating a preset angle along an axis of a height of a spatial dimension to obtain a second attention weight; The fusion pooling is splicing an average pooling result and a maximum pooling result.
6. The small sample face beauty evaluation method according to claim 3, characterized in that, The calculating the third attention weight of the input of the attention layer on the channel dimension and the height of the spatial dimension comprises: rotating a preset angle along an axis of a width of a spatial dimension to obtain an eighth sub-result; performing fusion pooling on the eighth sub-result to reduce the number of channels to obtain a ninth sub-result; performing convolution and normalization on the ninth sub-result to reduce the number of channels to obtain a tenth sub-result; performing activation function calculation on the tenth sub-result to obtain an eleventh sub-result; fusing the eleventh sub-result and the eighth sub-result, and rotating a preset angle along an axis of a height of a spatial dimension to obtain a third attention weight; The fusion pooling is splicing an average pooling result and a maximum pooling result.
7. The small sample face beauty evaluation method according to claim 1, characterized in that, The loss function value is represented as: wherein L ParamSmoot hL1 is the loss function value, N is the number of training face images in a batch, y i is the true value of the i-th training face image, is the predicted value of the i-th training face image, and a is a dynamic parameter dynamically changed according to the class.
8. The small sample face beauty evaluation method according to claim 7, characterized in that, The dynamic parameters are represented as: where α max is the maximum value of the dynamic parameter, α min is the minimum value of the dynamic parameter, n e is the number of classes.
9. An electronic device, comprising: comprise: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the small sample face beauty evaluation method in any one of claims 1 to 8.
10. A computer storage medium, characterized in that, computer executable instructions are stored, and the computer executable instructions are used to execute the small sample face beauty evaluation method in any one of claims 1 to 8.
Citation Information
Patent Citations
Named entity recognition model training method and named entity recognition method
CN113177411A
Task-adaptive small sample image classification method based on meta transfer learning
CN114511739A
Hyperspectral image classification method and device and electronic equipment
CN116595208A
Small sample face beauty evaluation method and device and medium
CN118674690A
Semantic deep learning and rule optimization for surface corrosion detection and evaluation
US20230222643A1