Image generation method, device, computer equipment and storage medium

By amplifying the target corpus information and inputting it into the adversarial network, the adversarial network generated by mode augmentation conditions is used to generate multiple images with different content modalities, which solves the problem of insufficient image generation diversity in traditional methods and improves the efficiency of image generation. Image variety and quality.

CN112614197BActive Publication Date: 2024-09-24刘丽
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011320171.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-23
Publication Date
2024-09-24
Estimated Expiration
2040-11-23

AI Technical Summary

Technical Problem

In traditional image generation methods, only one image data can be obtained based on a text corpus, which lacks diversity and cannot effectively generate multiple images with different content modalities.

Method used

By amplifying the target corpus information, at least two amplified corpus information are obtained and input into the pre-trained adversarial network respectively. The adversarial network generated using pattern augmentation conditions is determined according to the preset control function. Discrepancy index training generates multiple target images with different content modalities.

Benefits of technology

It realizes the generation of multiple target images with different content modalities based on one corpus information, improves the diversity and visual effects of the images, and alleviates the mode collapse problem that may exist in traditional conditional generative adversarial networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112614197B
    Figure CN112614197B
Patent Text Reader

Abstract

The present application relates to an image generation method, device, computer equipment and storage medium. The method comprises: obtaining target corpus information, amplifying the target corpus information to obtain at least two amplified corpus information; respectively inputting at least two amplified corpus information into a pre-trained adversarial network to process each amplified corpus information according to a model parameter predetermined in the adversarial network model to obtain at least two target images with different content modalities, wherein the adversarial network is generated by training based on a difference index determined by a preset control function. The use of this method can improve the diversity of the generated target images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to an image generation method, apparatus, computer equipment and storage medium. Background Art

[0002] With the development of big data technology, when applying big data technology, large amounts of data will be needed for subsequent data applications. For example, in some scenarios, it is necessary to obtain multiple image data corresponding to text corpus.

[0003] In the traditional method, only one image data can be obtained based on a text corpus, and the output image data is relatively simple and lacks diversity. Summary of the invention

[0004] Based on this, it is necessary to provide an image generation method, apparatus, computer device and storage medium that can improve the diversity of image generation in response to the above technical problems.

[0005] A method for generating an image, the method comprising:

[0006] Acquire target corpus information, and perform amplification processing on the target corpus information to obtain at least two amplified corpus information;

[0007] At least two augmented corpus information are respectively input into a pre-trained adversarial network, so that each augmented corpus information is processed according to a model parameter predetermined in the adversarial network model to obtain at least two target images with different content modalities. The adversarial network is generated by training based on a difference index determined by a preset control function.

[0008] In one embodiment, the target corpus information is amplified to obtain at least two amplified corpus information, including:

[0009] At least two unequal vectors read from the distribution sequence are used as latent vectors, the number of latent vectors is consistent with the number of target images, the number of target images is at least two, and the integral value of the distribution sequence is a preset value;

[0010] Each latent vector is concatenated with the target corpus information to obtain the augmented corpus information corresponding to each target corpus information.

[0011] In one embodiment, at least two augmented corpus information are respectively input into a pre-trained adversarial network, so as to process each augmented corpus information according to a model parameter predetermined in the adversarial network model to obtain at least two target images with different content modalities, and the adversarial network is generated by training a difference index determined based on a preset control function, including:

[0012] The training augmented corpus information is respectively input into the adversarial network generated by the mode augmentation condition, and the target images corresponding to the respective augmented corpus information are output. The content modes of the multiple target images are different. The adversarial network generated by the mode augmentation condition is generated by difference index training based on a preset control function. The preset control function is determined according to the target images of different content modes and the latent vectors corresponding to the target images of different content modes.

[0013] In one embodiment, the training method of the adversarial network includes:

[0014] Acquire training corpus information, and amplify the training corpus information based on the pattern augmentation condition to obtain training augmented corpus information;

[0015] Inputting the training augmented corpus information into the adversarial network, so as to process each training augmented corpus information according to the current training parameters of the adversarial network to obtain a training image corresponding to each training augmented corpus information;

[0016] Determining difference values ​​between different training images based on a preset control function;

[0017] The difference index between different training images is determined according to the difference value, the current training parameter corresponding to the maximum difference index is used as the target training parameter, and the trained adversarial network is obtained according to the target training parameter.

[0018] In one embodiment, determining the difference values ​​between different training images based on a preset control function includes:

[0019] Determining a first difference value based on the difference values ​​between the training images;

[0020] Determine a second difference value according to the difference value between the latent vectors corresponding to the training images;

[0021] The difference value between the training images is determined according to the relative value of the first difference value and the second difference value.

[0022] In one embodiment, the training method of the adversarial network model includes:

[0023] Input each augmented corpus information into the generator of the adversarial network model, and process the augmented corpus information according to the initial generator parameters preset in the generator to obtain a real scene image;

[0024] Pairing the real scene image with the target corpus information to obtain a paired image;

[0025] Input the paired image into the discriminator in the adversarial network to identify the authenticity of the paired image according to the initial discriminator parameters preset in the discriminator to obtain an identification result;

[0026] The loss value is determined according to the identification result, and the discriminator of the adversarial network is trained according to the parameter gradient determined by the loss value to obtain the target discriminator.

[0027] In one embodiment, the training method of the adversarial network model includes:

[0028] Inputting the paired image into the target discriminator in the adversarial network to identify the authenticity of the paired image according to the target discriminator parameters preset in the target discriminator to obtain an identification result;

[0029] The loss value is determined according to the identification result, and the generator of the adversarial network is trained according to the parameter gradient determined by the loss value to obtain the target generator.

[0030] An image generating device, comprising:

[0031] An acquisition module is used to acquire target corpus information and perform amplification processing on the target corpus information to obtain at least two amplified corpus information;

[0032] A generation module is used to input at least two augmented corpus information into a pre-trained adversarial network respectively, so as to process each augmented corpus information according to a model parameter predetermined in the adversarial network model to obtain at least two target images with different content modalities, and the adversarial network is generated by training based on a difference index determined by a preset control function.

[0033] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0034] A computer-readable storage medium stores a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0035] The above-mentioned image generation method, device, computer equipment and storage medium obtain target corpus information, obtain at least two augmented corpus information by amplifying the target corpus information, and input the at least two augmented corpus information into a pre-trained adversarial network respectively, so as to process each augmented corpus information according to the model parameters predetermined in the adversarial network to obtain at least two target images with different content modalities. Since the adversarial network is generated by training based on the difference index determined by the preset control function, the purpose of obtaining at least two target images with different content modalities based on one corpus information is guaranteed, thereby improving the diversity of the output target images. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A diagram showing an application environment of an image generation method in an embodiment;

[0037] Figure 2 is a schematic flow chart of an image generating method in one embodiment;

[0038] Figure 3 A flowchart of a training method for an adversarial network provided in an embodiment;

[0039] Figure 4 A schematic diagram of generating multiple target images with different modalities based on an adversarial network provided in one embodiment;

[0040] Figure 5 is a structural block diagram of an image generating device in one embodiment;

[0041] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0043] The image generation method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The server 104 obtains the target corpus information, amplifies the target corpus information to obtain at least two amplified corpus information; the at least two amplified corpus information are respectively input into the pre-trained adversarial network, so as to process each amplified corpus information according to the model parameters predetermined in the adversarial network model to obtain at least two target images with different content modes, and the adversarial network is generated by training the difference index determined based on the preset control function. Among them, the terminal 102 can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented with an independent server or a server cluster composed of multiple servers.

[0044] In one embodiment, Figure 2 As shown, a method for generating an image is provided, and the method is applied to Figure 1 The server in the example is used to illustrate the following steps:

[0045] Step S202: acquiring target corpus information, and performing amplification processing on the target corpus information to obtain at least two amplified corpus information.

[0046] The target corpus information may be a semantic description information, such as "heavy rain", "heavy fog" and "a bird on a tree", etc. The augmented corpus information is information obtained after the target corpus information is augmented. For example, the augmentation process specifically converts the target corpus into coded information. In one embodiment, the target corpus is converted into coded information according to a natural language processing algorithm. The augmentation process may also include obtaining interference information, and obtaining augmented corpus information according to a combination of interference information and image information.

[0047] In one embodiment, the augmented corpus information is a further description of the target corpus information, and further modifies the target corpus without changing the basic semantics of the target corpus. Specifically, it can be by further expanding the target corpus to add or reduce some information on the basis of the target corpus information. For example, the augmented corpus information obtained by augmenting the target corpus "a bird on a tree" can be "a white bird on a tree", etc. For example, the target corpus information can be firstly subjected to natural language processing to obtain image information, and then the image information is further expanded to obtain the augmented corpus information. Specifically, a random sequence can be added on the basis of the image information, and the target augmented information can be obtained according to the image information and the random sequence, or the pixel matrix corresponding to the image information can be expanded, etc., which is not limited here.

[0048] Specifically, the server obtains input data, namely a text corpus, takes the corpus in the text corpus as the target corpus x, performs conditional amplification processing on the input target corpus x to obtain c, and then obtains at least two random vectors z1 and z2, and combines each random vector with the target corpus x to obtain combination data (c, z1) and (c, z2) with the same number of random vectors, and determines the amplified corpus information based on the combination data.

[0049] Step S203, respectively inputting at least two augmented corpus information into a pre-trained adversarial network to process each augmented corpus information according to a model parameter predetermined in the adversarial network model to obtain at least two target images with different content modalities, wherein the adversarial network is generated by training based on a difference index determined by a preset control function.

[0050] Among them, the content modality can be represented by the image content of the target image. Generally speaking, when the difference between the target images is greater than a preset value, they can be considered to be two target images with different content modalities. In other words, there are certain differences in information such as color and brightness between images with different content modalities. The control function is a custom function, which is a function used to characterize the difference values ​​between different target images, where the degree of difference in the difference values ​​can be determined according to the difference index. Generally, the larger the difference index, the greater the degree of difference between the target images, and the more it can represent two images with different content modalities. Among them, the training process of the adversarial network is determined based on the difference index determined by the preset control function, so the trained adversarial network can output different target images with larger difference indexes, thereby achieving the technical purpose of outputting multiple target images with different content modalities based on a target corpus, and improving the diversity of the output images.

[0051] Specifically, the server inputs at least two augmented corpus information into a pre-trained machine learning model respectively to process each augmented corpus information according to predetermined model parameters in the machine learning model to obtain at least two target images. The machine learning model is an adversarial network generated by pattern augmentation conditions.

[0052] The machine learning model is pre-trained, and specifically the machine learning model can be an adversarial network generated by pattern augmentation conditions. The pattern augmentation conditions refer to a network trained using the augmented corpus information obtained by augmentation processing as a training set. The adversarial network is a network with a generator and a discriminator, which processes the target augmented corpus through the coordinated operation of the generator and the discriminator to obtain a predicted target image.

[0053] Specifically, the determined augmented corpus information (c, z1) and (c, z2) are input into the generator of the stacked generated adversarial network to generate image data G1(c, z1) and G2(c, z2) corresponding to the corpus information. The generated image data G1(c, z1) and G2(c, z2) and the transformed real scene images generated by the adversarial network constitute paired images {x, G1(c, z1)} and {x, G2(c, z2)}, and the paired images {x, G1(c, z1)} and {x, G2(c, z2)} are input into the discriminator D to determine the authenticity of the input pairing.

[0054] Generative adversarial networks have a mode collapse problem in their models. In conditional generative adversarial networks (GANs), the mode collapse problem is more prominent, which severely limits the diversity of generated images. In practical applications, how to ensure both the visual quality and diversity of generated images is a challenging task. In the process of converting text to images based on conditional generative adversarial networks, it is very necessary to simultaneously maintain the visual quality and image diversity of generated images. This application proposes a mode-augmented conditional generative adversarial network to alleviate the serious mode collapse problem that may exist in traditional classical conditional generative adversarial networks, and improve the quality and diversity of generated images. This application is based on a mode-augmented conditional generative adversarial network, which can generate multimodal image results when converting text corpus information into images, amplifies the diversity of generated image results, and increases the visual effect of the image.

[0055] The above-mentioned image generation method obtains target corpus information, obtains at least two augmented corpus information by amplifying the target corpus information, and inputs the at least two augmented corpus information into a pre-trained machine learning model respectively, so as to process each target corpus information according to the image generation parameters predetermined in the machine learning model to obtain at least two target images, thereby achieving the purpose of obtaining at least two target images based on one corpus information, and improving the diversity of the output target images.

[0056] In one embodiment, the target corpus information is amplified to obtain at least two amplified corpus information, including: obtaining latent vectors, the number of latent vectors is consistent with the number of target images, and the number of target images is at least two; each latent vector is concatenated with the target corpus information to obtain the amplified corpus information corresponding to each target corpus information.

[0057] The latent vectors may be extracted from data that conforms to a normal distribution, and the number of latent vectors extracted is consistent with the number of target images to be obtained. For example, in one embodiment, in order to obtain two target images, at least two latent vectors need to be extracted from the normally distributed data, and the target corpus information is amplified according to the at least two latent vectors to obtain at least two amplified corpus information, and then at least two target images corresponding to the at least two amplified corpus information are obtained according to the at least two amplified corpus information.

[0058] The data that conforms to the normal distribution may be Gaussian distribution data, etc., which is not limited here. Specifically, two latent vectors z are randomly sampled from the Gaussian distribution, and the latent vectors are concatenated with the target corpus to obtain (c, z1) and (c, z2).

[0059] In one embodiment, obtaining a latent vector includes: reading at least two unequal vectors from a distribution sequence as latent vectors, and an integral value of the distribution sequence is a preset value.

[0060] The integral of the distribution sequence may be 1, wherein the distribution sequence may specifically be a Gaussian distribution sequence and a uniform distribution sequence, etc., which are not limited here.

[0061] In the above embodiment, by configuring different latent vectors as adjustment parameters, and amplifying the target corpus based on the adjustment parameters, a plurality of amplified corpus information corresponding to the target corpus is generated, so that the generated target images can be different. Specifically, the target corpus is amplified using the latent vector, and then the amplification of the target corpus is achieved to obtain the amplified corpus information, so that the amount of information of the amplified corpus information input into the adversarial network is richer, so as to obtain more diverse target images. In addition, the acquisition of the latent vector in the above embodiment is simple, efficient, and flexible, which also makes the solution in the present application applicable to more scenarios.

[0062] In one embodiment, at least two augmented corpus information are respectively input into a pre-trained adversarial network, so that each augmented corpus information is processed according to a model parameter predetermined in the adversarial network model to obtain at least two target images with different content modalities. The adversarial network is generated by training based on a difference index determined based on a preset control function, including: inputting the training augmented corpus information into the adversarial network generated by the mode augmentation condition, and outputting target images corresponding to each augmented corpus information. The content modalities of the multiple target images are different. The adversarial network generated by the mode augmentation condition is generated by training based on a difference index determined based on a preset control function. The preset control function is determined based on the target images of different content modalities and the latent vectors corresponding to the target images of different content modalities.

[0063] like Figure 3 , Figure 3 A flowchart of a training method of an adversarial network provided in an embodiment includes:

[0064] Step 302: Acquire training corpus information, and perform augmentation processing on the training corpus information based on the pattern augmentation condition to obtain the training augmented corpus.

[0065] Specifically, the server obtains training corpus information as input training sample data, specifically preparing a batch of paired text corpora and image data, and the data format of the training samples is consistent with the format of the target corpus information and target image in the specific use process.

[0066] Step 304: input the training augmented corpus information into the adversarial network, so as to process each training augmented corpus information according to the current training parameters of the adversarial network to obtain a training image corresponding to each training augmented corpus information.

[0067] Specifically, the server performs amplification processing on the target corpus information according to a preset amplification processing algorithm to obtain the amplified corpus information. Specifically, the target corpus information of the input text corpus is conditionally amplified to obtain c, and then two latent vectors z1 and z2 are randomly sampled from the Gaussian distribution, and c is concatenated with z1 and z2 to obtain (c, z1) and (c, z2). Then, the obtained (c, z1) and (c, z2) are respectively input into the adversarial network, and the input data is processed using the current training parameters in the adversarial network to obtain the training image.

[0068] Step 306: Determine the difference values ​​between different training images based on a preset control function.

[0069] Step 308, determining the difference index between different training images according to the difference value, taking the current training parameter corresponding to the maximum difference index as the target training parameter, and obtaining the trained adversarial network according to the target training parameter.

[0070] The difference value is a numerical value used to measure the degree of difference between different training images, and the difference value can be obtained by calculating the difference in pixel values ​​between the training images. Specifically, the difference value between the training images calculated by the server is specifically when two training images are output, the server calculates the difference value between the two training images. In other embodiments, when the output training images include more than two images, the difference value between the multiple images is calculated separately to maximize the difference value between the multiple images, thereby ensuring that the difference between the target images finally obtained is maximized, and achieving the diversity of the target images obtained.

[0071] In the above embodiment, the training parameters of the adversarial network are controlled by controlling the difference values ​​between different training images, and when the obtained difference values ​​are maximized, the training parameters at this time are used as target training parameters, thereby ensuring that the adversarial network determined by the target training parameters can output the target image with the greatest differentiation, thereby ensuring the comprehensiveness and diversity of the output image.

[0072] In one embodiment, the difference values ​​between different training images are determined based on a preset control function, including: determining a first difference value according to the difference value between the training images; determining a second difference value according to the difference value between latent vectors corresponding to the training images; and determining the difference value between the training images according to the relative value of the first difference value and the second difference value.

[0073] Specifically, the server obtains the image matrices corresponding to different training images, and calculates the difference between the image matrices to obtain the first difference. Specifically, the average pixel values ​​of different training images can be calculated respectively, and the difference between different training images can be determined according to the average pixel values, or different training images can be partitioned, and the difference between different training images can be determined according to the difference corresponding to each partition image. It should be noted that when calculating the difference value through partition processing, different weights can be set for different partitions so that the most concerned area can have a higher weight, and can account for a larger proportion when calculating the difference value, because the human eye is more sensitive to the most concerned area image, and by setting a larger weight, the determination of the difference value can be more in line with the actual situation and more accurate. In another embodiment, the similarity value between different training images can also be calculated, and the difference between different training images can be determined according to the similarity value. The calculation method of the similarity value includes but is not limited to a structural similarity algorithm, a cosine similarity algorithm, a mutual information similarity algorithm, and a fingerprint similarity algorithm. It should be noted that by calculating the similarity between different training images to determine the difference between different training images, the difference between different training images can be measured from multiple dimensions, so that the acquisition of the difference is more accurate and reliable.

[0074] Similarly, the method of calculating the difference between latent vectors includes but is not limited to directly calculating the difference between each data in the latent vector, determining the second difference based on the difference between each data, or calculating the difference between latent vectors based on the data distribution of the latent vector, or calculating the difference between latent vectors by other methods, which are not limited here.

[0075] Then the server obtains the first difference and the second difference to calculate the relative value, and determines the difference between the training images according to the relative value. The relative value may be the ratio of the first difference to the second difference, or may be other mathematical calculation values ​​between the first difference and the second difference. As shown in formula (1), it is a calculation formula for calculating the difference value between different training images provided in one embodiment.

[0076]

[0077] Specifically, the server randomly takes two unequal latent vectors z1 and z2 from the normal distribution N(0,1), inputs them in the latent space between the encoder and the decoder, requires the generator to output corresponding real scene images G(E(x), z1) and G(E(x), z2), and calculates the difference value D between the real scene images according to formula (1), and when the value D corresponding to the difference value is the maximum, the current training parameters are used as the target training parameters.

[0078] In the above embodiment, when the server trains the multimodal conditional generative adversarial network, the value of the difference index determined by the control function is as large as possible, that is, the difference between the output training images G(E(x), z1) and G(E(x), z2) is as large as possible, so that the trained multimodal conditional generative adversarial network can generate multiple target images with large differences, thereby improving the diversity of the generated target images.

[0079] Furthermore, the machine learning model is trained according to the acquired training samples, and when the training end condition is reached, the training is terminated to obtain a trained machine learning model. The training end condition includes but is not limited to the number of training iterations reaching a preset number, the training accuracy reaching a preset accuracy, or the training time reaching a preset time, etc.

[0080] In the above embodiment, in the process of training the machine learning model, a difference calculation formula is predefined to limit the model training process, so that the training image with the greatest differentiation can be obtained, and the obtained machine learning model is more in line with actual needs, and the difference between the obtained target images is maximized, thereby achieving the diversity and comprehensiveness of the target images.

[0081] In one embodiment, the machine learning model is an adversarial network model generated by pattern augmentation conditions; the training method of the adversarial network model includes: inputting each augmented corpus information into the generator of the adversarial network model, processing the augmented corpus information according to the initial generator parameters preset in the generator to obtain a real scene image; pairing the real scene image with the target corpus information to obtain a paired image; inputting the paired image into the discriminator in the adversarial network to authenticate the paired image according to the initial discriminator parameters preset in the discriminator to obtain an authentication result; determining a loss value according to the authentication result, and training the discriminator of the adversarial network according to the parameter gradient determined by the loss value to obtain a target discriminator.

[0082] Specifically, the process of training the adversarial network includes training the discriminator in the adversarial network and the generator in the adversarial network. The process of training the discriminator network D includes: inputting the data spliced ​​into (c, z) into the generator G of the stacked generative adversarial network to obtain the generated real-life image G(c, z), pairing the input text corpus and the generated image G(c, z) to obtain the paired image {x, G(c, z)}. The paired image is input into the discriminator network D, and the paired authenticity result D(x, G(c, z)) is output. The loss function is calculated according to the output label result of the discriminator to obtain the corresponding gradient, and then the network is optimized through the back-propagation technology, so that the discriminator network D is trained.

[0083] In one embodiment, the training method of the adversarial network model includes: inputting the paired image into the target discriminator in the adversarial network to perform authenticity identification on the paired image according to the target discriminator parameters preset in the target discriminator to obtain an identification result; determining a loss value according to the identification result, and training the generator of the adversarial network according to the parameter gradient determined by the loss value to obtain a target generator.

[0084] Specifically, the steps of training the generator network G in the server include: obtaining a target discriminator and maintaining the weight of the target discriminator network D unchanged, pairing the input text corpus and the generated image G(c,z) to obtain a paired image {x,G(c,z)}, and inputting the paired image into the discriminator network D, outputting a paired authenticity result D(x,G(c,z))), calculating the loss function according to the discriminator output label result, obtaining the corresponding gradient, and then optimizing the network through back propagation technology to train the generator network G.

[0085] In the above embodiment, the discriminator and the generator in the adversarial network are gradually trained to obtain a trained adversarial network, thereby improving the training efficiency and training accuracy of the network.

[0086] In a specific embodiment, the steps of the method provided in the present application include: the server obtains text information input by the terminal, such as the target corpus x, and then performs conditional amplification on the target corpus to obtain at least two target amplified information (c, z1) and (c, z2), wherein conditional amplification refers to adding random perturbations through Gaussian distribution. Then, at least two target amplified information (c, z1) and (c, z2) are input into the model, and the difference between the two target images finally obtained is limited to the maximum according to the custom max function, so that at least two target images can be obtained. It should be noted that the method for obtaining more than two target images is similar to the method for obtaining two target images, which will not be repeated here.

[0087] Traditional classical conditional generative adversarial networks (cGANs) have a mode collapse problem during training. Directly using conditional generative adversarial networks to transform text to images usually results in a one-to-one mapping, which is inconsistent with human intuition. Humans themselves construct image transformations that are one-to-many or many-to-many. The mode augmented conditional generative adversarial network designed in this application achieves multi-modal text image generation enhancement by regulating the latent vector, requiring that when the latent vector is different, the output result of the target image is the most differentiated, thereby increasing the diversity of the generated images and ensuring that the generated images have good image quality.

[0088] like Figure 4 , Figure 4 A schematic diagram of generating a plurality of target images with different modalities based on an adversarial network provided in an embodiment, from Figure 4 It can be seen from the figure that based on the input target corpus c, the target corpus is amplified based on the latent vectors z1 and z2 to obtain the amplified corpus information, which is input into the adversarial network, and then two target images I1 and I2 with different content modalities are obtained. Among them, the adversarial network is trained based on the preset control function.

[0089] It should be understood that although Figure 2-3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-3 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0090] In one embodiment, Figure 5 As shown, an image generation device is provided, which can be a part of a computer device using a software module or a hardware module, or a combination of the two. The device specifically includes:

[0091] The acquisition module 502 is used to acquire target corpus information and perform amplification processing on the target corpus information to obtain at least two amplified corpus information.

[0092] The generation module 504 is used to input at least two augmented corpus information into a pre-trained adversarial network respectively, so as to process each augmented corpus information according to the model parameters predetermined in the adversarial network model to obtain at least two target images with different content modalities. The adversarial network is generated by training based on the difference index determined by the preset control function.

[0093] In one embodiment, the acquisition module 502 is also used to read at least two unequal vectors from the distribution sequence as latent vectors, the number of latent vectors is consistent with the number of target images, the number of target images is at least two, and the integral value of the distribution sequence is a preset value; each latent vector is concatenated with the target corpus information to obtain the augmented corpus information corresponding to each target corpus information.

[0094] In one embodiment, the generation module 504 is also used to input the training augmented corpus information into the adversarial network generated by the pattern augmentation condition, and output the target images corresponding to each augmented corpus information. The content modes of the multiple target images are different. The adversarial network generated by the pattern augmentation condition is generated by difference index training based on a preset control function. The preset control function is determined according to the target images of different content modes and the latent vectors corresponding to the target images of different content modes.

[0095] In one embodiment, the image generation device also includes a training module, which is used to obtain training corpus information, and amplify the training corpus information based on the pattern augmentation condition to obtain the training augmented corpus information; input the training augmented corpus information into the adversarial network to process each training augmented corpus information according to the current training parameters of the adversarial network to obtain a training image corresponding to each training augmented corpus information; determine the difference value between different training images based on a preset control function; determine the difference index between different training images according to the difference value, use the current training parameter corresponding to the maximum difference index as the target training parameter, and obtain the trained adversarial network according to the target training parameter.

[0096] In one embodiment, the training module is further used to determine a first difference value based on the difference value between training images; determine a second difference value based on the difference value between latent vectors corresponding to the training images; and determine a difference value between the training images based on a relative value between the first difference value and the second difference value.

[0097] In one embodiment, the image generation device also includes a training module, which is also used to input each augmented corpus information into the generator of the adversarial network model, process the augmented corpus information according to the initial generator parameters preset in the generator to obtain a real scene image; pair the real scene image with the target corpus information to obtain a paired image; input the paired image into the discriminator in the adversarial network to authenticate the paired image according to the initial discriminator parameters preset in the discriminator to obtain an authentication result; determine a loss value according to the authentication result, and train the discriminator of the adversarial network according to the parameter gradient determined by the loss value to obtain a target discriminator.

[0098] In one embodiment, the image generating device also includes a training module, which is also used to input the paired image into the target discriminator in the adversarial network to perform authenticity identification on the paired image according to the target discriminator parameters preset in the target discriminator to obtain an identification result; determine the loss value according to the identification result, and train the generator of the adversarial network according to the parameter gradient determined by the loss value to obtain the target generator.

[0099] For the specific definition of the image generation device, please refer to the definition of the image generation method above, which will not be repeated here. Each module in the above-mentioned image generation device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0100] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store image generation data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an image generation method is implemented.

[0101] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0102] In one embodiment, a computer device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following is achieved: acquiring target corpus information, amplifying the target corpus information to obtain at least two amplified corpus information; respectively inputting the at least two amplified corpus information into a pre-trained adversarial network to process each amplified corpus information according to a model parameter predetermined in the adversarial network model to obtain at least two target images with different content modalities, wherein the adversarial network is generated by training based on a difference indicator determined based on a preset control function.

[0103] In one embodiment, when the processor executes the computer program, it is also used to implement: at least two unequal vectors read from the distribution sequence are used as latent vectors, the number of latent vectors is consistent with the number of target images, the number of target images is at least two, and the integral value of the distribution sequence is a preset value; each latent vector is concatenated with the target corpus information to obtain the augmented corpus information corresponding to each target corpus information.

[0104] In one embodiment, when the processor executes the computer program, it is also used to implement: inputting the training augmented corpus information into the adversarial network generated by the pattern augmentation condition respectively, and outputting the target images corresponding to the respective augmented corpus information, wherein the content modalities of the multiple target images are different, and the adversarial network generated by the pattern augmentation condition is generated by difference index training based on a preset control function, and the preset control function is determined according to the target images of different content modalities and the latent vectors corresponding to the target images of different content modalities.

[0105] In one embodiment, in one embodiment, when the processor executes the computer program, it is also used to implement: obtaining training corpus information, amplifying the training corpus information based on the pattern augmentation condition to obtain the training augmented corpus information; inputting the training augmented corpus information into the adversarial network to process each training augmented corpus information according to the current training parameters of the adversarial network to obtain a training image corresponding to each training augmented corpus information; determining the difference value between different training images based on a preset control function; determining the difference index between different training images according to the difference value, using the current training parameter corresponding to the maximum difference index as the target training parameter, and obtaining the trained adversarial network according to the target training parameter.

[0106] In one embodiment, in one embodiment, the processor, when executing the computer program, is also used to implement: determining a first difference value based on a difference value between training images; determining a second difference value based on a difference value between latent vectors corresponding to the training images; determining a difference value between the training images based on a relative value between the first difference value and the second difference value.

[0107] In one embodiment, in one embodiment, when the processor executes the computer program, it is also used to implement: inputting each augmented corpus information into the generator of the adversarial network model, processing the augmented corpus information according to the initial generator parameters preset in the generator to obtain a real scene image; pairing the real scene image with the target corpus information to obtain a paired image; inputting the paired image into the discriminator in the adversarial network to authenticate the paired image according to the initial discriminator parameters preset in the discriminator to obtain an authentication result; determining a loss value according to the authentication result, and training the discriminator of the adversarial network according to the parameter gradient determined by the loss value to obtain a target discriminator.

[0108] In one embodiment, in one embodiment, when the processor executes the computer program, it is also used to implement: inputting the paired image into the target discriminator in the adversarial network to perform authenticity identification on the paired image according to the target discriminator parameters preset in the target discriminator to obtain an identification result; determining a loss value according to the identification result, and training the generator of the adversarial network according to the parameter gradient determined by the loss value to obtain a target generator.

[0109] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which, when executed by a processor, implements: acquiring target corpus information, amplifying the target corpus information to obtain at least two amplified corpus information; respectively inputting the at least two amplified corpus information into a pre-trained adversarial network to process each amplified corpus information according to a model parameter predetermined in the adversarial network model to obtain at least two target images with different content modalities, wherein the adversarial network is generated by training based on a difference index determined based on a preset control function.

[0110] In one embodiment, when the computer program is executed by a processor, it is also used to implement: at least two unequal vectors read from the distribution sequence are used as latent vectors, the number of latent vectors is consistent with the number of target images, the number of target images is at least two, and the integral value of the distribution sequence is a preset value; each latent vector is concatenated with the target corpus information to obtain augmented corpus information corresponding to each target corpus information.

[0111] In one embodiment, when the computer program is executed by the processor, it is also used to implement: inputting the training augmented corpus information into the adversarial network generated by the pattern augmentation condition respectively, and outputting the target images corresponding to the respective augmented corpus information, wherein the content modalities of the multiple target images are different, and the adversarial network generated by the pattern augmentation condition is generated by training based on the difference index determined by the preset control function, and the preset control function is determined according to the target images of each different content modality and the latent vectors corresponding to the target images of each different content modality.

[0112] In one embodiment, when the computer program is executed by the processor, it is also used to implement: obtaining training corpus information, amplifying the training corpus information based on the pattern augmentation condition to obtain the training augmented corpus information; inputting the training augmented corpus information into the adversarial network to process each training augmented corpus information according to the current training parameters of the adversarial network to obtain a training image corresponding to each training augmented corpus information; determining the difference value between different training images based on a preset control function; determining the difference index between different training images according to the difference value, using the current training parameter corresponding to the maximum difference index as the target training parameter, and obtaining the trained adversarial network according to the target training parameter.

[0113] In one embodiment, when the computer program is executed by a processor, it is also used to implement: determining a first difference value based on the difference value between training images; determining a second difference value based on the difference value between latent vectors corresponding to the training images; and determining a difference value between the training images based on a relative value between the first difference value and the second difference value.

[0114] In one embodiment, when the computer program is executed by the processor, it is also used to implement: inputting each augmented corpus information into the generator of the adversarial network model, processing the augmented corpus information according to the initial generator parameters preset in the generator to obtain a real scene image; pairing the real scene image with the target corpus information to obtain a paired image; inputting the paired image into the discriminator in the adversarial network to authenticate the paired image according to the initial discriminator parameters preset in the discriminator to obtain an authentication result; determining a loss value according to the authentication result, and training the discriminator of the adversarial network according to the parameter gradient determined by the loss value to obtain a target discriminator.

[0115] In one embodiment, when the computer program is executed by a processor, it is also used to implement: inputting the paired image into a target discriminator in an adversarial network to perform authenticity identification on the paired image according to target discriminator parameters preset in the target discriminator to obtain an identification result; determining a loss value according to the identification result, and training a generator of the adversarial network according to a parameter gradient determined by the loss value to obtain a target generator.

[0116] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.

[0117] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0118] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0119] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. An image generation method, characterized in that: The method comprises: Acquire target corpus information, and perform amplification processing on the target corpus information to obtain at least two amplified corpus information; Inputting the augmented corpus information into the adversarial network generated by the mode augmentation condition respectively, outputting the target images corresponding to the respective augmented corpus information, wherein the content modes of the plurality of target images are different, and the adversarial network generated by the mode augmentation condition is generated by training based on a difference index determined by a preset control function, and the preset control function is determined according to the target images of the different content modes and the latent vectors corresponding to the target images of the different content modes; The training method of the adversarial network includes: Acquire training corpus information, and perform amplification processing on the training corpus information based on a pattern augmentation condition to obtain training augmented corpus information; Inputting the training augmented corpus information into an adversarial network, so as to process each of the training augmented corpus information according to current training parameters of the adversarial network to obtain a training image corresponding to each of the training augmented corpus information; Determining difference values ​​between different training images based on a preset control function; Determining a difference index between different training images according to the difference value, taking a current training parameter corresponding to a maximum difference index as a target training parameter, and obtaining a trained adversarial network according to the target training parameter; Wherein, determining the difference values ​​between different training images based on a preset control function includes: Determine a first difference value according to the difference value between the training images; Determine a second difference value according to the difference value between the latent vectors corresponding to the training images; The difference value between the training images is determined according to a relative value between the first difference value and the second difference value.

2. The method according to claim 1, characterized in that The amplifying the target corpus information to obtain at least two amplified corpus information includes: At least two unequal vectors read from the distribution sequence are used as latent vectors, the number of the latent vectors is consistent with the number of the target images, the number of the target images is at least two, and the integral value of the distribution sequence is a preset value; Each of the latent vectors is concatenated with the target corpus information to obtain augmented corpus information corresponding to each of the target corpus information.

3. The method according to claim 1, characterized in that The training method of the adversarial network model includes: Inputting each of the augmented corpus information into the generator of the anti-network model, and processing the augmented corpus information according to the initial generator parameters preset in the generator to obtain a real scene image; Pairing the real scene image with the target corpus information to obtain a paired image; Inputting the paired image into a discriminator in an adversarial network to perform authenticity identification on the paired image according to initial discriminator parameters preset in the discriminator to obtain an identification result; A loss value is determined according to the identification result, and the discriminator of the adversarial network is trained according to a parameter gradient determined by the loss value to obtain a target discriminator.

4. The method according to claim 3, characterized in that The training method of the adversarial network model includes: Inputting the paired image into the target discriminator in the adversarial network to perform authenticity identification on the paired image according to target discriminator parameters preset in the target discriminator to obtain an identification result; A loss value is determined according to the identification result, and a generator of the adversarial network is trained according to a parameter gradient determined by the loss value to obtain a target generator.

5. An image generating device, characterized in that: The device comprises: An acquisition module, used for acquiring target corpus information, and performing amplification processing on the target corpus information to obtain at least two amplified corpus information; A generation module is used to input the augmented corpus information into the adversarial network generated by the mode augmentation condition, and output the target images corresponding to the respective augmented corpus information, wherein the content modes of the multiple target images are different, and the adversarial network generated by the mode augmentation condition is generated by training based on the difference index determined by the preset control function, and the preset control function is determined according to the target images of the different content modes and the latent vectors corresponding to the target images of the different content modes; A training module is used to obtain training corpus information, perform amplification processing on the training corpus information based on the pattern augmentation condition to obtain training augmented corpus information; input the training augmented corpus information into the adversarial network to process each training augmented corpus information according to the current training parameters of the adversarial network to obtain a training image corresponding to each training augmented corpus information; determine the difference value between different training images based on a preset control function; determine the difference index between different training images according to the difference value, use the current training parameter corresponding to the maximum difference index as the target training parameter, and obtain the trained adversarial network according to the target training parameter; The training module is further used to determine a first difference value according to the difference value between the training images; determine a second difference value according to the difference value between the latent vectors corresponding to the training images; and determine a difference value between the training images according to a relative value between the first difference value and the second difference value.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.