Face freckle and acne removing and skin evening method and system based on generative adversarial network

Through the face freckle removal and skin smoothing methods based on the adversarial generation network, the problems of complex processes and limited effects in the existing technology are solved, and efficient and stable freckle removal and skin smoothing effects are achieved, and the advantages of free adjustment and robustness are provided.

CN120013748APending Publication Date: 2025-05-16FACEUNITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510158691.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-13
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

The existing facial freckle removal and skin smoothing solutions are complex and time-consuming. The freckle removal effect is limited by the accuracy of the acne detection network. The skin smoothing process is limited by a fixed threshold, and it is impossible to uniformly deal with areas with uneven skin tones.

Method used

The face freckle removal and skin uniforming method based on the adversarial generation network is adopted. By obtaining face images, correcting processing, inputting the training freckle removal and skin uniforming model, calculating the difference map and adjusting the processing, generating the face skin mask and mask processing, finally generating the output image.

Benefits of technology

The model generation ability and stability are improved, and the intensity of the freckle removal and skin uniformity effect can be freely adjusted through the idea of ​​differential graphs, which enhances the robustness of the model and avoids the loss of facial texture details.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120013748A_ABST
    Figure CN120013748A_ABST
Patent Text Reader

Abstract

The invention discloses a face freckle and acne removing and skin evening method and system based on a generative adversarial network, and belongs to the technical field of image processing. The face freckle and acne removing and skin evening method based on the generative adversarial network is characterized by comprising the following steps of performing correction processing on a face image to obtain a corrected face image; inputting the corrected face image into the trained freckle and acne removing and skin smoothing model to obtain an intermediate result image; comparing the intermediate result image with the corrected face image to obtain a difference image; performing adjustment processing on the face image according to the difference image to obtain a result image; inputting the face image into the skin segmentation model to obtain a face skin mask; and performing mask processing on the result image according to the face skin mask to obtain an output image. According to the method, the face is corrected, zoomed and cut out as network input, so that the model generation capability and stability are improved; the intensity of the freckle and acne removing and skin smoothing effects is freely adjusted by adjusting the intensity coefficient a.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method and system for removing acne spots and smoothing skin on the face based on a generative adversarial network. Background Art

[0002] The facial acne removal and skin smoothing solution relies on the adversarial generation algorithm. It can automatically identify acne blemishes based on the specific content of the facial area image and fill them with skin color. At the same time, it can smooth the skin of the facial area image according to the skin color distribution of the facial area image. In the field of portrait beautification, facial acne removal and skin smoothing are one of the most popular functions in beauty software. Traditional facial acne removal and skin smoothing solutions are usually divided into multiple tasks: first use a acne detection network to identify the acne area, then fill the acne area with the skin color around the acne, and finally adjust the local color and brightness of the face to achieve skin smoothing.

[0003] However, the process of such solutions is complicated and time-consuming. On the one hand, the effect of removing acne is limited by the accuracy of the acne detection network. On the other hand, the skin evenness process is limited by a fixed threshold, and areas with different degrees of uneven skin color cannot achieve uniform results. Summary of the invention

[0004] The purpose of the present invention is to provide a method and system for removing acne and smoothing skin on the face based on a generative adversarial network, which can freely adjust the degree of removing acne and smoothing skin.

[0005] In order to solve the above technical problems, the present invention provides a method for removing spots and acne on the face and smoothing the skin based on a generative adversarial network, comprising the following steps:

[0006] Get face image;

[0007] Performing correction processing on the face image to obtain a corrected face image;

[0008] Input the corrected face image into the trained acne removal and skin smoothing model to obtain an intermediate result image;

[0009] Compare the intermediate result image with the corrected face image to obtain a difference image;

[0010] The face image is adjusted and processed according to the difference image to obtain a result image;

[0011] Input the face image into the skin segmentation model to obtain the face skin mask;

[0012] The result image is masked according to the face skin mask to obtain the output image.

[0013] Preferably, the facial image is corrected to obtain a corrected facial image, which specifically includes the following steps:

[0014] Based on face detection and face key point detector, obtain face image I src The key point coordinates of

[0015] According to the average face shape and the key point coordinates, the affine transformation matrix F is calculated;

[0016] Through the affine transformation matrix F, the face image I src Correction is performed to obtain the corrected face image I in .

[0017] Preferably, the intermediate result image is compared with the corrected face image to obtain a difference image, which specifically includes the following steps:

[0018] The intermediate result graph I out And the input face image I in Subtract them to get the comparison chart;

[0019] The comparison graph is inversely transformed using the affine transformation matrix F to obtain the difference graph I diff ; The difference map I diff and face image I src The same size.

[0020] Preferably, adjusting the face image according to the difference image to obtain a result image specifically includes the following steps:

[0021] The difference map I diff Multiply by the intensity coefficient a and add to the face image I src The result is shown in Figure I dst .

[0022] Preferably, the calculation formula for the output image is:

[0023] I′ dst =I mask I dst +(JI mask )·I src

[0024] Where: I′ dst is the output image; I mask is the face skin mask; J represents a matrix of all 1s, · represents matrix multiplication, and the value range is [0,1].

[0025] Preferably, the training process of the acne removal and skin smoothing model comprises the following steps:

[0026] Obtain sample images and target images; the sample images include portraits of people with different skin types, different ages and genders, different lighting conditions, and different facial postures; the target image is a picture obtained by an image beautifier after fine-tuning the image to remove acne and even out the skin;

[0027] Performing correction processing on the sample image to obtain a corrected sample image;

[0028] The corrected sample image and the target image are input into the acne removal and skin smoothing model for training, so as to obtain the trained acne removal and skin smoothing model.

[0029] Preferably, the acne removal and skin smoothing model includes a generator and a discriminator;

[0030] The generator includes a lightweight U-shaped encoding and decoding network, and the network input and output are normalized to the range of [-1, 1]. The ECA attention mechanism is used in the downsampling process of the generator, and the channel attention mechanism is introduced into the convolutional neural network to perform global adaptive weighting on the feature map of each channel. The upsampling of the generator adopts deconvolution. The network output layer selects tanh as the activation function.

[0031] A multi-scale discriminator is used to enhance the discriminative ability of the discriminator. The discriminator concatenates the generator output or the labeled image with the generator input as the discriminator input. Another discriminator input of the multi-scale discriminator is obtained by direct downsampling. The discriminator network output is a feature map of 5 different scales in the network. The spectralnorm layer is selected to limit the drastic degree of function change.

[0032] Preferably, the decision device Loss adopts GAN loss;

[0033] The decision device Loss is expressed as:

[0034]

[0035] Where: α, β represent the corresponding loss weights; fake, real represent the acne removal and skin smoothing result image and acne removal and skin smoothing target image generated by the generator network respectively; D fake and D real They represent the outputs of fake and real after passing through the decision network.

[0036] Preferably, the generator Loss introduces VGG perceptual loss and adds L1 loss;

[0037] The generator Loss is specifically expressed as:

[0038] Loss G =γ*L1(D fake ,D real )+δ*L VGG (fake,real)

[0039] Where: γ, δ represent the corresponding loss weights; L1 represents L1 loss.

[0040] The present invention also provides a facial acne removal and skin smoothing system based on a generative adversarial network, which is used to implement the facial acne removal and skin smoothing method based on a generative adversarial network as described in any one of claims 1 to 9, characterized in that it includes:

[0041] An acquisition module, used for acquiring a face image;

[0042] A correction module is used to correct the face image to obtain a corrected face image;

[0043] The acne removal and skin smoothing module is used to input the corrected face image into the trained acne removal and skin smoothing model to obtain an intermediate result image;

[0044] The difference module is used to compare the intermediate result image with the corrected face image to obtain a difference image;

[0045] An adjustment module, used for adjusting the face image according to the difference image to obtain a result image;

[0046] A mask generation module is used to input a face image into a skin segmentation model to obtain a face skin mask;

[0047] The masking module is used to mask the result image according to the face skin mask to obtain the output image.

[0048] Compared with the prior art, the present invention has the following beneficial effects:

[0049] The present invention corrects, scales and cuts out the face as network input, thereby improving the model generation capability and stability;

[0050] The present invention uses the idea of ​​differential image to apply the corrected face image to the face image, and freely adjusts the intensity of the acne removal and skin-toning effect by adjusting the intensity coefficient a;

[0051] The present invention uses a variety of data enhancements, including affine transformation, local occlusion, image degradation, image contrast and saturation adjustment, and adding random noise to enhance the robustness of the model;

[0052] The generator of the present invention adopts the ECA attention mechanism in the downsampling process, introduces the channel attention mechanism into the convolutional neural network, and improves the feature expression ability by globally adaptively weighting the feature map of each channel. The upsampling of the generator adopts deconvolution instead of direct scaling to avoid the loss of facial texture details;

[0053] The present invention obtains another discriminator input of the multi-scale discriminator by directly downsampling, and the discriminator network output is a feature map of 5 different scales in the network. During training, the spectral norm layer is selected to limit the drastic degree of function change, thereby making the model more stable. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The specific implementation modes of the present invention are further described in detail below with reference to the accompanying drawings.

[0055] Figure 1 It is a flow chart of a method for removing acne spots and smoothing skin on the face based on a generative adversarial network according to the present invention;

[0056] Figure 2 The affine transformation matrix F and the corrected face image I are calculated in step 1 in Schematic diagram of the process;

[0057] Figure 3 The output image I′ is calculated in steps 2 and 3 dst Schematic diagram of the process;

[0058] Figure 4 It is a comparison picture of the human face before and after removing acne spots and smoothing skin in Example 1. DETAILED DESCRIPTION

[0059] Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention, so the present invention is not limited to the specific implementation disclosed below.

[0060] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0061] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0062] The present invention is further described in detail below in conjunction with the accompanying drawings:

[0063] The present invention provides a method for removing spots and acne on the face and smoothing the skin based on a generative adversarial network, comprising the following steps:

[0064] Get face image;

[0065] Performing correction processing on the face image to obtain a corrected face image;

[0066] Input the corrected face image into the trained acne removal and skin smoothing model to obtain an intermediate result image;

[0067] Compare the intermediate result image with the corrected face image to obtain a difference image;

[0068] The face image is adjusted and processed according to the difference image to obtain a result image;

[0069] Input the face image into the skin segmentation model to obtain the face skin mask;

[0070] The result image is masked according to the face skin mask to obtain the output image.

[0071] Preferably, the facial image is corrected to obtain a corrected facial image, which specifically includes the following steps:

[0072] Based on face detection and face key point detector, obtain face image I src The key point coordinates of

[0073] According to the average face shape and the key point coordinates, the affine transformation matrix F is calculated;

[0074] Through the affine transformation matrix F, the face image I src Correction is performed to obtain the corrected face image I in .

[0075] Preferably, the intermediate result image is compared with the corrected face image to obtain a difference image, which specifically includes the following steps:

[0076] The intermediate result graph I outAnd the input face image I in Subtract them to get the comparison chart;

[0077] The comparison graph is inversely transformed using the affine transformation matrix F to obtain the difference graph I diff ; The difference map I diff and face image I src The same size.

[0078] Preferably, adjusting the face image according to the difference image to obtain a result image specifically includes the following steps:

[0079] The difference map I diff Multiply by the intensity coefficient a and add to the face image I src The result is shown in Figure I dst .

[0080] Preferably, the calculation formula for the output image is:

[0081] I′ dst =I mask I dst +(JI mask )·I src

[0082] Where: I′ dst is the output image; I mask is the face skin mask; J represents a matrix of all 1s, · represents matrix multiplication, and the value range is [0,1].

[0083] Preferably, the training process of the acne removal and skin smoothing model comprises the following steps:

[0084] Obtain sample images and target images; the sample images include portraits of people with different skin types, different ages and genders, different lighting conditions, and different facial postures; the target image is a picture obtained by an image beautifier after fine-tuning the image to remove acne and even out the skin;

[0085] Performing correction processing on the sample image to obtain a corrected sample image;

[0086] The corrected sample image and the target image are input into the acne removal and skin smoothing model for training, so as to obtain the trained acne removal and skin smoothing model.

[0087] Preferably, the acne removal and skin smoothing model includes a generator and a discriminator;

[0088] The generator includes a lightweight U-shaped encoding and decoding network, and the network input and output are normalized to the range of [-1, 1]. The ECA attention mechanism is used in the downsampling process of the generator, and the channel attention mechanism is introduced into the convolutional neural network to perform global adaptive weighting on the feature map of each channel. The upsampling of the generator adopts deconvolution. The network output layer selects tanh as the activation function.

[0089] A multi-scale discriminator is used to enhance the discriminative ability of the discriminator. The discriminator concatenates the generator output or the labeled image with the generator input as the discriminator input. Another discriminator input of the multi-scale discriminator is obtained by direct downsampling. The discriminator network output is a feature map of 5 different scales in the network. The spectralnorm layer is selected to limit the drastic degree of function change.

[0090] Preferably, the decision device Loss adopts GAN loss;

[0091] The decision device Loss is expressed as:

[0092]

[0093] Where: α, β represent the corresponding loss weights; fake, real represent the acne removal and skin smoothing result image and acne removal and skin smoothing target image generated by the generator network respectively; D fake and D real They represent the outputs of fake and real after passing through the decision network.

[0094] Preferably, the generator Loss introduces VGG perceptual loss and adds L1 loss;

[0095] The generator Loss is specifically expressed as:

[0096] Loss G =γ*L1(D fake ,D real )+δ*L VGG (fake,real)

[0097] Where: γ, δ represent the corresponding loss weights; L1 represents L1 loss.

[0098] The present invention also provides a facial acne removal and skin smoothing system based on a generative adversarial network, which is used to implement the facial acne removal and skin smoothing method based on a generative adversarial network as described in any one of claims 1 to 9, characterized in that it includes:

[0099] An acquisition module, used for acquiring a face image;

[0100] A correction module is used to correct the face image to obtain a corrected face image;

[0101] The acne removal and skin smoothing module is used to input the corrected face image into the trained acne removal and skin smoothing model to obtain an intermediate result image;

[0102] The difference module is used to compare the intermediate result image with the corrected face image to obtain a difference image;

[0103] An adjustment module, used for adjusting the face image according to the difference image to obtain a result image;

[0104] A mask generation module is used to input a face image into a skin segmentation model to obtain a face skin mask;

[0105] The masking module is used to mask the result image according to the face skin mask to obtain the output image.

[0106] In order to better illustrate the technical effect of the present invention, the present invention provides the following specific embodiments to illustrate the above technical process:

[0107] Embodiment 1: A method for removing acne spots and smoothing skin on the face based on a generative adversarial network, such as Figure 1 As shown, the following steps are included:

[0108] 1. If Figure 2 As shown, in order to improve the model generation capability and stability, the present invention does not directly use the original image as the network input, but corrects, scales and cuts out the face as the network input. In this way, the face in the network input has a high screen ratio, the input effective information is increased, and the background interference to the network is avoided. Specifically, for the face image to be processed I src First, use face detection and face key point detector to obtain the key point coordinates of each face, then calculate the affine transformation matrix F according to the average face shape and the obtained key point coordinates, and apply the affine transformation matrix F to the face image to obtain the corrected face image I in .

[0109] 2. If Figure 3 As shown, the corrected face image I in Input into the acne removal and skin smoothing model to obtain the intermediate result Figure I out Since the intermediate result image is of low resolution, it is necessary to apply it to the face image with the help of the idea of ​​difference image. out And the input rectified face image I in Subtract, and use the affine transformation matrix F to inversely transform to the face image size to obtain the difference image I diff Finally, the difference image I diff Multiply by the intensity coefficient a and add to the face image Isrc The result of obtaining the original image size is shown in Figure I dst Here, users can freely adjust the intensity of the acne removal and skin-toning effect by adjusting the intensity coefficient a.

[0110] Third, in order to prevent the parts outside the skin area of ​​the face from being changed under occlusion, the skin segmentation model is used to protect the areas outside the skin of the face. src Input into the skin segmentation model to obtain the face skin mask I mask , by masking, only the facial skin area is treated for acne removal and skin tone smoothing, and finally the image I′ is output dst It can be expressed as:

[0111] I′ dst =I mask I dst +(JI mask )·I src

[0112] Where J represents a matrix of all 1s, · represents matrix multiplication, and its value range is [0,1].

[0113] The model training of the above-mentioned acne removal and skin smoothing model is as follows:

[0114] The training data was obtained by collecting portrait data of different skin types, different ages and genders, different lighting, and different facial postures (sample images). At the same time, we specifically collected portrait data of people with severe acne, totaling 20,000. Professional image beautifiers refined the corresponding pictures after acne removal and skin smoothing, which were used as the target images in training. In order to enhance the robustness of the model, a variety of data enhancements were used, including affine transformation, local occlusion, image degradation, image contrast and saturation adjustment, and adding random noise.

[0115] The acne removal and skin smoothing model is constructed based on a generative adversarial network, which includes a generator and a discriminator. During training, the generator and discriminator networks work together, and during testing, only the generator is involved. Considering the time consumption problem on the mobile phone side, a face image of size 3x384x288 (image channel 3, width 288, height 384) is selected for generation during design.

[0116] The generator consists of a lightweight U-shaped encoder-decoder network. The network input and output are both 3x384x288 face images, and both input and output are normalized to the range of [-1,1]. The ECA attention mechanism is used in the downsampling process of the generator, and the channel attention mechanism is introduced into the convolutional neural network. By globally adaptively weighting the feature map of each channel, the feature expression ability is improved. The upsampling of the generator uses deconvolution instead of direct scaling to avoid the loss of facial texture details. Tanh is selected as the activation function of the network output layer.

[0117] A multi-scale discriminator is used to enhance the discriminative ability of the discriminator, making the output images of the generator more realistic. The discriminator concatenates the output or annotated image of the generator with the input of the generator as the input of the discriminator (the dimension is 6x384x288). Another discriminator input of the multi-scale discriminator is obtained by direct downsampling (the dimension is 6x192x144). The output of the discriminator network is the feature map of 5 different scales in the network. During training, the spectralnorm layer is selected to limit the drastic degree of function change, so as to make the model more stable.

[0118] The Adam optimizer is used for training the generator and the discriminator. The initial learning rate is 0.0002, and the learning rate decays according to the CosineAnnealing strategy. During training, the generator network is updated first and then the discriminator network is updated.

[0119] The decision maker Loss uses GAN loss. Since a multi-scale decision maker is used, the decision maker Loss is expressed as:

[0120]

[0121] Where: α, β represent the corresponding loss weights. In training, α is set to 1.0 and β is set to 0.8. fake and real represent the acne removal and skin smoothing result image and acne removal and skin smoothing target image generated by the generator network, respectively. fake , D real They represent the outputs of fake and real after passing through the decision network.

[0122] The generator loss introduces the VGG perceptual loss to ensure the consistency between the generator output (fake) and the target image (real). At the same time, the L1 loss is added to ensure that the details of the high-frequency area of ​​the generated image are not lost. The generator loss is specifically expressed as:

[0123] Loss G =γ*L1(D fake ,D real)+δ*L VGG (fake,real)

[0124] Where: γ, δ represent the corresponding loss weights, γ is set to 1.0, δ is set to 0.8 during training, and L1 represents L1 loss.

[0125] The final result is Figure 4 shown.

[0126] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules, modules or units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units, modules or components can be combined or integrated into another device, or some features can be ignored or not executed.

[0127] The units may or may not be physically separated, and the components displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

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

[0129] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part, and / or installed from a removable medium. When the computer program is executed by the central processing unit (CPU), the above-mentioned functions defined in the method of the present invention are executed. It should be noted that the above-mentioned computer-readable medium of the present invention can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of an electrical, magnetic, optical, electromagnetic, infrared segment, or semiconductor, or any combination of the above.

[0130] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0131] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for removing acne spots and smoothing skin on the face based on a generative adversarial network, characterized in that: The following steps are involved: Get face image; Performing correction processing on the face image to obtain a corrected face image; Input the corrected face image into the trained acne removal and skin smoothing model to obtain an intermediate result image; Compare the intermediate result image with the corrected face image to obtain a difference image; The face image is adjusted and processed according to the difference image to obtain a result image; Input the face image into the skin segmentation model to obtain the face skin mask; The result image is masked according to the face skin mask to obtain the output image.

2. The method for removing acne spots and smoothing skin on the face based on a generative adversarial network according to claim 1, characterized in that: Correcting the face image to obtain a corrected face image specifically includes the following steps: Based on face detection and face key point detector, obtain face image I src The key point coordinates of According to the average face shape and the key point coordinates, the affine transformation matrix F is calculated; Through the affine transformation matrix F, the face image I src Correction is performed to obtain the corrected face image I in .

3. The method for removing acne spots and smoothing skin on the face based on a generative adversarial network according to claim 2, characterized in that: Compare the intermediate result image with the corrected face image to obtain a difference image, which specifically includes the following steps: The intermediate result graph I out And the input face image I in Subtract them to get the comparison chart; The comparison graph is inversely transformed using the affine transformation matrix F to obtain the difference graph I diff ; The difference map I diff and face image I src The same size.

4. The method for removing acne spots and smoothing skin on the face based on a generative adversarial network according to claim 3, characterized in that: The face image is adjusted and processed according to the difference image to obtain a result image, which specifically includes the following steps: The difference map I diff Multiply by the intensity coefficient a and add to the face image I src The result is shown in Figure I dst .

5. The method for removing acne spots and smoothing skin on the face based on a generative adversarial network according to claim 4, characterized in that: The calculation formula of the output image is: I′ dst =I mask ·I dst +(J-I mask )·I src Where: I′ dst is the output image; I mask is the face skin mask; J represents a matrix of all 1s, · represents matrix multiplication, and the value range is [0,1].

6. The method for removing acne spots and smoothing skin on the face based on a generative adversarial network according to claim 5, characterized in that: The training process of the acne removal and skin smoothing model comprises the following steps: Obtain sample images and target images; the sample images include portraits of people with different skin types, different ages and genders, different lighting conditions, and different facial postures; the target image is a picture obtained by an image beautifier after fine-tuning the image to remove acne and even out the skin; Performing correction processing on the sample image to obtain a corrected sample image; The corrected sample image and the target image are input into the acne removal and skin smoothing model for training, so as to obtain the trained acne removal and skin smoothing model.

7. The method for removing acne spots and smoothing skin on the face based on a generative adversarial network according to claim 6, characterized in that: The acne removal and skin smoothing model includes a generator and a discriminator; The generator includes a lightweight U-shaped encoding and decoding network, and the network input and output are normalized to the range of [-1, 1]. The ECA attention mechanism is used in the downsampling process of the generator, and the channel attention mechanism is introduced into the convolutional neural network to perform global adaptive weighting on the feature map of each channel. The upsampling of the generator adopts deconvolution. The network output layer selects tanh as the activation function. A multi-scale discriminator is used to enhance the discriminative ability of the discriminator. The discriminator concatenates the generator output or the labeled image with the generator input as the discriminator input. Another discriminator input of the multi-scale discriminator is obtained by direct downsampling. The discriminator network output is a feature map of 5 different scales in the network. The spectral norm layer is selected to limit the drastic degree of function change.

8. The method for removing acne spots and smoothing skin on the face based on a generative adversarial network according to claim 7, characterized in that: The decision device Loss adopts GAN loss; The decision device Loss is expressed as: Where: α, β represent the corresponding loss weights; fake, real represent the acne removal and skin smoothing result image and acne removal and skin smoothing target image generated by the generator network respectively; D fake and D real They represent fake and real outputs after passing through the decision network.

9. The method for removing acne spots and smoothing skin on the face based on a generative adversarial network according to claim 8, characterized in that: The generator Loss introduces VGG perceptual loss; The generator Loss is specifically expressed as: Loss G =γ*L1(D fake ,D real )+δ*L VGG (fake, real) Where: γ, δ represent the corresponding loss weights; L1 represents L1 loss.

10. A facial acne removal and skin toning system based on a generative adversarial network, used to implement the facial acne removal and skin toning method based on a generative adversarial network as claimed in any one of claims 1 to 9, characterized in that: include: An acquisition module, used for acquiring a face image; A correction module is used to correct the face image to obtain a corrected face image; The acne removal and skin smoothing module is used to input the corrected face image into the trained acne removal and skin smoothing model to obtain an intermediate result image; The difference module is used to compare the intermediate result image with the corrected face image to obtain a difference image; An adjustment module, used for adjusting the face image according to the difference image to obtain a result image; A mask generation module is used to input a face image into a skin segmentation model to obtain a face skin mask; The masking module is used to mask the result image according to the face skin mask to obtain the output image.