Method, device, electronic device and storage medium for synthesizing face images
By identifying and adjusting face features, using the specified age encoding information and conditions to generate target face images, the problem of inaccurate face image synthesis in the prior art is solved, and more accurate and flexible face images are achieved synthesis.
Patent Information
- Application Number
- CN202110664896.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-16
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2041-06-16
AI Technical Summary
The existing face image synthesis method is mainly based on experience, which leads to the inaccurate enough to accurately reflect the real appearance of the target person at different ages.
By obtaining the original face image and the specified age, identifying and adjusting the face characteristics, using the specified age encoding information and conditions to generate the target face image to ensure that the synthesized face image meets the face characteristics of the specified age, and performing Identity and age matching verification.
The accuracy and application scope of face image synthesis are improved, and the generated target face image is smoother, which can accurately reflect the appearance of the target person at the specified age, and ensure the accuracy of the results through verification.
Smart Images

Figure CN113392769B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for synthesizing facial images. Background Art
[0002] The simulation and synthesis technology of human face appearance is a hot topic in the field of image processing, and has important application value in the fields of public security criminal investigation, face recognition, film and television makeup auxiliary design, and digital entertainment. For example, in criminal investigation applications, the police synthesize the current appearance of prisoners who have been on the run for many years or lost children based on photos taken many years ago; in film and television production, makeup artists use various makeup techniques to apply makeup of different ages to actors, thereby creating the appearance of different ages of the characters.
[0003] However, the above-mentioned face image synthesis method is mainly based on experience, resulting in that the synthesized face image is not accurate enough. Summary of the invention
[0004] The embodiments of the present disclosure provide a method, device, electronic device and storage medium for synthesizing a facial image, which can improve the accuracy of the synthesized facial image. The technical solution is as follows:
[0005] In a first aspect, a method for synthesizing a face image is provided, the method comprising:
[0006] Acquire an original facial image and a specified age, wherein the specified age is the age of the target person in the original facial image in the target facial image to be synthesized;
[0007] Acquire a conditional face image of a target person in the original face image that meets a preset condition;
[0008] Acquire designated age coding information corresponding to the designated age, the designated age coding information is used to indicate facial features of a face of the designated age, the designated age coding information is determined based on facial features of a face whose age difference with the designated age satisfies a difference condition;
[0009] Based on the designated age coding information, the facial features of the target person in the conditional facial image are adjusted to obtain the target facial image.
[0010] In another embodiment of the present disclosure, the step of obtaining a conditional face image of a target person in the original face image that meets a preset condition includes:
[0011] Obtaining the facial posture and light intensity of the target person in the original facial image;
[0012] When any one of the facial posture and the light intensity of the target person in the original facial image does not meet the preset condition, a conditional facial image meeting the preset condition is constructed based on the original facial image.
[0013] In another embodiment of the present disclosure, constructing a conditional face image that meets the preset condition based on the original face image includes:
[0014] Recognize the facial contour of the target person in the original facial image to obtain a facial contour model of the target person;
[0015] Recognize the facial features of the target person in the original facial image to obtain a facial detail image of the target person;
[0016] Superimposing the facial detail image onto the facial contour model to obtain a new facial image;
[0017] According to the preset conditions, the facial posture and light intensity of the target person in the new facial image are adjusted to obtain the conditional facial image.
[0018] In another embodiment of the present disclosure, the method further includes:
[0019] When the facial posture and light intensity of the target person in the original facial image meet the preset conditions, the original facial image is determined as the conditional facial image.
[0020] In another embodiment of the present disclosure, adjusting the facial features of the target person in the conditional facial image based on the designated age coding information to obtain the target facial image includes:
[0021] The specified age coding information and the conditional face image are input into a conditional generative adversarial network, and the target face image is output. The conditional generative adversarial network is used to adjust the facial features of the face image based on different age coding information to obtain face images of different ages.
[0022] In another embodiment of the present disclosure, after adjusting the facial features of the target person in the conditional facial image based on the designated age coding information to obtain the target facial image, the method further includes:
[0023] Identify the target age and target identity information of the target person in the target face image;
[0024] When the target identity information matches the identity information of the target person in the original facial image, and / or the target age matches the specified age, the target facial image is determined as the final synthesis result.
[0025] In a second aspect, a device for synthesizing a face image is provided, the device comprising:
[0026] A first acquisition module is used to acquire an original face image and a specified age, wherein the specified age is the age of the target person in the original face image in the target face image to be synthesized;
[0027] A second acquisition module is used to acquire a conditional face image of a target person in the original face image that meets a preset condition;
[0028] A third acquisition module is used to acquire designated age coding information corresponding to the designated age, the designated age coding information is used to indicate facial features of a face of the designated age, and the designated age coding information is determined based on facial features of a face whose age difference with the designated age satisfies a difference condition;
[0029] The adjustment module is used to adjust the facial features of the target person in the conditional facial image based on the specified age coding information to obtain the target facial image.
[0030] In another embodiment of the present disclosure, the second acquisition module is used to acquire the facial posture and light intensity of the target person in the original facial image; when any one of the facial posture and light intensity of the target person in the original facial image does not meet the preset conditions, a conditional facial image that meets the preset conditions is constructed based on the original facial image.
[0031] In another embodiment of the present disclosure, the second acquisition module is used to identify the facial contour of the target person in the original facial image to obtain a facial contour model of the target person; identify the facial features of the target person in the original facial image to obtain a facial detail image of the target person; superimpose the facial detail image on the facial contour model to obtain a new facial image; and adjust the facial posture and light intensity of the target person in the new facial image according to the preset conditions to obtain the conditional facial image.
[0032] In another embodiment of the present disclosure, the device further comprises:
[0033] The determination module is used to determine the original facial image as the conditional facial image when the facial posture and light intensity of the target person in the original facial image meet the preset conditions.
[0034] In another embodiment of the present disclosure, the adjustment module is used to input the specified age coding information and the conditional facial image into a conditional generative adversarial network, and output the target facial image. The conditional generative adversarial network is used to adjust the facial features of the facial image based on different age coding information to obtain facial images of different ages.
[0035] In another embodiment of the present disclosure, the device further comprises:
[0036] A recognition module, used to recognize the target age and target identity information of the target person in the target face image;
[0037] The determination module is used to determine the target face image as the final synthesis result when the target identity information matches the identity information of the target person in the original face image, and / or the target age matches the specified age.
[0038] According to a third aspect, an electronic device is provided, comprising a processor and a memory, wherein the memory stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the facial image synthesis method as described in the first aspect.
[0039] In a fourth aspect, a computer-readable storage medium is provided, wherein at least one program code is stored in the storage medium, and the at least one program code is loaded and executed by a processor to implement the facial image synthesis method described in the first aspect.
[0040] The technical solution provided by the embodiments of the present disclosure has the following beneficial effects:
[0041] Based on the designated age coding information, the facial features of the target person in the conditional facial image are adjusted to obtain the target facial image. The designated age coding information learns the common young or old facial features near the designated age, and can accurately reflect the facial features of the face of the designated age. The appearance of the target person in the target facial image synthesized based on the designated age coding information is the appearance that the target person should have at the designated age, so the synthesized target facial image is smoother and more accurate. And the original facial image of the synthesized target facial image can be a facial image of any posture and illumination intensity, which improves the application scope and universality of the facial image synthesis method. Furthermore, after synthesizing the target facial image, the target age and target identity information of the target person in the target facial image are predicted, and the target facial image is verified based on the predicted target age and designated age, so as to further ensure the accuracy of the synthesized target facial image. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 is a flow chart of a method for synthesizing a facial image provided by an embodiment of the present disclosure;
[0044] Figure 2 is a flow chart of another method for synthesizing a facial image provided by an embodiment of the present disclosure;
[0045] Figure 3 It is a schematic diagram of the structure of a facial image synthesis device provided by an embodiment of the present disclosure;
[0046] Figure 4 A structural block diagram of an electronic device provided by an exemplary embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0047] In order to make the objectives, technical solutions and advantages of the present disclosure more clear, the embodiments of the present disclosure will be further described in detail below with reference to the accompanying drawings.
[0048] It can be understood that the terms "each", "multiple", and "any" used in the embodiments of the present disclosure include two or more, each refers to each of the corresponding multiple, and any refers to any one of the corresponding multiple. For example, the multiple words include 10 words, and each word refers to each word of the 10 words, and any word refers to any one of the 10 words.
[0049] The present disclosure provides a method for synthesizing a face image. Figure 1 , the method flow provided by the embodiment of the present disclosure includes:
[0050] 101. Get the original face image and the specified age.
[0051] Among them, the original face image is an image input or selected by the user for synthesizing the target person's appearance at different ages. The original face image includes the target person, and the number of the target person can be one or more. The embodiment of the present disclosure does not determine the number of target persons included in the original face image. The specified age is the age of the target person in the original face image in the target face image to be synthesized. The specified age can be older than the age of the target person in the original face image, or younger than the age of the target person in the original face image. That is, the method provided by the embodiment of the present disclosure can synthesize both aging face images and young face images.
[0052] 102. Obtain a conditional face image of a target person in the original face image that meets preset conditions.
[0053] Among them, the preset conditions are used to constrain the facial posture, light intensity, etc. of the target person. Facial postures include upside down flipping, left-right flipping, in-plane rotation, etc. By constraining the facial posture of the target person in the original face image, the generated target face image is easy for the user to view; by constraining the light intensity of the target person in the original face image, the influence of light intensity on the texture of the target person can be removed, so that the generated target face image has a better look and feel.
[0054] 103. Obtain the specified age coding information corresponding to the specified age.
[0055] The designated age coding information is used to indicate the facial features of a face of the designated age, and the designated age coding information is determined based on the facial features of a face whose age difference with the designated age satisfies a difference condition, and the difference condition may be that the absolute value of the age difference with the designated age is less than a preset value, and the preset value may be 1 year old, 2 years old, etc. Since the designated age coding information learns the facial features of young or old faces of adjacent ages, the target face image generated based on the designated age coding information is more accurate.
[0056] 104. Based on the specified age coding information, the facial features of the target person in the conditional facial image are adjusted to obtain the target facial image.
[0057] Based on the specified age coding information and the conditional facial image, the electronic device uses the specified age coding information to perform weighted calculations on the facial features in the conditional facial image to obtain facial features that meet the specified age, and then generates a target facial image output.
[0058] The method provided by the embodiment of the present disclosure adjusts the facial features of the target person in the conditional facial image based on the specified age coding information to obtain the target facial image. The specified age coding information learns the common young or old facial features near the specified age and can accurately reflect the facial features of a face of the specified age. The appearance of the target person in the target facial image synthesized based on the specified age coding information is the appearance that the target person should have at the specified age, and thus the synthesized target facial image is smoother and more accurate.
[0059] The embodiment of the present disclosure provides a method for synthesizing a face image. Taking an electronic device executing the embodiment of the present disclosure as an example, the electronic device may be a terminal with strong computing power, such as a smart phone, a tablet computer, a smart camera, an e-book reader, etc. The electronic device may also be a server for applications such as photo taking applications and image processing applications. The server may be an independent physical server or a server cluster or a distributed system composed of multiple physical servers. Figure 2 , the method flow provided by the embodiment of the present disclosure includes:
[0060] 201. The electronic device obtains an original face image and a specified age.
[0061] Among them, the original facial image can be a facial image in any posture, including a frontal facial image, a side facial image, and a blurred or occluded facial image, etc. In this way, the user can randomly input his or her favorite facial image without having to input only a frontal "ID photo", which improves the user's freedom and expands the scope of application of the facial image synthesis method provided in the embodiment of the present disclosure.
[0062] The electronic device acquires the original facial image in a manner including, but not limited to: the electronic device acquires the facial image input by the user and uses the facial image input by the user as the original facial image. The facial image input by the user includes an image obtained by the user using a camera or a camera application to take a picture of a target person or a picture including the target person, or may be an image including the target person acquired by the user from the Internet.
[0063] The electronic device may obtain the specified age in the following ways, including but not limited to:
[0064] In the first method, during the face image synthesis process, the electronic device obtains the age number input by the user for the target face image to be synthesized, and determines the age number input by the user as the designated age.
[0065] The second method is that if the electronic device is a device with a display screen, an age progress bar is displayed on the display screen of the electronic device, and the user controls the target age corresponding to the target face image to be synthesized by sliding the age progress bar left and right.
[0066] Furthermore, since the method provided in the embodiment of the present disclosure is to synthesize a target facial image of a specified age, the original facial image must include the facial region of the target person. If the original facial image does not include the facial region of the target person, the method provided in the embodiment of the present disclosure cannot be used to synthesize the target facial image of the specified age. Therefore, after acquiring the original facial image, the electronic device will also detect whether the original facial image includes the facial region. If it is detected that the original facial image includes the facial region, step 202 is executed. If it is detected that the original facial image does not include the facial region, step 201 needs to be continued to be executed to re-acquire the original facial image until the acquired original facial image includes the facial region.
[0067] When the electronic device detects whether the original face image includes a face region, the Haar feature of the original face image can be extracted. If the Haar feature of the original face image is a Haar feature corresponding to a face, it is determined that the original face image includes a face region. The Haar feature is a type of image feature. Generally, objects of the same type have the same Haar feature, and objects of different types have different Haar features. For example, face images have the same Haar feature, and face images and non-face images have different Haar features. Therefore, the Haar feature corresponding to a face can be used to detect whether the original face image includes a face region.
[0068] 202. The electronic device obtains the facial posture and light intensity of the target person in the original facial image.
[0069] When the electronic device obtains the facial posture of the target person in the original facial image, the original facial image can be input into the facial posture recognition model, and the facial posture of the target person in the original facial image can be output. The facial posture recognition model is used to recognize the facial posture of each person in the facial image. The facial posture recognition model can be trained based on the training sample facial images labeled with facial postures.
[0070] Based on the facial posture and light intensity of the target person in the acquired original facial image, the electronic device compares the facial posture of the target person in the original facial image with the facial posture required by the preset conditions, and compares the light intensity of the target person in the original facial image with the light intensity required by the preset conditions. If the facial posture of the target person in the original facial image meets the facial posture required by the preset conditions, and the light intensity of the target person in the original facial image meets the light intensity required by the preset conditions, then it is determined that when the facial posture and light intensity of the target person in the original facial image meet the preset conditions, the electronic device will execute step 203; if the facial posture of the target person in the original facial image does not meet the facial posture required by the preset conditions, or the light intensity of the target person in the original facial image does not meet the light intensity required by the preset conditions, or the facial posture of the target person in the original facial image does not meet the facial posture required by the preset conditions and the light intensity of the target person in the original facial image does not meet the light intensity required by the preset conditions, then it is determined that when the facial posture and light intensity of the target person in the original facial image do not meet the preset conditions, the electronic device will execute step 204.
[0071] 203. When the facial posture and light intensity of the target person in the original facial image meet the preset conditions, the electronic device determines the original facial image as a conditional facial image.
[0072] In response to the facial posture and light intensity of the target person in the original facial image meeting preset conditions, the electronic device directly determines the original facial image as a conditional facial image, which is a basic image for subsequently synthesizing the target facial image.
[0073] 204. When any one of the facial posture and light intensity of the target person in the original facial image does not meet the preset conditions, the electronic device constructs a conditional facial image that meets the preset conditions based on the original facial image.
[0074] In response to any one of the facial posture and the light intensity of the original facial image not meeting the preset condition, the electronic device constructs a conditional facial image meeting the preset condition according to the original facial image by using the following method:
[0075] 2041. The electronic device recognizes the facial contour of the target person in the original facial image and obtains the facial contour model of the target person.
[0076] The electronic device recognizes the face shape and texture features of the target person in the original face image, and inputs the recognized face shape and texture features into 3DMM (3D Morphable Models), which reconstructs the face contour of the target person in 3D (3D dimensions) to obtain the face contour model of the target person. Among them, 3DMM is a relatively basic three-dimensional face statistical model, which is used to solve the problem of restoring a three-dimensional shape from a two-dimensional face image. The 3DMM can represent any face contour model based on a set of statistical models of face shape and texture features.
[0077] 2042. The electronic device recognizes the facial features of the target person in the original facial image and obtains a detailed facial image of the target person.
[0078] The electronic device inputs the original facial image into the 3D-GAN (3 Dimensions Generative Adversarial Network) network, recognizes the facial features of the target person in the original facial image based on the 3D-GAN network, and obtains a detailed facial image of the target person, which is similar to a human skin mask that can be laid flat on a plane.
[0079] 2043. The electronic device superimposes the facial detail image onto the facial contour model to obtain a new facial image.
[0080] The electronic device obtains a new face image by pasting various components in the face detail image of the target person back to the corresponding positions of the face contour model, and the new face image includes the target person.
[0081] 2044. The electronic device adjusts the facial posture and light intensity of the target person in the new facial image according to preset conditions to obtain a conditional facial image.
[0082] Based on the new facial image obtained, the electronic device adjusts the facial posture of the target person in the new facial image according to the facial posture requirements in the preset conditions, and adjusts the light intensity of the target person in the new facial image according to the light intensity requirements in the preset conditions, to obtain a conditional facial image that meets the preset conditions and includes the target person.
[0083] 205. The electronic device obtains the designated age coding information corresponding to the designated age.
[0084] In the disclosed embodiment, the electronic device maintains an age convolution kernel sequence, which includes age convolution kernels corresponding to different ages, and the age convolution kernels corresponding to different ages are arranged according to age characteristics, and the age convolution kernel corresponding to each age can learn the aging face characteristics or young face characteristics of the age convolution kernel corresponding to the adjacent age, so that the face characteristics of different ages will not have sudden changes and can transition smoothly. Among them, the age convolution kernel of each age is used to determine the weight value of the face feature of each age, and the weight value of the face feature of each age is used to perform weighted calculation on the face features in the face image, so that the face features of each age can be obtained, and then the face image of each age can be obtained.
[0085] When the specified age is obtained, the electronic device obtains the age convolution kernel corresponding to the specified age based on the specified age, and then obtains the weight value of the facial feature corresponding to the age convolution kernel, and obtains the specified age coding information by encoding the weight value of the facial feature. During the application process, the electronic device continuously learns the facial features of the faces of the specified age and the age difference between the specified age and the specified age that meets the difference condition, so that the specified age coding information can accurately reflect the facial features of the faces of the specified age.
[0086] 206. Based on the specified age coding information, the electronic device adjusts the facial features of the target person in the conditional facial image to obtain the target facial image.
[0087] The electronic device inputs the designated age coding information and the conditional face image into the conditional generative-adversarial network, and outputs the target face image. Among them, the conditional generative-adversarial network (CGAN) is a constrained GAN (Generative Adversarial Network) network, including a generative network, an adversarial network and a label. For the input noise, the conditional generative-adversarial network can generate an image indicated by the label. In the embodiment of the present disclosure, the conditional generative-adversarial network can adjust the facial features of the face image based on different age coding information to obtain face images of different ages.
[0088] In another embodiment of the present disclosure, after synthesizing the target facial image according to the specified age coding information and the conditional facial image, the electronic device will also verify the quality of the generated target facial image to ensure that the generated target facial image belongs to the target person and the age meets the expected requirements. When the electronic device verifies the quality of the generated target facial image, the following method can be used:
[0089] 2061. The electronic device recognizes the target age and target identity information of the target person in the target face image.
[0090] The electronic device inputs the target face image into the pre-built attention model, and outputs the target age and target identity information of the target person in the target face image. The attention model can be composed of several attention networks such as Channel Attention, Spatial Attention and Mask Attention. The Channel Attention mainly focuses on different features in the image, the Spatial Attention mainly focuses on different areas in the image, and the Mask Attention mainly focuses on information related to age and identity. The identity information refers to information that can determine the identity of the target person.
[0091] 2062. When the target identity information matches the identity information of the target person in the original facial image, and / or the target age matches the specified age, the electronic device determines the target facial image as the final synthesis result.
[0092] The electronic device matches the target identity information of the target person in the target face image with the identity information of the target person in the original face image, and matches the target age of the target face image with the specified age. When the target identity information matches the identity information of the target person in the original face image, and / or the target age matches the specified age, the target face image is determined as the final synthesis result. Specifically, when the target identity information of the target person in the target face image matches the identity information of the target person in the original face image, the electronic device determines that the target person in the target face image is the same face as the target person in the original face image, and then determines the target face image as the final synthesis result; when the target age of the target face image matches the specified age, the electronic device determines that the generated target face image meets the required age requirement, and then determines the target face image as the final synthesis result; when the target identity information of the target person in the target face image matches the identity information of the target person in the original face image, and the target age of the target face image matches the specified age, the electronic device determines the target face image as the final synthesis result.
[0093] The method provided by the disclosed embodiment adjusts the facial features of the target person in the conditional facial image based on the designated age coding information to obtain the target facial image. The designated age coding information learns the common young or old facial features near the designated age, and can accurately reflect the facial features of the face of the designated age. The appearance of the target person in the target facial image synthesized based on the designated age coding information is the appearance that the target person should have at the designated age, so the synthesized target facial image is smoother and more accurate. And the original facial image of the synthesized target facial image can be a facial image of any posture and illumination intensity, which improves the application scope and universality of the facial image synthesis method. Furthermore, after the target facial image is synthesized, the target age and target identity information of the target person in the target facial image are predicted, and the target facial image is verified based on the predicted target age and designated age, so as to further ensure the accuracy of the synthesized target facial image.
[0094] See also Figure 3 The present disclosure provides a facial image synthesis device, the device comprising:
[0095] The first acquisition module 301 is used to acquire an original face image and a specified age, where the specified age is the age of the target person in the original face image in the target face image to be synthesized;
[0096] The second acquisition module 302 is used to acquire a conditional face image of a target person in the original face image that meets a preset condition;
[0097] The third acquisition module 303 is used to acquire designated age coding information corresponding to the designated age, the designated age coding information is used to indicate the facial features of a face of the designated age, and the designated age coding information is determined based on the facial features of a face whose age difference with the designated age satisfies a difference condition;
[0098] The adjustment module 304 is used to adjust the facial features of the target person in the conditional facial image based on the specified age coding information to obtain the target facial image.
[0099] In another embodiment of the present disclosure, the second acquisition module 302 is used to obtain the facial posture and light intensity of the target person in the original facial image; when any one of the facial posture and light intensity of the target person in the original facial image does not meet the preset conditions, a conditional facial image that meets the preset conditions is constructed based on the original facial image.
[0100] In another embodiment of the present disclosure, the second acquisition module 302 is used to identify the facial contour of the target person in the original facial image to obtain a facial contour model of the target person; identify the facial features of the target person in the original facial image to obtain a facial detail image of the target person; superimpose the facial detail image onto the facial contour model to obtain a new facial image; and adjust the facial posture and light intensity of the target person in the new facial image according to preset conditions to obtain a conditional facial image.
[0101] In another embodiment of the present disclosure, the device further comprises:
[0102] The determination module is used to determine the original face image as a conditional face image when the face posture and light intensity of the target person in the original face image meet the preset conditions.
[0103] In another embodiment of the present disclosure, a synthesis module is used to input specified age coding information and conditional facial images into a conditional generative adversarial network, and output a target facial image. The conditional generative adversarial network is used to adjust facial features of the facial image based on different age coding information to obtain facial images of different ages.
[0104] In another embodiment of the present disclosure, the device further comprises:
[0105] A recognition module, used for recognizing target age and target identity information of a target person in a target face image;
[0106] The determination module is used to determine the target face image as the final synthesis result when the target identity information matches the identity information of the target person in the original face image, and / or the target age matches the specified age.
[0107] In summary, the device provided by the embodiment of the present disclosure adjusts the facial features of the target person in the conditional facial image based on the designated age coding information to obtain the target facial image. The designated age coding information learns the common young or old facial features near the designated age, and can accurately reflect the facial features of the face of the designated age. The appearance of the target person in the target facial image synthesized based on the designated age coding information is the appearance that the target person should have at the designated age, so the synthesized target facial image is smoother and more accurate. And the original facial image of the synthesized target facial image can be a facial image of any posture and illumination intensity, which improves the application scope and universality of the facial image synthesis method. Furthermore, after the target facial image is synthesized, the target age and target identity information of the target person in the target facial image are predicted, and the target facial image is verified based on the predicted target age and designated age, so as to further ensure the accuracy of the synthesized target facial image.
[0108] Figure 4 The structure block diagram of an electronic device 400 provided by an exemplary embodiment of the present disclosure is shown. Generally, the device 400 includes: a processor 401 and a memory 402 .
[0109] The processor 401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 401 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 401 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 401 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0110] The memory 402 may include one or more computer-readable storage media, which may be non-transitory. The memory 402 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 402 is used to store at least one instruction, which is used to be executed by the processor 401 to implement the method for synthesizing a facial image provided by the method embodiment of the present disclosure.
[0111] In some embodiments, the electronic device 400 may further optionally include: a peripheral device interface 403 and at least one peripheral device. The processor 401, the memory 402 and the peripheral device interface 403 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 403 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: a power supply 404.
[0112] The peripheral device interface 403 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 401 and the memory 402. In some embodiments, the processor 401, the memory 402, and the peripheral device interface 403 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 401, the memory 402, and the peripheral device interface 403 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0113] The power supply 404 is used to power various components in the electronic device 400. The power supply 404 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 404 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged through a wired line, and a wireless rechargeable battery is a battery that is charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0114] Those skilled in the art will understand that Figure 4 The structure shown in the figure does not constitute a limitation on the electronic device 400, and may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0115] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of the electronic device 400 to complete the above video processing method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0116] The electronic device provided by the disclosed embodiment adjusts the facial features of the target person in the conditional facial image based on the designated age coding information to obtain the target facial image. The designated age coding information learns the common young or old facial features near the designated age, and can reflect the facial features of the face of the accurately designated age. The appearance of the target person in the target facial image synthesized based on the designated age coding information is the appearance that the target person should have at the designated age, so the synthesized target facial image is smoother and more accurate. And the original facial image of the synthesized target facial image can be a facial image of any posture and illumination intensity, which improves the application scope and universality of the facial image synthesis method. Furthermore, after synthesizing the target facial image, the target age and target identity information of the target person in the target facial image are predicted, and the target facial image is verified based on the predicted target age and designated age, so as to further ensure the accuracy of the synthesized target facial image.
[0117] The embodiment of the present disclosure provides a computer-readable storage medium, wherein at least one program code is stored in the storage medium, and the at least one program code is loaded and executed by a processor to implement a method for synthesizing a face image. The computer-readable storage medium may be non-transitory. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0118] The computer-readable storage medium provided by the disclosed embodiment adjusts the facial features of the target person in the conditional facial image based on the designated age coding information to obtain the target facial image. The designated age coding information learns the common young or old facial features near the designated age, and can reflect the facial features of the face of the accurately designated age. The appearance of the target person in the target facial image synthesized based on the designated age coding information is the appearance that the target person should have at the designated age, so the synthesized target facial image is smoother and more accurate. And the original facial image of the synthesized target facial image can be a facial image of any posture and illumination intensity, which improves the application scope and universality of the facial image synthesis method. Furthermore, after the target facial image is synthesized, the target age and target identity information of the target person in the target facial image are predicted, and the target facial image is verified based on the predicted target age and designated age, so as to further ensure the accuracy of the synthesized target facial image.
[0119] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0120] The above description is only an optional embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for synthesizing a face image, characterized in that: The method comprises: Acquire an original facial image and a specified age, wherein the specified age is the age of the target person in the original facial image in the target facial image to be synthesized; the original facial image is a facial image of a person in any posture; In response to any one of the facial posture and the light intensity of the original facial image not meeting the preset condition, constructing a conditional facial image meeting the preset condition based on the original facial image; According to the specified age, an age convolution kernel corresponding to the specified age in the maintained age convolution kernel sequence is obtained; wherein the age convolution kernel sequence includes age convolution kernels corresponding to different ages, and the age convolution kernels corresponding to different ages are arranged according to age characteristics, and the age convolution kernel corresponding to each age learns the aging face features or young face features of the age convolution kernel corresponding to the adjacent age, and the age convolution kernel of each age is used to determine the weight value of the face features of each age; Obtaining the weight value of the facial feature corresponding to the age convolution kernel corresponding to the specified age; By encoding the weight values of the facial features, the designated age coding information corresponding to the designated age is obtained, the designated age coding information is used to indicate the facial features of the face of the designated age, the designated age coding information is determined based on the facial features of faces of adjacent ages around the designated age whose age difference with the designated age satisfies a difference condition, and the designated age coding information learns the facial features of young or old faces of adjacent ages around the designated age; The designated age coding information is used to perform weighted calculation on the facial features of the target person in the conditional facial image to obtain facial features that meet the designated age, and generate the target facial image.
2. The method according to claim 1, characterized in that In response to any one of the facial posture and the light intensity of the original facial image not meeting the preset condition, constructing a conditional facial image meeting the preset condition based on the original facial image, comprising: Obtaining the facial posture and light intensity of the target person in the original facial image; When any one of the facial posture and the light intensity of the target person in the original facial image does not meet the preset condition, a conditional facial image meeting the preset condition is constructed based on the original facial image.
3. The method according to claim 2, characterized in that The step of constructing a conditional face image that meets the preset conditions based on the original face image includes: Recognize the facial contour of the target person in the original facial image to obtain a facial contour model of the target person; Recognize the facial features of the target person in the original facial image to obtain a facial detail image of the target person; Superimposing the facial detail image onto the facial contour model to obtain a new facial image; According to the preset conditions, the facial posture and light intensity of the target person in the new facial image are adjusted to obtain the conditional facial image.
4. The method according to claim 1, characterized in that: The method further comprises: When the facial posture and light intensity of the target person in the original facial image meet the preset conditions, the original facial image is determined as the conditional facial image.
5. The method according to claim 1, characterized in that The method further comprises: The specified age coding information and the conditional face image are input into a conditional generative adversarial network, and the target face image is output. The conditional generative adversarial network is used to adjust the facial features of the face image based on different age coding information to obtain face images of different ages.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Identify the target age and target identity information of the target person in the target face image; When the target identity information matches the identity information of the target person in the original facial image, and / or the target age matches the specified age, the target facial image is determined as the final synthesis result.
7. A facial image synthesis device, characterized in that: The device comprises: A first acquisition module is used to acquire an original face image and a specified age, wherein the specified age is the age of the target person in the original face image in the target face image to be synthesized; the original face image is a face image of a person in any posture; A second acquisition module is used for constructing a conditional face image that meets the preset condition based on the original face image in response to any one of the face posture and the light intensity of the original face image not meeting the preset condition; A third acquisition module is used to acquire, according to the specified age, an age convolution kernel corresponding to the specified age in the maintained age convolution kernel sequence; wherein the age convolution kernel sequence includes age convolution kernels corresponding to different ages, and the age convolution kernels corresponding to different ages are arranged according to age characteristics, and the age convolution kernel corresponding to each age learns the aging facial features or young facial features of the age convolution kernel corresponding to the adjacent age, and the age convolution kernel of each age is used to determine the weight value of the facial features of each age; the weight value of the facial features corresponding to the age convolution kernel corresponding to the specified age is acquired; the specified age coding information corresponding to the specified age is obtained by encoding the weight value of the facial features, and the specified age coding information is used to indicate the facial features of the face of the specified age, and the specified age coding information is determined according to the facial features of the faces of the adjacent ages around the specified age whose age difference with the specified age satisfies the difference condition, and the specified age coding information learns the young or aging facial features of the adjacent ages around the specified age; The adjustment module is used to use the specified age coding information to perform weighted calculation on the facial features of the target person in the conditional facial image, obtain facial features that meet the specified age, and generate the target facial image.
8. The device according to claim 7, characterized in that The device also includes: A recognition module, used to recognize the target age and target identity information of the target person in the target face image; The determination module is used to determine the target face image as the final synthesis result when the target identity information matches the identity information of the target person in the original face image, and / or the target age matches the specified age.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the facial image synthesis method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: At least one program code is stored in the storage medium, and the at least one program code is loaded and executed by the processor to implement the facial image synthesis method according to any one of claims 1 to 6.
