Image processing method, readable storage medium and computer terminal
By training the image translation model with pre-generated image pairs, the problem of high training cost for stylized images in existing technologies is solved, and efficient and accurate image stylization processing is achieved.
Patent Information
- Application Number
- CN202111216626.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-19
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2041-10-19
AI Technical Summary
The existing technology uses a large number of stylized images to train image translation models, which leads to increased processing costs.
By training an image translation model using multiple pre-generated image pairs, the need for users to provide stylized images is reduced. A large number of pseudo-data pairs are generated through an image generation model for training, which reduces the cost of manual annotation and improves processing accuracy.
It achieves good stylization results with a small number of stylized images, reduces the training time and cost of image translation models, and improves processing accuracy.
Smart Images

Figure CN114170472B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the computer field, in particular to an image processing method, a readable storage medium and a computer terminal. BACKGROUND
[0002] Face stylization can convert a user input face image into a face image of a different style, for example, a cartoon style, a painting style, a hand-drawn style, etc. A commonly used face stylization scheme at present is to pre-collect different stylized images as training data, train an image translation model through the training data, so that the trained image translation model can perform face stylization. However, in order to ensure the processing accuracy of the image translation model, a large number of stylized images need to be obtained for training, resulting in increased processing cost.
[0003] At present, no effective solution has been proposed for the above problems. SUMMARY
[0004] Embodiments of the present application provide an image processing method, a readable storage medium and a computer terminal to at least solve the technical problem of increased processing cost caused by training an image translation model through a large number of stylized images in the related art.
[0005] According to an aspect of an embodiment of the present application, an image processing method is provided, comprising: obtaining a to-be-processed image; processing the to-be-processed image using an image translation model to obtain a target image of a target style, wherein the semantics of the to-be-processed image and the target image correspond to each other, and the image translation model is obtained by training through a plurality of pre-generated image pairs, each image pair comprising a first image and a second image of the target style.
[0006] According to another aspect of an embodiment of the present application, an image processing method is also provided, comprising: displaying a to-be-processed image in an interactive interface; processing the to-be-processed image using an image translation model in response to a received processing instruction to obtain a target image of a target style, wherein the semantics of the to-be-processed image and the target image correspond to each other, and the image translation model is obtained by training through a plurality of pre-generated image pairs, each image pair comprising a first image and a second image of the target style; and displaying the target image in the interactive interface.
[0007] According to another aspect of an embodiment of the present application, an image processing method is also provided, comprising: obtaining a face image; processing the face image using an image translation model to obtain a target image of a target style, wherein the semantics of the face image and the target image correspond to each other, and the image translation model is obtained by training through a plurality of pre-generated image pairs, each image pair comprising a first image and a second image of the target style.
[0008] According to a further aspect of the embodiments of the present application, an image processing method is also provided, comprising: receiving an image processing request, wherein the image processing request comprises: an image to be processed and a target style; obtaining an image translation model corresponding to the target style, wherein the image translation model is obtained by training a plurality of pre-generated image pairs, each image pair comprising: a first image and a second image of the target style; processing the image to be processed using the image translation model to obtain a target image of the target style, wherein the semantics of the image to be processed and the target image correspond.
[0009] According to a further aspect of the embodiments of the present application, an image processing method is also provided, comprising: a cloud server receiving an image to be processed uploaded by a client; the cloud server processing the image to be processed using an image translation model to obtain a target image of a target style, wherein the semantics of the image to be processed and the target image correspond, and the image translation model is obtained by training a plurality of pre-generated image pairs, each image pair comprising: a first image and a second image of the target style; and the cloud server sending the target image to the client.
[0010] According to a further aspect of the embodiments of the present application, a computer readable storage medium is also provided, comprising a stored program, wherein the program, when executed, controls a device in which the computer readable storage medium is located to perform the image processing method in the above embodiments.
[0011] According to a further aspect of the embodiments of the present application, a computer terminal is also provided, comprising: a memory and a processor, the processor being configured to execute a program stored in the memory, wherein the program, when executed, performs the image processing method in the above embodiments.
[0012] In the embodiments of the present application, after obtaining the image to be processed, the image to be processed is processed using the image translation model to obtain a target image of a target style, thereby achieving the purpose of image stylization. It is easy to note that, since the image translation model can be obtained by training a plurality of pre-generated image pairs, the user does not need to provide additional stylized images, thereby reducing the cost of manual annotation, and further reducing the training time and cost of the image translation model, and improving the processing accuracy of the image translation model, thereby solving the technical problem in the related art that training the image translation model by a large number of stylized images increases the processing cost. BRIEF DESCRIPTION OF DRAWINGS
[0013] The accompanying drawings, which are included to provide a further understanding of the present application, form a part of the present application and illustrate the illustrative embodiments of the present application and its description, which do not constitute improper limitations on the present application. In the drawings:
[0014] Figure 1is a hardware structure block diagram of a computer terminal for implementing an image processing method according to an embodiment of the present application;
[0015] Figure 2 is a flowchart of a first image processing method according to an embodiment of the present application;
[0016] Figure 3a is a schematic diagram of an interactive interface according to an embodiment of the present application;
[0017] Figure 3b is a schematic diagram of an optional interactive interface according to an embodiment of the present application;
[0018] Figure 4 is a schematic diagram of an optional semi-parametric training according to an embodiment of the present application;
[0019] Figure 5 is a flowchart of an optional training of a first generation submodel according to an embodiment of the present application;
[0020] Figure 6 is a flowchart of an optional training of a second generation submodel according to an embodiment of the present application;
[0021] Figure 7 is a flowchart of an optional generation of a pseudo data pair according to an embodiment of the present application;
[0022] Figure 8 is a flowchart of an optional training of an image translation model according to an embodiment of the present application;
[0023] Figure 9 is a flowchart of a second image processing method according to an embodiment of the present application;
[0024] Figure 10 is a flowchart of a third image processing method according to an embodiment of the present application;
[0025] Figure 11 is a flowchart of a fourth image processing method according to an embodiment of the present application;
[0026] Figure 12 is a flowchart of a fifth image processing method according to an embodiment of the present application;
[0027] Figure 13 is a schematic diagram of a first image processing apparatus according to an embodiment of the present application;
[0028] Figure 14 is a schematic diagram of a second image processing apparatus according to an embodiment of the present application;
[0029] Figure 15 is a schematic diagram of a third image processing apparatus according to an embodiment of the present application;
[0030] Figure 16 is a schematic diagram of a fourth image processing device according to an embodiment of the application;
[0031] Figure 17 is a structural block diagram of a computer terminal according to an embodiment of the application. DETAILED DESCRIPTION
[0032] In order to enable persons skilled in the art to better understand the scheme of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should fall within the scope of protection of the present application.
[0033] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] First, some of the nouns or terms appearing in the description of the embodiments of the present application are applicable to the following explanations:
[0035] GAN: Generative Adversarial Network, a kind of widely used in image editing, generated AI technology.
[0036] Style: can be the process of applying an artistic style to an image.
[0037] Latent code: can refer to a set of n-dimensional vectors. By changing the latent code, the content generated by the generative model can be controlled.
[0038] Generative model: in the embodiments of the present application, it can refer to a model that generates an image from a latent variable.
[0039] Image translation model: can be input a picture of field A, generate a picture of field B corresponding in semantics (such as input night scene photo, generate the effect of the photo in the daytime).
[0040] Common face stylization is generally divided into three methods: texture mapping type, style transfer type and hidden variable editing type.
[0041] The texture mapping type method generally needs to give a sample image, and then the algorithm finds the corresponding relationship between the sample image and the image to be processed pixel by pixel or block by block, and then based on the corresponding relationship of the pixels, the texture of the sample image is pasted on the image to be processed one by one. However, the main problem of this method is that it only changes the style of the texture, but cannot change the shape of the facial features. For example, in reality, cartoon faces generally have the feature of large eyes, and this method cannot capture this feature.
[0042] The style transfer type method generally needs to give one or a group of style images, and based on the deep learning method, extracts the style code from the style image, extracts the content code from the content image, i.e. the image to be processed, and finally inputs the two groups of inputs into a generation model to generate the corresponding stylized picture. However, the main disadvantage of this method is that all input faces usually share a set of style codes, and the generated faces are highly homogeneous in style.
[0043] The hidden variable editing type method generally fine-tunes an existing real face generation model to the target field to obtain a stylized face generation model, and then maps the user's input real face picture to the corresponding hidden variable to generate the corresponding cartoon picture through the hidden variable. However, the main problem of this method is that the hidden variable mapping usually requires a large amount of calculation, and the accuracy is not high enough, so that the mapped hidden variable will lose the detailed features of the original input face, which is easy to cause the generated stylized effect to lose the personal identification features or distortion.
[0044] In order to solve the above problems, the present application provides a new face stylization method, which uses a large number of pre-generated image pairs as training data for an image translation model, so that good stylization effect can be achieved even in the scene where only a small amount of stylized images can be collected.
[0045] Embodiment 1
[0046] According to the embodiments of the present application, an image processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a group of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0047] The method embodiments provided by the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing the image processing method is shown. As shown in the figure, Figure 1 The computer terminal 10 (or mobile device) can include one or more processors 102 (the processor 102 can include but is not limited to a microprocessor MCU or a programmable logic device FPGA processing device), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. Those skilled in the art can understand that, Figure 1 The structure shown is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can include more or less components than those shown in the figure, or have a different configuration than that shown in the figure. Figure 1 The structure shown is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can include more or less components than those shown in the figure, or have a different configuration than that shown in the figure. Figure 1 The structure shown is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can include more or less components than those shown in the figure, or have a different configuration than that shown in the figure.
[0048] It should be noted that the one or more processors 102 and / or other data processing circuits described above can be referred to as "data processing circuits" herein. The data processing circuit can be embodied in whole or in part as software, hardware, firmware or any combination thereof. In addition, the data processing circuit can be a single independent processing module, or any one of the other elements combined into the computer terminal 10 (or mobile device) in whole or in part. The data processing circuit serves as a processor to control, for example, the selection of the variable resistance terminal path connected to the interface.
[0049] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the image processing method in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the above-mentioned image processing method. The memory 104 can include a high-speed random access memory, and can also include a non-volatile memory such as one or more magnetic storage devices, flash memory or other non-volatile solid state memory. In some examples, the memory 104 can further include a memory remotely arranged with respect to the processor 102, which can be connected to the computer terminal 10 through 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 a combination thereof.
[0050] The transmission device 106 is configured to receive or send data via a network. The network can include, for example, a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network interface controller (NIC) that can connect to other network devices through a base station to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module that is configured to communicate with the Internet wirelessly.
[0051] The display can be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0052] It is noted that in some alternative embodiments, the above-described Figure 1 The computer device (or mobile device) can include hardware elements (including circuitry), software elements (including computer code stored on a computer readable medium), or a combination of both hardware and software elements. It should be noted that in some embodiments, the computer device (or mobile device) can be a stand-alone device or can be part of a larger device, such as a mobile phone or a computer. Figure 1 is merely one example of a particular implementation and is intended to illustrate the types of components that can be present in the above-described computer device (or mobile device).
[0053] It is noted that in some embodiments, the above-described Figure 1 The computer device (or mobile device) has a touch display (also referred to as a "touch screen" or "touch display screen"). In some embodiments, the above-described Figure 1 The computer device (or mobile device) has a graphical user interface (GUI) that enables a user to interact with the GUI through finger contacts and / or gestures on the touch-sensitive surface. The human-machine interactions can optionally include, for example, creating web pages, drawing, word processing, creating electronic documents, gaming, video conferencing, instant messaging, sending / receiving e-mails, call interfaces, playing digital videos, playing digital music, and / or web browsing, and executable instructions for performing the above-mentioned human-machine interactions are configured / stored in one or more computer program products or computer readable storage media that are executable by the one or more processors.
[0054] In the above-described operating environment, the present application provides an image processing method as shown in Figure 2 The present application provides an image processing method as shown in Figure 2 is a flowchart of a first image processing method according to an embodiment of the present application. As shown in Figure 2 The method includes the following steps:
[0055] In step S202, a to-be-processed image is acquired.
[0056] The image to be processed in the above step can be an image that needs to be stylized, for example, can be a landscape image, a human face image, a commodity image, or a video image in a general video, a real-time image in a live video, but is not limited to this, and can be set according to actual processing needs.
[0057] In an optional embodiment, the user can take an image through a shooting device and transmit it to the server through the network for processing by the server, and at the same time, the image to be processed can be displayed in the image collection area as shown in Figure 3a In another optional embodiment, the user can directly select an image from all the images taken as the image to be processed, and select an image on the network as the image to be processed, and transmit it to the server through the network for processing by the server, and at the same time, the image to be processed can be displayed in the image collection area as shown in Figure 3b As shown in the figure, the user can complete the purpose of uploading the image to be processed to the server by clicking the "upload image" button in the interactive interface or directly dragging the image to be processed into the dashed box, and moreover, the image uploaded by the user can be displayed in the image collection area. The server here can be a server deployed locally or a server deployed in the cloud.
[0058] In step S204, the image to be processed is processed by using an image translation model to obtain a target image of a target style, wherein the semantics of the image to be processed and the target image correspond, and the image translation model is obtained by training a plurality of pre-generated image pairs, each image pair including a first image and a second image of a target style.
[0059] The image translation model in the above step can be cocosent, spade, cyclegan, but is not limited to this. The image translation model only changes the style of the image to be processed and does not change the specific content in the image, so the semantics of the image to be processed and the target image correspond.
[0060] The first image in the above step can be a real image, and the second image of the target style can be a stylized image. Here, the target style can be a specific style that the user wants to stylize, such as anime style, oil painting style, hand-drawn style, fairy tale style, Three Kingdoms style, etc. In order to ensure the processing accuracy of the image translation model, a large number of original images and stylized images corresponding to the original images need to be trained. However, the number of stylized images is small, and it is difficult and costly to collect multiple sets of image pairs. In order to reduce the processing cost of the image translation model, in the embodiments of the present application, a large number of real image-stylized image pseudo data pairs (i.e. the above-mentioned multiple image pairs) can be generated in advance by the image generation model. Here, the pseudo data pair is called because no paired data based on artist drawing is used as a supervision signal in the image generation process.
[0061] It should be noted that in order to meet the stylization needs of different users, different stylized pseudo data pairs can be pre-constructed for model training to obtain different image translation models. In the actual stylization process, a user can select a style and process the image to be processed by the image translation model corresponding to the style to obtain a target image of the corresponding style.
[0062] In addition, since a large amount of calculation is performed in the training part of the image processing model, a simple structure image processing model can be used for stylization of the image to be processed, so that the image processing model can be directly deployed on the client to generate the target image in real time, thereby realizing the application of the image translation model to live video and other scenarios.
[0063] In an optional embodiment, after the server stylizes the image to be processed by the image translation model to obtain a target image of a target style, the target image can be directly displayed to the user for viewing, as shown in Figure 3a In another optional embodiment, after the server stylizes the image to be processed by the image translation model to obtain a target image of a target style, the target image can be fed back to the user's client through the network, and the client can display the target image to the user for viewing, as shown in Figure 3b Further, after the target image is displayed to the user, the user can feed back whether the target image is correct. If the user thinks that the target image is incorrect, the user can feed back the correct image, as shown in Figure 3a and Figure 3b The user can feed back the correct image in the result feedback area and upload it to the server, so that the server can correct the image translation model according to the user feedback and the image to be processed.
[0064] For example, taking the face stylization in a live scene as an example, during the live broadcast, the host can select to show the original face image to the audience or show the stylized image to the audience according to needs. In the case where the host selects to show the stylized image to the audience, the client can directly call the locally stored image translation model for stylization processing after receiving the face image photographed by the shooting device, obtain a target image, and show the target image to the audience for viewing. Further, the client can also receive the target style specified by the host and call the image translation model corresponding to the target style for stylization processing. Moreover, the host can synchronously view the live picture and feed back on the stylization effect of the target image, so that the server can optimize the image translation model according to the feedback result of the user and deploy the optimized image translation model to the client, thereby improving the processing performance of the client.
[0065] Through the scheme provided by the above embodiments of the present application, after obtaining the to-be-processed image, the image translation model is used to process the to-be-processed image to obtain a target image of a target style, thereby achieving the purpose of image stylization. It is easy to note that, since the image translation model can be obtained by training a plurality of sets of image pairs, there is no need for the user to additionally provide stylized images, thereby achieving the technical effects of reducing the cost of manual annotation, thereby reducing the training time and cost of the image translation model, and improving the processing accuracy of the image translation model, thereby solving the technical problem in the related art that training the image translation model by using a large number of stylized images increases the processing cost.
[0066] In the above embodiments of the present application, the method further includes: generating a plurality of latent variables by a random algorithm, wherein the number of the plurality of sets of image pairs is the same as the number of the plurality of latent variables; and processing the plurality of latent variables by using an image generation model to obtain the plurality of sets of image pairs.
[0067] It should be noted that a common stylization process often only uses statistical information, such as texture, color, and other features for processing, and has no special perception of the target itself in the to-be-processed image. The same processing flow is used for both landscape images and face images, resulting in problems such as the target image having no personal characteristics and the style features not being obvious enough.
[0068] In an optional embodiment, in order to customize different stylization processing flows for different types of images to be processed, a generative model technique can be used, that is, an image generation model capable of generating an image from a hidden variable can be constructed in advance, and the construction process of the model needs to be trained by a large number of images of the same type, so that the model has an implicit understanding of the target features in the image to be processed, and different significant features of different targets can be found to solve the problem of homogenization of different stylization results. For example, taking face image stylization processing as an example, the significant features (such as eye size, nose shape, etc.) in the input face can be explored, and the stylized picture (such as eye size, nose shape, etc.) with personal characteristics can be generated, and the input face is stylized in combination with these features.
[0069] Further, a large number of hidden variables are randomly generated by a random algorithm, and then a large number of different image pairs are generated by the image generation model to serve as training samples of the image translation model. On this basis, in the training process of the image translation model, the stylization effect of the image translation model can be supervised based on the differences between the image pairs to ensure that the image translation model can differentially process the significant features in the image to be processed, achieving customized stylization processing flows for different types of images. For example, taking face image stylization processing as an example, the image translation model can simultaneously modify the style of the face image and the shape of the facial features in the face image, achieving customized stylization with personalized characteristics for the special input type of face, and solving the problem of being unable to change the shape of facial features.
[0070] In the above embodiments of the present application, the image generation model is used to process a plurality of hidden variables to obtain a plurality of image pairs, including: using a first generation sub-model to process a plurality of hidden variables to obtain a plurality of image pairs containing first images; using a second generation sub-model to process a plurality of hidden variables to obtain a plurality of image pairs containing second images.
[0071] The first generation sub-model in the above step can be a generative model for generating real images, and the second generation sub-model can be a generative model for generating stylized images, wherein the two generation sub-models can use a GAN (Generative Adversarial Network, generative adversarial network) model, but are not limited thereto, and other network structures such as VQ-VAE (Vector Quantised Variational AutoEncoder, vector quantization variational autoencoder), Diffusion Model (diffusion model), stylegan, biggan can also be used.
[0072] It should be noted that in order to ensure that the semantics of the generated first image and the second image correspond, the two generation sub-models can share hidden variables.
[0073] In an optional embodiment, after generating a large number of shared latent variables (i.e., multiple latent variables described above), the shared latent variables can be respectively input into two generation sub-models, so that multiple groups of image pairs can be obtained.
[0074] In the above embodiments of the present application, the method further includes: obtaining a first image set; and training a first initial model through the first image set to obtain a first generation sub-model.
[0075] The first image set in the above step can be a large number of real image sets. For example, in the case of face stylization, the first image set can be a self-owned high-definition face image set with copyright, which contains a large number of face images with different skin colors, face shapes, and attribute features.
[0076] Optionally, the first generation sub-model can include a first mapping network and a first backbone network. The first mapping network is configured to process an input image to obtain a latent variable of the input image, and the first backbone network is configured to process the input latent variable to obtain a generated image of the input latent variable.
[0077] In an optional embodiment, in the model training stage, an image in the first image set can be input into the first generation sub-model, the input image can be processed by the first mapping network, and the output latent variable can be input into the first backbone network to obtain a corresponding generated image. Then, a loss function can be constructed based on the generated image and the input image, and the model parameters of the entire model can be adjusted based on the loss function, that is, the model parameters of the first mapping network and the first backbone network can be adjusted. In the model prediction stage, a randomly generated latent variable can be directly input into the first backbone network to obtain a corresponding first image.
[0078] In an optional embodiment, a first generation sub-model can be trained using a large number of real image sets, so that a large number of real images with different features can be generated under the control of the latent variable. For example, in the case of face stylization, a large number of high-definition face image sets can be obtained, and a high-definition face generation model can be trained, so that the trained model has semantic understanding of face features, can find different salient features of different faces, and can perform customized stylization.
[0079] In the above embodiments of the present application, the method further includes: obtaining a second image set of a target style; and adjusting the first generation sub-model through the second image set to obtain a second generation sub-model, wherein the first generation sub-model and the second generation sub-model share latent variables.
[0080] The second image set in the above step can be a collected stylized image.
[0081] Since the collection cost of stylized images is high, in order to reduce the training cost of the model and ensure the accuracy of image generation, in an optional embodiment, a small amount of stylized images can be collected, and instead of directly training a generation model, a manner of fine-tuning the first generation sub-model that has been trained is adopted to obtain the second generation sub-model, so as to ensure that the first generation sub-model and the second generation sub-model share the latent variable.
[0082] It should be noted that the first generation sub-model can be fine-tuned in manners such as semi-parametric training, model interpolation used in toonify, VAE training used in agilegan, but is not limited thereto. In the embodiments of the present application, the semi-parametric training manner is adopted for fine-tuning, and the specific training process is described later.
[0083] In the above embodiments of the present application, the second generation sub-model is obtained by adjusting the first generation sub-model through the second image set, including: processing the second image set by using the first mapping network to obtain the first latent variable corresponding to the second image set; processing the second image set by using the second mapping network to obtain the second latent variable corresponding to the second image set, wherein the structure of the second mapping network is the same as that of the first mapping network, but the parameters are adjustable; processing the first latent variable and the second latent variable by using the second backbone network to obtain the first generated image and the second generated image, wherein the structure of the second backbone network is the same as that of the first backbone network, but the parameters are adjustable; adjusting the network parameters of the second mapping network and the second backbone network based on the first generated image and the second generated image to obtain the second generation sub-model.
[0084] In an optional embodiment, the first generation sub-model that has been trained can be used as an initial model in the training process of the second generation sub-model, and the entire training process is further supervised by the first mapping network in the first generation sub-model that has been trained. Therefore, in the training process of the second generation sub-model, in addition to the input of the second image set, the first latent variable output by the first mapping network is also needed to be additionally input.
[0085] In another optional embodiment, the first mapping network in the first generation sub-model that has been trained can be copied into the second mapping network to obtain two mapping networks, one of which has fixed parameters and remains unchanged in the training process, and the first backbone network is connected to the two mapping networks at the same time. Therefore, in the training process of the second generation sub-model, only the second image set needs to be input. For example, Figure 4As shown, the second generation sub-model can be divided into two parts, one part is a mapping network, including two branches, respectively, a fixed parameter real model mapping network (i.e. the first mapping network described above), and a trainable cartoon model mapping network (i.e. the second mapping network described above); the other part is a trainable backbone network (i.e. the second backbone network described above). Two forward propagations can be performed simultaneously in one training (as shown by the solid line in Figure 4 ), and the perceptual loss is calculated for the generated images of the two branches, and then a backward propagation is performed (as shown by the dashed line in Figure 4 ) to adjust the cartoon model mapping network and the backbone network.
[0086] In the above embodiments of the present application, adjusting the network parameters of the second mapping network and the second backbone network based on the first generated image and the second generated image to obtain the second generation sub-model includes: processing the first generated image and the second generated image through a perceptual loss algorithm to obtain a target loss value; in the case that the target loss value is greater than or equal to a preset loss value, adjusting the network parameters of the second mapping network and the second backbone network until the target loss value is less than the preset loss value, to obtain the second generation sub-model.
[0087] The preset loss value in the above step can be determined according to the actual required model accuracy, which is not limited in the present application.
[0088] Since the second generation sub-model obtained by training shares the latent variable with the first generation sub-model and is used to generate stylized images, in order to improve the generation accuracy of the second generation sub-model, in an optional embodiment, the second generation sub-model can be trained in combination with the perceptual loss, that is, after obtaining two generated images, the loss value of the two generated images is calculated using a perceptual loss function, and by comparing with a preset loss value, it is determined whether the second generation sub-model is trained. If the calculated loss value is greater than the preset loss value, it is determined that training needs to continue; if the calculated loss value is less than or equal to the preset loss value, it is determined that the second generation sub-model training is completed.
[0089] The following will be combined Figure 4 to Figure 8 An optimal embodiment of the present application will be described in detail taking the face stylization scene as an example, which includes the following processes:
[0090] Step A, as shown in Figure 5 , a high-definition face generation model can be trained using its own massive copyrighted high-definition face dataset. The high-definition face generation model obtained by training can process the latent variable to generate a face image.
[0091] Step B, as shown in Figure 6As shown, after the high-definition face generation model is trained, the high-definition face generation model can be fine-tuned using the stylized face dataset to obtain a stylized face generation model. As shown in Figure 4 As shown, the generation model can be divided into two parts, one part is a mapping network, and the other part is a backbone network. In one training, two forward propagations will be performed at the same time, one branch is through the fixed parameter real model mapping network, the other branch is the trainable cartoon model mapping network, and the trainable backbone network, and the perceptual loss of the generation results of the two branches is calculated.
[0092] The trained high-definition face generation model and stylized face generation model can share the same latent variable, that is, the trained high-definition face generation model and stylized face generation model can process the same latent variable to obtain a face image and a stylized image corresponding in semantics.
[0093] Step C, as shown in Figure 7 As shown, after the high-definition face generation model and stylized face generation model are trained, a large number of latent variables can be randomly generated and input into the high-definition face generation model and stylized face generation model to obtain a large number of real face-stylized face pseudo data pairs.
[0094] Step D, as shown in Figure 8 As shown, after obtaining the real face-stylized face pseudo data pair, the pseudo data pair can be used to train the image translation model, that is, the real face image in the pseudo data pair can be input into the image translation model to obtain an image translation result, and then the similarity between the image translation result and the stylized image in the pseudo data pair is measured, and the training process of the image translation model is supervised according to the measurement result.
[0095] Step E, after the image translation model is trained, the image translation model can be used to process the real image uploaded by the client to obtain a stylized image, and the stylized image is fed back to the client. The stylized image can be confirmed by the user, and the feedback result is uploaded, so that the server can adjust the image translation model based on the feedback result to improve the performance of the server.
[0096] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the order of the described actions, because according to the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily necessary for the present application.
[0097] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software on a general hardware platform as necessary, and of course can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product in essence or the part that contributes to the prior art, and the computer software product is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disc), and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the method described in each embodiment of the present application.
[0098] Embodiment 2
[0099] According to the embodiments of the present application, an image processing method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0100] Figure 9 is a flowchart of a second image processing method according to an embodiment of the present application. As shown in Figure 9 , the method includes the following steps:
[0101] Step S902, displaying a to-be-processed image in an interactive interface.
[0102] The interactive interface in the above steps can be an interface provided for the user to view and operate, as shown in Figure 3a and 3b .
[0103] Step S904, in response to the received processing instruction, processing the to-be-processed image using an image translation model to obtain a target image of a target style, wherein the semantics of the to-be-processed image and the target image correspond, and the image translation model is obtained by training a plurality of pre-generated image pairs, each image pair including a first image and a second image of a target style.
[0104] The processing instruction in the above steps can be an instruction that the user confirms the need to generate a stylized image. In an alternative embodiment, a button can be provided in the interactive interface, which the user can click after determining that the to-be-processed image is correct, so that the client can upload the to-be-processed image to the server, and the server processes it using the trained image translation model to obtain the stylized image.
[0105] Step S906, displaying the target image in the interactive interface.
[0106] In the method in the above embodiments of the present application, the method further comprises: generating a plurality of latent variables by a random algorithm, wherein the number of the plurality of groups of image pairs is the same as the number of the plurality of latent variables; and processing the plurality of latent variables by using the image generation model to obtain the plurality of groups of image pairs.
[0107] In the method in the above embodiments of the present application, processing the plurality of latent variables by using the image generation model to obtain the plurality of groups of image pairs comprises: processing the plurality of latent variables by using a first generation sub-model to obtain first images contained in the plurality of groups of image pairs; and processing the plurality of latent variables by using a second generation sub-model to obtain second images contained in the plurality of groups of image pairs.
[0108] In the method in the above embodiments of the present application, the method further comprises: obtaining a first image set; and training a first initial model by using the first image set to obtain the first generation sub-model.
[0109] In the method in the above embodiments of the present application, the method further comprises: obtaining a second image set of a target style; and adjusting the first generation sub-model by using the second image set to obtain a second generation sub-model, wherein the first generation sub-model and the second generation sub-model share latent variables.
[0110] In the method in the above embodiments of the present application, adjusting the first generation sub-model by using the second image set to obtain the second generation sub-model comprises: processing the second image set by using a first mapping network to obtain first latent variables corresponding to the second image set; processing the second image set by using a second mapping network to obtain second latent variables corresponding to the second image set, wherein the second mapping network has the same structure as the first mapping network but adjustable parameters; processing the first latent variables and the second latent variables by using a second backbone network respectively to obtain first generated images and second generated images, wherein the second backbone network has the same structure as the first backbone network but adjustable parameters; and adjusting network parameters of the second mapping network and the second backbone network based on the first generated images and the second generated images to obtain the second generation sub-model.
[0111] In the method in the above embodiments of the present application, adjusting the network parameters of the second mapping network and the second backbone network based on the first generated images and the second generated images to obtain the second generation sub-model comprises: processing the first generated images and the second generated images by using a perception loss algorithm to obtain a target loss value; and in a case where the target loss value is greater than or equal to a preset loss value, adjusting the network parameters of the second mapping network and the second backbone network until the target loss value is less than the preset loss value to obtain the second generation sub-model.
[0112] It should be noted that the preferred embodiments involved in the above embodiments of the present application have the same application scenarios and implementation processes as the scheme provided in Embodiment 1, but are not limited to the scheme provided in Embodiment 1.
[0113] Embodiment 3
[0114] According to an embodiment of the present application, a method for image processing is also provided. It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0115] Figure 10 is a flowchart of a third method for image processing according to an embodiment of the present application. As shown in the figure, the method comprises the following steps: Figure 10
[0116] Step S1002, obtaining a face image.
[0117] Step S1004, processing the face image using an image translation model to obtain a target image of a target style, wherein the semantics of the face image and the target image correspond, and the image translation model is obtained by training a plurality of sets of image pairs, each set of image pairs comprising a first image and a second image of a target style.
[0118] In the above embodiments of the present application, the method further comprises: generating a plurality of latent variables by a random algorithm, wherein the number of the plurality of sets of image pairs is the same as the number of the plurality of latent variables; and processing the plurality of latent variables using an image generation model to obtain the plurality of sets of image pairs.
[0119] In the above embodiments of the present application, processing the plurality of latent variables using the image generation model to obtain the plurality of sets of image pairs comprises: processing the plurality of latent variables using a first generation sub-model to obtain the first images contained in the plurality of sets of image pairs; and processing the plurality of latent variables using a second generation sub-model to obtain the second images contained in the plurality of sets of image pairs.
[0120] In the above embodiments of the present application, the method further comprises: obtaining a first image set; and training a first initial model using the first image set to obtain the first generation sub-model.
[0121] In the above embodiments of the present application, the method further comprises: obtaining a second image set of the target style; and adjusting the first generation sub-model using the second image set to obtain a second generation sub-model, wherein the first generation sub-model and the second generation sub-model share latent variables.
[0122] In the above embodiments of the present application, adjusting the first generation sub-model through the second image set to obtain the second generation sub-model includes: processing the second image set by using the first mapping network to obtain the first hidden variable corresponding to the second image set; processing the second image set by using the second mapping network to obtain the second hidden variable corresponding to the second image set, wherein the second mapping network has the same structure as the first mapping network but adjustable parameters; processing the first hidden variable and the second hidden variable by using the second backbone network to obtain the first generated image and the second generated image, wherein the second backbone network has the same structure as the first backbone network but adjustable parameters; and adjusting the network parameters of the second mapping network and the second backbone network based on the first generated image and the second generated image to obtain the second generation sub-model.
[0123] In the above embodiments of the present application, adjusting the network parameters of the second mapping network and the second backbone network based on the first generated image and the second generated image to obtain the second generation sub-model includes: processing the first generated image and the second generated image by using a perception loss algorithm to obtain a target loss value; and adjusting the network parameters of the second mapping network and the second backbone network until the target loss value is less than a preset loss value, in a case where the target loss value is greater than or equal to the preset loss value, to obtain the second generation sub-model.
[0124] It should be noted that the preferred embodiments involved in the above embodiments of the present application have the same application scenarios and implementation processes as the schemes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0125] Embodiment 4
[0126] According to the embodiments of the present application, an image processing method is also provided. It should be noted that the steps shown in the flowchart can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0127] Figure 11 is a flowchart of a fourth image processing method according to an embodiment of the present application. As shown in Figure 11 the method includes the following steps:
[0128] Step S1102, receiving an image processing request, wherein the image processing request includes: an image to be processed and a target style.
[0129] In an optional embodiment, when a user needs to perform style processing on an image to be processed, the user can select an image to be processed to be uploaded and a target style to be style processed, so that the client can package the image to be processed selected by the user and the target style to generate an image processing request and upload it to the server for processing.
[0130] In step S1104, an image translation model corresponding to the target style is obtained, wherein the image translation model is obtained by training a plurality of groups of image pairs, and each group of image pairs includes a first image and a second image of the target style.
[0131] In an optional embodiment, different image translation models can be trained in advance for different styles, so that users can select as needed.
[0132] In step S1106, the image translation model is used to process the to-be-processed image to obtain a target image of the target style, wherein the semantics of the to-be-processed image and the target image correspond to each other.
[0133] In the above embodiments of the present application, the method further includes: generating a plurality of latent variables by a random algorithm, wherein the number of the plurality of groups of image pairs is the same as the number of the plurality of latent variables; and processing the plurality of latent variables by using an image generation model to obtain the plurality of groups of image pairs.
[0134] In the above embodiments of the present application, processing the plurality of latent variables by using the image generation model to obtain the plurality of groups of image pairs includes: processing the plurality of latent variables by using a first generation sub-model to obtain the first images included in the plurality of groups of image pairs; and processing the plurality of latent variables by using a second generation sub-model to obtain the second images included in the plurality of groups of image pairs.
[0135] In the above embodiments of the present application, the method further includes: obtaining a first image set; and training a first initial model by using the first image set to obtain the first generation sub-model.
[0136] In the above embodiments of the present application, the method further includes: obtaining a second image set of the target style; and adjusting the first generation sub-model by using the second image set to obtain a second generation sub-model, wherein the first generation sub-model and the second generation sub-model share latent variables.
[0137] In the above embodiments of the present application, adjusting the first generation sub-model by using the second image set to obtain the second generation sub-model includes: processing the second image set by using a first mapping network to obtain first latent variables corresponding to the second image set; processing the second image set by using a second mapping network to obtain second latent variables corresponding to the second image set, wherein the second mapping network has the same structure as the first mapping network but adjustable parameters; processing the first latent variables and the second latent variables by using a second backbone network respectively to obtain first generated images and second generated images, wherein the second backbone network has the same structure as the first backbone network but adjustable parameters; and adjusting network parameters of the second mapping network and the second backbone network based on the first generated images and the second generated images to obtain the second generation sub-model.
[0138] In the above embodiments of the present application, adjusting the network parameters of the second mapping network and the second backbone network based on the first generated image and the second generated image to obtain the second generated submodel includes: processing the first generated image and the second generated image through a perception loss algorithm to obtain a target loss value; in a case where the target loss value is greater than or equal to a preset loss value, adjusting the network parameters of the second mapping network and the second backbone network until the target loss value is less than the preset loss value, and obtaining the second generated submodel.
[0139] It should be noted that the preferred embodiments involved in the above embodiments of the present application have the same application scenarios and implementation processes as the schemes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0140] Embodiment 5
[0141] According to the embodiments of the present application, an image processing method is also provided. It should be noted that the steps shown in the flowchart can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that here.
[0142] Figure 12 is a flowchart of a fifth image processing method according to an embodiment of the present application. As shown in Figure 12 the method includes the following steps:
[0143] Step S1202, the cloud server receives the image to be processed uploaded by the client.
[0144] Step S1204, the cloud server processes the image to be processed using an image translation model to obtain a target image of a target style, wherein the semantics of the image to be processed and the target image correspond, and the image translation model is obtained by training a plurality of pre-generated image pairs. Each image pair includes a first image and a second image of a target style.
[0145] Step S1206, the cloud server sends the target image to the client.
[0146] In the above embodiments of the present application, the method further includes: generating a plurality of latent variables through a random algorithm, wherein the number of the plurality of image pairs is the same as the number of the plurality of latent variables; and processing the plurality of latent variables using an image generation model to obtain the plurality of image pairs.
[0147] In the above embodiments of the present application, processing the plurality of latent variables using the image generation model to obtain the plurality of image pairs includes: processing the plurality of latent variables using a first generated submodel to obtain the first image included in the plurality of image pairs; and processing the plurality of latent variables using a second generated submodel to obtain the second image included in the plurality of image pairs.
[0148] In the above embodiments of the present application, the method further comprises: obtaining a first image set; and training the first initial model through the first image set to obtain a first generation sub-model.
[0149] In the above embodiments of the present application, the method further comprises: obtaining a second image set of a target style; and adjusting the first generation sub-model through the second image set to obtain a second generation sub-model, wherein the first generation sub-model and the second generation sub-model share hidden variables.
[0150] In the above embodiments of the present application, adjusting the first generation sub-model through the second image set to obtain the second generation sub-model comprises: processing the second image set by using a first mapping network to obtain first hidden variables corresponding to the second image set; processing the second image set by using a second mapping network to obtain second hidden variables corresponding to the second image set, wherein the second mapping network has the same structure as the first mapping network but adjustable parameters; processing the first hidden variables and the second hidden variables by using a second backbone network to obtain first generated images and second generated images, wherein the second backbone network has the same structure as the first backbone network but adjustable parameters; and adjusting network parameters of the second mapping network and the second backbone network based on the first generated images and the second generated images to obtain the second generation sub-model.
[0151] In the above embodiments of the present application, adjusting the network parameters of the second mapping network and the second backbone network based on the first generated images and the second generated images to obtain the second generation sub-model comprises: processing the first generated images and the second generated images by using a perception loss algorithm to obtain a target loss value; and adjusting the network parameters of the second mapping network and the second backbone network until the target loss value is less than a preset loss value, under the condition that the target loss value is greater than or equal to the preset loss value, to obtain the second generation sub-model.
[0152] It should be noted that the preferred embodiments involved in the above embodiments of the present application have the same application scenarios and implementation processes as the schemes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0153] Embodiment 6
[0154] According to the embodiments of the present application, an image processing device for implementing the above image processing method is further provided, as shown in Figure 13 The device 1300 includes an image acquisition module 1302 and an image processing module 1304.
[0155] The image acquisition module 1302 is configured to acquire a to-be-processed image, and the image processing module 1304 is configured to process the to-be-processed image by using an image translation model to obtain a target image of a target style, wherein the to-be-processed image and the target image correspond in semantics, and the image translation model is obtained by training a plurality of sets of image pairs in advance, each set of image pairs including a first image and a second image of the target style.
[0156] It should be noted that the image acquisition module 1302 and the image processing module 1304 correspond to steps S202 to S204 in Embodiment 1, and the two modules have the same instances and application scenarios as the corresponding steps, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules can run in the computer terminal 10 provided in Embodiment 1 as part of the device.
[0157] In the above embodiments of the present application, the device further includes a latent variable generation module and a latent variable processing module.
[0158] The latent variable generation module is configured to generate a plurality of latent variables by using a random algorithm, and the number of the plurality of sets of image pairs is the same as the number of the plurality of latent variables; and the latent variable processing module is configured to process the plurality of latent variables by using an image generation model to obtain the plurality of sets of image pairs.
[0159] In the above embodiments of the present application, the latent variable processing module includes a first processing unit and a second processing unit.
[0160] The first processing unit is configured to process the plurality of latent variables by using a first generation sub-model to obtain the first image included in the plurality of sets of image pairs, and the second processing unit is configured to process the plurality of latent variables by using a second generation sub-model to obtain the second image included in the plurality of sets of image pairs.
[0161] In the above embodiments of the present application, the device further includes a training module.
[0162] The image acquisition module is further configured to acquire a first image set, and the training module includes training a first initial model by using the first image set to obtain the first generation sub-model.
[0163] In the above embodiments of the present application, the device further includes an adjustment module.
[0164] The image acquisition module is further configured to acquire a second image set of the target style, and the adjustment module is configured to adjust the first generation sub-model by using the second image set to obtain a second generation sub-model, wherein the first generation sub-model and the second generation sub-model share the latent variables.
[0165] In the above embodiments of the present application, the adjusting module comprises a first image processing unit, a second image processing unit, an image generating unit and an adjusting unit.
[0166] The first image processing unit is configured to process the second image set by using a first mapping network to obtain first hidden variables corresponding to the second image set; the second image processing unit is configured to process the second image set by using a second mapping network to obtain second hidden variables corresponding to the second image set, wherein the second mapping network has the same structure as the first mapping network but adjustable parameters; the image generating unit is configured to process the first hidden variables and the second hidden variables by using a second backbone network to obtain first generated images and second generated images, wherein the second backbone network has the same structure as the first backbone network but adjustable parameters; and the adjusting unit is configured to adjust network parameters of the second mapping network and the second backbone network based on the first generated images and the second generated images to obtain a second generated submodel.
[0167] In the above embodiments of the present application, the adjusting unit is further configured to process the first generated images and the second generated images by using a perception loss algorithm to obtain a target loss value; and in a case where the target loss value is greater than or equal to a preset loss value, adjust the network parameters of the second mapping network and the second backbone network until the target loss value is less than the preset loss value to obtain the second generated submodel.
[0168] It should be noted that the preferred embodiments involved in the above embodiments of the present application have the same application scenarios and implementation processes as the schemes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0169] Embodiment 7
[0170] According to the embodiments of the present application, an image processing device for implementing the above image processing method is further provided, as shown in Figure 14 The device 1400 comprises a first display module 1402, a response module 1404 and a second display module 1406.
[0171] The first display module 1402 is configured to display a to-be-processed image in an interactive interface; the response module 1404 is configured to process the to-be-processed image by using an image translation model to obtain a target image of a target style, wherein the semantics of the to-be-processed image and the target image correspond to each other, the image translation model is obtained by training a plurality of pre-generated image pairs, and each image pair comprises a first image and a second image of the target style; and the second display module 1406 is configured to display the target image in the interactive interface.
[0172] It should be noted that the first display module 1402, the response module 1404 and the second display module 1406 correspond to steps S902 to S906 in Embodiment 2, and the three modules have the same instances and application scenarios as the corresponding steps, but are not limited to the disclosure of Embodiment 2. It should be noted that the above modules can be run in the computer terminal 10 provided in Embodiment 1 as part of the device.
[0173] In the above embodiments of the present application, the device further comprises a latent variable generation module and a latent variable processing module.
[0174] The latent variable generation module is configured to generate a plurality of latent variables by using a random algorithm, and the number of the plurality of image pairs is the same as the number of the plurality of latent variables; and the latent variable processing module is configured to process the plurality of latent variables by using the image generation model to obtain the plurality of image pairs.
[0175] In the above embodiments of the present application, the latent variable processing module comprises a first processing unit and a second processing unit.
[0176] The first processing unit is configured to process the plurality of latent variables by using the first generation sub-model to obtain the first image included in the plurality of image pairs; and the second processing unit is configured to process the plurality of latent variables by using the second generation sub-model to obtain the second image included in the plurality of image pairs.
[0177] In the above embodiments of the present application, the device further comprises a training module.
[0178] The image acquisition module is further configured to acquire a first image set; and the training module comprises training the first initial model by using the first image set to obtain the first generation sub-model.
[0179] In the above embodiments of the present application, the device further comprises an adjustment module.
[0180] The image acquisition module is further configured to acquire a second image set of a target style; and the adjustment module is configured to adjust the first generation sub-model by using the second image set to obtain a second generation sub-model, wherein the first generation sub-model and the second generation sub-model share the latent variables.
[0181] In the above embodiments of the present application, the adjustment module comprises a first image processing unit, a second image processing unit, an image generation unit and an adjustment unit.
[0182] The first image processing unit is configured to process the second image set by using a first mapping network to obtain a first latent variable corresponding to the second image set; the second image processing unit is configured to process the second image set by using a second mapping network to obtain a second latent variable corresponding to the second image set, wherein the second mapping network has the same structure as the first mapping network but has adjustable parameters; the image generation unit is configured to process the first latent variable and the second latent variable by using a second backbone network to obtain a first generated image and a second generated image, wherein the second backbone network has the same structure as the first backbone network but has adjustable parameters; and the adjustment unit is configured to adjust network parameters of the second mapping network and the second backbone network based on the first generated image and the second generated image to obtain a second generation submodel.
[0183] In the above embodiments of the present application, the adjustment unit is further configured to process the first generated image and the second generated image by using a perception loss algorithm to obtain a target loss value; and adjust the network parameters of the second mapping network and the second backbone network until the target loss value is less than a preset loss value, under the condition that the target loss value is greater than or equal to the preset loss value, to obtain the second generation submodel.
[0184] It should be noted that the preferred embodiments involved in the above embodiments of the present application have the same application scenarios and implementation processes as the scheme provided in Embodiment 1, but are not limited to the scheme provided in Embodiment 1.
[0185] Embodiment 8
[0186] According to the embodiments of the present application, an image processing device for implementing the above image processing method is further provided, as shown in the figure, the device 1300 includes an image acquisition module 1302 and an image processing module 1304. Figure 13
[0187] The image acquisition module 1302 is configured to acquire a face image; and the image processing module 1304 is configured to process the face image by using an image translation model to obtain a target image of a target style, wherein the semantics of the face image and the target image correspond to each other, the image translation model is obtained by training a plurality of pre-generated image pairs, and each image pair includes a first image and a second image of the target style.
[0188] It should be noted that the above image acquisition module 1302 and image processing module 1304 correspond to steps S1002 to S1004 in Embodiment 3, and the two modules have the same instances and application scenarios as the corresponding steps, but are not limited to the contents disclosed in Embodiment 3. It should be noted that the above modules as part of the device can run in the computer terminal 10 provided in Embodiment 1.
[0189] In the above embodiments of the present application, the device further comprises a latent variable generation module and a latent variable processing module.
[0190] The latent variable generation module is configured to generate a plurality of latent variables by using a random algorithm, wherein the number of the plurality of groups of image pairs is the same as the number of the plurality of latent variables; and the latent variable processing module is configured to process the plurality of latent variables by using the image generation model to obtain the plurality of groups of image pairs.
[0191] In the above embodiments of the present application, the latent variable processing module comprises a first processing unit and a second processing unit.
[0192] The first processing unit is configured to process the plurality of latent variables by using the first generation sub-model to obtain the first images contained in the plurality of groups of image pairs; and the second processing unit is configured to process the plurality of latent variables by using the second generation sub-model to obtain the second images contained in the plurality of groups of image pairs.
[0193] In the above embodiments of the present application, the device further comprises a training module.
[0194] The image acquisition module is further configured to acquire a first image set; and the training module comprises training the first initial model by using the first image set to obtain the first generation sub-model.
[0195] In the above embodiments of the present application, the device further comprises an adjustment module.
[0196] The image acquisition module is further configured to acquire a second image set of a target style; and the adjustment module is configured to adjust the first generation sub-model by using the second image set to obtain a second generation sub-model, wherein the first generation sub-model and the second generation sub-model share the latent variables.
[0197] In the above embodiments of the present application, the adjustment module comprises a first image processing unit, a second image processing unit, an image generation unit and an adjustment unit.
[0198] The first image processing unit is configured to process the second image set by using a first mapping network to obtain first latent variables corresponding to the second image set; the second image processing unit is configured to process the second image set by using a second mapping network to obtain second latent variables corresponding to the second image set, wherein the second mapping network has the same structure as the first mapping network but has adjustable parameters; the image generation unit is configured to process the first latent variables and the second latent variables by using a second backbone network respectively to obtain first generated images and second generated images, wherein the second backbone network has the same structure as the first backbone network but has adjustable parameters; and the adjustment unit is configured to adjust network parameters of the second mapping network and the second backbone network based on the first generated images and the second generated images to obtain the second generation sub-model.
[0199] In the above embodiments of the present application, the adjusting unit is further configured to: process the first generated image and the second generated image through a perception loss algorithm to obtain a target loss value; and adjust network parameters of the second mapping network and the second backbone network until the target loss value is less than the preset loss value in a case where the target loss value is greater than or equal to the preset loss value, to obtain the second generated sub-model.
[0200] It should be noted that the preferred embodiments involved in the above embodiments of the present application have the same application scenarios and implementation processes as the schemes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0201] Embodiment 9
[0202] According to the embodiments of the present application, an image processing device for implementing the above image processing method is further provided, as shown in Figure 15 The device 1500 includes a request receiving module 1502, a model obtaining module 1504, and an image processing module 1506.
[0203] The request receiving module 1502 is configured to receive an image processing request, wherein the image processing request includes a to-be-processed image and a target style; the model obtaining module 1504 is configured to obtain an image translation model corresponding to the target style, wherein the image translation model is obtained by training a plurality of pre-generated image pairs, and each image pair includes a first image and a second image of the target style; and the image processing module 1506 is configured to process the to-be-processed image using the image translation model to obtain a target image of the target style, wherein the semantics of the to-be-processed image and the target image correspond to each other, and the image translation model is obtained by training a plurality of pre-generated image pairs, and each image pair includes a first image and a second image of the target style.
[0204] It should be noted that the request receiving module 1502, the model obtaining module 1504, and the image processing module 1506 correspond to steps S1102 to S1106 in Embodiment 4, and the three modules have the same instances and application scenarios as the corresponding steps, but are not limited to the content disclosed in Embodiment 4. It should be noted that the above modules, as part of the device, can run in the computer terminal 10 provided in Embodiment 1.
[0205] In the above embodiments of the present application, the device further includes a latent variable generating module and a latent variable processing module.
[0206] The latent variable generating module is configured to generate a plurality of latent variables through a random algorithm, wherein the number of the plurality of image pairs is the same as the number of the plurality of latent variables; and the latent variable processing module is configured to process the plurality of latent variables using an image generating model to obtain the plurality of image pairs.
[0207] In the foregoing embodiments of the present application, the hidden variable processing module comprises a first processing unit and a second processing unit.
[0208] The first processing unit is configured to process the plurality of hidden variables by using the first generation sub-model to obtain the first image contained in the plurality of image pairs.
[0209] In the foregoing embodiments of the present application, the device further comprises a training module.
[0210] The image acquisition module is further configured to acquire a first image set; and the training module comprises training the first initial model by using the first image set to obtain the first generation sub-model.
[0211] In the foregoing embodiments of the present application, the device further comprises an adjusting module.
[0212] The image acquisition module is further configured to acquire a second image set of a target style; and the adjusting module is configured to adjust the first generation sub-model by using the second image set to obtain a second generation sub-model, wherein the first generation sub-model and the second generation sub-model share hidden variables.
[0213] In the foregoing embodiments of the present application, the adjusting module comprises a first image processing unit, a second image processing unit, an image generation unit and an adjusting unit.
[0214] The first image processing unit is configured to process the second image set by using a first mapping network to obtain first hidden variables corresponding to the second image set; the second image processing unit is configured to process the second image set by using a second mapping network to obtain second hidden variables corresponding to the second image set, wherein the second mapping network has the same structure as the first mapping network but adjustable parameters; the image generation unit is configured to process the first hidden variables and the second hidden variables by using a second backbone network respectively to obtain first generated images and second generated images, wherein the second backbone network has the same structure as the first backbone network but adjustable parameters; and the adjusting unit is configured to adjust network parameters of the second mapping network and the second backbone network based on the first generated images and the second generated images to obtain the second generation sub-model.
[0215] In the foregoing embodiments of the present application, the adjusting unit is further configured to process the first generated images and the second generated images by using a perception loss algorithm to obtain a target loss value; and in a case where the target loss value is greater than or equal to a preset loss value, the network parameters of the second mapping network and the second backbone network are adjusted until the target loss value is less than the preset loss value to obtain the second generation sub-model.
[0216] It should be noted that the preferred embodiments involved in the above embodiments of the present application have the same application scenarios and implementation processes as the schemes provided in Embodiment 1, but are not limited to the schemes provided in Embodiment 1.
[0217] Embodiment 10
[0218] According to the embodiments of the present application, an image processing device for implementing the above image processing method is further provided. The device is deployed in a cloud server, as shown in the following device 1600, which includes an image receiving module 1602, an image processing module 1604, and an image sending module 1606. Figure 16
[0219] The image receiving module 1602 is configured to receive an image to be processed uploaded by a client. The image processing module 1604 is configured to process the image to be processed by using an image translation model to obtain a target image of a target style, wherein the semantics of the image to be processed and the target image correspond to each other. The image translation model is obtained by training a plurality of sets of image pairs in advance. Each set of image pairs includes a first image and a second image of a target style. The image sending module 1606 is configured to send the target image to the client.
[0220] It should be noted that the image receiving module 1602, the image processing module 1604, and the image sending module 1606 correspond to steps S1202 to S1206 in Embodiment 5. The three modules have the same instances and application scenarios as the corresponding steps, but are not limited to the content disclosed in Embodiment 5. It should be noted that the above modules as part of the device can run in the computer terminal 10 provided in Embodiment 1.
[0221] In the above embodiments of the present application, the device further includes a latent variable generation module and a latent variable processing module.
[0222] The latent variable generation module is configured to generate a plurality of latent variables by using a random algorithm, wherein the number of the plurality of sets of image pairs is the same as the number of the plurality of latent variables. The latent variable processing module is configured to process the plurality of latent variables by using an image generation model to obtain the plurality of sets of image pairs.
[0223] In the above embodiments of the present application, the latent variable processing module includes a first processing unit and a second processing unit.
[0224] The first processing unit is configured to process the plurality of latent variables by using a first generation sub-model to obtain the first image included in the plurality of sets of image pairs. The second processing unit is configured to process the plurality of latent variables by using a second generation sub-model to obtain the second image included in the plurality of sets of image pairs.
[0225] In the above embodiments of the present application, the device further includes a training module.
[0226] The image acquisition module is further configured to acquire a first image set; and the training module comprises: training the first initial model based on the first image set to obtain a first generation sub-model.
[0227] In the above embodiments of the present application, the device further comprises an adjusting module.
[0228] The image acquisition module is further configured to acquire a second image set of a target style; and the adjusting module is configured to adjust the first generation sub-model based on the second image set to obtain a second generation sub-model, wherein the first generation sub-model and the second generation sub-model share hidden variables.
[0229] In the above embodiments of the present application, the adjusting module comprises a first image processing unit, a second image processing unit, an image generation unit, and an adjusting unit.
[0230] The first image processing unit is configured to process the second image set by using a first mapping network to obtain first hidden variables corresponding to the second image set; the second image processing unit is configured to process the second image set by using a second mapping network to obtain second hidden variables corresponding to the second image set, wherein the second mapping network has the same structure as the first mapping network but adjustable parameters; the image generation unit is configured to process the first hidden variables and the second hidden variables by using a second backbone network to obtain first generated images and second generated images, wherein the second backbone network has the same structure as the first backbone network but adjustable parameters; and the adjusting unit is configured to adjust network parameters of the second mapping network and the second backbone network based on the first generated images and the second generated images to obtain the second generation sub-model.
[0231] In the above embodiments of the present application, the adjusting unit is further configured to: process the first generated images and the second generated images by using a perception loss algorithm to obtain a target loss value; and adjust the network parameters of the second mapping network and the second backbone network until the target loss value is less than a preset loss value in a case where the target loss value is greater than or equal to the preset loss value, to obtain the second generation sub-model.
[0232] It should be noted that the preferred embodiments involved in the above embodiments of the present application have the same application scenarios and implementation processes as the scheme provided in Embodiment 1, but are not limited to the scheme provided in Embodiment 1.
[0233] Embodiment 11
[0234] The embodiments of the present application can provide a computer terminal, which can be any computer terminal device in a computer terminal group. Alternatively, in the present embodiment, the above computer terminal can also be replaced by a terminal device such as a mobile terminal.
[0235] Optionally, in the embodiment, the computer terminal can be located in at least one of the plurality of network devices of the computer network.
[0236] In the embodiment, the computer terminal can execute program codes of the following steps in the image processing method: obtaining a to-be-processed image; processing the to-be-processed image by using an image translation model to obtain a target image of a target style, wherein the semantics of the to-be-processed image and the target image correspond to each other, and the image translation model is obtained by training a plurality of pre-generated image pairs, each of the image pairs comprising a first image and a second image of the target style.
[0237] Optionally, Figure 17 is a structural block diagram of a computer terminal according to an embodiment of the present application. As shown in the figure, the computer terminal A can include one or more (only one is shown in the figure) processors 1702 and a memory 1704. Figure 17
[0238] The memory can be used to store software programs and modules, such as program instructions / modules corresponding to the image processing method and device in the embodiments of the present application. The processor executes various functions and data processing by running the software programs and modules stored in the memory, that is, implements the above-mentioned image processing method. The memory can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory can further include a memory remotely arranged with respect to the processor, which can be connected to the terminal A through 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 a combination thereof.
[0239] The processor can call information and application programs stored in the memory through the transmission device to execute the following steps: obtaining a to-be-processed image; processing the to-be-processed image by using an image translation model to obtain a target image of a target style, wherein the semantics of the to-be-processed image and the target image correspond to each other, and the image translation model is obtained by training a plurality of pre-generated image pairs, each of the image pairs comprising a first image and a second image of the target style.
[0240] Optionally, the processor can further execute program codes of the following steps: generating a plurality of latent variables by using a random algorithm, wherein the number of the plurality of image pairs is the same as the number of the plurality of latent variables; processing the plurality of latent variables by using an image generation model to obtain the plurality of image pairs.
[0241] Optionally, the processor can further execute program codes of the following steps: processing the plurality of latent variables by using the first generation sub-model to obtain a first image contained in the plurality of image pairs; processing the plurality of latent variables by using the second generation sub-model to obtain a second image contained in the plurality of image pairs.
[0242] Optionally, the processor can further execute program codes of the following steps: obtaining a first image set; training the first initial model by using the first image set to obtain the first generation sub-model.
[0243] Optionally, the processor can further execute program codes of the following steps: obtaining a second image set of a target style; adjusting the first generation sub-model by using the second image set to obtain the second generation sub-model, wherein the first generation sub-model and the second generation sub-model share the latent variables.
[0244] Optionally, the processor can further execute program codes of the following steps: processing the second image set by using the first mapping network to obtain a first latent variable corresponding to the second image set; processing the second image set by using the second mapping network to obtain a second latent variable corresponding to the second image set, wherein the second mapping network has the same structure as the first mapping network but adjustable parameters; processing the first latent variable and the second latent variable by using the second backbone network to obtain a first generated image and a second generated image, wherein the second backbone network has the same structure as the first backbone network but adjustable parameters; adjusting the network parameters of the second mapping network and the second backbone network based on the first generated image and the second generated image to obtain the second generation sub-model.
[0245] Optionally, the processor can further execute program codes of the following steps: processing the first generated image and the second generated image by using a perception loss algorithm to obtain a target loss value; in a case that the target loss value is greater than or equal to a preset loss value, adjusting the network parameters of the second mapping network and the second backbone network until the target loss value is less than the preset loss value to obtain the second generation sub-model.
[0246] The processor can call information and application programs stored in the memory through the transmission device to execute the following steps: displaying a to-be-processed image in an interactive interface; processing the to-be-processed image by using an image translation model to obtain a target image of a target style in response to a received processing instruction, wherein the semantics of the to-be-processed image and the target image correspond to each other, the image translation model is obtained by training a plurality of pre-generated image pairs, and each image pair includes a first image and a second image of a target style; and displaying the target image in the interactive interface.
[0247] The processor can call information and application programs stored in the memory through the transmission device to perform the following steps: obtaining a face image; processing the face image by using an image translation model to obtain a target image of a target style, wherein the semantics of the face image and the target image correspond to each other, and the image translation model is obtained by training a plurality of pre-generated image pairs, and each image pair includes a first image and a second image of the target style.
[0248] The processor can call information and application programs stored in the memory through the transmission device to perform the following steps: receiving an image processing request, wherein the image processing request includes a to-be-processed image and a target style; obtaining an image translation model corresponding to the target style, wherein the image translation model is obtained by training a plurality of pre-generated image pairs, and each image pair includes a first image and a second image of the target style; processing the to-be-processed image by using the image translation model to obtain a target image of the target style, wherein the semantics of the to-be-processed image and the target image correspond to each other.
[0249] The processor can call information and application programs stored in the memory through the transmission device to perform the following steps: a cloud server receives a to-be-processed image uploaded by a client; the cloud server processes the to-be-processed image by using an image translation model to obtain a target image of a target style, wherein the semantics of the to-be-processed image and the target image correspond to each other, and the image translation model is obtained by training a plurality of pre-generated image pairs, and each image pair includes a first image and a second image of the target style; and the cloud server sends the target image to the client.
[0250] By training the image translation model by using a plurality of pre-generated image pairs and processing the to-be-processed image by using the image translation model to obtain a target image of a target style, the technical effect of achieving image stylization without requiring a user to additionally provide a stylized image is achieved, thereby reducing the cost of manual annotation, further reducing the training time and cost of the image translation model, improving the processing accuracy of the image translation model, and further solving the technical problem of increasing processing cost caused by training the image translation model by using a large number of stylized images in the related art.
[0251] Those skilled in the art can understand that Figure 17 The structure shown is only schematic, and the computer terminal can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Figure 17 This does not limit the structure of the electronic device. For example, the computer terminal A can further include more Figure 17more or less components than those shown, such as no network interface, one network interface, multiple network interfaces, etc., or a different configuration of components, such as an additional display, no display, etc. Figure 17
[0252] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiments can be completed by instructing the terminal device related hardware through a program, and the program can be stored in a computer readable storage medium, which can include a flash disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0253] Embodiment 12
[0254] The embodiments of the present application also provide a storage medium. Optionally, in the embodiments, the above-mentioned storage medium can be used to save the program code executed by the image processing method provided by the above-mentioned embodiments.
[0255] Optionally, in the embodiments, the above-mentioned storage medium can be located in any one of the computer terminals in the computer terminal group in the computer network, or in any one of the mobile terminals in the mobile terminal group.
[0256] Optionally, in the embodiments, the storage medium is configured to store program code for performing the following steps: obtaining a to-be-processed image; processing the to-be-processed image by using an image translation model to obtain a target image of a target style, wherein the semantics of the to-be-processed image and the target image correspond to each other, and the image translation model is obtained by training a plurality of sets of image pairs, each set of image pairs comprising a first image and a second image of the target style.
[0257] Optionally, the above-mentioned processor can also execute the program code of the following steps: generating a plurality of latent variables by using a random algorithm, wherein the number of the plurality of sets of image pairs is the same as the number of the plurality of latent variables; processing the plurality of latent variables by using an image generation model to obtain the plurality of sets of image pairs.
[0258] Optionally, the above-mentioned processor can also execute the program code of the following steps: processing the plurality of latent variables by using a first generation sub-model to obtain the first image contained in the plurality of sets of image pairs; processing the plurality of latent variables by using a second generation sub-model to obtain the second image contained in the plurality of sets of image pairs.
[0259] Optionally, the above-mentioned processor can also execute the program code of the following steps: obtaining a first image set; training a first initial model by using the first image set to obtain the first generation sub-model.
[0260] Optionally, the processor can further execute program codes of the following steps: obtaining a second image set of the target style; adjusting the first generation sub-model through the second image set to obtain a second generation sub-model, wherein the first generation sub-model and the second generation sub-model share the latent variable.
[0261] Optionally, the processor can further execute program codes of the following steps: processing the second image set by using the first mapping network to obtain a first latent variable corresponding to the second image set; processing the second image set by using a second mapping network to obtain a second latent variable corresponding to the second image set, wherein the second mapping network has the same structure as the first mapping network but adjustable parameters; processing the first latent variable and the second latent variable by using a second backbone network to obtain a first generated image and a second generated image, wherein the second backbone network has the same structure as the first backbone network but adjustable parameters; adjusting network parameters of the second mapping network and the second backbone network based on the first generated image and the second generated image to obtain the second generation sub-model.
[0262] Optionally, the processor can further execute program codes of the following steps: processing the first generated image and the second generated image by using a perception loss algorithm to obtain a target loss value; in a case that the target loss value is greater than or equal to a preset loss value, adjusting the network parameters of the second mapping network and the second backbone network until the target loss value is less than the preset loss value to obtain the second generation sub-model.
[0263] Optionally, in the embodiment, the storage medium is configured to store program codes for executing the following steps: displaying a to-be-processed image in an interactive interface; in response to a received processing instruction, processing the to-be-processed image by using an image translation model to obtain a target image of a target style, wherein the semantics of the to-be-processed image and the target image correspond to each other, the image translation model is obtained by training a plurality of pre-generated image pairs, each image pair includes a first image and a second image of the target style; and displaying the target image in the interactive interface.
[0264] Optionally, in the embodiment, the storage medium is configured to store program codes for executing the following steps: obtaining a face image; processing the face image by using an image translation model to obtain a target image of a target style, wherein the semantics of the face image and the target image correspond to each other, the image translation model is obtained by training a plurality of pre-generated image pairs, each image pair includes a first image and a second image of the target style.
[0265] Optionally, in the embodiment, the storage medium is configured to store program code for performing the following steps: receiving an image processing request, wherein the image processing request comprises: an image to be processed and a target style; obtaining an image translation model corresponding to the target style, wherein the image translation model is obtained by training a plurality of pre-generated image pairs, and each image pair comprises: a first image and a second image of the target style; processing the image to be processed by using the image translation model to obtain a target image of the target style, wherein the semantics of the image to be processed and the target image correspond to each other.
[0266] Optionally, in the embodiment, the storage medium is configured to store program code for performing the following steps: receiving an image processing request, wherein the image processing request comprises: an image to be processed and a target style; obtaining an image translation model corresponding to the target style, wherein the image translation model is obtained by training a plurality of pre-generated image pairs, and each image pair comprises: a first image and a second image of the target style; processing the image to be processed by using the image translation model to obtain a target image of the target style, wherein the semantics of the image to be processed and the target image correspond to each other.
[0267] The serial numbers of the embodiments of the application are only for description, and do not represent the advantages or disadvantages of the embodiments.
[0268] In the above-described embodiments of the application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0269] In the several embodiments of the application, it should be understood that the disclosed technology can be implemented in other ways. Of course, the above-described device embodiments are only schematic. For example, the division of units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, and can be electrical or other forms.
[0270] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment.
[0271] In addition, each of the functional units in the various embodiments of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0272] When the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such an understanding, the technical solutions of the present application, essentially or in part, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various other media that can store program codes.
[0273] The above description is only the preferred embodiments of the present application, and it should be pointed out that, for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be regarded as the protection scope of the present application.
Claims
1. An image processing method, characterized in that, include: Obtain the image to be processed; The image to be processed is processed using an image translation model to obtain a target image of the target style, wherein the semantics of the image to be processed and the target image correspond. The image translation model is trained by pre-generated multiple sets of image pairs. Each set of image pairs includes a first image and a second image of the target style. The multiple sets of image pairs are obtained by processing multiple latent variables using an image generation model. The multiple latent variables are generated by a random algorithm. The number of multiple sets of image pairs is the same as the number of multiple latent variables. The method further includes: processing the plurality of latent variables using a first generator sub-model to obtain a first image contained in the plurality of image pairs; and processing the plurality of latent variables using a second generator sub-model to obtain a second image contained in the plurality of image pairs.
2. The method according to claim 1, characterized in that, The method further includes: Obtain the first image set; The first generated sub-model is obtained by training the initial model using the first image set.
3. The method according to claim 1 or 2, characterized in that, The method further includes: Obtain the second image set of the target style; The first generating sub-model is adjusted using the second image set to obtain the second generating sub-model, wherein the first generating sub-model and the second generating sub-model share latent variables.
4. The method according to claim 3, characterized in that, The first generative sub-model includes a first mapping network and a first backbone network. The second generative sub-model is obtained by adjusting the first generative sub-model using the second image set. The first mapping network is used to process the second image set to obtain the first latent variable corresponding to the second image set; The second image set is processed using a second mapping network to obtain the second latent variable corresponding to the second image set. The second mapping network has the same structure as the first mapping network, but its parameters can be adjusted. The first latent variable and the second latent variable are processed by the second backbone network to obtain the first generated image and the second generated image. The second backbone network has the same structure as the first backbone network, but the parameters can be adjusted. The network parameters of the second mapping network and the second backbone network are adjusted based on the first generated image and the second generated image to obtain the second generated sub-model.
5. The method according to claim 4, characterized in that, The second generation sub-model is obtained by adjusting the network parameters of the second mapping network and the second backbone network based on the first generated image and the second generated image, including: The first generated image and the second generated image are processed by a perceptual loss algorithm to obtain the target loss value; If the target loss value is greater than or equal to the preset loss value, the network parameters of the second mapping network and the second backbone network are adjusted until the target loss value is less than the preset loss value, thus obtaining the second generated sub-model.
6. An image processing method, characterized in that, include: Display the image to be processed in the interactive interface; In response to the received processing instruction, the image to be processed is processed using an image translation model to obtain a target image of the target style, wherein the semantics of the image to be processed and the target image correspond. The image translation model is trained by pre-generated multiple sets of image pairs. Each set of image pairs includes: a first image and a second image of the target style. The multiple sets of image pairs are obtained by processing multiple latent variables using an image generation model. The multiple latent variables are generated by a random algorithm. The number of multiple sets of image pairs is the same as the number of multiple latent variables. The target image is displayed in the interactive interface; The method further includes: processing the plurality of latent variables using a first generator sub-model to obtain a first image contained in the plurality of image pairs; and processing the plurality of latent variables using a second generator sub-model to obtain a second image contained in the plurality of image pairs.
7. An image processing method, characterized in that, include: Acquire facial images; The face image is processed using an image translation model to obtain a target image of the target style, wherein the face image and the target image correspond semantically. The image translation model is trained by pre-generated multiple sets of image pairs. Each set of image pairs includes a first image and a second image of the target style. The multiple sets of image pairs are obtained by processing multiple latent variables using an image generation model. The multiple latent variables are generated by a random algorithm, and the number of multiple sets of image pairs is the same as the number of latent variables. The method further includes: processing the plurality of latent variables using a first generator sub-model to obtain a first image contained in the plurality of image pairs; and processing the plurality of latent variables using a second generator sub-model to obtain a second image contained in the plurality of image pairs.
8. An image processing method, characterized in that, include: Receive an image processing request, wherein the image processing request includes: an image to be processed and a target style; Obtain the image translation model corresponding to the target style, wherein the image translation model is trained by pre-generated multiple sets of image pairs, each set of image pairs includes: a first image and a second image of the target style, the multiple sets of image pairs are obtained by processing multiple latent variables using an image generation model, the multiple latent variables are generated by a random algorithm, and the number of the multiple sets of image pairs is the same as the number of the multiple latent variables; The image to be processed is processed using the image translation model to obtain a target image of the target style, wherein the semantics of the image to be processed and the target image correspond. The method further includes: processing the plurality of latent variables using a first generator sub-model to obtain a first image contained in the plurality of image pairs; and processing the plurality of latent variables using a second generator sub-model to obtain a second image contained in the plurality of image pairs.
9. An image processing method, characterized in that, include: The cloud server receives images to be processed uploaded by the client; The cloud server uses an image translation model to process the image to be processed to obtain a target image of the target style. The image to be processed and the target image correspond semantically. The image translation model is trained by pre-generated multiple sets of image pairs. Each set of image pairs includes a first image and a second image of the target style. The multiple sets of image pairs are obtained by processing multiple latent variables using an image generation model. The multiple latent variables are generated by a random algorithm. The number of multiple sets of image pairs is the same as the number of latent variables. The cloud server sends the target image to the client; The method further includes: processing the plurality of latent variables using a first generator sub-model to obtain a first image contained in the plurality of image pairs; and processing the plurality of latent variables using a second generator sub-model to obtain a second image contained in the plurality of image pairs.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform the image processing method according to any one of claims 1 to 9.
11. A computer terminal, characterized in that, include: A memory and a processor, the processor being configured to run a program stored in the memory, wherein the program, when executed, performs the image processing method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Interactive arbitrary deformation style face cartoon automatic generation method
CN111508048A
Method for constructing matching model, clothing recommendation method and device, medium, and terminal
WO2019134560A1