Image generation method and device
By decomposing the image generation process and utilizing the chain generation method, the problem of unreasonable image generation structure in the existing technology is solved, and higher quality and controllable image generation is achieved.
Patent Information
- Application Number
- CN202310689933.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2043-06-12
AI Technical Summary
Existing image generation methods are prone to unreasonable structures when generating images, such as characters with three arms and six fingers, and lack reliable generation solutions.
By obtaining the target text and determining the image generation conditions, the image generation process is decomposed into multiple sub-steps, simulating the composition, line draft, color matching and light and shadow production processes of human designers, and using the chain generation method to serialize and generate multiple conditions to ensure the accuracy of the generated image. rationality.
It significantly improves the accuracy and quality of image generation, ensures the structural rationality of the generated image, and enhances the controllability of the image.
Smart Images

Figure CN116883528B
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the field of computer technology, and in particular to an image generating method. Background Art
[0002] With the continuous development of computer technology, users have more and more demands for image generation. At present, in order to improve the efficiency of image generation, the image generation model is usually trained, and then the image description text is input into the image generation model to obtain the image corresponding to the text.
[0003] However, the images generated by the current image generation methods may have unreasonable structures, such as a character having three arms and six fingers; therefore, a more reliable solution is needed to achieve image generation. Summary of the invention
[0004] In view of this, an embodiment of this specification provides an image generation method. One or more embodiments of this specification also relate to an image generation device, a training method for an image generation model, a method for generating a character image, a computing device, a computer-readable storage medium, and a computer program to solve the technical defects existing in the prior art.
[0005] According to a first aspect of an embodiment of this specification, there is provided an image generation method, comprising:
[0006] Acquire a target text, and determine at least one type of image generation condition based on the target text, wherein the image generation condition is used to generate a target image corresponding to the target text;
[0007] The target text and the at least one type of image generation condition are input into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is trained based on a sample image set, the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images.
[0008] According to a second aspect of the embodiments of this specification, there is provided an image generating device, including:
[0009] an acquisition module, configured to acquire a target text, and determine at least one type of image generation condition based on the target text, wherein the image generation condition is used to generate a target image corresponding to the target text;
[0010] An input module is configured to input the target text and the at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is obtained based on training of a sample image set, the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images.
[0011] According to a third aspect of an embodiment of this specification, another image generation method is provided, which is applied to a server and includes:
[0012] receiving a target text sent by a client, and determining at least one type of image generation condition based on the target text, wherein the image generation condition is used to generate a target image corresponding to the target text;
[0013] Inputting the target text and the at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is obtained by training based on a sample image set, the sample image set includes sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images;
[0014] The target image is returned to the client.
[0015] According to a fourth aspect of the embodiments of this specification, a method for training an image generation model is provided, comprising:
[0016] Acquire a target sample pair from a sample image set, wherein the target sample pair carries at least one type of image generation condition, and the target sample pair consists of a target sample text and a target sample image;
[0017] Inputting the target sample text and various image generation conditions into an image generation model to obtain a predicted image output by the image generation model;
[0018] Calculate a model loss value based on the predicted image and the target sample image;
[0019] The model parameters of the image generation model are adjusted according to the model loss value until a trained image generation model is obtained.
[0020] According to a fifth aspect of the embodiments of this specification, a method for generating a character image is provided, comprising:
[0021] Acquire a character description text, and determine at least one type of image generation condition based on the character description text, wherein the image generation condition is used to generate a target image corresponding to the character description text;
[0022] The character description text and the at least one type of image generation condition are input into an image generation model to obtain a character image corresponding to the character description text, wherein the image generation model is trained based on a sample image set, the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images.
[0023] According to a sixth aspect of an embodiment of this specification, a computing device is provided, including:
[0024] Memory and processor;
[0025] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the above-mentioned image generation method are implemented.
[0026] According to a seventh aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the above-mentioned image generation method are implemented.
[0027] According to an eighth aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-mentioned image generation method.
[0028] An embodiment of the present specification implements obtaining a target text and determining at least one type of image generation condition based on the target text, wherein the image generation condition is used to generate a target image corresponding to the target text; inputting the target text and the at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is trained based on a sample image set, wherein the sample image set includes sample pairs and at least one type of image generation condition corresponding to the sample pairs, wherein the sample pairs are composed of sample text and sample images.
[0029] At least one type of image generation condition is determined based on the target text so as to generate an image based on the image generation condition; the target text and at least one type of image generation condition are input into the image generation method, thereby enriching the generation method of the target image, and the target image is generated based on at least one type of image generation condition, thereby improving the accuracy of the target image. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 is a scene schematic diagram of an image generation method provided by an embodiment of this specification;
[0031] Figure 2is a flow chart of an image generation method provided by an embodiment of this specification;
[0032] Figure 3 is a flowchart of a training method for an image generation model provided by an embodiment of this specification;
[0033] Figure 4 is a flow chart of another image generation method provided by an embodiment of this specification;
[0034] Figure 5 is a processing flow chart of an image generation method provided by an embodiment of this specification;
[0035] Figure 6 is a structural schematic diagram of an image generating device provided by an embodiment of this specification;
[0036] Figure 7 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0037] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0038] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0039] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0040] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0041] The large model in one or more embodiments of this specification specifically refers to a deep learning model with large-scale model parameters, which usually contains hundreds of millions, tens of billions, or even hundreds of billions of model parameters. The large model can also be called a foundation model / foundation model. The large model is pre-trained with large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks, and the model has good generalization ability, such as a large-scale language model (LLM), a multi-modal pre-training model, etc.
[0042] When the big model is used in practice, only a small number of samples are needed to fine-tune the pre-trained model and it can be applied to different tasks. The big model can be widely used in natural language processing (NLP), computer vision and other fields. Specifically, it can be applied to computer vision tasks such as visual question answering (VQA), image caption (IC), image generation, as well as natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. The main application scenarios of the big model include digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc.
[0043] First, the terms involved in one or more embodiments of this specification are explained.
[0044] Generative models: methods that can model data distribution and generate images through sampling.
[0045] Diffusion model: Stable-diffusion is a data generation model that generates data with a specified distribution from pure noise through iterative denoising.
[0046] Chain-of-generation: Generates images in a step-by-step manner according to a certain order of elements.
[0047] DALLE-2: is OpenAI's text-to-image system.
[0048] Imagen: Imagen is a text-to-image diffusion model with deep language understanding that can create images from input text
[0049] Composer: A large model of Vincent graphs that decomposes an image into representative factors and then trains a diffusion model conditioned on these factors to reorganize the input.
[0050] Markov chain: Markov chain (MC) is a stochastic process in probability theory and mathematical statistics that has Markov property and exists in a discrete index set and state space.
[0051] At present, image generation models have made rapid progress, and the current AIGC (AI generated content) method can generate diverse images based on input text. However, existing image generation methods often have distorted details, unreasonable structures, and other phenomena, such as six fingers, multiple arms, unclear foreground and background, unreasonable lighting and shadows, etc. The image generation method of this manual decomposes the image generation process into sub-steps, simulating the production process of human designers from composition, line drawing, color matching, light and shadow to the final draft. Each sub-step is less difficult, but in the end it can more strictly guarantee the structural rationality of the generated image.
[0052] The image generation method of this manual provides more conditional information for the text-generated image model. In addition to enhancing the controllability of the image, it can also significantly improve the quality of the image. For example, in Stable-diffusion, if the level of detail of the text description is increased, that is, the control information contained in the text description is increased, the quality of the generated image can be significantly improved. For Composer, the quality of the generated image provided only with text description is obviously not as good as the quality of the generated image after providing other information such as sketch and depth map.
[0053] However, in the actual generation process, it is difficult to obtain multiple conditions that match each other. For example, the user provides a text description, but cannot obtain the corresponding sketch, let alone obtain information such as a depth map and a grayscale map. If you want to obtain matching sketches, depth maps, grayscale maps and other conditions, you can only find a picture that meets the conditions and extract them separately, but this picture cannot be obtained, otherwise it does not need to be generated. In order to obtain multiple conditions that meet the conditions and match each other, the method of this specification serializes the generation of multiple conditions through chain generation. Specifically, a certain condition, such as a sketch, will be generated based on the text condition. Then use the generated condition to predict the next condition, such as a depth map, together with the text condition. This is equivalent to decomposing the complex text to image generation into multiple relatively simple subtasks, and the success rate of each task is improved. After obtaining all the required conditions, the conditions are merged into the final pre-trained image generation model to complete the image generation. By generating from condition to condition in a chain, the image is finally generated based on all conditions, which better guarantees the rationality of the final generated image.
[0054] In this specification, an image generation method is provided. This specification also involves an image generation device, a training method for an image generation model, a character image generation method, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0055] See also Figure 1 , Figure 1 A schematic diagram of a scene of an image generation method provided according to an embodiment of the present specification is shown, specifically comprising:
[0056] The text input by the user is obtained, and the text is used to generate the corresponding image; a preset image generation chain is determined based on the text, and the generation chain includes an image generation condition generation model, each image generation condition generation model; a mask can be generated based on the text, and the text is input into the first image generation condition generation model to obtain a sketch for generating the image; the text and the mask are input into the second image generation condition generation model to obtain an instance mask output by the model; the text, the sketch and the instance mask are input into the third image generation condition generation model to obtain a depth map output by the model; the text, the sketch, the instance mask and the depth map are input into the fourth image generation condition generation model to obtain an edge map; the text, the sketch, the instance mask, the depth map and the edge map are input into the fifth image generation model to obtain a grayscale map image); input text, sketch, instance mask, depth map, edge map and grayscale map into the sixth image generation model to obtain image color (color); input different types of image generation conditions obtained: sketch, instance mask, depth map, edge map, grayscale map, image color and text into the image generation model, and the image generation model outputs an image generated based on the image generation conditions and text, thereby realizing image generation based on text and image generation conditions.
[0057] The image generation method of the present specification determines at least one type of image generation condition based on text so as to generate an image based on the image generation condition; inputs the text and at least one type of image generation condition into an image generation model, thereby enriching the generation method of the target image, and generates the target image based on at least one type of image generation condition, thereby improving the accuracy of the target image.
[0058] See also Figure 2 , Figure 2 A flowchart of an image generation method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0059] Step 202: Acquire a target text, and determine at least one type of image generation condition based on the target text, wherein the image generation condition is used to generate a target image corresponding to the target text.
[0060] Among them, the target text refers to the text used to generate the corresponding image, for example, the target text is "a dog wearing sunglasses" input by the user; in actual applications, the target text can be input by the user, queried in a text library, extracted from a document, etc., and this specification does not make any specific limitation on the target text; the image generation condition refers to the condition used to generate the target image, that is, the elements used to constitute the target image, that is, the image generation condition can include at least one of the following conditions: mask condition, sketch condition, instance condition, depth map condition, edge condition, grayscale image condition, color condition; sketch condition, grayscale image condition, etc. are image generation conditions for different components of the image and can be divided into different types, that is, sketch condition can be a type of image generation condition, grayscale image condition can be a type of image generation condition, etc.; the target image refers to the image generated based on the target text.
[0061] Specifically, a target text for generating a target image is obtained; at least one type of image generation condition corresponding to the target text is obtained according to the target text and a pre-set image generation condition acquisition rule; the pre-set image generation condition acquisition rule may be: searching for image generation conditions in a database based on the target text, inputting the target text into a pre-trained image generation model, outputting image generation conditions, and other acquisition rules, which are not specifically limited in this application.
[0062] In a specific implementation of the present specification, the text "a dog wearing sunglasses" input by the user is obtained; based on the text "a dog wearing sunglasses" and pre-set image generation condition acquisition rules, a sketch, grayscale image, and color corresponding to the text "a dog wearing sunglasses" are obtained as different types of image generation conditions corresponding to the text.
[0063] By acquiring the target text, at least one type of image generation condition is determined based on the target text, and then a target image can be generated based on the target text and the at least one type of image generation condition.
[0064] Furthermore, the method for determining at least one type of image generation condition based on the target text may include:
[0065] Determining at least one image generation condition generation model, wherein the image generation condition generation model is used to output an image generation condition of a target type according to an input text;
[0066] Based on the target text and the at least one image generation condition generation model, various types of image generation conditions are obtained.
[0067] Among them, the image generation condition generation model refers to a model that can output corresponding image generation conditions based on text; different image generation condition generation models can output different types of image generation conditions; at least one image generation condition generation model means that one or more image generation condition generation models can be obtained, so that one type or multiple different types of image generation conditions can be output.
[0068] Specifically, one or more image generation condition generation models for generating image generation conditions are determined; the target text is input into each image generation condition generation model, or the target text and the current image generation condition corresponding to the target text are input into the image generation condition generation model to obtain various types of image generation conditions output by each image generation condition generation model; the current image generation condition refers to an image generation condition that has been generated in advance, and the type of the current image generation condition is different from the type of image generation condition output by the image generation condition generation model to be input. For example, the target text and the sketch condition corresponding to the target text can be input into the image generation condition generation model to obtain the grayscale image condition of the target text.
[0069] In practical applications, the image generation conditional generative model can be a diffusion model. The diffusion model is divided into two stages, the forward process and the reverse process. The forward process is to construct a Markov chain to gradually add noise to the image signal and turn it into a noise signal. Specifically, first construct a discrete Markov chain {x0,x1,…,x N}, where x N represents the noisy image, N represents different noise levels, x0 represents the original image; the input is the noisy image x t and noise intensity t, the forward transfer probability can be expressed as {β0,β1,…,β N} is a pre-designed noise sequence table that determines {x0,x1,…,x N Specifically, first, {β0,β1,…,β N}Determine the corresponding {α0,α1,…,α N} sequence, the corresponding relationship is x N The noise adding method is Among them, ∈ is the noise randomly sampled from the standard Gaussian distribution. Under such a design, when forward to T steps, its distribution is very close to the standard normal distribution, and the reverse generation process can directly sample from a Gaussian distribution. Using this noise addition strategy (or forward process), we can ensure that x TThere are few components in the original image, but many noise components, which is similar to ∈, so it can be considered to be approximately subject to the standard Gaussian distribution. The reverse process of the denoising diffusion probability model can be modeled as the following transition probability Among them, ∈ θ (x t ,t) is a neural network whose goal is to predict the noise ∈ added to the image. The meaning of the transition probability is: given x t , assuming x t-1 It follows a Gaussian distribution with a mean of There are usually two versions of the variance setting. and Different variance settings will directly affect the quality of sampling. The obtained data distribution can be expressed as p θ (x0)=∫p θ (x 0:T )dx 1:T ,in, Network∈ θ (x t ,t) can be trained using the following loss function In the loss function, θ refers to the trainable parameters of the model. The training target is an expectation, which can be understood as the mean. Specifically, during training, some training images are first collected from the data set, and the distribution of the data set is represented by q(x0); then the corresponding noise intensity t is collected, and t follows a uniform distribution. Then sample the noise added to the image, the noise follows a standard Gaussian distribution Finally, the training images are denoised, and after network operations, the average loss function is calculated.
[0070] In a specific implementation of the present specification, image generation condition generation models 1 and 2 are determined, and image generation condition generation models 1 and 2 can output different types of image generation conditions; the target text is input into image generation condition generation model 1 to obtain a draft condition, and the target text is input into image generation condition generation model 2 to obtain a depth map condition, thereby obtaining different types of image generation conditions corresponding to the text.
[0071] Various types of image generation conditions are obtained through the target text and at least one image generation condition generation model, thereby improving the efficiency of obtaining the image generation conditions.
[0072] Furthermore, the above describes a processing method of inputting the target text into each image generation condition generation model. In practical applications, the target text and the current image generation condition corresponding to the target text may also be input into the image generation condition generation model. Specifically, the method of determining at least one type of image generation condition based on the target text may include:
[0073] Determining a first type of image generation condition based on the first image generation condition generation model and the target text;
[0074] determining a second type of image generation condition in a preset image generation chain according to the first type of image generation condition;
[0075] Generate a model according to the target text, the first type image generation condition and the second image generation condition to obtain the second type image generation condition;
[0076] The first type image generation condition and the second type image generation condition are used as the image generation condition of the target text.
[0077] Among them, the first image generation condition generation model refers to a model that can output the first type of image generation condition based on the input target text; the second image generation condition generation model refers to a model that can output the second type of image generation condition based on the input target text and the first type of image generation condition; the first type of image generation condition refers to an image generation condition that is different in type from the second type of image generation condition and is output by the first image generation condition generation model; the second type of image generation condition refers to an image generation condition that is different in type from the first type of image generation condition and is output by the second image generation condition generation model.
[0078] The preset image generation chain refers to a conditional processing chain composed of one or more image generation condition generation models. The order of the image generation condition generation models in the preset image generation chain is determined based on the image processing requirements. For example, the image generation condition generation models {1, 2, 3} can be ordered in the order of image generation condition generation model 1, image generation condition generation model 2, and image generation condition generation model 3, wherein image generation condition generation model 1 can generate a sketch based on text, image generation condition generation model 2 can generate a depth map based on text and sketch, and image generation condition generation model 3 can generate a grayscale map based on text, sketch, and depth map. In practical applications, the image generation chain can be flexibly generated based on demand, and the processing nodes on each chain, i.e., the image generation condition generation models, can be exchanged, and each processing node can process multiple image generation conditions. In the case of new conditions, they can also be added at the end of the image generation chain, so that there is no need to repeat the training of the trained processing nodes.
[0079] Specifically, the target text is input into the first image generation condition generation model, or the target text and one or more types of image generation conditions corresponding to the target text are input into the first type of image generation condition generation model to obtain the first type of image generation conditions output by the first type of image generation condition generation model; the target text and the first type of image generation condition, or the target text, one or more types of image generation conditions corresponding to the target text, and the first type of image generation condition are input into the second image generation condition generation model to obtain the second type of image generation condition; the first type of image generation condition and the second type of image generation condition are both used as image generation conditions for the target text, so as to be subsequently used to generate a target image corresponding to the target text.
[0080] In a specific implementation of the present specification, the target text "a dog wearing sunglasses" is input into the image generation condition generation model a in the preset image generation chain to obtain the mask condition output by the image generation condition generation model; further, based on the preset image generation chain, the image generation condition generation model b that is sorted after the image generation condition generation model a is determined; the target text and the mask condition are input into the image generation condition generation model b to obtain the sketch condition; the target text, the mask condition and the sketch condition are used for the subsequent generation of the target image.
[0081] In another specific implementation of the present specification, the target text "a dog wearing sunglasses" and the mask conditions and sketch conditions corresponding to the target text are input into the image generation condition generation model a of the preset image generation chain to obtain the instance conditions output by the image generation condition generation model a; further, based on the preset image generation chain, the image generation condition generation model b that is sorted after the image generation condition generation model a is determined; the target text, mask conditions, sketch conditions and instance conditions are input into the image generation condition generation model b to obtain the depth map conditions; the target text, mask conditions, sketch conditions, instance conditions and depth map conditions are used for the subsequent generation of the target image.
[0082] Through one or more image generation condition generation models, various types of image generation conditions corresponding to the target text are generated, thereby enriching the processing method of generating the target image, and further improving the accuracy of subsequent generation of the target image based on the target text and various types of image generation conditions.
[0083] In practical applications, before using the image generation condition generation model, it needs to be trained. Specifically, before determining at least one image generation condition generation model, the following may also be included:
[0084] Acquire a target text to be processed from a sample text set, wherein the sample text set contains text to be processed that carries a target type of image generation condition;
[0085] Inputting the target text to be processed into an image generation condition generation model to obtain a predicted image generation condition;
[0086] Calculating a target loss value according to the preset image generation condition and the image generation condition of the target type;
[0087] The model parameters of the image generation condition generation model are adjusted based on the target loss value until a trained image generation condition generation model is obtained.
[0088] Among them, the sample text set refers to a set composed of at least one text to be processed, and each text to be processed in the set carries an image generation condition of a target type; in practical applications, each text to be processed may carry multiple different types of image generation conditions; the target text to be processed refers to any text to be processed in the sample text set; the predicted image generation condition refers to the image generation condition output by the image generation condition generation model based on the target text to be processed; the target loss value refers to the loss value calculated based on the preset image generation condition and the image generation condition of the target type, for example, the target loss value is determined by calculating the similarity between the preset image generation condition and the image generation condition of the target type.
[0089] Specifically, a target text to be processed is obtained from a sample text set; the target text to be processed is input into an image generation condition generation model; the predicted image generation condition output by the image generation condition generation model is obtained; a target loss value is calculated based on a preset loss value calculation method, preset image generation conditions and image generation conditions of the target type; model parameters of the image generation condition generation model are further adjusted based on the target loss value; it is determined whether the image generation condition generation model after adjusting the model parameters meets the training completion conditions, if not, a new text to be processed is determined in the sample text set, and the image generation condition generation model is further adjusted, and the above steps are repeated until a trained image generation condition generation model is obtained.
[0090] In a specific implementation of the present specification, text A is obtained from a sample text set; text A is input into an image generation condition generation model; predicted image generation conditions output by the image generation condition generation model are obtained; a target loss value is calculated based on a preset loss value calculation method, preset image generation conditions, and image generation conditions of a target type; further, model parameters of the image generation condition generation model are adjusted based on the target loss value; until a trained image generation condition generation model is obtained, so that the trained image generation condition generation model can be used to generate image generation conditions corresponding to text A.
[0091] By training the image generation conditional generation model based on a sample text set, the accuracy of the image generation conditions output by the image generation conditional generation model can be improved.
[0092] Step 204: Input the target text and the at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is trained based on a sample image set, the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs consist of sample text and sample images.
[0093] After obtaining the target text and the corresponding at least one type of image generation condition, the target image can be generated based on the target text and the at least one type of image generation condition; the image generation method of the present specification inputs the target text and the at least one type of image generation condition into a pre-trained image generation model to generate the target image, thereby improving the efficiency of generating the target image.
[0094] In practical applications, the image generation model can be a large Wenshengtu model; the large Wenshengtu model is a special conditional diffusion model, and the data distribution it models can be expressed as p θ (x0|c)=∫p θ (x 0:T |c)dx 1:T , which describes the reverse process of the diffusion model, where And p θ (x t-1 |x t ) is the single-step transition probability; c is the input condition, which can be text, category label, segmentation map, etc. In the text graph model, it specifically refers to text. When sampling, x is sampled from the standard Gaussian distribution T , and then through the learned transition probability p θ (x T-1 |x T ) predicts x T-1 , and then get x T-2 ,…x0, x0 is the final generated image. The large text-image model can generate matching images based on the input text. Large text-image models are usually trained on massive data sets and have strong generation capabilities. Large text-image models include DALLE-2, Imagen, Stable-diffusion, etc. Although the large text-image model has strong generation capabilities, the control ability of the text on the final generated image is relatively weak, and a sentence of text can often correspond to many images. Therefore, in order to strengthen the control of the final generated image, conditional control functions can be added on the basis of the large model, such as ControlNet. There are also large models with multi-conditional control capabilities, such as Composer.
[0095] In practical applications, the method of inputting the target text and the at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text may include:
[0096] Inputting the target text and the at least one type of image generation condition into a feature processing module of an image generation model to obtain an image feature vector;
[0097] A target image corresponding to the target text is generated based on each image feature vector.
[0098] The feature processing module refers to a module that can convert input content into corresponding feature vectors.
[0099] Specifically, the determined target text and at least one type of image generation condition corresponding to the target text are input into the feature processing module of the image generation model; the feature processing module converts the target text and each type of image generation condition into each image feature vector; and then generates the target image corresponding to the target text based on each image feature vector, thereby realizing image generation.
[0100] In practical applications, before applying the image generation model, the image generation model needs to be trained to ensure the generation accuracy of the image generation model. The image generation model can be trained based on the following steps:
[0101] Acquire a target sample pair from a sample image set, wherein the target sample pair carries at least one type of image generation condition, and the target sample pair consists of a target sample text and a target sample image;
[0102] Inputting the target sample text and various image generation conditions into an image generation model to obtain a predicted image output by the image generation model;
[0103] Calculate a model loss value based on the predicted image and the target sample image;
[0104] The model parameters of the image generation model are adjusted according to the model loss value until a trained image generation model is obtained.
[0105] Among them, the sample image set refers to a set composed of sample pairs, each sample pair in the set carries at least one type of image generation condition, and each sample pair consists of a sample text and a sample image; the target sample pair refers to any sample pair in the sample image set; the target sample text refers to the sample text contained in the target sample pair; the target sample image refers to the sample image contained in the target sample pair; the predicted image refers to the image output by the image generation model according to the target sample pair; the model loss value refers to the loss value used to adjust the model parameters of the image generation model.
[0106] In practical applications, sample pairs may carry one or more types of image generation conditions, so that the trained image generation model can generate a target image corresponding to the target text based on the target text and one or more image generation conditions.
[0107] Specifically, a sample image set is obtained; a sample pair is arbitrarily determined in the sample image set as a target sample pair; the target sample pair is parsed to determine the target sample text, the target sample image and the generation conditions of each image; the target sample text and the generation conditions of each image are input into the image generation model; a predicted image output by the image generation model is obtained; a model loss value is calculated according to a preset image and a target sample image, and then the model parameters of the image generation model are adjusted based on the model loss value until a trained image generation model is obtained.
[0108] In a specific implementation of the present specification, a sample pair G is determined in a sample image set; the sample pair G is parsed to obtain sample text, sample image, and sketch conditions and depth map conditions carried by the sample pair G; the sample text, sketch conditions, and depth map conditions are input into an image generation model to obtain a predicted image; a model loss value is calculated based on the sample image and the predicted image; and model parameters of the image generation model are adjusted based on the model loss value until a trained image generation model is obtained.
[0109] By pre-training the image generation model, the image generation model is enabled to have the ability to generate images based on image generation conditions, so that the target image can be obtained based on the image generation model later.
[0110] Furthermore, before obtaining the target sample pair in the sample image set, the method further includes:
[0111] Obtain at least one sample image and sample text corresponding to each sample image;
[0112] Determine at least one type of image generation condition corresponding to each sample image;
[0113] Generate sample pairs based on each sample image and the sample text corresponding to each sample image, and add the at least one type of image generation condition to each sample pair;
[0114] A sample image set is generated according to each sample pair carrying the at least one type of image generation condition.
[0115] Specifically, since sample images can be obtained directly, at least one sample image can be obtained first, and then the sample text corresponding to each sample image can be determined. For example, the user can describe the sample image in the form of text to obtain the sample text, or the sample image can be input into a pre-trained text generation model to obtain the sample text output by the text generation model based on the sample image, etc.; further, at least one type of image generation condition corresponding to each sample image is obtained, specifically, the image generation condition pre-set for the sample image can be obtained in a database, or the sample image can be input into an image recognition model to obtain the image generation condition output by the image recognition model, etc.; the corresponding sample image and sample text are combined to obtain a sample pair, and at least one type of image generation condition corresponding to the sample image is added to the sample pair.
[0116] By generating a sample image set, an image generation model is trained based on the sample image set containing image generation conditions.
[0117] In practical applications, the method for determining at least one type of image generation condition corresponding to each sample image may include:
[0118] Acquire at least one image recognition model, wherein the image recognition model is used to output an image generation condition of a target type according to an input image;
[0119] The sample image is input into each image recognition model to obtain at least one type of image generation condition corresponding to the sample image.
[0120] Among them, the image recognition model refers to a model that can output image generation conditions based on the input image; different image recognition models can identify different types of image generation conditions in the image.
[0121] Specifically, at least one image recognition model can be obtained, and each image recognition model can recognize different types of image generation conditions of the sample image; it is also possible to pre-train an image recognition model that recognizes multiple types of image generation conditions, and input the sample image into the image recognition model to directly obtain multiple types of image generation conditions output by the graphic recognition model.
[0122] In a specific implementation of the present specification, image recognition model a and image recognition model b are obtained; a landscape image is input into image recognition models a and b respectively to obtain a sketch condition output by image recognition model a and a depth map condition output by image recognition model b; thereby obtaining different types of image generation conditions corresponding to the sample image.
[0123] By determining at least one type of image generation condition corresponding to the sample image through the image recognition model, the efficiency of obtaining the image generation condition can be improved.
[0124] The image generation method of the present specification obtains a target text and determines at least one type of image generation condition based on the target text, wherein the image generation condition is used to generate a target image corresponding to the target text; the target text and the at least one type of image generation condition are input into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is trained based on a sample image set, wherein the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, wherein the sample pairs consist of sample text and sample images.
[0125] At least one type of image generation condition is determined based on the target text so as to generate an image based on the image generation condition; the target text and at least one type of image generation condition are input into the image generation method, thereby enriching the generation method of the target image, and the target image is generated based on at least one type of image generation condition, thereby improving the accuracy of the target image.
[0126] See also Figure 3 , Figure 3 A flowchart of a training method for an image generation model provided according to an embodiment of the present specification is shown, which is applied to a server and specifically includes the following steps:
[0127] Step 302: Acquire a target sample pair from a sample image set, wherein the target sample pair carries at least one type of image generation condition and is composed of a target sample text and a target sample image.
[0128] Step 304: Input the target sample text and various image generation conditions into the image generation model to obtain a predicted image output by the image generation model.
[0129] Step 306: Calculate a model loss value based on the predicted image and the target sample image.
[0130] Step 308: Adjust the model parameters of the image generation model according to the model loss value until a trained image generation model is obtained.
[0131] The training method of the image generation model of the present specification obtains a target sample pair from a sample image set, wherein the target sample pair carries at least one type of image generation condition and is composed of a target sample text and a target sample image; inputs the target sample text and each image generation condition into the image generation model to obtain a predicted image output by the image generation model; calculates a model loss value based on the predicted image and the target sample image; and adjusts model parameters of the image generation model according to the model loss value until a trained image generation model is obtained.
[0132] The image generation model is trained by using a sample image set that contains at least one type of image generation condition, so that the image generation model has the function of generating images based on text and image generation conditions, thereby improving the accuracy of the image output by the image generation model.
[0133] See also Figure 4 , Figure 4 A flowchart of another image generation method provided according to an embodiment of the present specification is shown, which is applied to a server and specifically includes:
[0134] Step 402: receiving a target text sent by a client, and determining at least one type of image generation condition based on the target text, wherein the image generation condition is used to generate a target image corresponding to the target text.
[0135] Step 404: Input the target text and the at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is trained based on a sample image set, the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images.
[0136] Step 406: Return the target image to the client.
[0137] The present specification is applied to an image generation method of a server, receiving a target text sent by a client, and determining at least one type of image generation condition based on the target text, wherein the image generation condition is used to generate a target image corresponding to the target text; inputting the target text and the at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is trained based on a sample image set, the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images; and returning the target image to the client.
[0138] By receiving the target text sent by the client, the server generates a target image based on the target text and then returns the target image to the client, thereby avoiding the problem of generating the target image on the client, which would occupy the client's computing resources, and thus improving the efficiency of generating the target image.
[0139] The following combination Figure 5 , taking the application of the image generation method provided in this specification to a person image as an example, the image generation method is further described. Figure 5A processing flow chart of an image generation method provided by an embodiment of the present specification is shown, which specifically includes the following steps.
[0140] Step 502: Acquire character description text, and determine at least one type of image generation condition based on the character description text, wherein the image generation condition is used to generate a target image corresponding to the character description text.
[0141] Step 504: Input the character description text and the at least one type of image generation condition into an image generation model to obtain a character image corresponding to the character description text, wherein the image generation model is trained based on a sample image set, the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images.
[0142] The character image generation method of the present specification obtains character description text, and determines at least one type of image generation condition based on the character description text, wherein the image generation condition is used to generate a target image corresponding to the character description text; the character description text and the at least one type of image generation condition are input into an image generation model to obtain a character image corresponding to the character description text, wherein the image generation model is trained based on a sample image set, wherein the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images.
[0143] At least one type of image generation condition is determined based on character description text so as to generate an image based on the image generation condition; the character description text and at least one type of image generation condition are input into the image generation method, thereby enriching the generation method of the target image, and generating the target image based on at least one type of image generation condition, thereby improving the accuracy of the character image.
[0144] Corresponding to the above method embodiment, this specification also provides an image generating device embodiment, Figure 6 FIG. 1 shows a schematic diagram of the structure of an image generating device provided by an embodiment of the present specification. Figure 6 As shown, the device comprises:
[0145] An acquisition module 602 is configured to acquire a target text and determine at least one type of image generation condition based on the target text, wherein the image generation condition is used to generate a target image corresponding to the target text;
[0146] The input module 604 is configured to input the target text and the at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is obtained by training based on a sample image set, the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images.
[0147] Optionally, the device further includes a first training module configured to:
[0148] Acquire a target sample pair from a sample image set, wherein the target sample pair carries at least one type of image generation condition, and the target sample pair consists of a target sample text and a target sample image;
[0149] Inputting the target sample text and various image generation conditions into an image generation model to obtain a predicted image output by the image generation model;
[0150] Calculate a model loss value based on the predicted image and the target sample image;
[0151] The model parameters of the image generation model are adjusted according to the model loss value until a trained image generation model is obtained.
[0152] Optionally, the device further includes a generating module configured to:
[0153] Obtain at least one sample image and sample text corresponding to each sample image;
[0154] Determine at least one type of image generation condition corresponding to each sample image;
[0155] Generate sample pairs based on each sample image and the sample text corresponding to each sample image, and add the at least one type of image generation condition to each sample pair;
[0156] A sample image set is generated according to each sample pair carrying the at least one type of image generation condition.
[0157] Optionally, the generating module is further configured to:
[0158] Acquire at least one image recognition model, wherein the image recognition model is used to output an image generation condition of a target type according to an input image;
[0159] The sample image is input into each image recognition model to obtain at least one type of image generation condition corresponding to the sample image.
[0160] Optionally, the acquisition module 602 is further configured to:
[0161] Determining at least one image generation condition generation model, wherein the image generation condition generation model is used to output an image generation condition of a target type according to an input text;
[0162] Based on the target text and the at least one image generation condition generation model, various types of image generation conditions are obtained.
[0163] Optionally, the device further includes a second training module configured to:
[0164] Acquire a target text to be processed from a sample text set, wherein the sample text set contains text to be processed that carries a target type of image generation condition;
[0165] Inputting the target text to be processed into an image generation condition generation model to obtain a predicted image generation condition;
[0166] Calculating a target loss value according to the preset image generation condition and the image generation condition of the target type;
[0167] The model parameters of the image generation condition generation model are adjusted based on the target loss value until a trained image generation condition generation model is obtained.
[0168] Optionally, the acquisition module 602 is further configured to:
[0169] Determining a first type of image generation condition based on the first image generation condition generation model and the target text;
[0170] determining a second type of image generation condition in a preset image generation chain according to the first type of image generation condition;
[0171] Generate a model according to the target text, the first type image generation condition and the second image generation condition to obtain the second type image generation condition;
[0172] The first type image generation condition and the second type image generation condition are used as the image generation condition of the target text.
[0173] Optionally, the input module 604 is further configured to:
[0174] Inputting the target text and the at least one type of image generation condition into a feature processing module of an image generation model to obtain an image feature vector;
[0175] A target image corresponding to the target text is generated based on each image feature vector.
[0176] Optionally, the image generation condition includes at least one of the following conditions: a mask condition, a sketch condition, an instance condition, a depth map condition, an edge condition, a grayscale image condition, and a color condition.
[0177] The image generation device of the present specification includes an acquisition module, which acquires a target text and determines at least one type of image generation condition based on the target text, wherein the image generation condition is used to generate a target image corresponding to the target text; and an input module, which inputs the target text and the at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is trained based on a sample image set, wherein the sample image set includes sample pairs and at least one type of image generation condition corresponding to the sample pairs, wherein the sample pairs are composed of sample text and sample images.
[0178] At least one type of image generation condition is determined based on the target text so as to generate an image based on the image generation condition; the target text and at least one type of image generation condition are input into the image generation method, thereby enriching the generation method of the target image, and the target image is generated based on at least one type of image generation condition, thereby improving the accuracy of the target image.
[0179] The above is a schematic scheme of an image generating device of this embodiment. It should be noted that the technical scheme of the image generating device and the technical scheme of the above image generating method belong to the same concept, and the details not described in detail in the technical scheme of the image generating device can be referred to the description of the technical scheme of the above image generating method.
[0180] Figure 7 The block diagram of a computing device 700 according to an embodiment of the present specification is shown. The components of the computing device 700 include but are not limited to a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and the database 750 is used to store data.
[0181] The computing device 700 also includes an access device 740 that enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 740 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0182] In one embodiment of the present specification, the above components of the computing device 700 and Figure 7 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 7 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0183] The computing device 700 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 700 may also be a mobile or stationary server.
[0184] The processor 720 is used to execute the following computer executable instructions, which, when executed by the processor, implement the steps of the above-mentioned image generation method.
[0185] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned image generation method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned image generation method.
[0186] An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which can implement the steps of the above-mentioned image generation method when executed by a processor.
[0187] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned image generation method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned image generation method.
[0188] An embodiment of the present specification further provides a computer program, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-mentioned image generating method.
[0189] The above is an illustrative solution of a computer program of this embodiment. It should be noted that the technical solution of the computer program and the technical solution of the above-mentioned image generation method belong to the same concept, and the details not described in detail in the technical solution of the computer program can be referred to the description of the technical solution of the above-mentioned image generation method.
[0190] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0191] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0192] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0193] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0194] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A method for generating an image, comprising: Acquire a target text, and generate a model and the target text based on a first image generation condition, and determine a first type of image generation condition; Determining a second image generation condition generation model in a preset image generation chain according to the first type of image generation condition; Generate a model according to the target text, the first type image generation condition and the second image generation condition to obtain the second type image generation condition; Using the first type of image generation condition and the second type of image generation condition as the image generation condition of the target text, wherein the image generation condition is used to generate a target image corresponding to the target text; The target text and at least one type of image generation condition are input into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is trained based on a sample image set, the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images.
2. The method according to claim 1, wherein the image generation model is trained based on the following steps: Get the target sample pairs in the sample image set, where: The target sample pair carries at least one type of image generation condition, and the target sample pair consists of a target sample text and a target sample image; Inputting the target sample text and various image generation conditions into an image generation model to obtain a predicted image output by the image generation model; Calculate a model loss value based on the predicted image and the target sample image; The model parameters of the image generation model are adjusted according to the model loss value until a trained image generation model is obtained.
3. The method according to claim 2, before acquiring the target sample pair in the sample image set, further comprising: Obtain at least one sample image and sample text corresponding to each sample image; Determine at least one type of image generation condition corresponding to each sample image; Generate sample pairs based on each sample image and the sample text corresponding to each sample image, and add the at least one type of image generation condition to each sample pair; A sample image set is generated according to each sample pair carrying the at least one type of image generation condition.
4. The method according to claim 3, determining at least one type of image generation condition corresponding to each sample image, comprising: Acquire at least one image recognition model, wherein the image recognition model is used to output an image generation condition of a target type according to an input image; The sample image is input into each image recognition model to obtain at least one type of image generation condition corresponding to the sample image.
5. The method according to claim 1, wherein the image generation condition generation model is trained based on the following steps: Get the target text to be processed in the sample text set, where: The sample text set includes text to be processed that carries image generation conditions of the target type; Inputting the target text to be processed into an image generation condition generation model to obtain a predicted image generation condition; Calculating a target loss value according to the predicted image generation condition and the image generation condition of the target type; The model parameters of the image generation condition generation model are adjusted based on the target loss value until a trained image generation condition generation model is obtained.
6. The method according to claim 1, inputting the target text and at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text, comprising: Inputting the target text and the at least one type of image generation condition into a feature processing module of an image generation model to obtain an image feature vector; A target image corresponding to the target text is generated based on each image feature vector.
7. The method as claimed in claim 1, wherein the image generation condition comprises at least one of the following conditions: a mask condition, a sketch condition, an instance condition, a depth map condition, an edge condition, a grayscale map condition, and a color condition.
8. A training method for an image generation model, applied to a server, comprising: Acquire a target sample pair from a sample image set, wherein the target sample pair carries at least one type of image generation condition, the target sample pair consists of a target sample text and a target sample image, the image generation condition is determined based on a first type of image generation condition and a second type of image generation condition, the first type of image generation condition is determined based on a first image generation condition generation model and the target sample text, the second type of image generation condition is determined based on the target sample text, the first type of image generation condition and the second type of image generation condition generation model, and the second image generation condition generation model is determined in a preset image generation chain according to the first type of image generation condition; Inputting the target sample text and various image generation conditions into an image generation model to obtain a predicted image output by the image generation model; Calculate a model loss value based on the predicted image and the target sample image; The model parameters of the image generation model are adjusted according to the model loss value until a trained image generation model is obtained.
9. An image generation method, applied to a server, comprising: Receive the target text sent by the client, generate a model and the target text based on the first image generation condition, and determine the first type of image generation condition; Determining a second image generation condition generation model in a preset image generation chain according to the first type of image generation condition; Generate a model according to the target text, the first type image generation condition and the second image generation condition to obtain the second type image generation condition; Using the first type of image generation condition and the second type of image generation condition as the image generation condition of the target text, wherein the image generation condition is used to generate a target image corresponding to the target text; Inputting the target text and at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is obtained by training based on a sample image set, the sample image set includes sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images; The target image is returned to the client.
10. An image generating device, comprising: An acquisition module is configured to acquire a target text, and based on a first image generation condition generation model and the target text, determine a first type of image generation condition; Determining a second image generation condition generation model in a preset image generation chain according to the first type of image generation condition; Generate a model according to the target text, the first type image generation condition and the second image generation condition to obtain the second type image generation condition; Using the first type of image generation condition and the second type of image generation condition as the image generation condition of the target text, wherein the image generation condition is used to generate a target image corresponding to the target text; An input module is configured to input the target text and at least one type of image generation condition into an image generation model to obtain a target image corresponding to the target text, wherein the image generation model is obtained based on training of a sample image set, the sample image set contains sample pairs and at least one type of image generation condition corresponding to the sample pairs, and the sample pairs are composed of sample text and sample images.
11. A computing device comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method described in any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the steps of the method according to any one of claims 1 to 9.
Citation Information
Cited By
Scene rendering graph automatic generation method based on multi-modal intention analysis
CN122760789A
