Real-time makeup imitation method, neural network training acquisition method and device based on makeup imitation

Through convolutional neural network technology, real-time imitation of user-defined makeup is realized, which solves the problem in the existing technology that users cannot customize makeup, and improves the applicability and user experience of makeup migration.

CN113674141BActive Publication Date: 2024-10-15XIAMEN MEITUZHIJIA TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110970589.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-23
Publication Date
2024-10-15
Estimated Expiration
2041-08-23

AI Technical Summary

Technical Problem

Existing makeup transfer technology relies on makeup materials drawn by designers in advance. Users cannot customize their own makeup and have poor applicability.

Method used

A real-time makeup imitation method based on convolutional neural networks is adopted. By obtaining the makeup image to be imitated, the preset convolutional neural network is used to obtain the makeup information, and is transferred to the training image. It combines the reference face image and the target user image to generate Target imitation makeup images to achieve user-customized makeup.

Benefits of technology

This enables users to customize makeup in real time, improving the applicability and user experience of makeup migration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113674141B_ABST
    Figure CN113674141B_ABST
Patent Text Reader

Abstract

The present application provides a real-time imitation makeup method, a neural network training acquisition method and device based on imitation makeup, and relates to the field of image processing technology. The real-time imitation makeup method includes: obtaining an image to be imitated, the image to be imitated includes: a face area image; according to a preset convolutional neural network, obtaining the imitation makeup information of the image to be imitated, and migrating the imitation makeup information to a first training image, obtaining a reference face image, the preset convolutional neural network is trained and acquired according to a training image set, the training image set includes: a sample face image, a sample imitation makeup image set; according to the first training image, the reference face image and the target user image, obtaining a target imitation makeup image, the target user image includes: a face area image, so that according to the preset convolutional neural network, any image to be imitated can be imitated in real time, and the target imitation makeup image is obtained, so that the user can customize the makeup in real time and improve the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a real-time makeup imitation method, and a neural network training acquisition method and device based on makeup imitation. Background Art

[0002] Makeup transfer refers to the technology of directly transferring the makeup on the target image to the original image. Makeup transfer is widely used in application scenarios such as beauty and virtual makeup trial.

[0003] Existing makeup migration technology is mainly based on traditional material makeup technology. Generally, designers are required to draw makeup materials on a standard model picture in advance. When migration is required, the existing makeup materials are rendered onto the user picture.

[0004] It can be seen that the existing makeup imitation method completely relies on the makeup materials drawn in advance by the designer. Therefore, there is a problem that users cannot customize the makeup they want, and the applicability is poor. Summary of the invention

[0005] The purpose of this application is to provide a real-time makeup imitation method, a neural network training acquisition method and device based on makeup imitation, in view of the deficiencies in the above-mentioned prior art, which can solve the problem that users cannot customize the makeup they want.

[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0007] In a first aspect, the present invention provides a real-time makeup imitation method, comprising:

[0008] Acquire a makeup image to be imitated, wherein the makeup image to be imitated includes: a face area image;

[0009] According to a preset convolutional neural network, the imitation makeup information of the makeup image to be imitated is obtained, and the imitation makeup information is transferred to a first training image to obtain a reference face image, wherein the preset convolutional neural network is obtained by training a training image set, wherein the training image set includes: a sample face image and a sample imitation makeup image set, wherein the sample face image includes: a first training image and a plurality of second training images, wherein the sample imitation makeup image set includes: a plurality of sample imitation makeup images, wherein each of the second training images is an image after each of the sample imitation makeup information is transferred to the first training image, and each of the sample imitation makeup information is makeup information corresponding to each of the sample imitation makeup images;

[0010] A target imitation makeup image is acquired according to the first training image, the reference face image and the target user image, wherein the target user image includes a face region image.

[0011] In an optional implementation, acquiring a target imitation makeup image according to the first training image, the reference face image, and the target user image includes:

[0012] Acquire a target makeup material image according to the first training image and the reference face image;

[0013] The target makeup material image and the target user image are fused to obtain a target imitation makeup image after imitation makeup.

[0014] In an optional implementation, the step of fusing the target makeup material image with the target user image to obtain a target imitation makeup image after imitation makeup includes:

[0015] According to the face detection algorithm, respectively detecting a first face point set in the target makeup material image and a second face point set in the target user image;

[0016] Based on the first face point set and the second face point set, a preset grid deformation algorithm is used to superimpose the target makeup material image onto the target user image to obtain the target imitation makeup image.

[0017] In an optional embodiment, the preset convolutional neural network includes: a maximum-minimum pooling layer, which is used to merge and convolve the first pooling features output by the maximum pooling layer and the second pooling features output by the minimum pooling layer, and the minimum pooling layer is used to obtain the minimum feature value in the pooling window.

[0018] In an optional embodiment, the preset convolutional neural network is optimized and updated according to a loss value, wherein the loss value includes at least one of the following: a visual geometry group network loss value, a generative adversarial network loss value, and a color loss value, wherein the visual geometry group network loss value is calculated based on the first training image and the second training image, and the generative adversarial network loss value is calculated based on the second training image and the sample imitation makeup image.

[0019] In an optional implementation, the step of acquiring the makeup image to be imitated includes: receiving the makeup image to be imitated sent by a user terminal;

[0020] After obtaining the target makeup material image according to the first training image and the reference face image, the method further includes:

[0021] The target makeup material image is sent to the user terminal, so that the user terminal generates the target imitation makeup image according to the target makeup material image and the target user image.

[0022] In a second aspect, the present invention provides a method for acquiring neural network training based on imitation makeup, comprising:

[0023] Acquire a training image set, the training image set comprising sample face images and a sample imitation makeup image set, the sample face images comprising: a first training image and a plurality of second training images, the sample imitation makeup image set comprising: a plurality of sample imitation makeup images, each of the second training images being an image obtained by transferring each sample imitation makeup information to the first training image, and each of the sample imitation makeup information being makeup information corresponding to each of the sample imitation makeup images;

[0024] According to the training image set, a preset convolutional neural network is trained and acquired, wherein the preset convolutional neural network is used to acquire imitation makeup information of the makeup image to be imitated, and transfer the imitation makeup information to the first training image.

[0025] In an optional embodiment, the preset convolutional neural network includes: a maximum-minimum pooling layer, which is used to merge and convolve the first pooling features output by the maximum pooling layer and the second pooling features output by the minimum pooling layer, and the minimum pooling layer is used to obtain the minimum feature value in the pooling window.

[0026] In an optional implementation, after training and acquiring a preset convolutional neural network according to the training image set, the method further includes:

[0027] Calculate a loss value according to the first training image, the second training image, and the sample imitation makeup image, wherein the loss value includes at least one of the following: a visual geometry group network loss value, a generative adversarial network loss value, and a color loss value, wherein the visual geometry group network loss value is calculated according to the first training image and the second training image, and the generative adversarial network loss value is calculated according to the second training image and the sample imitation makeup image;

[0028] If it is determined that the loss value does not meet the preset convergence condition, the preset convolutional neural network is adjusted according to the loss value.

[0029] In an optional implementation, the loss value includes: a color loss value; and calculating the loss value according to the first training image, the second training image, and the sample imitation makeup image includes:

[0030] Performing a segmentation operation on each of the sample imitation makeup images according to a first preset mask template set to obtain first preset area images corresponding to each of the sample imitation makeup images;

[0031] Performing a segmentation operation on each of the first training images according to a second preset mask template set to obtain second preset area images corresponding to each of the first training images;

[0032] Using a preset color migration algorithm, the makeup information of each of the first preset area images corresponding to each of the sample imitation makeup images is migrated to each of the second preset area images, and each of the migrated second preset area images is obtained;

[0033] The color loss value is obtained by calculation according to each of the first preset area images and each of the migrated second preset area images.

[0034] In a third aspect, the present invention provides a real-time makeup imitation device, comprising:

[0035] The first acquisition module is used to acquire a makeup image to be imitated, wherein the makeup image to be imitated includes: a face area image;

[0036] A second acquisition module is used to acquire the imitation makeup information of the makeup image to be imitated according to a preset convolutional neural network, and transfer the imitation makeup information to a first training image to acquire a reference face image, wherein the preset convolutional neural network is acquired by training a training image set, wherein the training image set includes: a sample face image and a sample imitation makeup image set, wherein the sample face image includes: a first training image and a plurality of second training images, wherein the sample imitation makeup image set includes: a plurality of sample imitation makeup images, wherein each of the second training images is an image after each of the sample imitation makeup information is transferred to the first training image, and each of the sample imitation makeup information is makeup information corresponding to each of the sample imitation makeup images;

[0037] The third acquisition module is used to acquire a target imitation makeup image according to the first training image, the reference face image and the target user image, wherein the target user image includes a face area image.

[0038] In an optional implementation, the third acquisition module is specifically configured to acquire a target makeup material image according to the first training image and the reference face image;

[0039] The target makeup material image and the target user image are fused to obtain a target imitation makeup image after imitation makeup.

[0040] In an optional implementation, the third acquisition module is specifically configured to detect, according to a face detection algorithm, a first face point set in the target makeup material image and a second face point set in the target user image;

[0041] Based on the first face point set and the second face point set, a preset grid deformation algorithm is used to superimpose the target makeup material image onto the target user image to obtain the target imitation makeup image.

[0042] In an optional embodiment, the preset convolutional neural network includes: a maximum-minimum pooling layer, which is used to merge and convolve the first pooling features output by the maximum pooling layer and the second pooling features output by the minimum pooling layer, and the minimum pooling layer is used to obtain the minimum feature value in the pooling window.

[0043] In an optional embodiment, the preset convolutional neural network is optimized and updated according to a loss value, wherein the loss value includes at least one of the following: a visual geometry group network loss value, a generative adversarial network loss value, and a color loss value, wherein the visual geometry group network loss value is calculated based on the first training image and the second training image, and the generative adversarial network loss value is calculated based on the second training image and the sample imitation makeup image.

[0044] In an optional implementation, the first acquisition module is specifically used to receive a makeup image to be imitated sent by a user terminal; the imitation makeup implementation module also includes: a sending module, used to send the target makeup material image to the user terminal, so that the user terminal generates the target imitation makeup image according to the target makeup material image and the target user image.

[0045] In a fourth aspect, the present invention provides a neural network training acquisition device based on imitation makeup, comprising: an acquisition module, used to acquire a training image set, wherein the training image set comprises a sample face image and a sample imitation makeup image set, wherein the sample face image comprises: a first training image and a plurality of second training images, wherein the sample imitation makeup image set comprises: a plurality of sample imitation makeup images, wherein each of the second training images is an image obtained by transferring each sample imitation makeup information to the first training image, and each of the sample imitation makeup information is makeup information corresponding to each of the sample imitation makeup images;

[0046] The training module is used to train and obtain a preset convolutional neural network based on the training image set, wherein the preset convolutional neural network is used to obtain the imitation makeup information of the makeup image to be imitated, and transfer the imitation makeup information to the first training image.

[0047] In an optional embodiment, the preset convolutional neural network includes: a maximum-minimum pooling layer, which is used to merge and convolve the first pooling features output by the maximum pooling layer and the second pooling features output by the minimum pooling layer, and the minimum pooling layer is used to obtain the minimum feature value in the pooling window.

[0048] In an optional embodiment, the training module is further used to calculate a loss value based on the first training image, the second training image and the sample imitation makeup image, the loss value including at least one of the following: a visual geometry group network loss value, a generative adversarial network loss value and a color loss value, the visual geometry group network loss value is calculated based on the first training image and the second training image, and the generative adversarial network loss value is calculated based on the second training image and the sample imitation makeup image;

[0049] If it is determined that the loss value does not meet the preset convergence condition, the preset convolutional neural network is adjusted according to the loss value.

[0050] In an optional implementation, the loss value includes: a color loss value; the training module is further used to perform a segmentation operation on each of the sample imitation makeup images according to a first preset mask template set to obtain each first preset area image corresponding to each of the sample imitation makeup images;

[0051] Performing a segmentation operation on each of the first training images according to a second preset mask template set to obtain second preset area images corresponding to each of the first training images;

[0052] Using a preset color migration algorithm, the makeup information of each of the first preset area images corresponding to each of the sample imitation makeup images is migrated to each of the second preset area images, and each of the migrated second preset area images is obtained;

[0053] The color loss value is obtained by calculation according to each of the first preset area images and each of the migrated second preset area images.

[0054] In a fifth aspect, the present invention provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the method described in any of the aforementioned implementations.

[0055] In a sixth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method as described in any of the aforementioned embodiments are executed.

[0056] The beneficial effects of this application are:

[0057] The real-time imitation makeup method, the neural network training acquisition method and the device based on imitation makeup provided by the embodiments of the present application include: obtaining an image to be imitated, obtaining imitation makeup information of the image to be imitated according to a preset convolutional neural network, and migrating the imitation makeup information to a first training image, obtaining a reference face image, training and acquiring the preset convolutional neural network according to a training image set, obtaining a target imitation makeup image according to the first training image, the reference face image and the target user image, the target user image including: a face area image, so that according to the preset convolutional neural network, any image to be imitated can be imitated in real time to obtain the target imitation makeup image, so that the user can customize the makeup in real time and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0059] Figure 1 A schematic diagram of a flow chart of a real-time makeup imitation method provided in an embodiment of the present application;

[0060] Figure 2 A schematic diagram of a flow chart of another real-time makeup imitation method provided in an embodiment of the present application;

[0061] Figure 3 A schematic diagram of a flow chart of another real-time makeup imitation method provided in an embodiment of the present application;

[0062] Figure 4 A schematic diagram of constructing a triangular mesh provided in an embodiment of the present application;

[0063] Figure 5 A flowchart of a neural network training acquisition method based on imitation makeup provided in an embodiment of the present application;

[0064] Figure 6 A flowchart of another method for obtaining a neural network training based on imitation makeup provided in an embodiment of the present application;

[0065] Figure 7 A flowchart of another method for obtaining a neural network training based on imitation makeup provided in an embodiment of the present application;

[0066] Figure 8 A schematic diagram of functional modules of another real-time makeup imitation device provided in an embodiment of the present application;

[0067] Fig. 9A schematic diagram of functional modules of a neural network training acquisition device based on imitation makeup provided in an embodiment of the present application;

[0068] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

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

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

[0072] Figure 1 A flowchart of a real-time makeup imitation method provided in an embodiment of the present application is provided. The execution subject of the method may be a computer, a server, a processor, a mobile terminal or other electronic device capable of image processing, such as Figure 1 As shown, the method may include:

[0073] S101, obtaining a makeup image to be imitated, where the makeup image to be imitated includes: a face region image.

[0074] Among them, the image to be imitated with makeup can be any image that the user needs to imitate with makeup, that is, the image to be imitated with makeup is an image with makeup. Among them, the present application does not limit the facial parts with makeup in the image to be imitated with makeup, and it can be any facial area such as eyebrows, eyes, nose, mouth, cheeks, etc.

[0075] S102: Acquire makeup information of the makeup-to-be-imitation image according to a preset convolutional neural network, and transfer the makeup information to a first training image to acquire a reference face image.

[0076] Among them, the preset convolutional neural network is trained and acquired based on the training image set, the training image set includes: sample face images, sample imitation makeup image set, the sample face images include: a first training image and multiple second training images, the sample imitation makeup image set includes: multiple sample imitation makeup images, each second training image is an image after each sample imitation makeup information is transferred to the first training image, and each sample imitation makeup information is the makeup information corresponding to each sample imitation makeup image.

[0077] It can be seen that the first training image is an image for training a preset convolutional neural network. Optionally, the first training image can be a standard face model image, wherein the standard face model image can have standard facial features, exposed forehead without bangs, no facial features blocked, facial features centered, and basically symmetrical left and right faces. Each second training image is an image after applying makeup to the first training image using makeup information corresponding to each sample imitation makeup image. It can be understood that, therefore, the reference face image and the first training image can be subtracted to obtain a target makeup material image. The sample imitation makeup image set can include multiple sample imitation makeup images, wherein the sample imitation makeup information of each sample imitation makeup image can be the same or different, which is not limited here.

[0078] It can be understood that the preset convolutional neural network provided in the embodiments of the present application should have the function of makeup migration. In some embodiments, from the perspective of network structure, the preset convolutional neural network provided in the present application may include: input layer: used for input of the makeup image to be imitated; convolution layer: using convolution kernel for feature extraction and feature mapping; excitation layer: since convolution is also a linear operation, it is necessary to add nonlinear mapping; pooling layer: realize downsampling, realize sparse processing of feature maps, reduce the amount of data calculation while retaining important feature information; fully connected layer: re-fitting at the tail of the preset convolutional neural network to reduce the loss of feature information; output layer: used to output the result, that is, output the reference face image.

[0079] In some embodiments, specifically when performing migration, a preset convolutional neural network can be configured to migrate all the imitation makeup information of the image to be imitated to the first training image; alternatively, part of the imitation makeup information of the image to be imitated can be migrated to the first training image, for example, only the imitation makeup information of the eye area can be migrated. This is not limited here and can be flexibly selected according to the actual application scenario.

[0080] S103, acquiring a target imitation makeup image according to the first training image, the reference face image and the target user image, where the target user image includes: a face region image.

[0081] The target user image may be an image taken by the user through a camera, and optionally, the target user image may be an image with makeup or an image without makeup, which is not limited here. The target imitation makeup image is an image obtained by imitating the makeup to be imitated image using the target user image.

[0082] Among them, when the target user image is an image without makeup, the target user image can be subjected to an imitation makeup operation according to the first training image and the reference face image to obtain a target imitation makeup image; when the target user image is an image with makeup, the target user image can be subjected to a makeup removal operation, and then, the target user image can be subjected to an imitation makeup operation according to the first training image and the reference face image to obtain a target imitation makeup image. Optionally, in some embodiments, the imitation makeup information of the image to be imitated can be superimposed on the target user image to obtain the target imitation makeup image. This is not limited here and can be flexibly operated according to the actual application scenario.

[0083] In summary, the real-time makeup imitation method provided by the embodiment of the present application includes: obtaining a makeup image to be imitated, the makeup image to be imitated includes: a face area image; according to a preset convolutional neural network, obtaining the makeup imitation information of the makeup image to be imitated, and migrating the makeup imitation information to a first training image to obtain a reference face image, the preset convolutional neural network is trained and obtained according to a training image set, the training image set includes: a sample face image, a sample makeup imitation image set, the sample face image includes: a first training image and a plurality of second training images, the sample makeup imitation image set includes: a plurality of sample makeup imitation images, each second training image is an image after each sample makeup imitation information is migrated to the first training image, and each sample makeup imitation information is makeup information corresponding to each sample makeup imitation image; according to the first training image, the reference face image and the target user image, obtaining a target makeup imitation image, the target user image includes: a face area image, so that according to the preset convolutional neural network, any makeup image to be imitated can be imitated in real time to obtain the target makeup imitation image, so that the user can customize the makeup in real time and improve the user experience.

[0084] Optionally, in some embodiments, the above-mentioned imitation makeup method can also be combined with imitation makeup methods for other parts, for example, it can be combined with neck imitation makeup, lower body imitation makeup, etc., which is not limited here and can be flexibly combined according to actual application scenarios.

[0085] Figure 2 A flowchart of another real-time makeup imitation method provided in an embodiment of the present application. Figure 2 As shown, the above method of obtaining a target imitation makeup image according to the first training image, the reference face image and the target user image includes:

[0086] S201. Obtain a target makeup material image according to a first training image and a reference face image.

[0087] It can be understood that, since the reference face image is obtained by transferring the imitation makeup information of the makeup image to be imitated to the first training image, the target makeup material image can be obtained by subtracting the reference face image from the first training image.

[0088] S202: fusing the target makeup material image and the target user image to obtain a target imitation makeup image after imitation makeup.

[0089] It can be understood that the target makeup material image obtained will include the imitation makeup information of the makeup image to be imitated, so the target makeup material image and the target user image can be fused, and the fused image is the target imitation makeup image. It can be seen that by using the real-time imitation makeup method provided in the embodiment of the present application, the user can imitate any makeup image to be imitated, thereby improving the applicability of the imitation makeup method.

[0090] Figure 3 A flowchart of another real-time makeup imitation method provided in an embodiment of the present application is shown below. Figure 4 A schematic diagram of a triangular mesh construction provided in an embodiment of the present application. Optionally, Figure 3 As shown, the above-mentioned fusion processing of the target makeup material image and the target user image to obtain the target imitation makeup image after the imitation makeup includes:

[0091] S301. According to a face detection algorithm, respectively detect a first face point set in a target makeup material image and a second face point set in a target user image.

[0092] Optionally, the face detection algorithm may include: Active Shape Model (ASM) algorithm, Active Appearance Model (AAM) algorithm, Cascaded pose regression (CPR), a deep learning-based method, etc., which are not limited here.

[0093] Among them, for the target makeup material image and the target user image, the first face point set in the target makeup material image and the second face point set in the target user image can be detected respectively according to the face detection algorithm, wherein the first face point set can include multiple first face points, and the second face point set can include multiple second face points. Taking the first face point set as an example for explanation, the multiple first face points can be face points in the facial features area. Of course, the present application does not limit the number of first face points in the first face point set. Optionally, its value can be any number between 10 and 120, or other numbers, which are not limited here.

[0094] S302: Based on the first face point set and the second face point set, a preset grid deformation algorithm is used to superimpose the target makeup material image onto the target user image to obtain a target imitation makeup image.

[0095] Optionally, the preset mesh deformation algorithm may be a mesh warp algorithm. Figure 4 In the method for constructing a triangular mesh, after obtaining a first face point set and a second face point set, a first triangular mesh can be constructed according to each first face point in the first face point set, and a second triangular mesh can be constructed according to each second face point in the second face point set. The target makeup material image is used as a texture, and the first triangular mesh of the target makeup material image is rendered onto the second triangular mesh corresponding to the target user image through rendering technology (for example, GL rendering technology) and superimposed to obtain a target imitation makeup image.

[0096] Optionally, the preset convolutional neural network is optimized and updated according to the loss value, wherein the loss value includes at least one of the following: a visual geometry group network loss value, a generative adversarial network loss value, and a color loss value, the visual geometry group network loss value is calculated based on the first training image and the second training image, and the generative adversarial network loss value is calculated based on the second training image and the sample imitation makeup image.

[0097] Optionally, the preset convolutional neural network may include: a maximum-minimum pooling layer, the maximum-minimum pooling layer is used to merge and convolve the first pooling features output by the maximum pooling layer and the second pooling features output by the minimum pooling layer, and the minimum pooling layer is used to obtain the minimum feature value in the pooling window.

[0098] Among them, the pooling layer in the aforementioned network structure can specifically be a maximum-minimum pooling layer, which is used to merge and convolve the first pooling feature output by the maximum pooling layer and the second pooling feature output by the minimum pooling layer. Of course, it should be noted that the preset convolutional neural network should also include: a convolution layer, a nonlinear layer, a fully connected layer, etc., which are not limited here. It should be noted that the minimum pooling layer is used to obtain the minimum eigenvalue in the pooling window, and the maximum pooling layer is used to obtain the maximum eigenvalue in the pooling window. It can be understood that for the makeup image to be imitated, since many important information of the makeup image to be imitated will be expressed in the maximum and minimum values ​​within a window, the maximum-minimum pooling layer proposed in this application can better capture the makeup information, and then when performing real-time makeup imitation based on the captured imitation makeup information, a more realistic and natural target imitation makeup image can be obtained.

[0099] Optionally, the maximum and minimum pooling layer can be expressed as: MaxThenMinPool(kernel_size, stride, padding), where kernel_size represents the size of the pooling window, stride represents the moving step of the pooling window, and padding represents the size of the boundary supplementary pixels. The output of the maximum and minimum pooling layer can be expressed as:

[0100] maxThenMinPoolOutput=conv(concat(MaxPoolOutput, MinPoolOutput)). That

[0101] In the figure, conv() represents a convolution operation, concat() represents a merge operation, MaxPoolOutput represents the first pooled feature output by the maximum pooling layer, and MinPoolOutput represents the second pooled feature output by the minimum pooling layer. That is, maxThenMinPoolOutput is obtained by concat and convolving MaxPoolOutput and MinPoolOutput.

[0102] Among them, MaxPoolOutput=MaxPool(input), MinPoolOutput=-log(MaxPool(e -input )), that is, the first pooling feature is obtained by performing maximum pooling on the input feature input, and the second pooling feature is obtained by performing minimum pooling on the input feature input.

[0103] It is understandable that during the training process of the preset convolutional neural network, it is necessary to continuously optimize and update. Optionally, when specifically updating, it can be optimized and updated according to the loss value. Among them, the visual geometry group network (Visual Geometry Group Network, VGG) loss value and the generative adversarial network (Generative Adversarial Network, GAN) loss value can represent the global loss value of the preset convolutional neural network, and the color loss value (color loss) can represent the local loss value of the preset convolutional neural network. Based on the above description, it can be understood that, to a certain extent, the visual geometry group network loss value can represent the similarity between the first training image and the second training image, and the generative adversarial network loss value can represent the similarity between the second training image and the sample imitation makeup image. By applying the embodiment of the present application, a preset convolutional neural network with good stability can be optimized, and when real-time imitation makeup is performed through the preset convolutional neural network, a more realistic and delicate real-time imitation makeup effect can be obtained.

[0104] Optionally, the real-time makeup imitation method may be deployed on a cloud server, that is, the execution subject of the real-time makeup imitation method may be a cloud server, and the acquisition of the makeup image to be imitated may include: receiving the makeup image to be imitated sent by the user terminal; after the target makeup material image is acquired according to the first training image and the reference face image, the method may further include:

[0105] The target makeup material image is sent to the user terminal, so that the user terminal generates a target imitation makeup image according to the target makeup material image and the target user image.

[0106] Among them, the user terminal can be a smart phone, a tablet computer, a car terminal, etc., which is not limited here. Optionally, the user terminal can download any image from the Internet as the makeup image to be imitated, or can select any image from the local album as the makeup image to be imitated, or can obtain it through web crawler technology, which is not limited here and can be flexibly selected according to the actual application scenario. After obtaining the makeup image to be imitated, the user terminal can send the makeup image to the cloud server. After the cloud server receives the makeup image to be imitated, it can refer to the above method to obtain a reference face image, and obtain the target makeup material image according to the first training image and the reference face image. For the description of this part, please refer to the above related description, and this application will not repeat it here.

[0107] Among them, for the cloud server, after obtaining the target makeup material image, the cloud server can return the target makeup material image to the user terminal. After receiving the target makeup material image, the user terminal can refer to the aforementioned method to fuse the target makeup material image and the target user image to obtain the target imitation makeup image after imitation makeup. For the description of this part, please refer to the aforementioned related description, and this application will not repeat it here. Applying the embodiment of the present application, it can be seen that the process of obtaining the target makeup material image can be completed by the cloud server, and the process of fusing the target makeup material image and the target user image to obtain the target imitation makeup image after imitation makeup can be completed by the user terminal, so that for the user terminal, the processing performance can be guaranteed, the generation efficiency of the target imitation makeup image can be improved, the real-time performance can be guaranteed, and the user experience can be improved.

[0108] Figure 5 The flowchart of a neural network training acquisition method based on imitation makeup provided in the embodiment of the present application is shown in FIG. The execution subject of the method may be the same as or different from the execution subject of the aforementioned real-time imitation makeup method, and is not limited here. Figure 5 As shown, the method may include:

[0109] S401, obtaining a training image set, the training image set comprising sample face images and a sample imitation makeup image set, the sample face images comprising: a first training image and a plurality of second training images.

[0110] The sample imitation makeup image set includes: a plurality of sample imitation makeup images, each second training image is an image obtained by transferring each sample imitation makeup information to the first training image, and each sample imitation makeup information is makeup information corresponding to each sample imitation makeup image.

[0111] Optionally, in the multiple sample imitation makeup images, the sample imitation makeup information of each sample imitation makeup image may be the same or different, which is not limited here. It can be understood that since each second training image is an image after each sample imitation makeup information is transferred to the first training image, the preset convolutional neural network is trained and obtained according to the first training image, the multiple second training images and the sample imitation makeup image set.

[0112] S402: According to the training image set, a preset convolutional neural network is trained and acquired, where the preset convolutional neural network is used to acquire imitation makeup information of the makeup image to be imitated, and transfer the imitation makeup information to the first training image.

[0113] Among them, the preset convolutional neural network includes: a maximum-minimum pooling layer, the maximum-minimum pooling layer is used to merge and convolve the first pooling features output by the maximum pooling layer and the second pooling features output by the minimum pooling layer, and the minimum pooling layer is used to obtain the minimum feature value in the pooling window.

[0114] For the description of the preset convolutional neural network, please refer to the above-mentioned related description, which will not be repeated here. After obtaining the training image set, the preset convolutional neural network can be trained based on the training image set. Among them, the maximum and minimum pooling layer in the trained preset convolutional neural network can better capture the imitation makeup information of the makeup image to be imitated, and then when performing real-time imitation makeup based on the captured imitation makeup information, a more realistic and natural target imitation makeup image can be obtained.

[0115] Optionally, the preset convolutional neural network may include: a maximum-minimum pooling layer, the maximum-minimum pooling layer is used to merge and convolve the first pooling feature output by the maximum pooling layer and the second pooling feature output by the minimum pooling layer, and the minimum pooling layer is used to obtain the minimum feature value in the pooling window. For the description of this part, please refer to the relevant part mentioned above, and this application will not repeat it here.

[0116] Figure 6 A flowchart of another method for acquiring a neural network training based on imitation makeup provided in an embodiment of the present application. Figure 6 As shown, after the preset convolutional neural network is trained based on the training image set, the following steps are also included:

[0117] S501, calculating a loss value according to a first training image, a second training image, and a sample imitation makeup image.

[0118] Among them, the loss value includes at least one of the following: a visual geometry group network loss value, a generative adversarial network loss value, and a color loss value. The visual geometry group network loss value is calculated based on the first training image and the second training image, and the generative adversarial network loss value is calculated based on the second training image and the sample imitation makeup image.

[0119] S502: If it is determined that the loss value does not meet the preset convergence condition, adjust the preset convolutional neural network according to the loss value.

[0120] Among them, it can be understood that for the preset convolutional neural network obtained through training, in order to ensure the stability and robustness of the preset convolutional neural network, the loss value can be calculated based on the first training image, the second training image and the sample imitation makeup image; wherein, if it is determined that the loss value meets the preset convergence condition, the optimization update operation of the preset convolutional neural network can be stopped, otherwise the preset convolutional neural network can be adjusted according to the loss value, that is, the relevant parameters of the preset convolutional neural network can be adjusted according to the loss value. Of course, the present application does not limit the specific adjusted parameters here, which may be different according to the actual application scenario.

[0121] Optionally, if the loss value includes loss values ​​of multiple categories, the loss values ​​of the multiple categories can be superimposed to obtain a final loss value, and the relevant parameters of the preset convolutional neural network can be adjusted according to the final loss value.

[0122] Figure 7 A flowchart of another method for acquiring a neural network training based on imitation makeup provided in an embodiment of the present application. Optionally, the loss value includes: a color loss value; Figure 7 As shown, the above-mentioned calculation of the loss value based on the first training image, the second training image and the sample imitation makeup image includes:

[0123] S601 . Perform a segmentation operation on each sample imitation makeup image according to a first preset mask template set to obtain first preset region images corresponding to each sample imitation makeup image.

[0124] S602: Perform a segmentation operation on each first training image according to a second preset mask template set to obtain second preset region images corresponding to each first training image.

[0125] The first preset mask template set may include multiple first preset mask templates, and the second preset mask template set may include multiple second preset mask templates. For example, multiple first preset mask templates are used as an example for explanation. The multiple first preset mask templates mask1 may include mask templates corresponding to the eye area, eyebrow area, mouth area, etc. of the face. Of course, according to the actual application scenario, mask templates corresponding to other areas of the face may also be included, which is not limited here.

[0126] In some embodiments, the plurality of first preset mask templates may be pre-made mask templates, or the plurality of first preset mask templates may be determined according to each sample imitation makeup image and a preset mask template generation algorithm, which is not limited here. Optionally, the plurality of second preset mask templates may be the same as the plurality of first preset mask templates, which may improve the efficiency of mask template production.

[0127] S603 , using a preset color migration algorithm, migrate makeup information of each first preset region image corresponding to each sample imitation makeup image to each second preset region image, and obtain each migrated second preset region image.

[0128] Optionally, the preset color migration algorithm can be a histogram matching algorithm, wherein the principle of the histogram matching algorithm is to use the histogram of an image as a basis, so that the grayscale distribution of the original image is similar to the grayscale distribution of the reference image (having similar hue and contrast). When applied to the present application, the grayscale distribution of each second preset area image and each first preset area image after migration is similar.

[0129] For example, the first preset area image corresponding to each sample imitation makeup image includes: a first eye area, a first eyebrow area and a first lip area, and the second preset area image corresponding to the first training image includes: a second eye area, a second eyebrow area and a second lip area. It can be understood that through migration, the makeup information of the first eye area can be migrated to the second eye area, the makeup information of the first eyebrow area can be migrated to the second eyebrow area, and the makeup information of the first lip area can be migrated to the second lip area to obtain the migrated second eye area, second eyebrow area and second lip area respectively.

[0130] S604: Calculate and obtain a color loss value according to each first preset region image and each migrated second preset region image.

[0131] Optionally, when calculating the color loss value, each first preset area image and each migrated second preset area image may be subjected to a mean square error (L2 loss), and the calculated multiple L2 losses may be added together to obtain the final local color_loss.

[0132] For example, based on the above example, the mean square error of the first eye area and the migrated second eye area can be calculated to obtain L2_loss_1, the mean square error of the first eyebrow area and the migrated second eyebrow area can be calculated to obtain L2_loss_2, the mean square error of the first lip area and the migrated second lip area can be calculated to obtain L2_loss_3, and finally, the color loss value color_loss can be expressed as: color_loss=L2_loss_1+L2_loss_2+L2_loss_3.

[0133] Figure 8 This is a functional module diagram of another real-time makeup imitation device provided in the embodiment of the present application. The basic principle and technical effects of the device are the same as those of the corresponding method embodiment described above. For the sake of brief description, the parts not mentioned in this embodiment can be referred to the corresponding contents in the method embodiment. Figure 8 As shown, the real-time makeup imitation device 100 comprises:

[0134] The first acquisition module 110 is used to acquire a makeup image to be imitated, wherein the makeup image to be imitated includes: a face region image;

[0135] The second acquisition module 120 is used to acquire the imitation makeup information of the makeup image to be imitated according to a preset convolutional neural network, and transfer the imitation makeup information to a first training image to acquire a reference face image, wherein the preset convolutional neural network is acquired by training a training image set, wherein the training image set includes: a sample face image and a sample imitation makeup image set, wherein the sample face image includes: a first training image and a plurality of second training images, wherein the sample imitation makeup image set includes: a plurality of sample imitation makeup images, wherein each of the second training images is an image after each of the sample imitation makeup information is transferred to the first training image, and each of the sample imitation makeup information is makeup information corresponding to each of the sample imitation makeup images;

[0136] The third acquisition module 130 is used to acquire a target imitation makeup image according to the first training image, the reference face image and the target user image, wherein the target user image includes a face region image.

[0137] In an optional implementation, the third acquisition module 130 is specifically configured to acquire a target makeup material image according to the first training image and the reference face image;

[0138] The target makeup material image and the target user image are fused to obtain a target imitation makeup image after imitation makeup.

[0139] In an optional implementation, the third acquisition module 130 is specifically configured to detect the first face point set in the target makeup material image and the second face point set in the target user image respectively according to a face detection algorithm;

[0140] Based on the first face point set and the second face point set, a preset grid deformation algorithm is used to superimpose the target makeup material image onto the target user image to obtain the target imitation makeup image.

[0141] In an optional embodiment, the preset convolutional neural network includes: a maximum-minimum pooling layer, which is used to merge and convolve the first pooling features output by the maximum pooling layer and the second pooling features output by the minimum pooling layer, and the minimum pooling layer is used to obtain the minimum feature value in the pooling window.

[0142] In an optional embodiment, the preset convolutional neural network is optimized and updated according to a loss value, wherein the loss value includes at least one of the following: a visual geometry group network loss value, a generative adversarial network loss value, and a color loss value, wherein the visual geometry group network loss value is calculated based on the first training image and the second training image, and the generative adversarial network loss value is calculated based on the second training image and the sample imitation makeup image.

[0143] In an optional implementation, the first acquisition module 110 is specifically used to receive a makeup image to be imitated sent by a user terminal; the makeup imitation implementation module further includes: a sending module, used to send the target makeup material image to the user terminal, so that the user terminal generates the target makeup imitation image according to the target makeup material image and the target user image.

[0144] Fig. 9 This is a functional module diagram of a neural network training acquisition device based on imitation makeup provided in an embodiment of the present application. The basic principle and technical effects of the device are the same as those of the corresponding method embodiment described above. For the sake of brief description, the parts not mentioned in this embodiment can be referred to the corresponding contents in the method embodiment. Fig. 9 As shown, the neural network training acquisition device 200 includes:

[0145] The acquisition module 210 is used to acquire a training image set, wherein the training image set includes sample face images and a sample imitation makeup image set, wherein the sample face images include: a first training image and a plurality of second training images, and the sample imitation makeup image set includes: a plurality of sample imitation makeup images, wherein each of the second training images is an image obtained by transferring each sample imitation makeup information to the first training image, and each of the sample imitation makeup information is makeup information corresponding to each of the sample imitation makeup images;

[0146] The training module 220 is used to train and obtain a preset convolutional neural network according to the training image set, wherein the preset convolutional neural network is used to obtain the imitation makeup information of the makeup image to be imitated, and transfer the imitation makeup information to the first training image.

[0147] In an optional embodiment, the preset convolutional neural network includes: a maximum-minimum pooling layer, which is used to merge and convolve the first pooling features output by the maximum pooling layer and the second pooling features output by the minimum pooling layer, and the minimum pooling layer is used to obtain the minimum feature value in the pooling window.

[0148] In an optional embodiment, the training module 220 is further used to calculate a loss value according to the first training image, the second training image and the sample imitation makeup image, and the loss value includes at least one of the following: a visual geometry group network loss value, a generative adversarial network loss value, and a color loss value, the visual geometry group network loss value is calculated according to the first training image and the second training image, and the generative adversarial network loss value is calculated according to the second training image and the sample imitation makeup image;

[0149] If it is determined that the loss value does not meet the preset convergence condition, the preset convolutional neural network is adjusted according to the loss value.

[0150] In an optional implementation, the loss value includes: a color loss value; the training module 220 is further used to perform a segmentation operation on each of the sample imitation makeup images according to a first preset mask template set to obtain each first preset area image corresponding to each of the sample imitation makeup images;

[0151] Performing a segmentation operation on each of the first training images according to a second preset mask template set to obtain second preset area images corresponding to each of the first training images;

[0152] Using a preset color migration algorithm, the makeup information of each of the first preset area images corresponding to each of the sample imitation makeup images is migrated to each of the second preset area images, and each of the migrated second preset area images is obtained;

[0153] The color loss value is obtained by calculation according to each of the first preset area images and each of the migrated second preset area images.

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

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

[0156] Fig.10 The following is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device can be integrated into a server. Fig.10 As shown, the electronic device may include: a processor 510, a storage medium 520 and a bus 530, the storage medium 520 stores machine-readable instructions executable by the processor 510, when the electronic device is running, the processor 510 and the storage medium 520 communicate through the bus 530, and the processor 510 executes the machine-readable instructions to perform the steps of the above method embodiment. The specific implementation method and technical effect are similar and will not be repeated here.

[0157] Optionally, the present application further provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method embodiment are executed. The specific implementation method and technical effect are similar and will not be repeated here.

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

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

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

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

[0162] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0163] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application. It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A real-time makeup imitation method, characterized in that: include: Acquire a makeup image to be imitated, wherein the makeup image to be imitated is an image with makeup, and the makeup image to be imitated includes: a face area image; According to a preset convolutional neural network, the imitation makeup information of the makeup image to be imitated is obtained, and the imitation makeup information is transferred to a first training image to obtain a reference face image, wherein the preset convolutional neural network is obtained by training a training image set, wherein the training image set includes: a sample face image and a sample imitation makeup image set, wherein the sample face image includes: a first training image and a plurality of second training images, wherein the sample imitation makeup image set includes: a plurality of sample imitation makeup images, wherein each of the second training images is an image after each of the sample imitation makeup information is transferred to the first training image, wherein each of the sample imitation makeup information is makeup information corresponding to each of the sample imitation makeup images, and wherein the first training image is a standard face model image; A target imitation makeup image is acquired according to the first training image, the reference face image and the target user image, wherein the target user image includes a face region image.

2. The method according to claim 1, characterized in that The step of acquiring a target imitation makeup image according to the first training image, the reference face image, and the target user image includes: Acquire a target makeup material image according to the first training image and the reference face image; The target makeup material image and the target user image are fused to obtain a target imitation makeup image after imitation makeup.

3. The method according to claim 2, characterized in that The step of fusing the target makeup material image with the target user image to obtain a target imitation makeup image after imitation makeup includes: According to the face detection algorithm, respectively detecting a first face point set in the target makeup material image and a second face point set in the target user image; Based on the first face point set and the second face point set, a preset grid deformation algorithm is used to superimpose the target makeup material image onto the target user image to obtain the target imitation makeup image.

4. The method according to claim 1, characterized in that: The preset convolutional neural network includes: a maximum-minimum pooling layer, which is used to merge and convolve the first pooling features output by the maximum pooling layer and the second pooling features output by the minimum pooling layer, and the minimum pooling layer is used to obtain the minimum feature value in the pooling window.

5. The method according to any one of claims 1 to 4, characterized in that: The preset convolutional neural network is optimized and updated according to the loss value, wherein the loss value includes at least one of the following: a visual geometry group network loss value, a generative adversarial network loss value, and a color loss value. The visual geometry group network loss value is calculated based on the first training image and the second training image, and the generative adversarial network loss value is calculated based on the second training image and the sample imitation makeup image.

6. The method according to claim 2, characterized in that The step of obtaining the makeup image to be imitated includes: receiving the makeup image to be imitated sent by a user terminal; After obtaining the target makeup material image according to the first training image and the reference face image, the method further includes: The target makeup material image is sent to the user terminal, so that the user terminal generates the target imitation makeup image according to the target makeup material image and the target user image.

7. A neural network training acquisition method based on imitation makeup, characterized in that: include: Acquire a training image set, the training image set comprising sample face images and a sample imitation makeup image set, the sample face images comprising: a first training image and a plurality of second training images, the sample imitation makeup image set comprising: a plurality of sample imitation makeup images, each of the second training images being an image obtained by transferring each sample imitation makeup information to the first training image, and each of the sample imitation makeup information being makeup information corresponding to each of the sample imitation makeup images; According to the training image set, a preset convolutional neural network is trained and obtained, and the preset convolutional neural network is used to obtain the imitation makeup information of the makeup image to be imitated, and migrate the imitation makeup information to the first training image, the makeup image to be imitated is an image with makeup, and the makeup image to be imitated includes: a face area image, and the first training image is a standard face model image.

8. The method according to claim 7, characterized in that The preset convolutional neural network includes: a maximum-minimum pooling layer, which is used to merge and convolve the first pooling features output by the maximum pooling layer and the second pooling features output by the minimum pooling layer, and the minimum pooling layer is used to obtain the minimum feature value in the pooling window.

9. The method according to claim 7, characterized in that: After the preset convolutional neural network is obtained through training according to the training image set, the method further includes: Calculate a loss value according to the first training image, the second training image, and the sample imitation makeup image, wherein the loss value includes at least one of the following: a visual geometry group network loss value, a generative adversarial network loss value, and a color loss value, wherein the visual geometry group network loss value is calculated according to the first training image and the second training image, and the generative adversarial network loss value is calculated according to the second training image and the sample imitation makeup image; If it is determined that the loss value does not meet the preset convergence condition, the preset convolutional neural network is adjusted according to the loss value.

10. The method according to claim 9, characterized in that The loss value includes: a color loss value; and calculating the loss value according to the first training image, the second training image and the sample imitation makeup image includes: Performing a segmentation operation on each of the sample imitation makeup images according to a first preset mask template set to obtain first preset area images corresponding to each of the sample imitation makeup images; Performing a segmentation operation on each of the first training images according to a second preset mask template set to obtain second preset area images corresponding to each of the first training images; Using a preset color migration algorithm, the makeup information of each of the first preset area images corresponding to each of the sample imitation makeup images is migrated to each of the second preset area images, and each of the migrated second preset area images is obtained; The color loss value is obtained by calculation according to each of the first preset area images and each of the migrated second preset area images.

11. A real-time makeup imitation device, characterized in that: include: The first acquisition module is used to acquire a makeup image to be imitated, wherein the makeup image to be imitated is an image with makeup, and the makeup image to be imitated includes: a face area image; A second acquisition module is used to acquire the imitation makeup information of the makeup image to be imitated according to a preset convolutional neural network, and transfer the imitation makeup information to a first training image to acquire a reference face image, wherein the preset convolutional neural network is acquired by training a training image set, wherein the training image set includes: a sample face image and a sample imitation makeup image set, wherein the sample face image includes: a first training image and a plurality of second training images, wherein the sample imitation makeup image set includes: a plurality of sample imitation makeup images, wherein each of the second training images is an image after each of the sample imitation makeup information is transferred to the first training image, wherein each of the sample imitation makeup information is makeup information corresponding to each of the sample imitation makeup images, and wherein the first training image is a standard face model image; The third acquisition module is used to acquire a target imitation makeup image according to the first training image, the reference face image and the target user image, wherein the target user image includes a face area image.

12. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of any method as claimed in claims 1-10.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are executed.