Portrait age reduction processing method, training method, device, equipment and storage medium

Through the down-sampling and up-sampling layers of the convolutional neural network model, combined with the residual structure block and the attention layer, the face image is processed, which solves the problem of insufficient robustness of face image processing in the existing technology and achieves more efficient The effect of age reduction processing on facial images.

CN112634126BActive Publication Date: 2024-10-18XIAMEN MEITUZHIJIA TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011524080.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-22
Publication Date
2024-10-18
Estimated Expiration
2040-12-22

AI Technical Summary

Technical Problem

The existing technology has insufficient robustness when processing facial images. Especially in complex scenes that include human faces and a variety of other scenes, the processing effect is low, and it is difficult to achieve effective age reduction processing of facial images.

Method used

Using a convolutional neural network model, including multiple downsampling layers, residual structure blocks and upsampling layers, resolution restoration processing is performed through optical flow results, image features are extracted and upsampled multiple times, combined with attention layers and stacked volumes. Stacked layers to improve the processing robustness and clarity of face images.

Benefits of technology

It improves the robustness and resolution of face image processing, significantly improves the overall effect of face image processing, and can better achieve age reduction processing of face images in complex scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112634126B_ABST
    Figure CN112634126B_ABST
Patent Text Reader

Abstract

The present application provides a portrait de-aging processing method, training method, device, equipment and storage medium, which belongs to the field of face image processing technology. The method comprises: obtaining an image to be processed; inputting the image to be processed into a pre-trained portrait de-aging processing network model, and performing de-aging processing by the portrait de-aging processing network model to obtain a processed image and an optical flow result of the image to be processed; performing resolution restoration processing on the processed image based on the optical flow result to obtain a restored image. The present application can improve the processing effect of face images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of face image processing, and in particular to a portrait age reduction processing method, training method, device, equipment and storage medium. Background Art

[0002] With the advancement of photography technology, it is a common demand among people to make the facial images in photos more youthful and beautiful through image processing.

[0003] In order to achieve this effect, the current technical means are to directly perform denoising and deblurring on the image, but these technical means are not robust enough and have limited ability to operate on the contour of the face. For some complex scenes in actual needs, such as scenes that contain faces and multiple other images at the same time, the processing effect of face images is low. Summary of the invention

[0004] The purpose of this application is to provide a portrait age reduction processing method, training method, device, equipment and storage medium, which can improve the processing effect of face images.

[0005] The embodiment of the present application is implemented as follows:

[0006] In one aspect of an embodiment of the present application, a method for reducing the age of a portrait is provided, comprising:

[0007] Obtain an image to be processed, where the image to be processed includes a portrait;

[0008] The image to be processed is input into a pre-trained portrait age reduction processing network model, and the portrait age reduction processing network model performs age reduction processing to obtain a processed image and an optical flow result of the image to be processed, wherein the portrait age reduction processing network model is a convolutional neural network model, and the portrait age reduction processing network model includes: multiple downsampling layers, residual structure blocks, and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features from the downsampled result and obtain image features of the image to be processed, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling result of the downsampling layer;

[0009] The processed image is subjected to resolution restoration processing based on the optical flow result to obtain a restored image, wherein the resolution of the restored image is higher than the resolution of the processed image.

[0010] Optionally, the image to be processed is input into a pre-trained portrait age reduction processing network model, and the portrait age reduction processing network model performs age reduction processing to obtain a processed image and an optical flow result of the image to be processed, including:

[0011] The image to be processed is input into the downsampling layer, and the downsampling layer performs multiple downsampling processes on the image to be processed to obtain a downsampling processing result;

[0012] The downsampling processing result is input into the residual structure block, and the residual structure block extracts the image features of the image to be processed based on the downsampling processing result;

[0013] The down-sampling result and the image features of the image to be processed are input into the up-sampling layer, and the up-sampling layer performs multiple up-sampling processes based on the down-sampling result and the image features of the image to be processed to obtain the processed image and the optical flow result.

[0014] Optionally, the portrait age reduction processing network model further includes: a plurality of attention layers; each attention layer is respectively connected to a downsampling layer and an upsampling layer; the image to be processed is input into the downsampling layer, and the downsampling layer performs multiple downsampling processes on the image to be processed, and after the downsampling processing result is obtained, the method further includes:

[0015] The downsampling result is input into the attention layer, which extracts the feature weights to obtain the feature weights of each downsampling layer.

[0016] The feature weights are fed into the upsampling layer.

[0017] Optionally, the upsampling layer performs multiple upsampling processes based on the downsampling result and the image features of the image to be processed to obtain a processed image and an optical flow result, including:

[0018] The upsampling layer performs multiple upsampling processes based on the downsampling results, the image features of the image to be processed, and the feature weights to obtain the processed image and the optical flow result.

[0019] Optionally, the portrait age reduction processing network model further includes: a plurality of stacked convolutional layers; each stacked convolutional layer is respectively connected to an upsampling layer; the upsampling layer performs multiple upsampling processes based on the downsampling result and the image features of the image to be processed, and after obtaining the processed image and the optical flow result, the method further includes:

[0020] The processed image is input into the stacked convolution layer, and the stacked convolution layer performs mapping processing on the processed image to obtain the processed image in a preset format and the optical flow result in a preset format.

[0021] Optionally, before acquiring the image to be processed, the method further includes:

[0022] Acquire an initial image, wherein the initial image includes a portrait;

[0023] Perform cropping and rotation preprocessing on the initial image to obtain an intermediate image;

[0024] The intermediate image is downsampled to obtain an image of a preset size, and the image of the preset size is used as the image to be processed.

[0025] Optionally, performing resolution restoration processing on the processed image based on the optical flow result to obtain a restored image includes:

[0026] Re-map the intermediate image based on the optical flow result to determine the image residual pyramid;

[0027] The resolution of the processed image is restored through the image residual pyramid to obtain a restored image.

[0028] Optionally, remapping the intermediate image based on the optical flow result to determine an image residual pyramid includes:

[0029] Re-mapping the intermediate image based on the optical flow result to determine a deformation map of the intermediate image;

[0030] The deformation map of the intermediate image is downsampled to obtain an image residual pyramid.

[0031] Another aspect of the embodiment of the present application provides a method for training a network model for portrait age reduction processing, comprising:

[0032] Obtain training set sample images and test set sample images containing portraits;

[0033] A portrait age reduction processing network model is obtained based on training sample images of a training set and sample images of a test set, wherein the portrait age reduction processing network model is a convolutional neural network model, and the portrait age reduction processing network model includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features of the downsampled results, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling results of the downsampling layer.

[0034] Optionally, a portrait age reduction processing network model is obtained by training based on the training set sample images and the test set sample images, including:

[0035] Based on the training set sample images and the test set sample images, the output images and optical flow results of the initial model are obtained;

[0036] The target loss function is used to determine the loss information of the initial model. The loss information is used to characterize the accuracy of the de-aging process and the accuracy of the optical flow estimation.

[0037] According to the loss information of the initial model, the initial model is corrected, and when the initial model meets the preset conditions, the initial model that meets the conditions is used as the portrait age reduction processing network model.

[0038] Another aspect of the embodiment of the present application provides a portrait age reduction processing device, including: an image acquisition module, a model processing module, and a restoration processing module;

[0039] An image acquisition module is used to acquire an image to be processed, where the image to be processed includes a portrait;

[0040] A model processing module, used for inputting the image to be processed into a pre-trained portrait age reduction processing network model, and the portrait age reduction processing network model performs age reduction processing to obtain a processed image and an optical flow result of the image to be processed, wherein the portrait age reduction processing network model is a convolutional neural network model, and the portrait age reduction processing network model includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features from the downsampled result and obtain image features of the image to be processed, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling result of the downsampling layer;

[0041] The restoration processing module is used to perform resolution restoration processing on the processed image based on the optical flow result to obtain a restored image, and the resolution of the restored image is higher than the resolution of the processed image.

[0042] Optionally, the model processing module is specifically used to input the image to be processed into the downsampling layer, and the downsampling layer performs multiple downsampling processes on the image to be processed to obtain the downsampling processing result; the downsampling processing result is input into the residual structure block, and the residual structure block extracts the image features of the image to be processed based on the downsampling processing result; the downsampling result and the image features of the image to be processed are input into the upsampling layer, and the upsampling layer performs multiple upsampling processes based on the downsampling result and the image features of the image to be processed to obtain the processed image and the optical flow result.

[0043] Optionally, the portrait age reduction processing network model also includes: multiple attention layers; each attention layer is connected to a downsampling layer and an upsampling layer respectively; the model processing module is also used to input the downsampling results into the attention layer, and the attention layer performs feature weight extraction to obtain the feature weight of each downsampling layer; and input the feature weight into the upsampling layer.

[0044] Optionally, the model processing module is specifically used to perform multiple upsampling processes by the upsampling layer based on the downsampling result, image features of the image to be processed, and feature weights to obtain a processed image and an optical flow result.

[0045] Optionally, the portrait age reduction processing network model also includes: multiple stacked convolutional layers; each stacked convolutional layer is connected to an upsampling layer respectively; the model processing module is also used to input the processed image into the stacked convolutional layer, and the stacked convolutional layer maps the processed image to obtain a processed image in a preset format and an optical flow result in a preset format.

[0046] Optionally, the image acquisition module is also used to acquire an initial image, which includes a portrait; perform cropping and rotation preprocessing on the initial image to obtain an intermediate image; downsample the intermediate image to obtain an image of a preset size, and use the image of the preset size as the image to be processed.

[0047] Optionally, the image acquisition module is further used to remap the intermediate image based on the optical flow result to determine the image residual pyramid; restore the resolution of the processed image through the image residual pyramid to obtain a restored image.

[0048] Optionally, the image acquisition module is specifically used to remap the intermediate image based on the optical flow result to determine a deformation map of the intermediate image; and downsample the deformation map of the intermediate image to obtain an image residual pyramid.

[0049] Another aspect of the embodiment of the present application provides a portrait age reduction processing network model training device, including: a sample acquisition module, a sample training module;

[0050] A sample acquisition module is used to acquire training set sample images and test set sample images containing portraits;

[0051] The sample training module is used to train a portrait age reduction processing network model based on sample images of a training set and sample images of a test set, wherein the portrait age reduction processing network model is a convolutional neural network model, and the portrait age reduction processing network model includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features of the downsampled result, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling result of the downsampling layer.

[0052] Optionally, a sample training module is specifically used to obtain the output image and optical flow result of the initial model based on the sample images of the training set and the sample images of the test set; use the target loss function to determine the loss information of the initial model, and the loss information is used to characterize the accuracy of the aging process and the accuracy of the optical flow estimation; according to the loss information of the initial model, the initial model is corrected, and when the initial model meets the preset conditions, the initial model that meets the conditions is used as the portrait aging process network model.

[0053] In another aspect of an embodiment of the present application, a computer device is provided, including: a first memory and a first processor, wherein the first memory stores a computer program that can be executed on the first processor, and when the first processor executes the computer program, the steps of the above-mentioned portrait age reduction processing method are implemented.

[0054] In another aspect of an embodiment of the present application, a computer device is provided, including: a second memory and a second processor, wherein the second memory stores a computer program that can be executed on the second processor, and when the second processor executes the computer program, the steps of the above-mentioned portrait age reduction processing network model training method are implemented.

[0055] In another aspect of an embodiment of the present application, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned portrait age reduction processing method and the portrait age reduction processing network model training method are implemented.

[0056] The beneficial effects of the embodiments of the present application include:

[0057] In the portrait age reduction processing method, training method, device, equipment and storage medium provided in the embodiments of the present application, it is possible to obtain an image to be processed, and input the image to be processed into a pre-trained portrait age reduction processing network model, and use the portrait age reduction processing network model to perform age reduction processing to obtain a processed image and an optical flow result of the image to be processed, and then perform resolution restoration processing on the processed image based on the optical flow result to obtain a restored image. Among them, the portrait age reduction processing network model is a convolutional neural network model, and the portrait age reduction processing network model includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features of the downsampled result and obtain the image features of the image to be processed, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling result of the downsampling layer. Processing through the portrait age reduction processing model can improve the robustness of face processing, and by restoring the resolution of the processed image through the optical flow result, a restored image with a resolution higher than the resolution of the processed image can be obtained, and the clarity of face image processing can be improved, thereby improving the overall effect of face image processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0059] Figure 1 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 1 ;

[0060] Figure 2 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 2 ;

[0061] Figure 3 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 3 ;

[0062] Figure 4 A schematic diagram of the structure of a portrait age reduction network model provided in an embodiment of the present application;

[0063] Figure 5 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 4 ;

[0064] Figure 6 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 5 ;

[0065] Figure 7 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 6 ;

[0066] Figure 8 Schematic diagram of the process of training the network model for portrait age reduction processing provided in the embodiment of the present application Figure 1 ;

[0067] Fig. 9 Schematic diagram of the process of training the network model for portrait age reduction processing provided in the embodiment of the present application Figure 2 ;

[0068] Fig.10 A schematic diagram of the structure of a portrait age reduction processing device provided in an embodiment of the present application;

[0069] Fig.11 A schematic diagram of the structure of a network model training device for portrait age reduction processing provided in an embodiment of the present application;

[0070] Fig.12 A schematic diagram of the structure of a computer device provided in an embodiment of the present application;

[0071] Fig.13 A schematic diagram of the structure of another computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0072] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0073] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0074] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0075] In the description of the present application, it should be noted that the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0076] The specific implementation process of the portrait age reduction processing method provided in the embodiment of the present application is explained below.

[0077] Figure 1 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 1 , please refer to Figure 1 , portrait age reduction processing method, including:

[0078] S110: Acquire an image to be processed.

[0079] The image to be processed includes a portrait.

[0080] Optionally, the image to be processed may be an image of a fixed size (e.g., 512x512 pixels) obtained after preprocessing, and the image to be processed may include a portrait, and optionally, may also include other images. Exemplarily, the portrait may be located in the middle of the image to be processed, and other images (e.g., landscapes, objects) may be located at the edge of the image to be processed. The image to be processed may specifically be a photograph taken or a picture searched from the Internet, etc., which is not limited here.

[0081] S120: Inputting the image to be processed into a pre-trained portrait age reduction processing network model, and performing age reduction processing by the portrait age reduction processing network model to obtain a processed image and an optical flow result of the image to be processed.

[0082] Among them, the portrait age reduction processing network model is a convolutional neural network model, which includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features of the downsampling results and obtain the image features of the image to be processed, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling results of the downsampling layer.

[0083] Optionally, the portrait age reduction processing network model may be a pre-trained CNN network (Convolutional Neural Networks) model, which is used to perform age reduction processing on the image to be processed.

[0084] Optionally, the image to be processed can be input into a portrait age reduction processing network model, and pass through multiple downsampling layers, residual structure blocks, and upsampling layers in sequence; multiple downsampling is performed through the downsampling layer to obtain a downsampling result, and the size of the downsampling result is smaller than the size of the image to be processed; the downsampling result is input into the residual structure block for feature extraction processing to obtain image features of the image to be processed, and the image features can specifically be features for achieving portrait age reduction; the image features are input into the upsampling layer for multiple upsampling to restore the size of the image, and multiple upsampling results are obtained, and then the optical flow results of the processed image and the image to be processed can be determined.

[0085] Among them, the optical flow result can be the motion change information from the image to be processed to the image processed by the portrait age reduction processing network model, and can be used to characterize the change process from the image to be processed to the processed image.

[0086] S130: Performing resolution restoration processing on the processed image based on the optical flow result to obtain a restored image.

[0087] The resolution of the restored image is higher than the resolution of the processed image.

[0088] Optionally, after obtaining the optical flow results of the processed image and the image to be processed, the resolution of the processed image may be restored based on the optical flow results, specifically, the resolution of the processed image may be improved.

[0089] In the portrait de-aging processing method provided in the embodiment of the present application, the image to be processed can be obtained, and the image to be processed can be input into the pre-trained portrait de-aging processing network model, and the portrait de-aging processing network model can perform de-aging processing to obtain the processed image and the optical flow result of the image to be processed, and then the processed image can be subjected to resolution restoration processing based on the optical flow result to obtain the restored image. Among them, the portrait de-aging processing network model is a convolutional neural network model, and the portrait de-aging processing network model includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features from the downsampled result and obtain the image features of the image to be processed, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling result of the downsampling layer. The robustness of face processing can be improved by processing with the portrait de-aging processing model, and the resolution of the processed image can be restored by the optical flow result to obtain a restored image with a resolution higher than that of the processed image, and the clarity of face image processing can be improved, thereby improving the overall effect of face image processing.

[0090] Another specific implementation process of the portrait age reduction processing method provided in the embodiment of the present application is explained below.

[0091] Figure 2 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 2 , please refer to Figure 2 , the image to be processed is input into the pre-trained portrait age reduction processing network model, and the portrait age reduction processing network model performs age reduction processing to obtain the processed image and the optical flow result of the image to be processed, including:

[0092] S210: Input the image to be processed into a downsampling layer, and the downsampling layer performs multiple downsampling processes on the image to be processed to obtain a downsampling processing result.

[0093] Optionally, the portrait age reduction processing network may include multiple sequentially connected downsampling layers, multiple residual structure blocks, and multiple sequentially connected upsampling layers. The multiple downsampling layers sequentially downsample the image to be processed, and each downsampling layer can extract and process the pixel points of the image to be processed, thereby obtaining a downsampled result with a pixel size smaller than the image to be processed; the multiple downsampling layers are sequentially connected, and the second downsampling layer downsamples the downsampled result output by the first downsampling layer again, and so on, until the last downsampling layer obtains the downsampled result.

[0094] S220: Inputting the down-sampling processing result into the residual structure block, and the residual structure block extracts the image features of the image to be processed based on the down-sampling processing result.

[0095] Optionally, the downsampling result of the last downsampling layer can be input into a residual structure block, which can be composed of multiple equivalent Res-Block structures. Feature extraction can be performed on the downsampling result to obtain image features of the image to be processed.

[0096] S230: Input the down-sampling result and the image features of the image to be processed into the up-sampling layer, and the up-sampling layer performs multiple up-sampling processes based on the down-sampling result and the image features of the image to be processed to obtain a processed image and an optical flow result.

[0097] Optionally, the image features to be processed can be input into multiple upsampling layers, and the number of upsampling layers can be consistent with the number of downsampling layers. Multiple upsampling layers can sequentially upsample the image features of the image to be processed, and each upsampling layer can increase the pixel points of the image features to obtain an upsampling result with a pixel size larger than the image features; multiple upsampling layers are sequentially connected, and the second upsampling layer can upsample the upsampling result output by the first upsampling layer again, and so on, until the last upsampling layer obtains the upsampling result. Then, the optical flow results of the processed image and the image to be processed can be determined.

[0098] Another specific implementation process of the portrait age reduction processing method provided in the embodiment of the present application is explained below.

[0099] Figure 3 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 3 , please refer to Figure 3 , multiple attention layers; each attention layer is connected to a downsampling layer and an upsampling layer respectively; the image to be processed is input into the downsampling layer, and the downsampling layer performs multiple downsampling processes on the image to be processed, and after the downsampling processing result is obtained, the method further includes:

[0100] S310: Input the downsampling result into the attention layer, and the attention layer extracts the feature weight to obtain the feature weight of each downsampling layer.

[0101] Optionally, the number of downsampling layers and upsampling layers is equal, and each downsampling layer can be connected to the upsampling layer through an attention layer. Specifically, the first downsampling layer can be connected to the last upsampling layer, the last downsampling layer can be connected to the first upsampling layer, and so on, connecting each downsampling layer to the upsampling layer.

[0102] Optionally, the attention layer can extract the feature weight of each downsampling layer according to the output result of the downsampling layer to determine the feature weight of the downsampling layer. Each attention layer can extract the feature weight of each downsampling layer respectively, and the feature weight of each downsampling layer can be different.

[0103] S320: Input feature weights into the upsampling layer.

[0104] Optionally, after determining the feature weight of each downsampling layer, the feature weight can be input into the upsampling layer connected to the attention layer so that the feature weight is used as the feature weight corresponding to the upsampling layer. The feature weights of the upsampling layer and the downsampling layer connected through the attention layer are equal.

[0105] Accordingly, in the above step S230, the upsampling layer may perform multiple upsampling processes based on the feature weights, the downsampling results, and the image features of the image to be processed to obtain a processed image and an optical flow result.

[0106] Optionally, the feature information extracted by the downsampling layer can be used to determine the weights of different feature positions through the attention layer, and the weighted downsampling features can be stacked with the upsampling features and then used together as feature inputs for the next upsampling layer.

[0107] Optionally, the portrait age reduction processing network model also includes: multiple stacked convolutional layers; each stacked convolutional layer is connected to an upsampling layer respectively; the upsampling layer performs multiple upsampling processes based on the downsampling results and the image features of the image to be processed to obtain the processed image and the optical flow result, the method also includes: inputting the processed image into the stacked convolutional layer, and the stacked convolutional layer maps the processed image to obtain the processed image in a preset format and the optical flow result in a preset format.

[0108] Optionally, the number of stacked convolutional layers can be equal to the number of upsampling layers, and each upsampling layer can be connected to a stacked convolutional layer. The processed image and optical flow result output by the upsampling layer are feature maps, not actual images. The stacked convolutional layers can be used to map the feature information in these feature maps to obtain image information and optical flow information, which are the actual images corresponding to the aforementioned processed images and optical flow results.

[0109] Accordingly, in the above step S130, the processed image in the preset format may be subjected to resolution restoration processing based on the optical flow result in the preset format to obtain the restored image. Accordingly, the restored image obtained may also be the actual image.

[0110] The specific structure of the portrait age reduction network model provided in the embodiment of the present application is explained in detail below.

[0111] Figure 4 For a structural diagram of the portrait age reduction network model provided in the embodiment of the present application, please refer to Figure 4 The portrait age reduction network model includes: five downsampling layers 110, eight residual structure blocks 120, five upsampling layers 130, five attention layers 140, and five stacked convolutional layers 150; the five downsampling layers 110 are connected in sequence, the last downsampling layer 110 is connected to the residual structure block 120, the eight residual structure blocks 120 are set together, the five upsampling layers 130 are connected in sequence, and the first upsampling layer 130 is connected to the residual structure block 120; each upsampling layer 110 and the downsampling layer 130 are also connected through an attention layer 140; each upsampling layer 130 is connected to a stacked convolutional layer 150.

[0112] Optionally, the output of the last upsampling layer of the portrait age reduction network model includes 4 channels, wherein the first three channels all output restoration results, the results output by the first three channels can constitute the aforementioned processed image, and the last channel outputs an optical flow result.

[0113] The working principle of the portrait age reduction network model has been explained in the implementation process of the aforementioned method and will not be repeated here.

[0114] The specific implementation process of the Huqiu image to be processed provided in the embodiment of the present application is explained in detail below.

[0115] Figure 5 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 4 , please refer to Figure 5 Before obtaining the image to be processed, the method further includes:

[0116] S510: Acquire an initial image.

[0117] The initial image includes a portrait.

[0118] Optionally, the initial image may be an image of any size, the image includes at least a portrait, and may be an image obtained by taking a photo or a picture downloaded from the Internet, and is not limited here.

[0119] S520: Perform cropping preprocessing and rotation preprocessing on the initial image to obtain an intermediate image.

[0120] Optionally, the face image in the initial image can be determined first, and then the minimum enclosing rectangle can be used to crop the face. For example, a convolutional neural network face detection method can be used to determine the face image in the initial image, and the face point set in the face image can be collected, the circumscribed rectangle of the face point set can be calculated, and then expanded outward to obtain the cropping rectangle of the face.

[0121] Optionally, the rotation angle of the face can be obtained through the cropping rectangle of the face, and a straightened face image can be cropped from the initial image as an intermediate image.

[0122] S530: down-sample the intermediate image to obtain an image of a preset size, and use the image of the preset size as the image to be processed.

[0123] Optionally, after the intermediate image is determined, the intermediate image may be downsampled to adjust the size of the intermediate image to a preset size, and the image of the preset size may be used as the aforementioned image to be processed.

[0124] The specific implementation process of obtaining the restored image provided in the embodiment of the present application is explained below.

[0125] Figure 6 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 5 , please refer to Figure 6 , based on the optical flow result, the processed image is subjected to resolution restoration processing to obtain a restored image, including:

[0126] S610: re-map the intermediate image based on the optical flow result to determine an image residual pyramid.

[0127] Optionally, the intermediate image can be remapped according to the optical flow result, and the intermediate image can be scaled step by step to a preset image size, and the information loss (residual information) caused by the scaling can be recorded step by step to determine the image residual pyramid corresponding to the intermediate image. It should be noted that the image residual pyramid can be a network structure for restoring the image resolution.

[0128] S620: Restoring the resolution of the processed image through an image residual pyramid to obtain a restored image.

[0129] Optionally, after determining the image residual pyramid, the processed image can be subjected to resolution restoration processing according to the image residual pyramid, specifically, the processed image is enlarged step by step to the size of the intermediate image, and residual information of the corresponding level of the residual pyramid is superimposed after each enlargement. Then, a restored image is determined, and the restored image has a higher resolution than the processed image, specifically, it can be equal to the resolution of the intermediate image.

[0130] The specific implementation process of determining the image residual pyramid provided in the embodiments of the present application is explained below.

[0131] Figure 7 Schematic diagram of the process of the portrait age reduction processing method provided in the embodiment of the present application Figure 6, please refer to Figure 7 , remap the intermediate image based on the optical flow result and determine the image residual pyramid, including:

[0132] S710: re-map the intermediate image based on the optical flow result to determine a deformation map of the intermediate image.

[0133] Optionally, after the intermediate image is remapped based on the optical flow result, a deformation map of the intermediate image can be obtained, and the portrait contour of the deformation map of the intermediate image is consistent with the portrait contour of the processed image.

[0134] S720: Down-sampling the deformation map of the intermediate image to obtain an image residual pyramid.

[0135] Optionally, the deformation map of the intermediate image can be downsampled to obtain an image residual pyramid, which can record the information difference between the intermediate image and the processed image. This information difference is because the resolution of the intermediate image is higher than the model output, and the image scaling will result in information loss. The residual pyramid records the information lost during the image scaling process, that is, the information difference.

[0136] The specific implementation process of the portrait age reduction processing network model training method provided in the embodiment of the present application is explained below.

[0137] Figure 8 Schematic diagram of the process of training the network model for portrait age reduction processing provided in the embodiment of the present application Figure 1 , please refer to Figure 8 , a portrait age reduction processing network model training method includes:

[0138] S810: Obtain training set sample images and test set sample images containing portraits.

[0139] Optionally, pre-screened sample images containing portraits can be obtained, and these sample images can be divided into a training set and a test set, wherein the training set can include multiple training set sample images; the test set can include multiple test set sample images, and these images can be similar to the aforementioned images to be processed.

[0140] S820: A portrait age reduction processing network model is obtained by training based on the training set sample images and the test set sample images.

[0141] Among them, the portrait de-aging processing network model is a convolutional neural network model, and the portrait de-aging processing network model includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features from the downsampling result, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling result of the downsampling layer. It should be noted that the multiple downsampling layers will also perform feature extraction during the downsampling process, specifically, the main features can be extracted step by step; and the residual structure block further abstracts and extracts the features extracted by the downsampling layer when performing feature extraction.

[0142] Optionally, multiple training set sample images can be input into a preset model for model training. Multiple test sample images can be input into a preset model for model testing, and a portrait age reduction processing network model can be obtained after training and testing.

[0143] It should be noted that the working principle of the above-mentioned portrait age reduction processing model network has been explained in detail in the aforementioned method embodiment and will not be repeated here.

[0144] The specific implementation process of the training and obtaining the portrait age reduction processing network model provided in the embodiment of the present application is explained in detail below.

[0145] Fig. 9 Schematic diagram of the process of training the network model for portrait age reduction processing provided in the embodiment of the present application Figure 2 , please refer to Fig. 9 , based on the training set sample images and the test set sample images, the portrait age reduction processing network model is trained, including:

[0146] S910: Obtaining an output image and an optical flow result of an initial model based on the training set sample images and the test set sample images.

[0147] Optionally, the initial model can be an untrained convolutional neural network model, and the initial model can be trained and tested based on the training set sample images and the test set sample images to obtain the output image and optical flow result of the initial model.

[0148] S920: Determine loss information of the initial model using the target loss function.

[0149] Among them, the loss information can be used to guide the iterative optimization of the initial model.

[0150] Optionally, there may be multiple objective loss functions, and the specific calculation method is as follows.

[0151] When training the training set, a multi-scale loss function is used, which can be expressed as:

[0152]

[0153] Where N is the number of output layers, H and W are the height and width of the corresponding output image, C is the number of channels of the output image, and L pyram is a multi-scale loss function, Y represents the output image, that is, the corresponding processed image mentioned above, k is the specific number of layers of N, i is the specific height of H, j is the specific width of W, c is the specific number of channels of C, and y represents the output structure of the model.

[0154] In addition, the error function of the optical flow result can be expressed as follows:

[0155]

[0156] Where X represents the input image, which is the intermediate image mentioned above, and Y represents the output image, which is the processed image mentioned above. The image input is mostly color photos, which are mapped to brightness information through the function Γ, and a variety of mapping functions can be used for mapping. The brightness information is converted into optical flow information through the function Φ. f represents the optical flow prediction result output by the model. M is the optical flow channel, which can generally be set to 2. m is the specific number of optical flow channels of M.

[0157] In addition, the image loss function also includes the alpha perception loss function, as follows:

[0158]

[0159] Among them, G k Represents the kth layer of the VGG model. This loss function can be used to intervene in the final output result of the model in a more targeted manner. Among them, the VGG model can be a widely used open source model for calculating the loss function in model training.

[0160] The overall loss of the objective loss function can be expressed as:

[0161] L total =γL pyram +βL pec +σL of

[0162] Among them, γ, β, and σ represent the proportion of each loss function.

[0163] Optionally, the loss information of the initial model can be determined according to the above loss function.

[0164] S930: Correcting the initial model according to the loss information of the initial model, and when the initial model meets the preset conditions, using the initial model that meets the conditions as the portrait age reduction processing network model.

[0165] Optionally, after determining the loss information, the corrected initial model obtained in S910 can be used as the aforementioned portrait age reduction processing network model when the initial model meets the preset conditions. The preset conditions can be set according to the actual needs of face age reduction, such as the degree of age reduction, etc., which are not limited here.

[0166] The following describes the devices, equipment, storage media, etc. corresponding to the portrait age reduction processing method and the portrait age reduction processing network model training method provided in this application. The specific implementation process and technical effects are mentioned above and will not be repeated below.

[0167] Fig.10 For a structural diagram of a portrait age reduction processing device provided in an embodiment of the present application, please refer to Fig.10 , a portrait age reduction processing device, comprising: an image acquisition module 100, a model processing module 200, and a restoration processing module 300;

[0168] The image acquisition module 100 is used to acquire an image to be processed, where the image to be processed includes a portrait;

[0169] The model processing module 200 is used to input the image to be processed into the pre-trained portrait age reduction processing network model, and the portrait age reduction processing network model performs age reduction processing to obtain the processed image and the optical flow result of the image to be processed, wherein the portrait age reduction processing network model is a convolutional neural network model, and the portrait age reduction processing network model includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features from the downsampled result and obtain the image features of the image to be processed, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling result of the downsampling layer;

[0170] The restoration processing module 300 is used to perform resolution restoration processing on the processed image based on the optical flow result to obtain a restored image, and the resolution of the restored image is higher than the resolution of the processed image.

[0171] Optionally, the model processing module 200 is specifically used to input the image to be processed into a downsampling layer, and the downsampling layer performs multiple downsampling processes on the image to be processed to obtain a downsampling processing result; the downsampling processing result is input into a residual structure block, and the residual structure block extracts image features of the image to be processed based on the downsampling processing result; the downsampling result and the image features of the image to be processed are input into an upsampling layer, and the upsampling layer performs multiple upsampling processes based on the downsampling result and the image features of the image to be processed to obtain a processed image and an optical flow result.

[0172] Optionally, the portrait age reduction processing network model also includes: multiple attention layers; each attention layer is connected to a downsampling layer and an upsampling layer respectively; the model processing module 200 is also used to input the downsampling result into the attention layer, and the attention layer performs feature weight extraction to obtain the feature weight of each downsampling layer; and input the feature weight into the upsampling layer.

[0173] Optionally, the model processing module 200 is specifically configured to perform multiple upsampling processes based on the downsampling result, the image features of the image to be processed, and the feature weights by the upsampling layer to obtain a processed image and an optical flow result.

[0174] Optionally, the portrait age reduction processing network model also includes: multiple stacked convolutional layers; each stacked convolutional layer is connected to an upsampling layer respectively; the model processing module 200 is also used to input the processed image into the stacked convolutional layer, and the stacked convolutional layer maps the processed image to obtain a processed image in a preset format and an optical flow result in a preset format.

[0175] Optionally, the image acquisition module 100 is also used to acquire an initial image, which includes a portrait; perform cropping preprocessing and rotation preprocessing on the initial image to obtain an intermediate image; downsample the intermediate image to obtain an image of a preset size, and use the image of the preset size as the image to be processed.

[0176] Optionally, the image acquisition module 100 is further used to remap the intermediate image based on the optical flow result to determine an image residual pyramid; and restore the resolution of the processed image through the image residual pyramid to obtain a restored image.

[0177] Optionally, the image acquisition module 100 is specifically configured to remap the intermediate image based on the optical flow result to determine a deformation map of the intermediate image; and downsample the deformation map of the intermediate image to obtain an image residual pyramid.

[0178] Fig.11 For a structural diagram of a portrait age reduction processing network model training device provided in an embodiment of the present application, please refer to Fig.11 , a portrait age reduction processing network model training device, comprising: a sample acquisition module 400, a sample training module 500;

[0179] The sample acquisition module 400 is used to acquire training set sample images and test set sample images containing human portraits;

[0180] The sample training module 500 is used to obtain a portrait age reduction processing network model based on training set sample images and test set sample images, wherein the portrait age reduction processing network model is a convolutional neural network model, and the portrait age reduction processing network model includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features of the downsampled result, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling result of the downsampling layer.

[0181] Optionally, the sample training module 500 is specifically used to obtain the output image and optical flow result of the initial model based on the sample images of the training set and the sample images of the test set; use the target loss function to determine the loss information of the initial model, and the loss information is used to characterize the accuracy of the age reduction processing and the accuracy of the optical flow estimation; according to the loss information of the initial model, correct the initial model, and when the initial model meets the preset conditions, use the initial model that meets the conditions as the portrait age reduction processing network model.

[0182] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0183] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0184] Fig.12 For a schematic diagram of the structure of the computer device provided in the embodiment of the present application, please refer to Fig.12 The computer device includes: a first memory 610 and a first processor 620. The first memory 610 stores a computer program that can be run on the first processor 620. When the first processor 620 executes the computer program, the steps of the above-mentioned portrait age reduction processing method are implemented.

[0185] Fig.13For a structural diagram of another computer device provided in an embodiment of the present application, please refer to Fig.13 The computer device includes: a second memory 710 and a second processor 720. The second memory 710 stores a computer program that can be run on the second processor 720. When the second processor 720 executes the computer program, the steps of the above-mentioned portrait age reduction processing network model training method are implemented.

[0186] In another aspect of an embodiment of the present application, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned portrait age reduction processing method and the portrait age reduction processing network model training method are implemented.

[0187] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

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

[0189] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0190] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

[0191] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0192] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for reducing the age of a portrait, characterized in that: include: Acquire an image to be processed, wherein the image to be processed includes a portrait; The image to be processed is input into a pre-trained portrait age reduction processing network model, and the portrait age reduction processing network model performs age reduction processing to obtain a processed image and an optical flow result of the image to be processed, wherein the portrait age reduction processing network model is a convolutional neural network model, and the portrait age reduction processing network model includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features from the downsampled result and obtain the image features of the image to be processed, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling result of the downsampling layer; Performing resolution restoration processing on the processed image based on the optical flow result to obtain a restored image, wherein the resolution of the restored image is higher than the resolution of the processed image; Before obtaining the image to be processed, the method further includes: Acquire an initial image, wherein the initial image includes a portrait; Performing cropping preprocessing and rotation preprocessing on the initial image to obtain an intermediate image; Downsampling the intermediate image to obtain an image of a preset size, and using the image of the preset size as the image to be processed; The performing resolution restoration processing on the processed image based on the optical flow result to obtain the restored image includes: Re-mapping the intermediate image based on the optical flow result to determine an image residual pyramid; The processed image is restored in resolution by using the image residual pyramid to obtain the restored image.

2. The method according to claim 1, characterized in that The step of inputting the image to be processed into a pre-trained portrait age reduction processing network model, performing age reduction processing by the portrait age reduction processing network model, and obtaining a processed image and an optical flow result of the image to be processed includes: Inputting the image to be processed into the downsampling layer, and performing multiple downsampling processes on the image to be processed by the downsampling layer to obtain a downsampling processing result; Inputting the downsampling processing result into the residual structure block, and the residual structure block extracts the image features of the image to be processed based on the downsampling processing result; The down-sampling result and the image features of the image to be processed are input into the up-sampling layer, and the up-sampling layer performs multiple up-sampling processes based on the down-sampling result and the image features of the image to be processed to obtain the processed image and the optical flow result.

3. The method according to claim 2, characterized in that The portrait age reduction processing network model further includes: a plurality of attention layers; each of the attention layers is respectively connected to a downsampling layer and an upsampling layer; the image to be processed is input into the downsampling layer, and the downsampling layer performs multiple downsampling processes on the image to be processed, and after obtaining the downsampling processing result, the method further includes: The downsampling result is input into the attention layer, and the attention layer performs feature weight extraction to obtain the feature weight of each downsampling layer; The feature weights are input into the upsampling layer.

4. The method according to claim 3, characterized in that The upsampling layer performs multiple upsampling processes based on the downsampling result and the image features of the image to be processed to obtain the processed image and the optical flow result, including: The upsampling layer performs multiple upsampling processes based on the downsampling result, the image features of the image to be processed and the feature weights to obtain the processed image and the optical flow result.

5. The method according to claim 2, characterized in that The portrait age reduction processing network model further includes: a plurality of stacked convolutional layers; each of the stacked convolutional layers is respectively connected to an upsampling layer; after the upsampling layer performs multiple upsampling processes based on the downsampling result and the image features of the image to be processed to obtain the processed image and the optical flow result, the method further includes: The processed image is input into the stacked convolution layer, and the stacked convolution layer performs mapping processing on the processed image to obtain a processed image in a preset format and an optical flow result in a preset format.

6. The method according to claim 1, characterized in that The remapping process is performed on the intermediate image based on the optical flow result to determine the image residual pyramid, including: Re-mapping the intermediate image based on the optical flow result to determine a deformation map of the intermediate image; Down-sampling is performed on the deformation map of the intermediate image to obtain the image residual pyramid.

7. The method according to claim 1, characterized in that The training process of the portrait age reduction processing network model includes: Obtain training set sample images and test set sample images containing portraits; A portrait age reduction processing network model is obtained based on the training set sample images and the test set sample images, wherein the portrait age reduction processing network model is a convolutional neural network model, and the portrait age reduction processing network model includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features of the downsampled result, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling result of the downsampling layer.

8. The method according to claim 7, characterized in that The portrait age reduction processing network model is obtained by training based on the training set sample images and the test set sample images, including: Obtaining an output image and an optical flow result of an initial model based on the training set sample images and the test set sample images; Determining loss information of the initial model using a target loss function, wherein the loss information is used to characterize the accuracy of the age reduction process and the accuracy of the optical flow estimation; According to the loss information of the initial model, the initial model is corrected, and when the initial model meets the preset conditions, the initial model that meets the conditions is used as the portrait age reduction processing network model.

9. A portrait age reduction processing device, characterized in that: include: Image acquisition module, model processing module, restoration processing module; The image acquisition module is used to acquire an image to be processed, wherein the image to be processed includes a portrait; The model processing module is used to input the image to be processed into a pre-trained portrait age reduction processing network model, and the portrait age reduction processing network model performs age reduction processing to obtain a processed image and an optical flow result of the image to be processed, wherein the portrait age reduction processing network model is a convolutional neural network model, and the portrait age reduction processing network model includes: multiple downsampling layers, residual structure blocks and upsampling layers; the downsampling layer is used to downsample the image to be processed, the residual structure block is used to extract features from the downsampled result and obtain the image features of the image to be processed, and the upsampling layer is used to upsample based on the image features of the image to be processed and the downsampling result of the downsampling layer; The restoration processing module is used to perform resolution restoration processing on the processed image based on the optical flow result to obtain a restored image, wherein the resolution of the restored image is higher than the resolution of the processed image; The image acquisition module is further used to acquire an initial image, which includes a portrait; perform cropping preprocessing and rotation preprocessing on the initial image to obtain an intermediate image; perform downsampling processing on the intermediate image to obtain an image of a preset size, and use the image of the preset size as the image to be processed; The image acquisition module is also used to remap the intermediate image based on the optical flow result to determine the image residual pyramid; restore the resolution of the processed image through the image residual pyramid to obtain the restored image.

10. A computer device, characterized in that: include: A first memory and a first processor. The first memory stores a computer program that can be run on the first processor. When the first processor executes the computer program, the steps of the method described in any one of claims 1 to 8 are implemented.

11. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by a processor, implements the steps of the method described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Image processing method and electronic equipment

    CN111563838A