Image generation method and device, medium and electronic equipment
By using the reference image to correct the intermediate image in the diffusion model, the problem of poor reproduction of the target object in the prior art is solved. The generated image reproduces the objects in the reference image more realistically, and improves the similarity of the image and Authenticity.
Patent Information
- Application Number
- CN202310762131.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-26
- Publication Date
- 2024-12-31
AI Technical Summary
When the existing diffusion model generates customized images, it is difficult to effectively reproduce the target object details in the reference image, resulting in low similarity between the generated image and the reference image.
By acquiring the reference image and text description, an intermediate image is generated, and the intermediate image is corrected using the reference image to generate a final image, thereby adding specific details of the target object and improving the authenticity of the image.
This avoids the loss of details caused by image encoder compression, maintains the generation ability of the pre-trained model, and provides more target object details, making the final generated image more similar to the reference image and more authenticity.
Smart Images

Figure CN119228920A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular, to an image generating method, device, medium and electronic device. Background Art
[0002] In the related art, diffusion models can generate images based on input text. Therefore, diffusion models are also used in some personalized applications, for example, to generate customized content based on one or a few reference images containing the same target object. However, existing diffusion models cannot reproduce the target object in the reference image well. Summary of the invention
[0003] This summary is provided to introduce concepts in a brief form 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.
[0004] In a first aspect, the present disclosure provides an image generation method, comprising: acquiring a reference image, wherein the reference image includes a target object; receiving a text description, wherein the text description includes a target object identifier for describing the target object and a change description for describing changes to be made to the target object; generating an intermediate image according to the text description; and using the reference image, correcting the intermediate image to obtain a final image including the target object.
[0005] In a second aspect, the present disclosure provides an image generating device, comprising: an acquisition module, used to acquire a reference image, wherein the reference image includes a target object; a receiving module, used to receive a text description, wherein the text description includes a target object identifier for describing the target object and a change description for describing changes to be made to the target object; a generation module, used to generate an intermediate image based on the text description; and a correction module, used to correct the intermediate image using the reference image to obtain a final image including the target object.
[0006] In a third 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.
[0007] In a fourth aspect, the present disclosure 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 the first aspect of the present disclosure.
[0008] The above technical solution has the following beneficial effects:
[0009] (1) Since the intermediate image is generated based on a text description, which includes a target object identifier for describing the target object and a change description for describing the changes to be made to the target object, no additional image encoder is required. Therefore, the loss of important details of the reference image due to compression encoding of the image encoder is avoided.
[0010] (2) Since the reference image containing the target object can be used to correct the intermediate image to obtain the final image containing the target object, when generating the final image, the attention related to the target object is added with the help of the reference image, that is, some specific details of the target object contained in the reference image are added with the help of the reference image. Therefore, it can minimize the impact on the pre-trained text-based graph model's text-based graph capability and provide more details about the target object, so that the target object in the final generated image is more similar to the target object in the reference image, so that the final generated image more realistically reproduces the target object.
[0011] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The above and other features, advantages and aspects of the 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 the originals and elements are not necessarily drawn to scale. In the drawings:
[0013] Figure 1 is a flowchart of an image generating method according to an embodiment of the present disclosure.
[0014] Figure 2 The present invention is a flowchart of obtaining a target object attribute identifier according to an embodiment of the present invention.
[0015] Figure 3 The present invention is a flowchart of using a reference image containing a target object to correct an intermediate image to obtain a final image containing a target object according to an embodiment of the present invention.
[0016] Figure 4 It is a schematic diagram of the effect of an image generated by the image generating method according to an embodiment of the present disclosure.
[0017] Figure 5 is a schematic block diagram of an image generating device according to an embodiment of the present disclosure.
[0018] Figure 6 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0019] Embodiments of the present disclosure will be described in more detail below 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 being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0020] 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.
[0021] The term "including" and its variations used herein are open inclusions, 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"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0022] It should be noted that the concepts such as "first" and "second" mentioned in the present 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.
[0023] It should be noted that the modifications of "one" and "plurality" 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, it should be understood as "one or more".
[0024] 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.
[0025] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present 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.
[0026] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0027] As an optional but non-limiting implementation, in response to receiving an active request from the user, 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. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0028] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0029] 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) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0030] Figure 1 1 is a flowchart of an image generation method according to an embodiment of the present disclosure. The image generation method can be applied to theme image generation scenarios, such as comic generation scenarios, video production scenarios based on novels, animation production scenarios with the same style around the same character, etc. Figure 1 As shown, the image generating method includes steps S11 to S14.
[0031] In step S11, a reference image is acquired, wherein the reference image includes a target object.
[0032] The target object refers to the subject that the user wants to reproduce. For example, for a comic generation scenario, the target object can be a comic character in the comic.
[0033] The number of reference images containing the target object does not need to be large; one or a few images are sufficient.
[0034] In step S12, a text description is received, wherein the text description includes a target object identifier for describing the target object and a change description for describing a change to be made to the target object.
[0035] The target object identifier may include a category to which the target object belongs and a target object attribute identifier for describing the attributes of the target object.
[0036] The target object attribute identifier may be in the form of a vector.
[0037] The category of the target object refers to the general classification of the target object. For example, if the target object is a dog sitting on the sofa, then the category of the target object is "dog".
[0038] The target object attribute identifier may include, for example, the color, shape, action, etc. of the target object. These target object attribute identifiers are represented in the form of vectors, rather than displayed text descriptions.
[0039] The change description may include at least one of the following: background, posture of the target object, color of the target object, artistic interpretation of the target object, species of the target object, and material of the target object. Background refers to the background environment in which the target object is located. Posture refers to the movement of the target object, etc. Artistic interpretation refers to the artistic style of the target object, such as oil painting style, etc. In addition, if the user wishes to rebuild the target object without making any changes to the target object, the change description may be empty.
[0040] In step S13, an intermediate image is generated according to the text description.
[0041] Various text-based graph models (eg, diffusion models) may be employed to generate intermediate images based on the received text description.
[0042] In step S14, the intermediate image is corrected using the reference image containing the target object to obtain a final image containing the target object.
[0043] The above technical solution has the following beneficial effects:
[0044] (1) Since the intermediate image is generated based on a text description, which includes a target object identifier for describing the target object and a change description for describing the changes to be made to the target object, no additional image encoder is required. Therefore, the loss of important details of the reference image due to compression encoding of the image encoder is avoided.
[0045] (2) Since the reference image containing the target object can be used to correct the intermediate image to obtain the final image containing the target object, when generating the final image, the attention related to the target object is added with the help of the reference image, that is, some specific details of the target object contained in the reference image are added with the help of the reference image. Therefore, it can minimize the impact on the pre-trained text-based graph model's text-based graph capability and provide more details about the target object, so that the target object in the final generated image is more similar to the target object in the reference image, so that the final generated image more realistically reproduces the target object.
[0046] Figure 2 The present invention is a flowchart of obtaining a target object attribute identifier according to an embodiment of the present invention.
[0047] like Figure 2 As shown, in step S21, an initial text description is received, the initial text description including an initial target object attribute identifier for describing the attributes of the target object and a category to which the target object belongs.
[0048] The initial target object attribute identifier may be in the form of a vector, and the initial target object attribute identifier is an initialization value.
[0049] The category of the target object refers to the general classification of the target object. For example, if the target object is a dog sitting on the sofa, then the category of the target object is "dog".
[0050] The target object attribute identifier may include, for example, the color, shape, action, etc. of the target object. These target object attribute identifiers are represented in the form of vectors, rather than displayed text descriptions.
[0051] In step S22, a first image is generated according to the initial text description.
[0052] Various text graph models (eg, diffusion models) may be employed to generate the first image according to the received initial text description.
[0053] In step S23, a reconstruction loss between the first image and a reference image containing the target object is calculated.
[0054] A preset loss function may be used to calculate the reconstruction loss between the first image and the reference image containing the target object. In addition, the number of reference images containing the target object does not need to be large, one or a few are sufficient.
[0055] In step S24, based on the reconstruction loss, the initial target object attribute identifier is corrected until the reconstruction loss meets a preset condition, thereby obtaining the target object attribute identifier.
[0056] That is, based on the reconstruction loss, the initial target object attribute identification is corrected to obtain the corrected target object attribute identification, and then the text description containing the corrected target object attribute identification and the category to which the target object belongs is used as a new text description, and a new first image is generated according to the text description, and then the reconstruction loss between the new first image and the reference image containing the target object is calculated, and it is determined whether the reconstruction loss meets the preset conditions. If the reconstruction loss meets the preset conditions, the iterative process is terminated to obtain the final target object attribute identification. If the reconstruction loss does not meet the preset conditions, the iteration is continued.
[0057] By adopting the above technical solution, the target object attribute identifier is continuously corrected by utilizing the reconstruction loss between the generated first image and the reference image containing the target object, so as to obtain the target object attribute identifier that can accurately describe the target object.
[0058] Figure 3 The present invention is a flowchart of using a reference image containing a target object to correct an intermediate image to obtain a final image containing a target object according to an embodiment of the present invention.
[0059] like Figure 3 As shown, in step S31, a mask image of the target object is obtained according to a reference image containing the target object.
[0060] In step S32, the pixels of the target object in the intermediate image are corrected according to the pixels in the mask image to obtain a final image containing the target object.
[0061] In some embodiments, the pixels of the target object in the intermediate image are corrected according to the pixels in the mask image, which can be achieved in the following manner: First, the similarity between the pixels in the mask image and the pixels of the target object in the intermediate image is calculated; then, according to the similarity, the pixels of the target object in the intermediate image are corrected.
[0062] By adopting the above technical solution, when generating the final image, attention related to the target object is added with the help of the reference image, that is, some specific details of the target object contained in the reference image are added with the help of the reference image. Therefore, it is possible to minimize the impact on the Vincent graph capability of the pre-trained Vincent graph model and provide more details about the target object, so that the target object in the final generated image is more similar to the target object in the reference image, and the final generated image more realistically reproduces the target object.
[0063] Figure 4 It is a schematic diagram of the effect of an image generated by the image generating method according to an embodiment of the present disclosure. Figure 4 In the figure, the left image is a reference image, which contains a target object, which is a boy. The right image is an image generated by the image generation method according to an embodiment of the present disclosure. It can be seen that the right image more realistically reproduces the boy in the left image.
[0064] Figure 5 FIG. 1 is a schematic block diagram of an image generating device according to an embodiment of the present disclosure. Figure 5As shown, the image generating device includes: an acquisition module 51, used for acquiring a reference image, wherein the reference image includes a target object; a receiving module 52, used for receiving a text description, wherein the text description includes a target object identifier for describing the target object and a change description for describing changes to be made to the target object; a generating module 53, used for generating an intermediate image according to the text description; and a correcting module 54, used for correcting the intermediate image using the reference image to obtain a final image including the target object.
[0065] The above technical solution has the following beneficial effects:
[0066] (1) Since the intermediate image is generated based on a text description, which includes a target object identifier for describing the target object and a change description for describing the changes to be made to the target object, no additional image encoder is required. Therefore, the loss of important details of the reference image due to compression encoding of the image encoder is avoided.
[0067] (2) Since the reference image containing the target object can be used to correct the intermediate image to obtain the final image containing the target object, when generating the final image, the attention related to the target object is added with the help of the reference image, that is, some specific details of the target object contained in the reference image are added with the help of the reference image. Therefore, it can minimize the impact on the pre-trained text-based graph model's text-based graph capability and provide more details about the target object, so that the target object in the final generated image is more similar to the target object in the reference image, so that the final generated image more realistically reproduces the target object.
[0068] Optionally, the target object identifier includes a category to which the target object belongs and a target object attribute identifier used to describe an attribute of the target object.
[0069] Optionally, the image generating device according to the embodiment of the present disclosure also includes a training module for obtaining a target object attribute identification in the following manner: receiving an initial text description, the initial text description including an initial target object attribute identification for describing the attributes of the target object and a category to which the target object belongs; generating a first image according to the initial text description; calculating a reconstruction loss between the first image and a reference image containing the target object; and based on the reconstruction loss, correcting the initial target object attribute identification until the reconstruction loss meets a preset condition, thereby obtaining the target object attribute identification.
[0070] Optionally, the target object attribute identifier is in the form of a vector.
[0071] Optionally, the change description includes at least one of the following: background, posture of the target object, color of the target object, artistic interpretation of the target object, species of the target object, material of the target object.
[0072] Optionally, the correction module 54 uses the reference image to correct the intermediate image to obtain a final image containing the target object, including: obtaining a mask image of the target object based on the reference image; and correcting the pixels of the target object in the intermediate image based on the pixels in the mask image to obtain a final image containing the target object.
[0073] Optionally, the correction module 54 corrects the pixels of the target object in the intermediate image according to the pixels in the mask image, including: calculating the similarity between the pixels in the mask image and the pixels of the target object in the intermediate image; and correcting the pixels of the target object in the intermediate image according to the similarity.
[0074] The present disclosure also provides a computer-readable medium having a computer program stored thereon, which implements the steps of any method in the present disclosure when the program is executed by a processing device.
[0075] The present disclosure also 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 method in the present disclosure.
[0076] Reference below Figure 6 , which shows a schematic diagram of the structure of an electronic device 600 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is 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), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0077] like Figure 6As shown, 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. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. 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.
[0078] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, 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 Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0079] 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 contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a 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 executed.
[0080] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, 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 containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit 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 of the above.
[0081] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may 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 future developed network.
[0082] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0083] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains a reference image, which includes a target object; receives a text description, which includes a target object identifier for describing the target object and a change description for describing the changes to be made to the target object; generates an intermediate image according to the text description; and uses the reference image to correct the intermediate image to obtain a final image containing the target object.
[0084] 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 separate software package, partially on the user's computer and partially on a remote computer, or entirely on a 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., via the Internet using an Internet service provider).
[0085] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0086] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a module does not limit the module itself in some cases. For example, a generation module may also be described as a "module for generating an intermediate image according to the text description".
[0087] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, 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 chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0088] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may 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 may 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.
[0089] According to one or more embodiments of the present disclosure, Example 1 provides an image generation method, comprising: acquiring a reference image, wherein the reference image includes a target object; receiving a text description, wherein the text description includes a target object identifier for describing the target object and a change description for describing changes to be made to the target object; generating an intermediate image based on the text description; and using the reference image, correcting the intermediate image to obtain a final image including the target object.
[0090] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, wherein the target object identifier includes a category to which the target object belongs and a target object attribute identifier for describing the attributes of the target object.
[0091] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 2, wherein the target object attribute identification is obtained in the following manner: receiving an initial text description, the initial text description including an initial target object attribute identification for describing the attributes of the target object and a category to which the target object belongs; generating a first image according to the initial text description; calculating a reconstruction loss between the first image and the reference image; and based on the reconstruction loss, correcting the initial target object attribute identification until the reconstruction loss meets a preset condition, thereby obtaining the target object attribute identification.
[0092] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 2 or 3, wherein the target object attribute identifier is in the form of a vector.
[0093] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 1, wherein the change description includes at least one of the following: background, posture of the target object, color of the target object, artistic interpretation of the target object, species of the target object, and material of the target object.
[0094] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 1, wherein the use of the reference image to correct the intermediate image to obtain a final image containing the target object includes: obtaining a mask image of the target object based on the reference image; and correcting pixels of the target object in the intermediate image based on pixels in the mask image to obtain a final image containing the target object.
[0095] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 6, wherein the pixels of the target object in the intermediate image are corrected based on the pixels in the mask image, including: calculating the similarity between the pixels in the mask image and the pixels of the target object in the intermediate image; and correcting the pixels of the target object in the intermediate image based on the similarity.
[0096] According to one or more embodiments of the present disclosure, Example 8 provides an image generating device, comprising: an acquisition module for acquiring a reference image, wherein the reference image includes a target object; a receiving module for receiving a text description, wherein the text description includes a target object identifier for describing the target object and a change description for describing changes to be made to the target object; a generation module for generating an intermediate image based on the text description; and a correction module for correcting the intermediate image using the reference image to obtain a final image including the target object.
[0097] According to one or more embodiments of the present disclosure, Example 9 provides a computer-readable medium having a computer program stored thereon, which implements the steps of any of the methods described in Examples 1-7 when executed by a processing device.
[0098] According to one or more embodiments of the present disclosure, Example 10 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-7.
[0099] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. 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 a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0100] 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 are 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.
[0101] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. An image generation method, characterized in that: include: Acquire a reference image, wherein the reference image includes a target object; receiving a text description, the text description comprising a target object identifier for describing the target object and a change description for describing a change to be made to the target object; generating an intermediate image according to the text description; The intermediate image is corrected using the reference image to obtain a final image containing the target object.
2. The method according to claim 1, characterized in that The target object identifier includes the category to which the target object belongs and a target object attribute identifier used to describe the attributes of the target object.
3. The method according to claim 2, characterized in that The target object attribute identifier is obtained in the following manner: receiving an initial text description, the initial text description including an initial target object attribute identifier for describing the attribute of the target object and a category to which the target object belongs; generating a first image according to the initial text description; calculating a reconstruction loss between the first image and the reference image; Based on the reconstruction loss, the initial target object attribute identifier is corrected until the reconstruction loss meets a preset condition, thereby obtaining the target object attribute identifier.
4. The method according to claim 2 or 3, characterized in that: The target object attribute identifier is in the form of a vector.
5. The method according to claim 1, characterized in that The change description includes at least one of the following: background, posture of the target object, color of the target object, artistic interpretation of the target object, species of the target object, and material of the target object.
6. The method according to claim 1, characterized in that The method of correcting the intermediate image by using the reference image to obtain a final image containing the target object includes: Obtaining a mask image of the target object according to the reference image; The pixels of the target object in the intermediate image are corrected according to the pixels in the mask image to obtain a final image containing the target object.
7. The method according to claim 6, characterized in that The correcting the pixels of the target object in the intermediate image according to the pixels in the mask image comprises: Calculating similarities between pixels in the mask image and pixels of the target object in the intermediate image; According to the similarity, pixels of the target object in the intermediate image are corrected.
8. An image generating device, characterized in that: include: An acquisition module, used for acquiring a reference image, wherein the reference image includes a target object; A receiving module, configured to receive a text description, wherein the text description includes a target object identifier for describing the target object and a change description for describing a change to be made to the target object; A generating module, used for generating an intermediate image according to the text description; The correction module is used to correct the intermediate image using the reference image to obtain a final image containing the target object.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 7 are implemented.
10. An electronic device, characterized in that: include: 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 7.
