Multi-scale digital makeup migration method and system
Through a multi-scale digital network model and a multi-discriminator architecture generative adversarial network, the problem of poor complex pattern transfer effects in existing makeup transfer technology is solved, and natural, realistic makeup transfer effects and background consistency are achieved.
Patent Information
- Application Number
- CN202410793311.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-06-19
AI Technical Summary
Existing makeup transfer technology does not work well with complex patterns produced by facial painting. There are problems such as obvious dividing lines, makeup distortion, color residue, and changes in background information. It cannot maintain the naturalness and background consistency before and after makeup transfer.
It uses a multi-scale digital network model and introduces a generative adversarial network model with a multi-discriminator architecture to process the face area separately. It separates content features and makeup style through the content discriminator, global discriminator and local discriminator, and combines the local loss function and face Analyze the image to ensure image background consistency before and after makeup transfer.
Generates a natural and realistic makeup transfer effect, improves the overall quality of makeup transfer, ensures the consistency of the image background before and after makeup transfer, and avoids the interference of background information on makeup transfer.
Smart Images

Figure CN118780972A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image style transfer, and in particular relates to a multi-scale digital makeup transfer method and system. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] Makeup is a common way for people to beautify their faces, which involves multiple steps and techniques such as foundation concealer, eye shadow, lipstick, and painting of complex patterns. Converting the physical makeup application and removal process into digital makeup migration and achieving one-click synthesis of facial image makeup has become a research hotspot in the field of computer vision image style transfer. It has a wide range of applications in photo beautification, video beautification, digital entertainment, live broadcasting, virtual makeup trials and many other fields.
[0004] Digital makeup migration mainly uses facial makeup migration technology, including digital makeup application and digital makeup removal; naturally transfer the makeup style from a face image with makeup (or without makeup) to a face image without makeup (or with makeup), and process the makeup of different parts of the face in a coherent and natural way. Digital makeup application has two goals: to transfer the low-frequency color features and high-frequency detail features of the pattern in the facial makeup from the makeup image to the non-makeup image; and, to keep the facial identity features of the non-makeup image unchanged during the makeup application process. Digital makeup removal refers to removing the makeup effect on the makeup face image and restoring the makeup face image to the non-makeup face image. Digital makeup removal has two goals: to accurately identify and eliminate the makeup effects on the face image, including color, texture and pattern, to avoid unnatural boundaries or transitions, color distortion and other phenomena; and, the face after makeup removal should maintain its original identity features.
[0005] According to the inventors, existing makeup transfer research can be divided into two categories: the first category is traditional makeup transfer technology based on image processing methods such as image gradient editing and physical operations, and the second category is makeup transfer technology based on deep learning methods such as deep neural networks. Traditional makeup transfer technology has the disadvantages of complex modeling and large amount of calculations during makeup transfer; makeup transfer technology based on deep learning is the current mainstream makeup transfer method and has made certain progress; but the makeup transfer effect is not good for complex patterns produced by facial painting, and there is a clear boundary between the complex pattern after transfer and the face image, and the makeup is distorted; there will also be problems of color residue or background information change, and it is impossible to maintain the naturalness and background consistency of the image before and after makeup transfer. Summary of the invention
[0006] In order to solve the above problems, the present invention proposes a multi-scale digital makeup migration method and system, which adopts a generative adversarial network model with a multi-discriminator architecture to migrate multi-scale digital makeup, processes the face area separately, reduces the impact on the makeup migration effect, ensures the consistency of the image background before and after makeup migration, and generates natural and realistic makeup migration images.
[0007] According to some embodiments, a first solution of the present invention provides a multi-scale digital makeup migration method, which adopts the following technical solution:
[0008] A multi-scale digital makeup transfer method, comprising:
[0009] Obtain images of different facial makeup;
[0010] A multi-scale digital network model is used to transfer makeup of a facial makeup image to obtain a facial makeup image after makeup transfer; specifically, in the process of transferring makeup of a facial makeup image, content features, makeup styles and background areas of different acquired facial makeup images are extracted; makeup transfer is performed according to the content features of the extracted facial makeup image to obtain a makeup transfer image, wherein the transferred makeup style is different from the makeup style of the facial makeup image to be transferred; a facial area of the obtained makeup transfer image is extracted; the extracted background area and the facial area are fused to obtain a facial makeup image after makeup transfer, thereby realizing makeup transfer of the facial makeup image;
[0011] Among them, the multi-scale digital network model adopted adopts a generative adversarial network model based on a multi-discriminator architecture; the multi-discriminator architecture includes a content discriminator for promoting the separation of content features and makeup styles, a global discriminator for evaluating the face area and identifying the quality and realism of makeup transfer of facial makeup images, and a local discriminator for local makeup detection and correction of makeup transfer images.
[0012] As a further technical limitation, the local discriminator adopts a local loss function for constraining the consistency of color distribution in local areas of the images before and after makeup transfer, thereby ensuring the consistency of local makeup styles of the images before and after makeup transfer.
[0013] Furthermore, with the goal of minimizing the objective function of the multi-scale digital network model including the local loss function, the detection and recognition of the global discriminator and the local discriminator are combined to optimize and adjust the makeup transfer process of the facial makeup image.
[0014] As a further technical limitation, a content encoder is used to extract content features of a facial makeup image, and a makeup style encoder is used to extract the makeup style of the facial makeup image; the makeup style encoder uses a hierarchical convolutional neural network to capture makeup-related makeup styles in facial makeup images.
[0015] As a further technical limitation, the face area is divided into several local face blocks. The makeup style of the face area is judged by a global discriminator with a multi-scale discriminant network structure. The facial makeup of the local face blocks is detected and corrected by a local discriminator. The effect of makeup migration is evaluated based on the judgment and detection results of the global discriminator and the local discriminator.
[0016] As a further technical limitation, a generator introducing a face parsing map is used to segment the acquired face makeup image into different semantic areas, and based on the obtained semantic areas, the background area of the face makeup image is obtained to complete the extraction of the background area; the face parsing map is used to extract the face area pixels of the makeup migration image to obtain the face area of the makeup migration image.
[0017] According to some embodiments, a second solution of the present invention provides a multi-scale digital makeup migration system, which adopts the following technical solutions:
[0018] A multi-scale digital makeup migration system, comprising:
[0019] An acquisition module, which is configured to acquire different facial makeup images;
[0020] A migration module is configured to use a multi-scale digital network model to perform makeup migration of a facial makeup image to obtain a facial makeup image after makeup migration; specifically, in the process of performing makeup migration of a facial makeup image, extract content features, makeup styles and background areas of different acquired facial makeup images; perform makeup migration according to the content features of the extracted facial makeup image to obtain a makeup migration image, wherein the migrated makeup style is different from the makeup style of the facial makeup image to be migrated; extract a facial area of the obtained makeup migration image; fuse the extracted background area and the facial area to obtain a facial makeup image after makeup migration, thereby realizing makeup migration of the facial makeup image;
[0021] Among them, the multi-scale digital network model adopted adopts a generative adversarial network model based on a multi-discriminator architecture; the multi-discriminator architecture includes a content discriminator for promoting the separation of content features and makeup styles, a global discriminator for evaluating the face area and identifying the quality and realism of makeup transfer of facial makeup images, and a local discriminator for local makeup detection and correction of makeup transfer images.
[0022] According to some embodiments, a third solution of the present invention provides a computer-readable storage medium, which adopts the following technical solution:
[0023] A computer-readable storage medium stores a program, which, when executed by a processor, implements the steps of the multi-scale digital makeup migration method as described in the first solution of the present invention.
[0024] According to some embodiments, a fourth solution of the present invention provides an electronic device, which adopts the following technical solution:
[0025] An electronic device comprises a memory, a processor and a program stored in the memory and running on the processor, wherein when the processor executes the program, the steps in the multi-scale digital makeup migration method as described in the first solution of the present invention are implemented.
[0026] According to some embodiments, a fifth solution of the present invention provides a computer program product, which adopts the following technical solution:
[0027] A computer program product includes software codes, wherein the program in the software codes executes the steps in the multi-scale digital makeup migration method as described in the first embodiment of the present invention.
[0028] Compared with the prior art, the present invention has the following beneficial effects:
[0029] The present invention introduces a multi-discriminator combination strategy into the multi-scale digital network model and designs a new multi-discriminator architecture, which can effectively improve the performance and effect of makeup transfer of the multi-scale digital network model; the multi-discriminator architecture consists of a content discriminator for judging the authenticity of facial content information, two global discriminators for judging the authenticity of the entire face, and ten local discriminators for judging the authenticity of local facial areas.
[0030] The present invention proposes a new local loss function, which is used to constrain the color distribution consistency of the image after makeup transfer and the original image with makeup in the local area; introducing this function into the local discriminator can ensure that the image after makeup transfer is consistent with the original image in local makeup style, and can guide the generator to better learn and maintain the details and features of each area, generate more realistic makeup transfer results, thereby improving the overall quality of the makeup transfer image.
[0031] In order to prevent the background information of the image from changing during the makeup transfer process and causing adverse interference to the final facial makeup effect, the present invention proposes the idea of processing the face area separately, and introduces a face analysis map in both the generator and the discriminator to separate the face area and the background area of the image. When the discriminator evaluates the face image, only the face area is evaluated, thereby eliminating the influence of background information on the facial makeup transfer effect; when the generator generates the image, the face analysis map is used to extract the face area of the network layer output result and the background area of the original image respectively, and then the two parts are combined into the final generated image, thereby ensuring the consistency of the background of the final facial makeup image after makeup transfer with the original image. The present invention only considers and pays attention to facial features and details during the makeup transfer process, and can generate a more natural and realistic makeup transfer effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The drawings in the specification that constitute a part of this embodiment are used to provide a further understanding of this embodiment. The schematic embodiments of this embodiment and their descriptions are used to explain this embodiment and do not constitute improper limitations on this embodiment.
[0033] Figure 1 This is an architecture diagram of a multi-scale digital network model in Embodiment 1 of the present invention;
[0034] Figure 2 is a structural diagram of a global discriminator in Embodiment 1 of the present invention;
[0035] Figure 3 is a structural diagram of a local discriminator in Embodiment 1 of the present invention;
[0036] Figure 4 This is a schematic diagram of the MT data set comparison experiment results in Example 1 of the present invention;
[0037] Figure 5 This is a schematic diagram of comparative experimental results of the Makeup dataset in Example 1 of the present invention;
[0038] Figure 6 This is a schematic diagram of the comparative experimental results of the MT dataset makeup removal in the first embodiment of the present invention;
[0039] Figure 7 This is a schematic diagram of the makeup removal comparison experiment results of the Makeup dataset in Example 1 of the present invention. DETAILED DESCRIPTION
[0040] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0041] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.
[0042] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0043] In the present invention, terms such as "upper", "lower", "left", "right", "front", "back", "vertical", "horizontal", "side", "bottom", etc. indicate directions or positional relationships based on the directions or positional relationships shown in the accompanying drawings. They are relational words determined only for the convenience of describing the structural relationships of the various parts or elements of the present invention, and do not specifically refer to any part or element in the present invention and should not be understood as limitations on the present invention.
[0044] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0045] Embodiment 1
[0046] Embodiment 1 of the present invention introduces a multi-scale digital makeup migration method.
[0047] This embodiment adopts a multi-scale digital network model for makeup transfer; that is, a generative adversarial network model based on a multi-discriminator architecture including a content discriminator, a global discriminator and a local discriminator is adopted; wherein the content discriminator, the global discriminator and the local discriminator are respectively used for separation of content information and makeup style information, evaluation of large-scale overall face authenticity and evaluation of small-scale local face region authenticity. The combination of the three types of discriminators enables the generator to generate a more realistic and natural facial makeup transfer effect; a local loss function is constructed to constrain the color distribution consistency of the makeup transfer image and the original makeup image in the local area, and the loss function is used for the local discriminator, which helps the network to better transfer the details of the makeup; a face analysis map is introduced in the generator and the discriminator to extract the face area for separate processing, so as to reduce the adverse effect of the background on the facial makeup transfer effect, and ensure that the background of the facial makeup image generated after makeup transfer is consistent with the background of the same identity image.
[0048] This embodiment takes two different makeup looks as examples for detailed description.
[0049] Assume that A and B are two different domains of facial makeup images, where A represents the domain of images without makeup and B represents the domain of images with makeup. Both A and B contain images of different identities and makeup, and there is no paired image of the same identity before and after makeup. Assume that the image without makeup is a special case of the image with makeup. Based on this assumption, makeup removal and makeup application can be regarded as the same problem. Specifically, when four given images are input: the image without makeup I s ∈A, makeup image I m ∈B, face analysis map of no-makeup image M s And the face analysis diagram of makeup image M m When the network model in this embodiment is used, a makeup image can be generated. and remover image It is a card that has both Is Identity and I m makeup style images, and Background information and I s Consistent, that is, to achieve I s Makeup effect. It is a card that has both I m Identity and I s images with makeup styles (i.e., no makeup), and Background information and I m Consistent, that is, achieved m The effect of makeup removal. By learning the mapping relationship between the two domains: Ω: To realize the makeup application and removal of facial makeup images.
[0050] This embodiment adopts Figure 1 The multi-scale digital network model shown includes a makeup style encoder, a content encoder, a generator, a content discriminator, a global discriminator, and a local discriminator.
[0051] (1) Content Encoder
[0052] The content encoder is used to transform the input makeup-free image I s ∈A and makeup image I m ∈B, which captures the shared features in images such as facial structure and expression, regardless of makeup style.
[0053] The content encoder in this embodiment is composed of multiple convolutional layers, activation function layers, and normalization layers, and is used to capture content information from facial images. The captured content information includes the contour of the face, and the shapes and positions of the eyes, nose, mouth, and other parts. The content encoder can also extract higher-level abstract features, such as facial expressions, postures, gender, age, and other information. The content encoder plays a key role in the entire makeup transfer process. It converts the input face image into a potential content space representation, allowing the generator to use the content space representation to maintain the consistency of the face identity when performing makeup transfer. Extracting content features and The process is:
[0054] (2) Makeup style encoder
[0055] The makeup style encoder is used to extract the input image I s ∈A and I m The latent features of makeup style ∈B map the image to the attribute space representing the variation of makeup style.
[0056] The makeup style encoder in this embodiment is used to capture makeup-related information in the image. The design and training of the makeup style encoder is crucial to achieving accurate makeup migration effects. This embodiment uses a makeup style encoder with a Conv-Relu-Conv-BN structure to extract potential feature representations of makeup styles such as eye makeup, lip makeup, foundation, and blush from the image; wherein the first convolutional layer in the structure is responsible for extracting basic features, and the second convolutional layer can further extract more complex features based on these basic features. The hierarchical structure enables the makeup style encoder to learn richer and more diverse feature representations, thereby better capturing the makeup style of the input data; the output of the makeup style encoder is input into the generator to guide the generator to generate images with specific makeup styles. Extracting makeup style features and The process is:
[0057] (3) Generator
[0058] The generator takes the original image I s with I m And its corresponding face analysis graph M s With M m , and facial features extracted by the content encoder and makeup style encoder and As input, the features extracted by the two encoders are fused and input into the network layer as new features to obtain the output result. The face area information is extracted from the output result using the face analysis graph, and the background area information is extracted from the original image. The two parts of information extracted are combined to generate the makeup image. and remover image
[0059] The face regions (i.e., background information removed) are extracted from the generated image of the generator and the real image respectively as the input of the global discriminator, which is used to evaluate whether the input face regions belong to the same makeup style. At the same time, the face regions with background information removed are segmented to obtain multiple local blocks of the face. These local blocks are used as the input of the local discriminator, which is used to evaluate whether the corresponding local face blocks between the input generated image and the real image belong to the same makeup style. Through the joint action of the global discriminator and the local discriminator, the network can more accurately evaluate the makeup style of the image, thereby generating more realistic makeup transfer results.
[0060] As an image processing technology, face parsing graphs divide face images into different semantic regions, such as skin, eyes, mouth, hair, etc. This embodiment introduces face parsing graphs in the generator to separate the face region and the background region in the image and process them separately, so as to avoid the background of the generated face makeup image after makeup transfer being inconsistent with the background of the original image.
[0061] Specifically, the face parsing graph is used to classify the pixels in the face image into two categories: face area pixels and background area pixels; where face area pixels include eyebrows, lips, skin, nose and other pixels involved in the makeup area, while background area pixels include background, hair, teeth, eyeballs and other pixels not involved in the makeup area. By using the face parsing graph to classify the pixels in the image, the model extracts face area pixels from the image generated by the generator, extracts background area pixels from the original image, and combines the pixels extracted from different images to generate a new image in which only the face makeup is changed but the background remains unchanged, that is, the face makeup image after makeup migration is obtained.
[0062] The generator used in this embodiment not only receives the content features extracted by the encoder And makeup style characteristics And at the same time receive the original image I s ,I m And its corresponding face analysis graph M s 、M m As input. In this embodiment, the generator G is divided into two branches, makeup application and makeup removal. Each branch consists of a feature fusion module, three Conv-BN-Relu layers, two upsampling layers and a Conv-Tanh layer. An upsampling operation is performed on the output features of the first two Conv-BN-Relu layers, which helps to maintain the spatial information and structure of the input image, especially in retaining the details such as the edge and texture of the object, so that the generated image is more realistic. When all the inputs enter the generator, the makeup-free image I s 、Analysis of face without makeup M s And the content features of the makeup-free image extracted by the encoder Makeup style characteristics of makeup images Sent to the makeup branch of the generator, the content features are fused in the feature fusion module And makeup style characteristics Perform feature fusion to form new features The new features after fusion The output result is obtained by inputting into the network composed of Conv-BN-Relu layer, upsampling layer and Conv-Tanh layer. s Extract the makeup-free image I sThe background area pixels of the output result and the face area pixels of the output result are combined to generate a final makeup image with the identity information of the no-makeup image, the background information of the no-makeup image, and the makeup style of the makeup image. Similarly, the makeup image I m 、Analysis of face with makeup M m , Content characteristics of makeup images and makeup style features of no-makeup images The makeup removal branch is sent to the generator, and after the pixels are classified and combined by the feature fusion module, network layer and face analysis map, a makeup removal image with identity information of the makeup image, background information of the makeup image and makeup style of the non-makeup image is generated. During the process of applying and removing makeup, the introduction of the face analysis map can effectively distinguish whether the pixels in the image belong to the face area or the background area, making it convenient to process the pixels in different areas of different images separately, so that the final generated makeup image and makeup removal image can maintain the same background as the original input image of the same identity.
[0063] The process of generating an image by the generator in this embodiment is as follows:
[0064] (4) Content Discriminator
[0065] The content discriminator is used to determine whether the information contained in the feature vector output by the content encoder is content information common between domains or attribute information of a specific domain (that is, content feature information unrelated to makeup or makeup style information).
[0066] The content discriminator and the content encoder form adversarial training to determine whether the information output by the content encoder is common content information between domains or attribute information of a specific domain. In this embodiment, the content discriminator consists of four Conv-IN-LeakyRelu layers and one Conv-Sigmoid layer, using the content features extracted by the content encoder from the images without makeup and the images with makeup. As input, this information is evaluated to determine whether it is information related to the makeup style or content information unrelated to the makeup; by constructing a content adversarial loss function between the content encoder and the content discriminator, the separation of content information and makeup style information is effectively promoted during the encoding process.
[0067] (5) Global Discriminator
[0068] In the generative adversarial network, the discriminator plays a vital role, which can accurately distinguish between real images and generated images, thereby driving the generator to create more realistic results. To improve the accuracy of the model, this embodiment introduces two global discriminators; among them, the global discriminator D AFocusing on evaluating the authenticity and realism of makeup removal images and makeup-free images, the global discriminator D B It is used to evaluate the authenticity and realism of makeup images and makeup-free images. Global discriminator D A With D B Using the same network structure, Figure 2 D A Network structure diagram.
[0069] The global discriminator in this embodiment adopts a multi-scale discriminant network structure, and the original scale image and the features after downsampling using the average pooling layer are respectively subjected to four Conv-IN-LeakyRelu layers and one Conv-sigmoid layer, and finally the discriminator's evaluation results of the real image and the generated image are obtained. Features of different scales represent different levels of information in the image. By discriminating facial features of different scales, the discriminator can pay attention to more comprehensive information and improve its ability to understand the content of facial images.
[0070] For the global discriminator D A , in the no-makeup image I s and remover image Before inputting into the discriminator, this embodiment uses the face analysis map to classify the image pixels, fills the background with black to remove the background area information in the image, and extracts the makeup-free image I s With remover image The face area in and It should be noted that in this embodiment, the eyeballs and teeth are not the makeup area, so they are excluded when extracting the face area. In this way, only the face area is retained. No-makeup images and face regions The makeup removal images are sent to the discriminator for evaluation; this effectively prevents background information from interfering with the makeup application and removal process, thereby ensuring that the discriminator can focus on evaluating the makeup style on the face, making the generated images more accurate and realistic.
[0071] Global Discriminator D B With D A The processing flow is similar to that of , and will not be repeated in this embodiment.
[0072] (6) Local Discriminator
[0073] In this embodiment, 10 local discriminators are set to evaluate the authenticity of local face areas during makeup transfer; the face area with background information removed is divided into 10 local blocks using facial key points, and these local blocks contain complete facial details and features after splicing. A local discriminator is set for each local face block to focus on evaluating the local face area corresponding to the local block. The sum of the areas evaluated by these 10 local discriminators constitutes the entire face area. This sophisticated facial area division and local evaluation strategy enables the model to more accurately capture and evaluate various parts of the face, further improving the quality and realism of the generated image.
[0074] The 10 local discriminators in this embodiment use the same network structure, which is composed of a combination of 6 convolutional layers, a normalization layer and an activation function layer (Conv-IN-LeakyRelu) and a combination of 1 convolutional layer and an activation function layer (Conv-Sigmoid). The network structure diagram of the local discriminator is shown in Figure 3 shown.
[0075] In this embodiment, the makeup image I m Deformation fusion to the no-makeup image I s On the top, a synthetic makeup image W is generated m , using the face analysis graph to extract the synthetic makeup image W m , Makeup images And makeup image I m The facial area in the extracted synthetic makeup image is then extracted using the facial key points. Makeup image face area And the face area of the makeup image Perform local block segmentation on I m Partial block of the face with makeup and Partial blocks of makeup face Input to the local discriminator corresponding to the local block In the example, let the discriminator judge the pair of local blocks with different makeup styles as negative, and I m Partial block of the face with makeup and W m Synthetic makeup face local block Input to In , the discriminator is allowed to judge the pair of local blocks with the same makeup style as positive. The local discriminator not only maintains the integrity of the makeup color and complex makeup pattern during the makeup process, but also keeps the identity information of the face unchanged to a certain extent.
[0076] This embodiment combines the local discriminator with the global discriminator, so that the model can evaluate the authenticity not only of the entire face, but also of the local area of the face. Since the division of the face area is based on key points, the sum of the areas evaluated by multiple local discriminators can cover the entire face without missing edge details, so that in the process of complex makeup migration, the global discriminator focuses on overall consistency, while the local discriminator focuses on detail features. The combination of the two can better capture the details of the makeup, provide more comprehensive feedback signals, and help improve the quality of makeup migration in terms of coarse-grained overall makeup and fine-grained local details.
[0077] In this embodiment, the content discriminator D c Distinguishing the content features extracted from the makeup-free and makeup-without images allows the content encoder to focus more on content information unrelated to makeup when encoding data, reducing its reliance on makeup style information, while the makeup style encoder encodes the remaining specific makeup style information. The content adversarial loss function is in, Indicates the desired operation on the image.
[0078] The global discriminator takes the image with the background information removed, i.e., only the complete face area is retained as input. A It is used to distinguish the face area of the makeup removal image and the face area of the makeup-free image. B The global generative adversarial loss is used to distinguish the face area of the makeup image from the face area of the makeup image.
[0079] In this embodiment, the extracted face area is divided into 10 partial face blocks, and a local discriminator is set for each partial face block. Local Discriminator Taking the local face block as input, the makeup image I m and the composite makeup image W m Local block pairs It is judged as positive, that is, they are considered to have the same makeup style; m And the makeup image generated by the generator Local block pairs They are judged as negative pairs, that is, they are considered to have different makeup styles. The local generative adversarial loss function is
[0080]
[0081] In this embodiment, it is hoped that the makeup style features extracted by the makeup style encoder are as close as possible to the prior Gaussian distribution. Therefore, the KL (Kullback-Leibler) divergence loss is used for the makeup style encoder. Here, the KL divergence loss is used to measure the difference between the makeup style feature distribution and the prior Gaussian distribution to prevent the makeup style feature distribution from being too discrete or concentrated in a certain local area, thereby ensuring that the makeup style features are more stable and controllable in the entire feature space. The KL divergence loss function is: Among them, P(x) represents the probability density function of the makeup style feature distribution, and Q(x) represents the probability density function of the Gaussian distribution.
[0082] The reconstruction loss is a combination of the cycle consistency loss and the self-reconstruction loss. s The content information extracted from and makeup style information Input into the generator, it will regenerate the makeup-free image Similarly, the makeup image I m Content Information and makeup style information Inputting into the generator will also regenerate the makeup image Here, I s and Between and I m and The difference between them is called the self-reconstruction loss. and remover image Re-extracting content information and makeup style information, and then interchangeably fusing them and inputting them into the generator can produce the same s Consistent looping no-makeup images and I m Consistent looping with makeup images I s and Between and I m and The difference between is the cycle consistency loss. Therefore, the reconstruction loss function is
[0083]
[0084] This embodiment uses a smooth makeup removal loss to constrain the generator to produce a better makeup removal image. The face after makeup removal should have no high-frequency details and be smoother. The Laplacian filter f is applied to the divided face local blocks in sequence, and it is hoped that the result is closer to 0. Since the facial features contained in the face local blocks are different, the face local blocks of each makeup removal image are Set a separate weight ω i; The smooth removal loss function is
[0085] When calculating the loss of local facial regions, this embodiment shields the background, hair, eyeballs, eyebrows and teeth in the facial image based on the facial analysis graph, and uses the remaining facial region as the region affected by makeup migration and divides it into 10 local blocks. The eyebrow region is removed here because it is hoped that the color of the eyebrow will be migrated rather than the shape. If the eyebrow region is retained and the local loss function is calculated, traces of the eyebrow shape of the original makeup image will be left in the final makeup image of the face after makeup migration, which is inconsistent with the desired makeup result. Therefore, the eyebrows are shielded when calculating the local loss function, and other global loss functions are used to constrain the effect of eyebrow color migration. The makeup style of the face mainly depends on the color distribution, so the makeup image And makeup image I m Should enjoy similar color distribution across makeup areas.
[0086] In order to take into account more makeup details and produce better makeup migration effects during the makeup migration process, this embodiment constrains the color distribution consistency of each local block of the face. Specifically, the face analysis map is first used to extract the face area of the makeup-free image. Face area of makeup image And the face area of the synthesized makeup image Secondly, use the face area Each key point is segmented to obtain 10 local blocks, and the sum of the local blocks contains all the information of each face area; again, the local blocks of the face without makeup are segmented to obtain 10 local blocks. and the corresponding local blocks on the face of the person with makeup Do histogram matching to separate the local blocks of the face without makeup The histogram is adjusted to the local block with makeup face The histogram of the face without makeup is similar to that of the face without makeup, and the local block of the face without makeup after the histogram is adjusted is called the histogram matching local block, denoted as The histogram matches the local block It retains the local blocks of the face without makeup The identity information of the person with makeup is also related to the local block of the face. Have the same color distribution; finally use the L1 norm to calculate the histogram matching local blocks Partial blocks of the face with makeup The local loss function plays a key role in the color migration of extreme makeup. The local loss function is Wherein, HM stands for histogram matching.
[0087] In summary, the total loss function is Among them, λ content,λ adv ,λ local ,λ kl ,λ rec ,λ smooth and λ region_hm is the weight of each loss function.
[0088] Case Analysis
[0089] This example uses the Adam algorithm to optimize all modules of the model, and sets the initial learning rate to 0.0001. The model is trained for 700 epochs with a batch size of 1, and the weight parameter λ content ,λ adv ,λ local ,λ kl ,λ rec ,λ smooth and λ region_hm Set to 1, 1, 8, 0.01, 8, 15 and 1.5 respectively.
[0090] In this embodiment, two datasets, MT and Makeup, are used. The MT dataset consists of 1,115 images without makeup and 2,719 images with makeup, which include images of different races, postures, expressions, and backgrounds. Although the MT dataset contains many makeup styles, these makeup styles all belong to the light makeup category. The Makeup dataset contains a total of 334 images without makeup and 355 images with makeup; it includes both light makeup images and images with extreme makeup; these images show a variety of makeup colors and styles.
[0091] 300 images without makeup and 300 images with makeup were selected from the Makeup dataset to construct a training set, and it was ensured that not all extreme makeup images were included in the training set. The training set was used to train the multi-scale digital network model proposed in this embodiment, so that the model has good makeup transfer performance that can adapt to both light makeup and extreme makeup.
[0092] Two test datasets were constructed. 300 images without makeup and 200 images with makeup were randomly selected from the MT dataset to construct the first test dataset, called the MT test dataset. The training data in the Makeup dataset was removed, and the second test dataset was constructed from the remaining images, called the Makeup test dataset.
[0093] The method proposed in this example is compared with several advanced makeup transfer methods, including BeautyGAN, SCGAN, BeautyREC, and CPM. In order to more accurately evaluate the performance of each method, the result images generated by all methods are aligned to the same resolution (256*256). This can eliminate the visual differences caused by different image resolutions, making the comparison more comparable and fair.
[0094] like Figure 4 The figure shows the comparison results of the method adopted in this embodiment and other comparison methods on the MT dataset, which is mainly light makeup style; among them, the first row is the images without makeup, the second row is the images with makeup, and the third to seventh rows are the makeup migration results obtained by BeautyGAN, SCGAN, BeautyREC, CPM and the method of this embodiment respectively.
[0095] Depend on Figure 4 It can be seen that the makeup transfer effect obtained by the BeautyGAN method is not ideal, and the face appears black. The makeup transferred by the SCGAN method changes color, such as the lip makeup shown in the fourth row, column (b) and column (f), and the eye makeup and lip makeup shown in column (e). And the image generated by this method is overall blurry, and the hair and background are seriously distorted. Compared with the first two methods, the BeautyREC and CPM methods perform better. However, the BeautyREC method only transfers the color of the lower lip and ignores the upper lip when migrating lip makeup. This phenomenon can be seen in the results of the BeautyREC method. The lip makeup color of the makeup image generated by the CPM method is lighter than the lip makeup color of the corresponding makeup image, as shown in the CPM method result figure. Compared with the above methods, the method proposed in this embodiment not only realizes the makeup transfer well, ensures the accuracy of the makeup color and details, but also maintains the background of the original image well. Compared with other methods, the makeup transfer effect obtained in this embodiment is more natural and realistic.
[0096] like Figure 5 The figure shows the comparison results between the method adopted in this embodiment and the BeautyGAN, SCGAN, BeautyREC and CPM methods on the Makeup dataset; some extreme makeups in the Makeup dataset are selected to demonstrate the superiority of the method adopted in this embodiment in extreme makeup migration; wherein, the first row is the images without makeup, the second row is the images with makeup, and the third to seventh rows are the makeup migration results obtained by BeautyGAN, SCGAN, BeautyREC, CPM and the method of this embodiment respectively.
[0097] Depend on Figure 5It can be seen that the makeup transfer effect obtained by the BeautyGAN method is very poor, and the generated face has a serious blackening phenomenon. The generated result of SCGAN only achieves the transfer of lip color, and all other facial special effects makeup are not transferred, and the background and hair have color changes and blurring. The BeautyREC method also only achieves the transfer of lip color, and has no transfer effect on facial special effects makeup. Some results of the CPM method achieve a certain degree of facial special effects makeup transfer, but the makeup pattern transfer is incomplete and inaccurate. For example, the content in the sixth row, column (a) shows that there is a color out-of-bounds phenomenon after makeup transfer. In addition, there is an obvious boundary between the makeup color and the skin color on the forehead of the multiple makeup images generated by this method, as shown in the figure. Among the compared methods, BeautyGAN, SCGAN and BeautyREC cannot achieve the transfer of complex facial makeup. The CPM method can achieve the transfer of some complex facial makeup, but there are problems such as makeup color out-of-bounds and background changes after transfer. The method adopted in this embodiment shows better effects in both the migration of extreme makeup and the preservation of the background. It can not only accurately migrate the shape and color of the special effects makeup pattern, but also well preserve the original hair color and background of the image.
[0098] The method used in this embodiment can also realize the makeup removal function for makeup images. Figure 6 and Figure 7 By comparing the results of the method used in this embodiment with the BeautyGAN and SCGAN methods on the MT dataset and the Makeup dataset, we can get the makeup removal effects of the method used in this embodiment on the MT dataset and the Makeup dataset. The first column is the makeup images, the second column is the makeup removal results of the BeautyGAN method, the third column is the makeup removal results of the SCGAN method, and the fourth column is the makeup removal results of the method used in this embodiment. Figure 6 The makeup removal effect of the light makeup shown. It can be seen that in the makeup removal results of BeautyGAN, the lip makeup of some images is successfully removed, but the other makeup is basically not removed, and there is a problem of darkening of the face. The makeup removal image obtained by the SCGAN method shows an overall white effect, and the image clarity is low. In addition, the makeup removal images obtained by these two methods have changed the original background color. In comparison, the method adopted in this embodiment has achieved a better makeup removal effect. Not only the lip makeup and eye makeup are effectively removed, but also the facial skin color remains natural. In addition, the background in the makeup removal result of the method adopted in this embodiment is well maintained, and there is no obvious change compared with the original image. This shows that this embodiment can not only effectively remove makeup, but also maintain the consistency of the overall color tone and background of the image, and achieve a more natural and clear makeup removal effect.
[0099] like Figure 7The figure shows a comparison of the makeup removal effects of extreme makeup in the Makeup dataset. The BeautyGAN method basically does not remove the special effects makeup, and the face still has a blackening phenomenon. The SCGAN method has a great impact on the eyes and background during the makeup removal process, resulting in eye deformation, blurred and changed background. The method used in this embodiment has a better makeup removal effect for extreme makeup, less color residue, and the most complete background information.
[0100] In order to quantitatively compare the identity preservation effect of the method adopted in this embodiment with other methods when applying and removing makeup, this embodiment uses ArcFace to calculate the facial similarity between the makeup image and the non-makeup image, and the facial similarity between the makeup removal image and the makeup image on the MT dataset and the Makeup dataset respectively. The larger the index value, the better the identity characteristics of the face are preserved after applying or removing makeup. For the MT dataset, this embodiment randomly selects 100 non-makeup images and 100 makeup images in the test set to generate makeup images and makeup removal images respectively; for the Makeup dataset, this embodiment uses the entire test set, that is, 34 non-makeup images and 55 makeup images to generate makeup and makeup removal images respectively. The results calculated on the MT dataset are shown in Table 1. It can be seen that the ArcFace value in this embodiment is the highest, whether it is applying or removing makeup, indicating that the method adopted in this embodiment can well preserve identity characteristics when applying and removing makeup.
[0101] Table 1 ArcFace values calculated by different methods on the MT dataset (↑)
[0102]
[0103] The results calculated on the Makeup dataset are shown in Table 2. It can be seen that for makeup removal, the ArcFace value of the method used in this embodiment is the highest. For makeup application, the ArcFace value of the method used in this embodiment is the second highest. The ArcFace value of the BeautyREC method is the highest. This is because the dataset contains some facial images with complex makeup on the face, and the BeautyREC method is basically unable to achieve migration for these makeups (such as Figure 7 As shown in Figure 1, the makeup image is very similar to the original makeup-free image, resulting in a higher ArcFace value. Note that the BeautyREC and CPM methods cannot achieve the makeup removal function, so their ArcFace values when removing makeup are not calculated in Tables 1 and 2. In summary, compared with other methods, the method in this embodiment has a better effect on maintaining identity features when applying and removing makeup.
[0104] Table 2 ArcFace values calculated by different methods on the Makeup dataset (↑)
[0105]
[0106] In order to quantitatively compare the makeup similarity between the method adopted in this embodiment and other methods after applying and removing makeup, this embodiment uses FID on the MT image and the Makeup image to calculate the similarity between the makeup image and the makeup image, and the similarity between the makeup removal image and the makeup-free image. The smaller the FID value, the greater the similarity. The results calculated on the MT dataset are shown in Table 3, and the results calculated on the Makeup dataset are shown in Table 4. It can be seen that whether it is applying makeup or removing makeup, the FID value of the method in this embodiment is the highest, indicating that the makeup of the makeup image generated by the method in this embodiment is closer to the makeup of the corresponding makeup image, and the makeup of the makeup removal image generated is closer to the makeup of the corresponding makeup-free image.
[0107] Table 3 FID values calculated by different methods on the MT dataset (↓)
[0108]
[0109] Table 4 FID values calculated by different methods on the Makeup dataset (↓)
[0110]
[0111] This embodiment uses a generative adversarial network framework with a combination of multiple discriminators to perform digital makeup migration; the collaborative work of multiple discriminators enables the framework to effectively separate facial content information and makeup style information, and achieve good migration effects from large-scale overall makeup to small-scale local makeup details; among them, the proposed 10 local discriminators play a key role in maintaining facial identity information and maintaining the accuracy of makeup color; the proposed local loss function plays an important role in the migration of makeup style color and texture, which can ensure that the generated makeup migration image is consistent with the target image in makeup style, and can also fully migrate extreme makeup styles; the face parsing map introduced in the generator and discriminator can separate the background and face areas, effectively solve the problem that the image background information changes during the makeup application and removal process and the background information causes adverse interference to the migration effect, so that the final facial makeup image after makeup migration is more natural visually and the makeup migration effect is more accurate.
[0112] Embodiment 2
[0113] Embodiment 2 of the present invention introduces a multi-scale digital makeup migration system.
[0114] A multi-scale digital makeup migration system, comprising:
[0115] An acquisition module, which is configured to acquire different facial makeup images;
[0116] A migration module is configured to use a multi-scale digital network model to perform makeup migration of a facial makeup image to obtain a facial makeup image after makeup migration; specifically, in the process of performing makeup migration of a facial makeup image, extract content features, makeup styles and background areas of different acquired facial makeup images; perform makeup migration according to the content features of the extracted facial makeup image to obtain a makeup migration image, wherein the migrated makeup style is different from the makeup style of the facial makeup image to be migrated; extract a facial area of the obtained makeup migration image; fuse the extracted background area and the facial area to obtain a facial makeup image after makeup migration, thereby realizing makeup migration of the facial makeup image;
[0117] Among them, the multi-scale digital network model adopted adopts a generative adversarial network model based on a multi-discriminator architecture; the multi-discriminator architecture includes a content discriminator for promoting the separation of content features and makeup styles, a global discriminator for evaluating the face area and identifying the quality and realism of makeup transfer of facial makeup images, and a local discriminator for local makeup detection and correction of makeup transfer images.
[0118] The detailed steps are the same as those of the multi-scale digital makeup migration method provided in Example 1, and will not be repeated here.
[0119] Embodiment 3
[0120] Embodiment 3 of the present invention provides a computer-readable storage medium.
[0121] A computer-readable storage medium stores a program, which, when executed by a processor, implements the steps in the multi-scale digital makeup migration method as described in Embodiment 1 of the present invention.
[0122] The detailed steps are the same as those of the multi-scale digital makeup migration method provided in Example 1, and will not be repeated here.
[0123] Embodiment 4
[0124] A fourth embodiment of the present invention provides an electronic device.
[0125] An electronic device comprises a memory, a processor and a program stored in the memory and running on the processor, wherein when the processor executes the program, the steps in the multi-scale digital makeup migration method as described in the first embodiment of the present invention are implemented.
[0126] The detailed steps are the same as those of the multi-scale digital makeup migration method provided in Example 1, and will not be repeated here.
[0127] Embodiment 5
[0128] Embodiment 5 of the present invention provides a computer program product.
[0129] A computer program product includes software codes, wherein the program in the software codes executes the steps in the multi-scale digital makeup migration method as described in the first embodiment of the present invention.
[0130] The detailed steps are the same as those of the multi-scale digital makeup migration method provided in Example 1, and will not be repeated here.
[0131] The above description is only a preferred embodiment of the present embodiment and is not intended to limit the present embodiment. For those skilled in the art, the present embodiment may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present embodiment shall be included in the protection scope of the present embodiment.
Claims
1. A multi-scale digital makeup migration method, characterized in that: include: Get different facial makeup images; A multi-scale digital network model is used to transfer makeup from a facial makeup image to obtain a facial makeup image after makeup transfer. Specifically, in the process of performing makeup transfer of facial makeup images, content features, makeup styles and background areas of different acquired facial makeup images are extracted; makeup transfer is performed according to the content features of the extracted facial makeup images to obtain a makeup transfer image, wherein the migrated makeup style is different from the makeup style of the facial makeup image to be transferred; a facial area of the obtained makeup transfer image is extracted; the extracted background area and the facial area are fused to obtain a facial makeup image after makeup transfer, thereby realizing makeup transfer of the facial makeup image; Among them, the multi-scale digital network model adopted adopts a generative adversarial network model based on a multi-discriminator architecture; the multi-discriminator architecture includes a content discriminator for promoting the separation of content features and makeup styles, a global discriminator for evaluating the face area and identifying the quality and realism of makeup transfer of facial makeup images, and a local discriminator for local makeup detection and correction of makeup transfer images.
2. A multi-scale digital makeup migration method as claimed in claim 1, characterized in that: The local discriminator adopts a local loss function for constraining the color distribution consistency of the image before and after makeup transfer in the local area, thereby ensuring the consistency of the local makeup style of the image before and after makeup transfer.
3. A multi-scale digital makeup migration method as claimed in claim 2, characterized in that: Taking the minimization of the objective function of the multi-scale digital network model including the local loss function as the goal, the detection and recognition of the global discriminator and the local discriminator are combined to optimize and adjust the makeup transfer process of the facial makeup image.
4. A multi-scale digital makeup migration method as claimed in claim 1, characterized in that: A content encoder is used to extract content features of a facial makeup image, and a makeup style encoder is used to extract the makeup style of the facial makeup image; the makeup style encoder uses a hierarchical convolutional neural network to capture makeup-related makeup styles in facial makeup images.
5. A multi-scale digital makeup migration method as claimed in claim 1, characterized in that: The face area is divided into several local face blocks. The makeup style of the face area is judged by a global discriminator with a multi-scale discriminant network structure. The facial makeup of the local face blocks is detected and corrected by a local discriminator. The effect of makeup transfer is evaluated based on the judgment and detection results of the global discriminator and the local discriminator.
6. A multi-scale digital makeup migration method as claimed in claim 1, characterized in that: The acquired facial makeup image is segmented into different semantic regions by using a generator that introduces a facial parsing graph. According to the obtained semantic regions, the background region of the facial makeup image is obtained, thereby completing the extraction of the background region. The facial parsing graph is used to extract the facial region pixels of the makeup migration image, thereby obtaining the facial region of the makeup migration image.
7. A multi-scale digital makeup migration system, characterized in that: include: An acquisition module, which is configured to acquire different facial makeup images; A migration module is configured to use a multi-scale digital network model to perform makeup migration of a facial makeup image to obtain a facial makeup image after makeup migration; specifically, in the process of performing makeup migration of a facial makeup image, extract content features, makeup styles and background areas of different acquired facial makeup images; perform makeup migration according to the content features of the extracted facial makeup image to obtain a makeup migration image, wherein the migrated makeup style is different from the makeup style of the facial makeup image to be migrated; extract a facial area of the obtained makeup migration image; fuse the extracted background area and the facial area to obtain a facial makeup image after makeup migration, thereby realizing makeup migration of the facial makeup image; Among them, the multi-scale digital network model adopted adopts a generative adversarial network model based on a multi-discriminator architecture; the multi-discriminator architecture includes a content discriminator for promoting the separation of content features and makeup styles, a global discriminator for evaluating the face area and identifying the quality and realism of makeup transfer of facial makeup images, and a local discriminator for local makeup detection and correction of makeup transfer images.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the multi-scale digital makeup migration method according to any one of claims 1 to 6 are implemented.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the program, the steps of the multi-scale digital makeup migration method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising software code, characterized in that The program in the software code executes the steps of the multi-scale digital makeup migration method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Human face makeup method and system based on semantic segmentation
CN112949605A
Face makeup migration method based on generative adversarial learning
CN114913057A
Image style migration method, program product, storage medium and electronic equipment
CN115222578A
Chinese opera makeup migration method based on UV space mapping
CN117196935A
Face makeup semantic local discrimination method with reference conditions
CN117935327A
Cited By
Hair style transplantation method based on GAN (Generative Adversarial Network)
CN119417695A
