Model training method, picture generation method and apparatus, medium, and electronic device

By combining stylized images with general images with similar content, and using style feature vectors for model training, the problem of insufficient samples and difficult description of characteristics in stylized image generation is solved, and fast, low-cost stylized image generation is achieved.

WO2024199428A1PCT designated stage expired Publication Date: 2024-10-03BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/084744
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-30
Filing Date
2024-03-29
Publication Date
2024-10-03

AI Technical Summary

Technical Problem

When generating stylized images with existing technology, it is difficult to collect enough stylized image samples, and some style features are difficult to describe through text, making model training difficult.

Method used

By obtaining the stylized pictures to be trained and general pictures with similar content but missing style, training data is constructed, the stylized picture generation model is used for training, and the style feature vector is combined for joint training to ensure the accuracy of style learning.

Benefits of technology

Even if the number of samples is limited or the style characteristics are difficult to describe, it can still effectively train a stylized image generation model for user-defined styles, which has the advantages of small training overhead, low cost, and rapid generation of stylized images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024084744_03102024_PF_FP_ABST
    Figure CN2024084744_03102024_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure relates to a model training method, a picture generation method and apparatus, a medium, and an electronic device, which allow for performing model training in situations where there are very few stylized samples or where explicit style words cannot be used to describe a style. A method for training a stylized picture generation model comprises: obtaining a stylized picture to be trained and a generic picture to be trained, wherein the generic picture to be trained is a picture which has similar content to the stylized picture to be trained but does not have a style; based on the stylized picture to be trained and the generic picture to be trained, constructing training data, wherein the training data comprises a stylized picture to be trained and a first text description paired thereto, and a generic picture to be trained and a second text description paired thereto, and wherein the first text description contains a style feature vector to be trained; and based on the training data, training the stylized picture generation model.
Need to check novelty before this filing date? Find Prior Art

Description

Model training method, image generation method, device, medium and electronic device

[0001] This application claims priority to Chinese Patent Application No. 202310333549.1 filed on March 30, 2023, and the contents of the above-mentioned Chinese patent application disclosure are hereby incorporated by reference in their entirety as a part of this application. Technical Field

[0002] The embodiments of the present disclosure relate to a model training method, an image generation method, an apparatus, a medium, and an electronic device. Background Art

[0003] In related technologies, to generate stylized images, a common approach is to use a large number of stylized images and paired text descriptions for model training. Stylish words (for example, "oil painting style") are added to the paired text descriptions to guide model training. However, in many scenarios, it is often difficult to collect enough stylized images as training samples, and the stylistic characteristics of some stylized images are difficult to describe in text, making it impossible to use explicit stylistic words or labels to guide model training.

[0004] Summary of the Invention

[0005] This summary is provided to briefly introduce concepts that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0006] In a first aspect, the present disclosure provides a method for training a stylized image generation model, comprising: obtaining a stylized image to be trained and a general image to be trained, wherein the general image to be trained is a image that is similar in content to the stylized image to be trained but does not have a style; constructing training data based on the stylized image to be trained and the general image to be trained, wherein the training data includes a first text description of the stylized image to be trained and its pair, and a second text description of the general image to be trained and its pair, wherein the first text description contains a style feature vector to be trained; and training the stylized image generation model based on the training data.

[0007] In a second aspect, the present disclosure provides a stylized image generation method, comprising: receiving a picture to be stylized input by a user; processing the picture to be stylized using a stylized image generation model to generate a stylized picture, wherein the stylized image generation model is a model trained using the stylized image generation model training method described in any one of the first aspects of the present disclosure.

[0008] In a third aspect, the present disclosure provides a training device for a stylized image generation model, comprising: an acquisition module for acquiring a stylized image to be trained and a general image to be trained, wherein the general image to be trained is a image that is similar in content to the stylized image to be trained but does not have a style; a construction module for constructing training data based on the stylized image to be trained and the general image to be trained, wherein the training data includes a first text description of the stylized image to be trained and its pairing, and a second text description of the general image to be trained and its pairing, wherein the first text description contains a style feature vector to be trained; and a training module for training the stylized image generation model based on the training data.

[0009] In a fourth aspect, the present disclosure provides a stylized image generation device, comprising: a receiving module for receiving a picture to be stylized input by a user; and a generation module for processing the picture to be stylized using a stylized image generation model to generate a stylized picture, wherein the stylized image generation model is a model trained using the training method for the stylized image generation model described in any one of the first aspects of the present disclosure.

[0010] In a fifth aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of any one of the methods described in the first aspect of the present disclosure.

[0011] In a sixth aspect, the present disclosure provides an electronic device comprising: a storage device storing a computer program; and a processing device for executing the computer program in the storage device to implement the steps of any one of the methods described in the first aspect of the present disclosure.

[0012] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The above and other features, advantages and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale. In the drawings:

[0014] FIG1 is a flowchart of a method for training a stylized image generation model according to an embodiment of the present disclosure.

[0015] FIG2 is a schematic block diagram of training a stylized image generation model according to an embodiment of the present disclosure.

[0016] FIG3 is a flowchart of a method for generating a stylized image according to an embodiment of the present disclosure.

[0017] FIG4 is an effect diagram of a stylized image generated according to the stylized image generation method disclosed herein.

[0018] FIG5 is a schematic block diagram of a training apparatus for a stylized image generation model according to an embodiment of the present disclosure.

[0019] FIG6 is a schematic block diagram of a stylized image generating apparatus according to an embodiment of the present disclosure.

[0020] FIG7 shows a schematic structural diagram of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION

[0021] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.

[0022] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0023] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.

[0024] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0025] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".

[0026] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0027] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0028] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.

[0029] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.

[0030] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0031] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) must comply with the requirements of relevant laws, regulations and relevant provisions.

[0032] Figure 1 is a flow chart of a method for training a stylized image generation model according to an embodiment of the present disclosure. As shown in Figure 1 , the training method includes the following steps S11 to S13.

[0033] In step S11 , a stylized picture to be trained and a general picture to be trained are obtained, wherein the general picture to be trained is a picture that is similar to the stylized picture to be trained in content but does not have a style.

[0034] Stylized images refer to images with a certain style (e.g., oil painting style, or some style that cannot be described using explicit style words). Stylized images for training can be obtained from users. Furthermore, the number of stylized images for training of the same style does not need to be large; a very small number of stylized images (e.g., 3 to 5, or even 1) of the same style can also be used to train the style.

[0035] The general picture may be, for example, a real picture that is similar in content to the stylized picture to be trained and reflects a real scene.

[0036] The following example illustrates a general training image that is similar in content to a stylized training image. For example, the stylized training image contains a girl wearing a helmet, and the girl is partially stylized. The general training image also contains a girl wearing a helmet, but the girl is not stylized at all. In other words, the stylized training image and the general training image are similar in content—both are girls wearing helmets—but the difference lies in the stylized girl in the stylized training image.

[0037] In some embodiments, obtaining general images to be trained can be achieved as follows. First, corresponding text descriptions are generated for the stylized images to be trained. For example, a text generation model can be used to generate a corresponding text description for each stylized image to be trained. Then, based on the generated text descriptions, general images to be trained are generated. For example, a pre-trained diffusion model can be used to generate a batch of general images to be trained based on the generated text descriptions. These general images to be trained have similar content to the stylized images to be trained.

[0038] In addition, after generating a general image to be trained based on the generated text description, the generated general image to be trained can be amplified at different scales. This can obtain more training samples and solve the problem of insufficient training data.

[0039] In some embodiments, obtaining a stylized image to be trained can be accomplished as follows: First, a stylized image input by a user is received. Then, the stylized image input by the user is amplified at different scales to obtain a stylized image to be trained. This allows for the acquisition of more training samples, addressing the issue of insufficient training data.

[0040] In step S12, training data is constructed based on the stylized image to be trained and the general image to be trained. The training data includes a first text description of the stylized image to be trained and its pair, and a second text description of the general image to be trained and its pair. The first text description contains a style feature vector to be trained. The style feature vector is used to represent the style type of the stylized image to be trained.

[0041] The second text description does not contain any style feature vector to be trained.

[0042] In some embodiments, the first text description is constructed as follows: First, a corresponding text description is generated for the stylized image to be trained. For example, a text generation model can be used to generate a corresponding text description for each stylized image to be trained. Then, the style feature vector to be trained is added to the generated text description to obtain the first text description.

[0043] In some embodiments, the first text description may also be constructed in the following manner: First, a text description corresponding to the stylized image to be trained is received from a user. Then, the style feature vector to be trained is added to the text description to obtain the first text description.

[0044] In some embodiments, for the stylized images to be trained and the general images to be trained obtained by amplification mentioned above, corresponding prefixes can be added to their corresponding text descriptions. For example, when enlarged, the description "zoomin" can be attached to the corresponding text description. In this way, a first text description corresponding to the stylized images to be trained obtained by amplification and a second text description corresponding to the general images to be trained obtained by amplification are obtained.

[0045] In some embodiments, the constructed training data may be in the following form:

[0046] (stylized image to be trained, paired with the first text description)

[0047] (general image to be trained, paired second text description)

[0048] In step S13, the stylized image generation model is trained based on the training data.

[0049] The stylized image generation model can be a diffusion model or other models that can generate images from images.

[0050] In some embodiments, during the training process, training data can be input into the stylized image generation model to obtain stylized images and general images output by the stylized image generation model, and then the reconstruction loss between the stylized image to be trained and the stylized image output by the stylized image generation model, as well as the reconstruction loss between the general image to be trained and the general image output by the stylized image generation model are calculated. Then, based on the reconstruction loss, the stylized image generation model is corrected, and when the calculated reconstruction loss meets the preset conditions, the trained stylized image generation model is obtained. Taking Figure 2 as an example, the upper left corner shows the stylized image to be trained, where "[*]" represents the style feature vector to be trained. The lower left corner shows the general image to be trained, the upper right corner shows the stylized image output by the trained stylized image generation model, and the lower right corner shows the general image output by the trained stylized image generation model. The trained stylized image generation model calculates the reconstruction loss between the upper left and upper right images, and the reconstruction loss between the lower left and lower right images. When the reconstruction loss meets the preset conditions, the trained stylized image generation model is obtained. After training, the user can use this trained stylized image generation model to stylize any image, outputting an image with the style shown in the upper left corner of Figure 2. By training with both the stylized image to be trained and the general image to be trained, the general image to be trained can be used to offset the content of the stylized image to be trained, ensuring that the content of the stylized image to be trained is not learned as style, thus ensuring the accuracy of the style learning results.

[0051] By adopting the above technical solution, since pictures of a certain style are trained using stylized pictures to be trained and general pictures to be trained with similar content and their respective corresponding text descriptions, and the text descriptions of the stylized pictures to be trained contain the style feature vectors to be trained, that is, the training process of the present disclosure is to jointly train the stylized pictures to be trained and the general pictures to be trained, and to jointly train the style feature vectors to be trained and the stylized picture generation model. Therefore, even if there are not enough stylized pictures of the same style, the stylized picture generation model can be trained for stylized pictures of that style type. Even if the stylistic characteristics of a certain type of stylized picture cannot be described or labeled using explicit style words, the stylized picture generation model can be trained for stylized pictures of that style type. This makes the training method of the stylized picture generation model according to the present disclosure capable of training stylized pictures of any style type customized by the user. Moreover, the training method of the stylized picture generation model according to the present disclosure also has the advantages of low training overhead, small amount of training data required, low cost, simplicity, etc., can quickly train to achieve results, and facilitates user personal training.

[0052] FIG3 is a flow chart of a method for generating a stylized image according to an embodiment of the present disclosure. As shown in FIG3 , the method for generating a stylized image may include the following steps S31 and S32 .

[0053] In step S31, a picture to be stylized input by a user is received;

[0054] In step S32, the stylized image to be stylized is processed using a stylized image generation model to generate a stylized image, wherein the stylized image generation model is a model trained based on the training method for the stylized image generation model disclosed in the present invention.

[0055] In the process of generating stylized images, the stylized image generation model can automatically generate a text description corresponding to the image to be stylized input by the user, and automatically add the style feature vector learned during training to the text description to transform the image to be stylized input by the user into an image of the style the user wants.

[0056] Similarly, if the user inputs a text description of the image in step S31, then in step S32, the stylized image generation model can also automatically add the style feature vector learned during training to the text description input by the user to output an image of the style the user wants based on the text description input by the user.

[0057] By adopting the above technical solution, since the stylized image generation model is a model trained based on the training method of the stylized image generation model disclosed in the present invention, it is possible to quickly output the stylized image desired by the user.

[0058] Figure 4 is a rendering of a stylized image generated according to the stylized image generation method disclosed herein. The style reference images in Figure 4 are user-defined style images. The stylized image generation model can be trained using a small number of these style reference images using the training method disclosed herein. For example, for Style 1, the stylized image generation model can be trained using one style reference image provided by the user, so that the trained stylized image generation model can output stylized images of Style 1. For Style 2, the stylized image generation model can be trained using two style reference images provided by the user, so that the trained stylized image generation model can output stylized images of Style 2. For Style 3, the stylized image generation model can be trained using three style reference images provided by the user, so that the trained stylized image generation model can output stylized images of Style 3. After training is completed, if the user inputs a text description (corresponding to the text-generated image part in Figure 4) or inputs an image without style (corresponding to the image-generated image part in Figure 4) into the stylized image generation model, then the stylized image generation model corresponding to the corresponding style (for example, Style 1, Style 2, Style 3) can generate the corresponding stylized image.

[0059] Figure 5 is a schematic block diagram of a training device for a stylized image generation model according to an embodiment of the present disclosure. As shown in Figure 5, the training device includes: an acquisition module 51 for acquiring a stylized image to be trained and a general image to be trained, wherein the stylized image to be trained and the general image to be trained have similar main features; a construction module 52 for constructing training data based on the stylized image to be trained and the general image to be trained, wherein the training data includes a first text description of the stylized image to be trained and its pairing, and a second text description of the general image to be trained and its pairing, wherein the first text description contains a style feature vector to be trained; and a training module 53 for training the stylized image generation model based on the training data.

[0060] By adopting the above technical solution, since pictures of a certain style are trained using stylized pictures to be trained and general pictures to be trained with similar content and their respective corresponding text descriptions, and the text descriptions of the stylized pictures to be trained contain the style feature vectors to be trained, that is, the training process of the present disclosure is to jointly train the stylized pictures to be trained and the general pictures to be trained, and to jointly train the style feature vectors to be trained and the stylized picture generation model. Therefore, even if there are not enough stylized pictures of the same style, the stylized picture generation model can be trained for stylized pictures of that style type. Even if the stylistic characteristics of a certain type of stylized picture cannot be described or labeled using explicit style words, the stylized picture generation model can be trained for stylized pictures of that style type. This makes the training method of the stylized picture generation model according to the present disclosure capable of training stylized pictures of any style type customized by the user. Moreover, the training method of the stylized picture generation model according to the present disclosure also has the advantages of low training overhead, small amount of training data required, low cost, simplicity, etc., can quickly train to achieve results, and facilitates user personal training.

[0061] Optionally, the construction module 52 constructs the first text description in the following manner: generating a corresponding text description for the stylized image to be trained; and adding the style feature vector to be trained to the text description to obtain the first text description.

[0062] Optionally, the construction module 52 constructs the first text description in the following manner: receiving a text description corresponding to the stylized image to be trained input by a user; and adding the style feature vector to be trained to the text description to obtain the first text description.

[0063] Optionally, the acquisition module 51 acquires the general image to be trained, including: generating a corresponding text description for the stylized image to be trained; and generating the general image to be trained based on the text description.

[0064] Optionally, after generating the general image to be trained based on the text description, the acquisition module 51 further amplifies the generated general image to be trained in different scales.

[0065] Optionally, the acquisition module 51 acquires the stylized image to be trained, including: receiving a stylized image input by a user; and amplifying the stylized image input by the user at different scales to obtain the stylized image to be trained.

[0066] Optionally, the training module 53 trains the stylized image generation model based on the training data, including: inputting the training data into the stylized image generation model to obtain stylized images and general images output by the stylized image generation model; calculating the reconstruction loss between the stylized image to be trained and the stylized image output by the stylized image generation model, and the reconstruction loss between the general image to be trained and the general image output by the stylized image generation model; correcting the stylized image generation model based on the reconstruction loss; and obtaining a trained stylized image generation model when the calculated reconstruction loss meets a preset condition.

[0067] Figure 6 is a schematic block diagram of a stylized image generation device according to an embodiment of the present disclosure. As shown in Figure 6, the stylized image generation device includes: a receiving module 61 for receiving a user-inputted image to be stylized; and a generating module 62 for processing the image to be stylized using a stylized image generation model to generate a stylized image. The stylized image generation model is a model trained using the stylized image generation model training method disclosed herein.

[0068] By adopting the above technical solution, since the stylized image generation model is a model trained based on the training method of the stylized image generation model disclosed in the present invention, it is possible to quickly output the stylized image desired by the user.

[0069] According to an embodiment of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processing device, the steps of the method described in the present disclosure are implemented.

[0070] According to an embodiment of the present disclosure, an electronic device is provided, comprising: a storage device storing a computer program; and a processing device for executing the computer program in the storage device to implement the steps of the method described in the present disclosure.

[0071] Reference is now made to FIG7 , which illustrates a schematic diagram of the structure of an electronic device 600 suitable for implementing embodiments of the present disclosure. Terminal devices in embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. The electronic device illustrated in FIG7 is merely an example and should not limit the functionality or scope of use of embodiments of the present disclosure.

[0072] As shown in Figure 7, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the electronic device 600 are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0073] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although FIG. 7 shows the electronic device 600 with various devices, it should be understood that not all of the devices shown are required to be implemented or present. More or fewer devices may alternatively be implemented or present.

[0074] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.

[0075] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.

[0076] In some embodiments, the client and server can communicate using any currently known or later developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or later developed network.

[0077] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0078] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device is enabled to: obtain a stylized image to be trained and a general image to be trained, wherein the general image to be trained is a image that is similar to the stylized image to be trained in content but does not have a style; construct training data based on the stylized image to be trained and the general image to be trained, wherein the training data includes a first text description of the stylized image to be trained and its pairing, and a second text description of the general image to be trained and its pairing, wherein the first text description contains a style feature vector to be trained; and train a stylized image generation model based on the training data.

[0079] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

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

[0081] The modules described in the embodiments of the present disclosure may be implemented in software or hardware. In some cases, the name of a module does not limit the module itself. For example, the acquisition module may also be described as a "module for acquiring stylized images to be trained and general images to be trained."

[0082] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0083] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0084] According to one or more embodiments of the present disclosure, Example 1 provides a training method for a stylized image generation model, including: obtaining a stylized image to be trained and a general image to be trained, wherein the general image to be trained is a image that is similar to the stylized image to be trained in content but does not have a style; constructing training data based on the stylized image to be trained and the general image to be trained, wherein the training data includes a first text description of the stylized image to be trained and its pairing, and a second text description of the general image to be trained and its pairing, wherein the first text description contains a style feature vector to be trained; and training the stylized image generation model based on the training data.

[0085] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, wherein the first text description is constructed in the following manner: generating a corresponding text description for the stylized image to be trained; and adding the style feature vector to be trained to the text description to obtain the first text description.

[0086] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 1, wherein the first text description is constructed in the following manner: receiving a text description corresponding to the stylized image to be trained input by a user; and adding the style feature vector to be trained to the text description to obtain the first text description.

[0087] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 1, wherein obtaining the general image to be trained includes: generating a corresponding text description for the stylized image to be trained; and generating the general image to be trained based on the text description.

[0088] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 4, wherein, after generating the general picture to be trained based on the text description, obtaining the general picture to be trained further includes: amplifying the generated general picture to be trained at different scales.

[0089] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 1, wherein obtaining the stylized image to be trained includes: receiving a stylized image input by a user; and amplifying the stylized image input by the user at different scales to obtain the stylized image to be trained.

[0090] According to one or more embodiments of the present disclosure, Example 7 provides the method of any one of Examples 1 to 6, wherein the training of the stylized picture generation model based on the training data includes: inputting the training data into the stylized picture generation model to obtain a stylized picture and a general picture output by the stylized picture generation model; calculating the reconstruction loss between the stylized picture to be trained and the stylized picture output by the stylized picture generation model, and the reconstruction loss between the general picture to be trained and the general picture output by the stylized picture generation model; correcting the stylized picture generation model based on the reconstruction loss; and obtaining a trained stylized picture generation model when the calculated reconstruction loss meets a preset condition.

[0091] According to one or more embodiments of the present disclosure, Example 8 provides a stylized image generation method, including: receiving a picture to be stylized input by a user; processing the picture to be stylized using a stylized image generation model to generate a stylized picture, wherein the stylized image generation model is a model trained using the training method for the stylized image generation model described in any one of Examples 1 to 7.

[0092] According to one or more embodiments of the present disclosure, Example 9 provides a training device for a stylized image generation model, comprising: an acquisition module for acquiring a stylized image to be trained and a general image to be trained, wherein the general image to be trained is a image that is similar in content to the stylized image to be trained but does not have a style; a construction module for constructing training data based on the stylized image to be trained and the general image to be trained, wherein the training data includes a first text description of the stylized image to be trained and its pairing, and a second text description of the general image to be trained and its pairing, wherein the first text description contains a style feature vector to be trained; and a training module for training the stylized image generation model based on the training data.

[0093] According to one or more embodiments of the present disclosure, Example 10 provides a stylized image generation device, including: a receiving module for receiving a picture to be stylized input by a user; a generation module for processing the picture to be stylized using a stylized image generation model to generate a stylized picture, wherein the stylized image generation model is a model trained using the training method of the stylized image generation model described in any one of Examples 1 to 7.

[0094] According to one or more embodiments of the present disclosure, Example 11 provides a computer-readable medium having a computer program stored thereon, which implements the steps of any one of the methods described in Examples 1-8 when executed by a processing device.

[0095] According to one or more embodiments of the present disclosure, Example 12 provides an electronic device, comprising: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of any one of the methods described in Examples 1-8.

[0096] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.

[0097] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0098] Although the subject matter has been described using language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims. Regarding the apparatus in the above-described embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method and will not be elaborated upon here.

Claims

1. A training method for a stylized image generation model, comprising: Obtaining a stylized picture to be trained and a general picture to be trained, wherein the general picture to be trained is a picture that is similar to the stylized picture to be trained in content but does not have a style; Based on the stylized image to be trained and the general image to be trained, construct training data, wherein the training data includes a first text description of the stylized image to be trained and its pair, and a second text description of the general image to be trained and its pair, wherein the first text description contains a style feature vector to be trained; and The stylized image generation model is trained based on the training data.

2. The method according to claim 1, wherein: The first text description is constructed as follows: Generating a corresponding text description for the stylized image to be trained; The style feature vector to be trained is added to the text description to obtain the first text description.

3. The method according to claim 1, wherein: The first text description is constructed as follows: Receiving a text description corresponding to the stylized image to be trained input by a user; The style feature vector to be trained is added to the text description to obtain the first text description.

4. The method according to any one of claims 1 to 3, wherein: The step of obtaining a general image to be trained includes: Generating a corresponding text description for the stylized image to be trained; Based on the text description, the general image to be trained is generated.

5. The method according to claim 4, wherein: After generating the general image to be trained based on the text description, obtaining the general image to be trained further includes: The generated general images to be trained are enlarged at different scales.

6. The method according to any one of claims 1 to 5, wherein: The step of obtaining the stylized image to be trained includes: Receive a stylized image input by the user; The stylized image input by the user is amplified at different scales to obtain the stylized image to be trained.

7. The method according to any one of claims 1 to 6, wherein: The step of training the stylized image generation model based on the training data includes: Inputting the training data into the stylized image generation model to obtain a stylized image and a general image output by the stylized image generation model; Calculating a reconstruction loss between the stylized image to be trained and the stylized image output by the stylized image generation model, and a reconstruction loss between the general image to be trained and the general image output by the stylized image generation model; Based on the reconstruction loss, correcting the stylized image generation model; When the calculated reconstruction loss meets the preset conditions, a trained stylized image generation model is obtained.

8. A method for generating a stylized image, comprising: Receive the image to be stylized input by the user; The image to be stylized is processed using a stylized image generation model to generate the stylized image, wherein the stylized image generation model is a model trained by the training method for a stylized image generation model according to any one of claims 1 to 7.

9. A training device for a stylized image generation model, comprising: An acquisition module, configured to acquire a stylized image to be trained and a general image to be trained, wherein the general image to be trained is a image that is similar to the stylized image to be trained in content but does not have a style; A construction module, configured to construct training data based on the stylized image to be trained and the general image to be trained, wherein the training data includes a first text description of the stylized image to be trained and its pair, and a second text description of the general image to be trained and its pair, wherein the first text description contains a style feature vector to be trained; and A training module is configured to train the stylized image generation model based on the training data.

10. A stylized image generation device, comprising: A receiving module, configured to receive a picture to be stylized input by a user; A generation module is configured to process the image to be stylized using a stylized image generation model. The stylized image generation model is a model trained by the training method for stylized image generation model according to any one of claims 1 to 7.

11. A computer readable medium having a computer program stored thereon, wherein: When the computer program is executed by a processing device, the steps of the method according to any one of claims 1 to 8 are implemented.

12. An electronic device comprising: a storage device having a computer program stored thereon; A processing device configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 8.

13. A computer program product comprising a computer program / instructions, wherein: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Image stylization method and device, equipment and medium

    CN111340905A

  • Image processing method and device, electronic equipment and computer readable medium

    CN111402112A

  • Image processing method and device, storage medium and electronic equipment

    CN112232425A

  • Method and device for generating stylized image, electronic equipment and storage medium

    CN114429418A

  • Stylized image description generation method based on transfer learning

    CN115294427A