Image style conversion method, device, electronic device and storage medium

By detecting faces in images and applying different style transfer models to the face region and other regions respectively, the problem of unclear face regions is solved, and the quality of image style transfer is improved.

CN112150489BInactive Publication Date: 2024-11-19BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011023355.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-25
Publication Date
2024-11-19
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In existing image stylization processes, facial areas often become blurry after style transfer, leading to a decrease in image quality.

Method used

By detecting whether an image contains a human face, a pre-trained face style transfer model and a preset style map are used to transfer color information only in the face region, avoiding the addition of texture information, and a pre-trained image style transfer model is used to transfer the style of other regions.

Benefits of technology

It improves the clarity of the face area and the overall style transfer quality of the image, ensuring that the face area is clear and the style transfer effect in other areas is good.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112150489B_ABST
    Figure CN112150489B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, electronic device and storage medium for image style conversion, which relates to the field of artificial intelligence technology, specifically the field of computer vision and deep learning technology. The specific implementation scheme is: detect whether the image to be processed includes a face; if it does, use a pre-trained face style conversion model and a preset style map to perform style conversion on the face area in the image to be processed, so that the face area after style conversion only carries the color information in the style map, but does not include the texture information in the style map; use a pre-trained image style conversion model and a preset style map to perform style conversion on other areas other than the face area in the image to be processed. The scheme of the present application can perform different style conversions on the face area and other areas when the image to be processed includes a face, which can effectively ensure the clarity of the face area and improve the quality of image style conversion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, in particular to the field of artificial intelligence technology, specifically to the field of computer vision and deep learning technology, and specifically to a method, device, electronic device and storage medium for image style conversion. Background Art

[0002] As users pursue art, stylized images are becoming more and more popular. Stylized images are images that incorporate the color, texture and other styles of the style image into the content image.

[0003] For example, in the prior art, during the image stylization process, a content map and a style map can be given, and a new image can be generated after passing through a neural network. This new image retains the semantic content of the content map, and also incorporates the color, texture and other style styles of the style map, which can meet the user's demand for personalized style. Summary of the invention

[0004] The present application provides a method, device, electronic device and storage medium for image style conversion.

[0005] According to one aspect of the present application, a method for style conversion of an image is provided, wherein the method comprises:

[0006] Detecting whether the image to be processed includes a face;

[0007] If included, using a pre-trained face style conversion model and a preset style map to perform style conversion on the face area in the image to be processed, so that the face area after style conversion only carries the color information in the style map, but does not include the texture information in the style map;

[0008] The pre-trained image style conversion model and the preset style map are used to perform style conversion on other areas outside the face area in the image to be processed.

[0009] According to another aspect of the present application, a method for training a style transfer model is provided, wherein the method comprises:

[0010] Collecting a plurality of training samples, each of which includes a content graph, a style graph, and a target result graph obtained based on an optimization method;

[0011] The style transfer model is trained using each of the training samples.

[0012] According to another aspect of the present application, a style conversion device for an image is provided, wherein the device comprises:

[0013] A detection module, used to detect whether the image to be processed includes a human face;

[0014] A face style conversion module, for, if included, using a pre-trained face style conversion model and a preset style map to perform style conversion on a face region in the image to be processed, so that the face region after style conversion only carries color information in the style map but does not include texture information in the style map;

[0015] The image style conversion module is used to use a pre-trained image style conversion model and the preset style map to perform style conversion on other areas outside the face area in the image to be processed.

[0016] According to another aspect of the present application, a training device for a style transfer model is provided, wherein the device comprises:

[0017] A collection module, used for collecting a plurality of training samples, each of which includes a content map, a style map, and a target result map obtained based on an optimization method;

[0018] The training module is used to train the style transfer model using each of the training samples.

[0019] According to yet another aspect of the present application, there is provided an electronic device, including:

[0020] at least one processor; and

[0021] a memory communicatively connected to the at least one processor; wherein,

[0022] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described above.

[0023] According to yet another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method as described above.

[0024] According to yet another aspect of the present application, a computer program product is provided, comprising a computer program, wherein the computer program implements the above method when executed by a processor.

[0025] According to the technology of the present application, by first detecting whether the image to be processed includes a face, if it does, using a pre-trained face style conversion model and a preset style map, style conversion is performed on the face area in the image to be processed, so that the face area after style conversion only carries the color information in the style map, but does not include the texture information in the style map, thereby making the face area after style conversion very clear; and using a pre-trained image style conversion model and a preset style map, style conversion is performed on other areas other than the face area in the image to be processed. When the image to be processed includes a face, different style conversions can be performed on the face area and other areas, which can effectively ensure the clarity of the face area and improve the quality of image style conversion.

[0026] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.

[0028] Figure 1 is a schematic diagram according to the first embodiment of the present application;

[0029] Figure 2 is a schematic diagram according to a second embodiment of the present application;

[0030] Figure 3 is a schematic diagram according to a third embodiment of the present application;

[0031] Figure 4 is a schematic diagram according to a fourth embodiment of the present application;

[0032] Figure 5 is a schematic diagram according to a fifth embodiment of the present application;

[0033] Figure 6 is a schematic diagram according to a sixth embodiment of the present application;

[0034] Figure 7 It is a block diagram of an electronic device used to implement the above method in an embodiment of the present application. DETAILED DESCRIPTION

[0035] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0036] Figure 1 is a schematic diagram according to the first embodiment of the present application; Figure 1 As shown, this embodiment provides a method for image style conversion, which may specifically include the following steps:

[0037] S101, detecting whether the image to be processed includes a face; if so, executing step S102; otherwise, executing step S103;

[0038] S102, using a pre-trained face style conversion model and a preset style map, performing style conversion on the face area in the image to be processed, so that the face area after style conversion only carries the color information in the style map, but does not include the texture information in the style map; executing step S104;

[0039] S103: Use a pre-trained image style conversion model and a preset style map to perform style conversion on other regions except the face region in the image to be processed, and end.

[0040] S104: Use a pre-trained image style conversion model to perform style conversion on other regions except the face region in the image to be processed, and end.

[0041] The execution subject of the image style conversion method of this embodiment is an image style conversion device, and the image style conversion device can be an electronic entity, or can also be a software integrated application.

[0042] In the existing image style conversion scheme, the image is directly style converted. When the image includes a face, the texture information and color information corresponding to the style map are added to the face, which makes the face very unclear and the quality of the result image obtained after the style conversion is very poor. Considering the above problems, in this embodiment, before performing the style conversion, the image to be processed is first detected to detect whether the image to be processed includes a face. If it does, a pre-trained face style conversion model and a preset style map are used to perform style conversion on the face area in the image to be processed. For example, in order to improve the quality of the style conversion of the face area, the face area after style conversion can only carry the color information of the style map, but not the texture information in the style map, which can ensure that the face area is very clear, thereby improving the quality of the style conversion of the face area. Then, the pre-trained image style conversion model and the preset style map are used to perform style conversion on other areas other than the face area in the image to be processed.

[0043] If the image to be processed does not include a face, the pre-trained image style conversion model and the preset style map can be directly used to perform style conversion on the image to be processed.

[0044] The face style transfer model of this embodiment is used to perform style transfer on the face area in the image, and may also be referred to as a face image style transfer model. In order to distinguish it from the image style transfer model, it may be referred to as a face style transfer model for short.

[0045] The image to be processed in this embodiment can also be called a content map, that is, it carries certain content information. The style map can carry specific color information and texture information. The purpose of style conversion in this embodiment is to convert the content map into a result map that carries the color information and texture information in the style map.

[0046] The image style conversion method of the present embodiment adopts the above-mentioned technical scheme, firstly detects whether the image to be processed includes a face, and if so, adopts a pre-trained face style conversion model and a preset style map to perform style conversion on the face area in the image to be processed, so that the face area after style conversion only carries the color information in the style map, but does not include the texture information in the style map, thereby making the face area after style conversion very clear; and adopts a pre-trained image style conversion model and a preset style map to perform style conversion on other areas other than the face area in the image to be processed; and if no face is included, directly adopts a pre-trained image style conversion model and a preset style map to perform style conversion on the image to be processed, which can effectively improve the clarity of the image after style conversion and improve the quality of image style conversion.

[0047] Optionally, the above step S101 of this embodiment can detect whether the image to be processed includes a face by using a pre-trained face detection model; if included, output the position information of the face region, that is, the position information of the face region in the image to be processed, so as to locate the face in the image to be processed, so as to facilitate the subsequent style conversion of the face region in the image to be processed according to step S102. In this way, the face region can be accurately detected to effectively improve the accuracy of the subsequent face style conversion.

[0048] For example, an open source face segmentation model can be used to extract the face segmentation mask. In order to avoid detecting the neck area, the facial key points can be obtained first, and then the nose is used as the center point, the distance from the center point to the upper edge of the segmentation is used as half the height, and the maximum distance from the center point to the left and right edges of the segmentation is used as half the width to obtain a rectangular frame of the face area.

[0049] In addition, optionally, in this embodiment, other methods may be used to detect whether the image to be processed includes a face, such as detecting the face area by detecting the face skin or the face contour, etc., which will not be described in detail here.

[0050] Figure 2 is a schematic diagram according to the second embodiment of the present application; Figure 2 As shown, this embodiment provides a method for training a style transfer model, which may specifically include the following steps:

[0051] S201, collecting a number of training samples, each of which includes a content map, a style map, and a target result map obtained based on an optimization method;

[0052] S202: Use the training samples mentioned above to train a style transfer model.

[0053] The execution subject of the style transfer model training method of this embodiment is a style transfer model training device, and the style transfer model training device can be an electronic entity, or can also be a software integrated application.

[0054] The training method of the style conversion model in this embodiment can be applied to Figure 1 The image style transfer model and the face style transfer model of the illustrated embodiment are trained.

[0055] In the training method of the style conversion model of this embodiment, the sampled training samples include a content map, a style map, and a target result map obtained based on the optimization method. If the style conversion model is a face style conversion model, the content map corresponds to a face map. Among them, the target result map obtained based on the optimization method, the target result map obtained by the optimization method, can enable the collected target result map to fully learn the texture information and color information in the style map, and then use the collected training samples to train the style conversion model, so that the style conversion model can fully learn the texture information and color information in the target result map.

[0056] The current academic community is quite popular in the study of stylization. Among them, the training of style transfer models is mainly divided into two directions: optimization-based methods and feedforward-based methods. The optimization-based method means that every time a content image comes, a model for the content image needs to be retrained to generate the corresponding result image. In this case, it will take several minutes to generate the result image each time. If used in products, it will cause users to wait too long, seriously affecting the user experience. Another direction is the feedforward-based method, that is, after the model is trained, the model is fixed. Every time a content image comes, only one model feedforward is needed to get the output result image. However, the texture effect generated by this method is poor, which is quite different from the style image. Usually, although the overall color texture transformation is learned, the overall thread and brush strokes are not learned. Therefore, the existing optimization-based method is extremely slow, generally taking several minutes; and the feedforward-based method does not learn the texture effect well.

[0057] In the training method of the style transfer model of this embodiment, the target result image in the training sample is obtained based on the optimization method, which can improve the quality of the training sample. Then, the style transfer model is further trained using several collected training samples to ensure that the style transfer model can fully learn the texture information and color information in the target result image. That is, the training method of this embodiment effectively combines the optimization method and the feedforward-based method, so that the style transfer model can not only fully learn the texture information and color information in the target result image, but also can directly use the trained style transfer model when performing style conversion, effectively saving the time of style conversion and improving the efficiency of style conversion.

[0058] Figure 3 is a schematic diagram according to the third embodiment of the present application; Figure 3 As shown in the above Figure 2 Based on the illustrated embodiment, a training method for a style transfer model is provided in detail, which may specifically include the following steps:

[0059] S301, collecting a number of training samples, each of which includes a content graph, a style graph, and a target result graph obtained based on an optimization method;

[0060] S302: For each training sample, obtain a prediction result graph output by the corresponding style conversion model;

[0061] S303, constructing a corresponding first loss function based on the corresponding training sample and the corresponding prediction result graph;

[0062] S304, determine whether the first loss function converges, if not, execute step S305; if converged, execute step S306;

[0063] S305, adjusting the parameters of the style transfer model so that the first loss function converges toward convergence; returning to step S302, and continuing training with the next training sample;

[0064] S306, determining whether the first loss function always converges in consecutive preset rounds of training; if so, determining the parameters of the style transfer model, and then determining the style transfer model, and the training ends; otherwise, returning to step S302, and continuing the training with the next training sample.

[0065] This step S306 is the termination condition of the training. The continuous preset number of rounds may refer to 50, 80, 100 or other integers. If the first loss function always converges in the continuous preset number of rounds of training, it means that the style transfer model has been trained very accurately, and the training can be terminated, and the parameters of the style transfer model can be saved as the parameters of the trained style transfer model. Optionally, the termination condition of the training here can also be reaching a preset number of training iterations, such as one million times or other integers, which is not limited here.

[0066] The above steps S302-S306 are Figure 2 A specific implementation of step S201 of the illustrated embodiment.

[0067] When the content graph of the training samples collected in this embodiment, the MS-COCO-2014 data set can be used. The data set contains more than 80,000 images, covering various scenes such as indoor and outdoor, people, scenery, food, animals, etc., which are taken from real life and are closer to the user's shooting scene. The style graph of this embodiment can use famous paintings with obvious artistic styles such as Van Gogh and Monet. For example, Van Gogh's Starry Night can be used as a style graph. In addition, in practical applications, any image with specific color information and texture information can also be used as a style graph.

[0068] Further optionally, the above Figure 3Step S303 of the illustrated embodiment constructs a corresponding first loss function based on the corresponding training sample and the corresponding prediction result graph, which may specifically include the following steps:

[0069] (a1) For each training sample, a discriminator loss function is constructed based on the target result graph and the predicted result graph;

[0070] (b1) constructing a pixel difference loss function based on the pixel values ​​of each pixel point in the target result image and the predicted result image;

[0071] (c1) Based on each training sample and the corresponding prediction result graph, construct at least one of a style loss function, a total variation loss function and a boundary loss function.

[0072] (d1) constructing a first loss function based on at least one of a style loss function, a total variation loss function, and a boundary loss function, and combining a discriminator loss function and a pixel difference loss function.

[0073] The style transfer model of this embodiment can adopt the Generative Adversarial Networks (GAN) model. The training data appears in pairs, and each pair includes a content map, a style map, and a result map. Therefore, in this embodiment, the pix2pix training framework can be used. The original framework of pix2pix contains two loss functions: 1) discriminator loss function; 2) pixel difference loss function.

[0074] Among them, the discriminator loss function is used to judge the target result image and the predicted result image respectively, whether it belongs to the target result image or the predicted result image. If the judgment is correct, it means that the difference between the predicted result image and the target result image is large, and further training is needed; otherwise, if the judgment is wrong, it means that the difference between the two is small, which means that the trained image style transfer model is close to accuracy. The purpose of training is to make the difference between the two small enough.

[0075] The pixel difference loss function represents the difference in pixel values ​​between the generated prediction result image and the corresponding target result image. In specific implementation, the average value of the difference in pixel values ​​of all pixels in the prediction result image and the target result image can be taken. If the difference in pixel values ​​is large, training needs to be continued. Otherwise, if the difference in pixel values ​​is small, it means that the trained style transfer model is close to accuracy. Similarly, the purpose of training is to make the difference in pixel values ​​small enough.

[0076] Furthermore, in this embodiment, on the basis of the above two loss functions, in order to further improve the effect of the style transfer model, at least one of the following three loss functions may be added to further ensure the quality of the generated style map.

[0077] A) Style loss function, which is used to determine whether the predicted result image and the target result image are consistent in style. Drawing on the ideas in the field of style transfer, the Gram Matrix is ​​used here as a measure of style. The Gram Matrix is ​​defined as the eccentric covariance matrix between features (that is, the covariance matrix without subtracting the mean). In the feature map, each number represents the strength of a feature, and the Gram Matrix actually calculates the correlation between two features, which two features appear at the same time, which two are mutually exclusive, and so on. At the same time, the diagonal elements of the Gram Matrix also reflect the amount of each feature appearing in the image. Therefore, the Gram Matrix helps to grasp the general style of the entire image. With the Gram Matrix representing the style, to measure the difference in style between two images, you only need to compare the difference in their Gram Matrices.

[0078] Specifically, the feature matrices of the two images can be extracted separately. For example, the feature matrix of the image can be represented by an N*M matrix, that is, there are N pixels in the image, and each pixel is represented by an M-dimensional vector. Then, (N*M)*(M*N) is used to obtain an N*N Gram Matrix, that is, the correlation between the two features. Then, the difference of each position in the N*N matrix of the two images is calculated, and the average is taken as the style loss function.

[0079] Similarly, if the difference represented by the style loss function is large, then training needs to continue. Otherwise, if the difference is small, it means that the trained image style transfer model is close to accuracy. Similarly, the purpose of training is to make the difference small enough.

[0080] B) Total Variation loss function, which represents the pixel difference between the new prediction result image and the original position in the target result image after each pixel in the prediction result image is shifted one pixel to the right or one pixel down. Specifically, the pixel difference between each pixel in the new prediction result image and the pixel in the original position corresponding to the target result image when it is not moved can be taken, and the average of the differences of all pixels can be taken. This loss function reflects the smoothness of the image, and the difference in adjacent pixel values ​​in the image can be solved to a certain extent by reducing the loss function. For example, noise reduction, countering checkerboard, etc. Similarly, the purpose of training is to make the difference represented by the total variation loss function small enough.

[0081] C) Edge loss function, which is used to represent the edge of the generated prediction result image, and the difference between it and the edge of the content image is as small as possible. This loss function can have an edge-preserving effect, that is, it can retain the strong edge of the original content image and will not generate a whole block of pure color. For example, this solution can use a network model to screen the edge of the prediction result image and the edge of the content image, and then take the average of the difference in pixel values ​​of all pixel points on the edge. Similarly, the purpose of training is to make the difference represented by the edge loss function small enough.

[0082] After constructing at least one of the style loss function, the total variation loss function, and the boundary loss function in the above manner, the first loss function can be constructed based on at least one of the style loss function, the total variation loss function, and the boundary loss function, and combined with the discriminator loss function and the pixel difference loss function. For example, all the included loss functions can be summed as the first loss function, or certain weights can be configured for various loss functions, and then summed according to the weights as the first loss function. The first loss function can include only any one or two of the style loss function, the total variation loss function, and the boundary loss function, or can include all three at the same time. Of course, the more types of loss functions included, the higher the accuracy of the style conversion of the trained image style conversion model.

[0083] Optionally, when the style transfer model is an image style transfer model, before step S301, it may also include: a process of obtaining a target result image based on an optimization method, which may specifically include the following steps: for each content image and style image in each training sample, using the first optimized style transfer model to obtain a corresponding result image; based on the result image, and with reference to the content image and / or style image, constructing a second loss function; if the second loss function does not converge, adjusting the parameters of the first optimized style transfer model so that the second loss function tends to converge, and obtaining the result image output by the first optimized style transfer model after the second loss function converges as the corresponding target result image.

[0084] For example, the specific implementation process can be achieved through the following steps:

[0085] (a2) For any content map and style map in any training sample, the first optimized style transfer model is used to obtain the corresponding result map;

[0086] (b2) constructing a second loss function based on the content graph, the result graph and the style graph;

[0087] (c2) determining whether the second loss function converges, if not, executing step (d2); if converged, executing step (e2);

[0088] (d2) adjusting the parameters of the first optimized style transfer model so that the second loss function tends to converge, and returning to step (a2) to continue to obtain the corresponding result image based on the first optimized style transfer model after adjusting the parameters;

[0089] (e2) Determine whether the number of iterations reaches a preset iteration threshold, or whether the second loss function always converges in consecutive preset rounds of training. If so, use the obtained result image as the target result image of the corresponding content image; otherwise, return to (a2) and continue to obtain the corresponding result image based on the optimized style transfer model after adjusting the parameters.

[0090] Steps (a2)-(e2) represent the use of an optimized method to obtain the target result image in each training sample. In the specific training process, for any training sample, the content image and style image in the training sample are input into the optimized style transfer model. The optimized style transfer model can output the corresponding result image. The result image is the content image after style conversion, which includes the content in the content image and carries the style in the style image to meet the user's artistic pursuit of the style image.

[0091] In this embodiment, a second loss function needs to be constructed. Optionally, the second loss function can be implemented from two aspects: content loss function and style loss function. Of course, in practical applications, only one of them can be selected for implementation. The style loss function is constructed based on the result image and the style image, and is used to detect whether the style of the result image and the style image are consistent. The content loss function is constructed based on the content image and the result image, and is used to detect whether the content of the result image and the content image are consistent. When the second loss function includes both the content loss function and the style loss function, that is, the case corresponding to step (b1), the sum of the two loss functions can be directly taken, or the weighted sum of the two loss functions can be taken. If the loss function does not converge, the parameters of the second optimized style transfer model can be adjusted so that the loss function tends to converge, that is, the style of the result image and the style image tends to be consistent, and the content of the result image and the content image tend to be consistent. And continue to input the content image and style image in the training sample into the first optimized style transfer model after adjusting the parameters, repeat the above process until the iteration termination condition of step (e2) is met, and the final result image is used as the corresponding target result image. In step (e2), two optional iteration termination conditions are taken as an example, wherein the consecutive preset number of rounds can be 50, 80, 100 or other integers, which are not limited here.

[0092] It should be noted that the style loss function included in the second loss function constructed in the above step (b2) can also be constructed by referring to the style loss function in A) involved in the above embodiment. The content loss function can be constructed based on the content image and the result image by calculating the average value of the difference between the features of each pixel in the two images.

[0093] The above scheme of the target result graph obtained based on the optimization method can effectively ensure the style and style of the final target result graph Figure 1 To, content and content Figure 1 The accuracy of the target result image obtained is very high, which can effectively improve the quality of the training samples of the image style transfer model, and then effectively improve the accuracy of the trained image style transfer model.

[0094] Further optionally, when the style transfer model is a face style transfer model, in order to distinguish it from the above-mentioned image style transfer model, the content map is the corresponding face map, and the target result map is the corresponding target face result map. At this time, before step S301 of this embodiment, it can also include a process of obtaining the target face result map obtained based on the optimization method: for the face map and style map in each face training sample, the optimized style transfer model is used to obtain the corresponding initial result map; based on each face map, the color information in the initial result map is retained, and the texture information in the initial result map is removed to obtain an updated face result map; based on the updated face result map, and with reference to the face map and / or style map, a third loss function is constructed; if the third loss function does not converge, the parameters of the second optimized style transfer model are adjusted so that the third loss function tends to converge, until the updated face result map output by the second optimized style transfer model after the third loss function converges is obtained as the corresponding target result map.

[0095] For example, the specific implementation process can be achieved through the following steps:

[0096] (a3) for any face image and style image in a face training sample, using the second optimized style transfer model to obtain a corresponding initial result image;

[0097] (b3) retaining the color information in the initial result image, removing the texture information in the initial result image, and obtaining an updated face result image;

[0098] (c3) constructing a third loss function based on the face image, the updated face result image and the style image;

[0099] (d3) determining whether the third loss function converges, if not, executing step (e3); if converged, executing step (f3);

[0100] (e3) adjusting the parameters of the second optimized style transfer model so that the third loss function tends to converge, and returning to step (a3) ​​to continue to obtain the corresponding result image based on the optimized style transfer model after adjusting the parameters;

[0101] (f3) Determine whether the number of iterations reaches a preset iteration threshold, or whether the third loss function always converges in consecutive preset rounds of training. If so, use the updated face result image as the target result image of the corresponding content image; otherwise, return to (a3) ​​and continue to obtain the corresponding initial result image based on the second optimized style transfer model after adjusting the parameters.

[0102] The steps (a3)-(f3) of this embodiment are compared with the above steps (a2)-(e2), and the step (b3) is added therein. Obviously, the process of obtaining the target face result image based on the optimization method is different from the process of obtaining the target result image of the ordinary image based on the optimization method in that the target face result image does not need to carry the texture information in the style image. Therefore, in the process of training the optimized style transfer model, each time after the initial result image is obtained, only the color information in the initial result image is retained, and the texture information in the initial result image is removed as the updated result image. It is equivalent to only migrating the color information in the style image, and no longer generating texture information in the face area, which is equivalent to only mapping the color of the face area based on the color of the style image, so that the generated face is clearer. The implementation process of the remaining steps is the same as the implementation of the above steps (a2)-(e2). For details, please refer to the relevant records of the above embodiment, which will not be repeated here.

[0103] The above-mentioned solution of obtaining the target face result image based on the optimization method can effectively ensure the accuracy of the obtained target face result image, can effectively improve the quality of the training samples of the face style transfer model, and further can effectively improve the accuracy of the trained face style transfer model.

[0104] In the training method of the style transfer model of this embodiment, when training the image style transfer model, the target result image in the training sample is obtained based on the optimization method, which can improve the quality of the training sample. Then, the image style transfer model is further trained using several collected training samples to ensure that the image style transfer model can fully learn the texture information in the target result image. That is, the training method of this embodiment effectively combines the optimization method and the feedforward-based method, so that the image style transfer model can not only fully learn the texture of the style map, but also can directly use the trained image style transfer model when performing image style conversion, effectively saving the time of image style conversion and improving the efficiency of image style conversion.

[0105] In the training method of the style conversion model of this embodiment, when training the face style conversion model, the target face result image in the training sample is obtained based on the optimization method, which can improve the quality of the training sample. Then, the face style conversion model is further trained using the collected several training samples, which can ensure that the face style conversion model can fully learn the color conversion information in the target result image. That is, the training method of this embodiment effectively combines the optimization method and the feedforward-based method, so that the face style conversion model can not only fully learn the color of the style map, but also directly use the trained face style conversion model when performing image style conversion, effectively saving the time of image style conversion and improving the efficiency of image style conversion; and it can ensure that when performing style conversion on the face area, only the color in the style map is transferred, and the texture in the style map is not transferred to the face area, which can improve the clarity of the face after style conversion and improve the quality of style conversion on the face.

[0106] Furthermore, in this embodiment, a first loss function can be constructed based on at least one of the style loss function, the total variation loss function, and the boundary loss function, and combined with the discriminator loss function and the pixel difference loss function, to further ensure that the style of the result image after style conversion by the image style conversion model is consistent with the style of the style image, thereby further improving the quality of the result image after style conversion.

[0107] Figure 4 is a schematic diagram according to the fourth embodiment of the present application; Figure 4 As shown, this embodiment provides an image style conversion device 400, which includes:

[0108] A detection module 401 is used to detect whether the image to be processed includes a face;

[0109] A face style conversion module 402, for, if included, using a pre-trained face style conversion model and a preset style map to perform style conversion on a face region in the image to be processed, so that the face region after style conversion only carries color information in the style map, but does not include texture information in the style map;

[0110] The image style conversion module 403 is used to use a pre-trained image style conversion model and a preset style map to perform style conversion on other areas except the face area in the image to be processed.

[0111] The image style conversion device 400 of this embodiment realizes the implementation principle and technical effect of image style conversion by adopting the above-mentioned modules, which is the same as those of the above-mentioned related method embodiments. For details, please refer to the records of the above-mentioned related method embodiments, which will not be repeated here.

[0112] Further optionally, the detection module 401 is used to:

[0113] A pre-trained face detection model is used to detect whether the image to be processed contains a face; if so, the location information of the face area is output.

[0114] Further optionally, the image style conversion module 403 is further used for:

[0115] If the image to be processed does not include a face, a pre-trained image style conversion model and a preset style map are used to perform style conversion on the image to be processed.

[0116] Figure 5 is a schematic diagram according to the fifth embodiment of the present application; Figure 5 As shown, this embodiment provides a training device 500 for a style transfer model, which includes:

[0117] The collection module 501 is used to collect a plurality of training samples, each of which includes a content map, a style map, and a target result map obtained based on an optimization method;

[0118] The training module 502 is used to train the style transfer model using various training samples.

[0119] The style transfer model training device 500 of this embodiment, by adopting the above-mentioned modules to realize the implementation principle and technical effect of the style transfer model training, is the same as that of the above-mentioned related method embodiments. For details, please refer to the records of the above-mentioned related method embodiments, which will not be repeated here.

[0120] Figure 6 is a schematic diagram according to the sixth embodiment of the present application; Figure 6 As shown, the training device 500 of the style transfer model of this embodiment, in the above Figure 5 Based on the illustrated embodiments, the technical solution of the present application is further described in more detail.

[0121] The training module 502 includes:

[0122] An acquisition unit 5021 is used to acquire, for each training sample, a prediction result graph output by a corresponding style conversion model;

[0123] A construction unit 5022, configured to construct a corresponding first loss function based on the corresponding training sample and the corresponding prediction result graph;

[0124] An adjusting unit 5023, configured to adjust the parameters of the image style transfer model when the first loss function does not converge, so that the first loss function tends to converge;

[0125] Further optionally, referring to the above Figure 3According to the records of the illustrated embodiment, during the training process, for each training sample, the above three units, namely, the acquisition unit 5021, the construction unit 5022, and the adjustment unit 5023, need to be repeatedly started. Therefore, a training termination detection unit is also required, which can be used to determine whether the first loss function always converges in consecutive preset rounds of training. If so, the parameters of the style transfer model are determined, and then the style transfer model is determined, and the training ends; otherwise, the acquisition unit 5021 is triggered to start, and the next training sample is continued for training.

[0126] Further, the construction unit 5022 is used to:

[0127] For the training samples, a discriminator loss function is constructed based on the target result graph and the predicted result graph;

[0128] Based on the pixel values ​​of each pixel point in the target result image and the predicted result image, a pixel difference loss function is constructed;

[0129] Based on the training samples and the corresponding prediction result graph, construct at least one of a style loss function, a total variation loss function, and a boundary loss function;

[0130] Based on at least one of a style loss function, a total variation loss function, and a boundary loss function, and in combination with a discriminator loss function and a pixel difference loss function, a first loss function is constructed.

[0131] Further optionally, when the style transfer model is an image style transfer model, the training device 500 of the style transfer model of this embodiment further includes:

[0132] An acquisition module 503 is used to acquire a corresponding result image using a first optimized style conversion model for the content image and the style image in each training sample;

[0133] A construction module 504 is used to construct a second loss function based on the result graph and with reference to the content graph and / or the style graph;

[0134] The adjustment module 505 is used to adjust the parameters of the first optimized style transfer model if the second loss function does not converge, so that the second loss function tends to converge, until the result image output by the first optimized style transfer model after the second loss function converges is obtained as the corresponding target result image.

[0135] Similarly, further optionally, referring to the above Figure 3According to the relevant records of the illustrated embodiment, during the training process, for each training sample, it is necessary to repeatedly start the above three modules, namely, the acquisition module 503, the construction module 504, and the adjustment module 505. Therefore, a training termination detection module is also required, which can be used to determine whether the number of iterations reaches a preset iteration threshold, or whether the second loss function always converges in consecutive preset rounds of training. If so, the obtained result graph is used as the target result graph of the corresponding content graph; otherwise, the acquisition module 503 is triggered to start, and the corresponding result graph continues to be obtained based on the optimized style transfer model after adjusting the parameters.

[0136] Further optionally, when the style transfer model is a face style transfer model and the content image corresponds to a face image, the training device 500 of the style transfer model of this embodiment further includes an updating module 506;

[0137] The acquisition module 503 is further used to use the second optimized style conversion model to acquire the corresponding initial result image for the corresponding face image and style image in each face training sample;

[0138] An updating module 506 is used to retain the color information in the initial result image and remove the texture information in the initial result image to obtain an updated face result image;

[0139] The construction module 504 is further used to construct a third loss function based on the updated face result image and with reference to the face image and / or the style image;

[0140] The adjustment module 505 is also used to adjust the parameters of the second optimized style transfer model if the third loss function does not converge, so that the third loss function tends to converge, until an updated face result image output by the second optimized style transfer model after the third loss function converges is obtained as the corresponding target result image.

[0141] Similarly, further optionally, the detection module for training termination can be used to determine whether the number of iterations reaches a preset iteration threshold, or whether the third loss function always converges in consecutive preset rounds of training. If so, the updated face result image is used as the target result image of the corresponding content image; otherwise, the acquisition module 503 is triggered to start and continue to obtain the corresponding initial result image based on the optimized style transfer model after adjusting the parameters.

[0142] The style transfer model training device 500 of this embodiment, by adopting the above-mentioned modules to realize the implementation principle and technical effect of the style transfer model training, is the same as that of the above-mentioned related method embodiments. For details, please refer to the records of the above-mentioned related method embodiments, which will not be repeated here.

[0143] According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.

[0144] like Figure 7 , is a block diagram of an electronic device for implementing the above method of an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0145] like Figure 7 As shown, the electronic device includes: one or more processors 701, a memory 702, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 701 is taken as an example.

[0146] The memory 702 is a non-transitory computer-readable storage medium provided in the present application. The memory stores instructions executable by at least one processor to enable the at least one processor to perform the above-mentioned image style conversion method or style conversion model training method provided in the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the image style conversion method or style conversion model training method provided in the present application.

[0147] The memory 702 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the image style conversion method or the style conversion model training method in the embodiment of the present application (for example, the attached Figure 4 , Attachment Figure 5 , and attached Figure 6The processor 701 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 702, that is, the image style conversion method or the style conversion model training method in the above method embodiment is implemented.

[0148] The memory 702 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of an electronic device that implements a method for style conversion of an image, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 702 may optionally include a memory remotely arranged relative to the processor 701, and these remote memories may be connected to an electronic device that implements a method for style conversion of an image or a training method for a style conversion model via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0149] The electronic device for implementing the image style conversion method or the style conversion model training method may also include: an input device 703 and an output device 704. The processor 701, the memory 702, the input device 703 and the output device 704 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0150] The input device 703 can receive input digital or character information, and generate key signal input related to user settings and function control of an electronic device that implements the image style conversion method or the style conversion model training method, such as a touch screen, a keypad, a mouse, a trackpad, a touchpad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 704 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.

[0151] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0152] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0153] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0154] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

[0155] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.

[0156] According to the technical solution of the embodiment of the present application, it is first detected whether the image to be processed includes a face. If it does, a pre-trained face style conversion model and a preset style map are used to perform style conversion on the face area in the image to be processed, so that the face area after style conversion only carries the color information in the style map, but does not include the texture information in the style map, thereby making the face area after style conversion very clear; and a pre-trained image style conversion model and a preset style map are used to perform style conversion on other areas other than the face area in the image to be processed; and if no face is included, the pre-trained image style conversion model and the preset style map are directly used to perform style conversion on the image to be processed, which can effectively improve the clarity of the image after style conversion and improve the quality of image style conversion.

[0157] According to the technical solution of the embodiment of the present application, the target result image in the training sample is obtained based on the optimization method, which can improve the quality of the training sample. Then, the style transfer model is further trained using several collected training samples to ensure that the style transfer model can fully learn the texture information and color information in the target result image. That is, the training method of the present application effectively combines the optimization method and the feedforward-based method, so that the style transfer model can not only fully learn the texture information and color information in the target result image, but also can directly use the trained style transfer model when performing style conversion, effectively saving the time of style conversion and improving the efficiency of style conversion.

[0158] According to the technical solution of the embodiment of the present application, when training the image style transfer model, the target result map in the training sample is obtained based on the optimization method, which can improve the quality of the training sample. Then, the image style transfer model is further trained using several collected training samples to ensure that the image style transfer model can fully learn the texture information in the target result map. That is, the training method of the present application effectively combines the optimization method and the feedforward-based method, so that the image style transfer model can not only fully learn the texture of the style map, but also can directly use the trained image style transfer model when performing image style conversion, effectively saving the time of image style conversion and improving the efficiency of image style conversion.

[0159] According to the technical solution of the embodiment of the present application, when training the face style conversion model, the target face result image in the training sample is obtained based on the optimization method, which can improve the quality of the training sample. Then, the face style conversion model is further trained using several collected training samples, which can ensure that the face style conversion model can fully learn the color conversion information in the target result image. That is, the training method of the present application effectively combines the optimization method and the feedforward-based method, so that the face style conversion model can not only fully learn the color of the style map, but also directly use the trained face style conversion model when performing image style conversion, effectively saving the time of image style conversion and improving the efficiency of image style conversion; and it can ensure that when performing style conversion on the face area, only the color in the style map is transferred, and the texture in the style map is not transferred to the face area, which can improve the clarity of the face after style conversion and improve the quality of style conversion of the face.

[0160] According to the technical solution of the embodiment of the present application, a first loss function can be constructed based on at least one of the style loss function, the total variation loss function and the boundary loss function, and combined with the discriminator loss function and the pixel difference loss function, thereby further ensuring that the style of the result image after style conversion by the image style conversion model is consistent with the style of the style image, thereby further improving the quality of the result image after style conversion.

[0161] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

[0162] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A training method for a style transfer model, wherein: The method comprises: Collecting a plurality of training samples, each of which includes a content graph, a style graph, and a target result graph obtained based on an optimization method; Using each of the training samples to train the style transfer model; When the style transfer model is an image style transfer model, before collecting a plurality of training samples, each of which includes a content map, a style map, and a target result map obtained based on an optimization method, the method further includes: For the content map and style map in each of the training samples, a first optimized style conversion model is used to obtain a corresponding result map; Based on the result graph and with reference to the content graph and / or the style graph, construct a second loss function; If the second loss function does not converge, adjust the parameters of the first optimized style transfer model so that the second loss function tends to converge, until the result image output by the first optimized style transfer model after the second loss function converges is obtained as the corresponding target result image.

2. The method according to claim 1, wherein: Using each of the training samples to train the style transfer model includes: For each of the training samples, obtain a prediction result graph output by the corresponding style conversion model; Based on the corresponding training sample and the corresponding prediction result graph, construct a corresponding first loss function; When the first loss function does not converge, adjusting parameters of the image style conversion model so that the first loss function tends to converge.

3. The method according to claim 2, wherein: Based on the corresponding training sample and the corresponding prediction result graph, constructing a corresponding first loss function, including: For the training sample, constructing a discriminator loss function based on the target result graph and the predicted result graph; Constructing a pixel difference loss function based on the pixel value of each pixel point of the target result image and the predicted result image; Based on the training samples and the corresponding prediction result graph, construct at least one of a style loss function, a total variation loss function, and a boundary loss function; Based on at least one of the style loss function, the total variation loss function, and the boundary loss function, and in combination with the discriminator loss function and the pixel difference loss function, the first loss function is constructed.

4. The method according to any one of claims 1 to 3, wherein: When the style conversion model is a face style conversion model, the content image is a face image, and before collecting a plurality of training samples, each of which includes a content image, a style image, and a target result image obtained based on an optimization method, the method further includes: For the face image and the style image corresponding to each of the face training samples, a second optimized style conversion model is used to obtain a corresponding initial result image; Retaining the color information in the initial result image, removing the texture information in the initial result image, and obtaining an updated face result image; Based on the updated face result image and with reference to the face image and / or the style image, construct a third loss function; If the third loss function does not converge, adjust the parameters of the second optimized style transfer model so that the third loss function tends to converge, until the updated face result image output by the second optimized style transfer model after the third loss function converges is obtained as the corresponding target result image.

5. A method for transferring image style, wherein: The method comprises: Detecting whether the image to be processed includes a face; If included, using a pre-trained face style conversion model and a preset style map to perform style conversion on the face area in the image to be processed, so that the face area after style conversion only carries the color information in the style map, but does not include the texture information in the style map; A pre-trained image style conversion model and the preset style map are used to perform style conversion on other areas outside the face area in the image to be processed; wherein the face style conversion model and the image style conversion model are trained using the training method of the style conversion model described in any one of claims 1-4.

6. The method according to claim 5, wherein: Detect whether the image to be processed contains a face, including: A pre-trained face detection model is used to detect whether the image to be processed includes a face; if included, the location information of the face area is output.

7. The method according to claim 5, wherein: The method further comprises: If the image to be processed does not include a human face, the pre-trained image style conversion model and the preset style map are used to perform style conversion on the image to be processed.

8. A training device for a style transfer model, wherein: The device comprises: A collection module, used to collect a plurality of training samples, each of which includes a content map, a style map, and a target result map obtained based on an optimization method; A training module, used to train the style transfer model using each of the training samples; When the style conversion model is an image style conversion model, the device further includes: An acquisition module, configured to acquire a corresponding result image using a first optimized style conversion model for the content image and the style image in each of the training samples; A construction module, configured to construct a second loss function based on the result graph and with reference to the content graph and / or the style graph; An adjustment module is used to adjust the parameters of the first optimized style transfer model if the second loss function does not converge, so that the second loss function tends to converge, until the result image output by the first optimized style transfer model after the second loss function converges is obtained as the corresponding target result image.

9. The device according to claim 8, wherein: The training module comprises: An acquisition unit, used for acquiring, for each of the training samples, a prediction result graph output by a corresponding style conversion model; A construction unit, configured to construct a corresponding first loss function based on the corresponding training sample and the corresponding prediction result graph; An adjusting unit is used to adjust the parameters of the image style conversion model when the first loss function does not converge, so that the first loss function tends to converge.

10. The device according to claim 9, wherein: The building block is used for: For the training sample, constructing a discriminator loss function based on the target result graph and the predicted result graph; Constructing a pixel difference loss function based on the pixel value of each pixel point of the target result image and the predicted result image; Based on the training samples and the corresponding prediction result graph, construct at least one of a style loss function, a total variation loss function, and a boundary loss function; Based on at least one of the style loss function, the total variation loss function, and the boundary loss function, and in combination with the discriminator loss function and the pixel difference loss function, the first loss function is constructed.

11. The device according to any one of claims 8 to 10, wherein: When the style conversion model is a face style conversion model and the content image corresponds to a face image, the device further includes an updating module; The acquisition module is further used to use the second optimized style conversion model to acquire a corresponding initial result image for the face image and the style image corresponding to each of the face training samples; The updating module is used to retain the color information in the initial result image, remove the texture information in the initial result image, and obtain an updated face result image; The construction module is further used to construct a third loss function based on the updated face result image and with reference to the face image and / or the style image; The adjustment module is also used to adjust the parameters of the second optimized style transfer model if the third loss function does not converge, so that the third loss function tends to converge, until the updated face result image output by the second optimized style transfer model after the third loss function converges is obtained as the corresponding target result image.

12. A device for converting image style, wherein: The device comprises: A detection module, used to detect whether the image to be processed includes a human face; A face style conversion module, for, if included, using a pre-trained face style conversion model and a preset style map to perform style conversion on a face region in the image to be processed, so that the face region after style conversion only carries color information in the style map but does not include texture information in the style map; An image style conversion module is used to use a pre-trained image style conversion model and a preset style map to perform style conversion on other areas outside the face area in the image to be processed; wherein the face style conversion model and the image style conversion model are trained using the training device of the style conversion model described in any one of claims 8-11.

13. The device according to claim 12, wherein: The detection module is used for: A pre-trained face detection model is used to detect whether the image to be processed includes a face; if included, the location information of the face area is output.

14. The device according to claim 12, wherein: The image style conversion module is further used for: If the image to be processed does not include a human face, the pre-trained image style conversion model and the preset style map are used to perform style conversion on the image to be processed.

15. An electronic device, wherein: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 7.