An AI graph generation method for text fusion
By exchanging cue embeddings through a text encoder and a neural exchange module, and combining CLIP feature encoder and image segmentation model evaluation, a column-swapping vector generation network is trained. This solves the problem of text-to-image generation lacking novelty and creativity in existing methods, and realizes the generation of creative images.
Patent Information
- Application Number
- CN202311203159.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-18
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2043-09-18
AI Technical Summary
Existing text-to-image generation methods lack novelty, surprise, and value, and are difficult to effectively integrate creative image generation of multiple objects.
The system generates cue word pairs through a text encoder, swaps cue embeddings using a neural exchange module, performs semantic and feature filtering using a CLIP feature encoder, evaluates component similarity using an image segmentation model, trains a column-pair swap vector generation network, and generates creative images.
It generates novel, surprising, and valuable images that combine the creative elements of two objects rather than simply combining them, thus enhancing the creativity of the generative model.
Smart Images

Figure CN117197291B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual design, specifically to an AI-generated image method involving text fusion. Background Technology
[0002] Creativity is a fundamental characteristic of human intelligence and plays a crucial role in text-to-image (T2I) synthesis. However, this task presents a significant challenge for most existing methods in computer vision and machine learning, including Stable-Diffusion2, DALLE2, Imagen, and ERNIE-ViLG2. These methods aim to generate images that simulate a given training distribution, but they often lack novelty, surprise, and value. Therefore, it is necessary to develop machine learning systems with enhanced creativity to overcome these limitations.
[0003] Recent research has focused primarily on object composition, aiming to directly generate new, complex images by combining textual descriptions of multiple known objects. One example is the application of composable diffusion models (CDMs), which generate images containing multiple objects at specified locations. Another approach is Structure-Diffusion, which incorporates linguistic structure into the layout of the generated image, making it plausible and ensuring no object is omitted. Furthermore, Custom-Diffusion enables the generation of plausible multi-object compositions in previously unseen contexts. However, these composition methods can only produce outputs of independent objects, lacking elements for the fusion of multiple target objects. Summary of the Invention
[0004] The purpose of this invention is to provide an AI-generated image method for text fusion, which learns in a supervised manner the conversion between two original text codes and the text codes of a creative object, so as to generate innovative objects and thus innovative images based on the original object text codes.
[0005] The technical solution for achieving the objective of this invention is as follows: Firstly, this invention provides an AI-generated image method for text fusion, which generates a text-fused visual image based on the prompt word pairs of the original object text, including the following steps:
[0006] Step 1: Given an arbitrary text-based graph model encoder ε(·), the generator... Randomly generate cue word pairs (p1, p2), and use a text encoder to extract the text E1 = ε(p1) ∈ R for each pair. h×w E2=ε(p2)∈R h×w , where h and w are the lengths of the second and third dimensions of the character encoding;
[0007] Step 2: Randomly sample columns and swap vector f and its corresponding 0-1 inverse vector f.-1 The sampled code E is obtained by fusing it with the character code. f Then, the fusion encoding is input into the diffusion model to generate an object image. For each sample, repeat the process multiple times until a suitable set of sample cases is obtained.
[0008] Step 3: Perform semantic filtering and calculate The distance between the semantic encoding of all object images and the CLIP features of the two cue words is less than the hard threshold θ. p set
[0009] Step 4: Perform distance filtering and calculation. Feature encoding of all images and two reference images and The five images with the largest distance sum among those whose distance difference is less than the soft threshold θ1 and whose sum of distances to the two reference images I1 and I2 is less than the soft threshold θ2.
[0010] Step 5: Create a baseline component set, using the image segmentation model afterward. Image segmentation is performed on I1 and I2 to obtain component images, and the ten segmented component images with the highest confidence are retained as component sets C1 and C2 respectively;
[0011] Step 6: Perform component evaluation using an image segmentation model for the set. The image is segmented and a set of components C to be compared is created. f Furthermore, the similarity between the segmented results and the baseline component set is calculated, and the image with the highest score is selected as the optimal fused image, with its corresponding column swap vector being the optimal swap vector f. best ;
[0012] Step 7: Repeat steps 1-6 to obtain several... Create a dataset and train a column swap vector generation network.
[0013] Step 8: For new prompt words The column-swap vector generation network directly generates column-swap vectors and ultimately generates the optimal visual image for text fusion.
[0014] Furthermore, the sampling method for the randomly generated column swap vector in step 2; for the text encoding E1∈R of the prompt word p1 h×w Then the column swap vector generated during sampling should be f∈{0,1} w×1 And random The value at position 1.
[0015] Furthermore, in step 2, the fusion method of the column swap vector and the two original character codes is utilized; firstly, the 0-1 inverse vector f of the column swap vector f is calculated. -1 ,Right now The resulting fused character encoding E can then be obtained. f =E1·f+E2·f -1 Then, for the sampled column-transformation vector f, the corresponding sampled example of the generative model is:
[0016] Furthermore, the semantic-level encoding distance in step 3 is calculated using a multimodal encoder φ. img,txt (·,·) for sampled example I f Encode the prompt words p1 and p2 respectively and calculate the cosine distance, denoted as r(I f The absolute value of the difference of the cosine distances of the encoded data, p1), is |r(I f ,p1)-r(I f ,p2)|, and the hard threshold θ p The method for determining the value is to first set it to infinity during the first two random prompts, observe the calculated value of the sample, and finally determine it through manual observation.
[0017] Furthermore, the encoding distance at the feature level in step 4 is, firstly, based on the standard image generated from the prompt words. The image encoder φ then uses a multimodal encoder. img (·) Set I1, I2, I f Encode the values, then calculate the absolute value of the difference in cosine distances |r(I) f ,I1)-r(I f The average of the absolute values of the sum of the ,I2)| and cosine distances (|r(I f ,I1)+r(I f ,I2)|) / 2.
[0018] Furthermore, the soft threshold setting method in step 4 is as follows: during the sampling process of the first three groups of prompt words, only semantic filtering is performed, skipping the steps of innovativeness filtering, benchmark component set creation, and component evaluation. After the sampling of the first three groups is completed, the threshold set to be set is then... First, obtain the sample size l of the set and sort the set in descending order. Then, determine the proportion through manual observation. The final soft threshold is set to the first one in the set. The values at the location are set, and then feature distance filtering, benchmark component set creation, and component evaluation steps are performed on these three groups. The subsequent sampling process of prompt words uses the determined soft threshold to perform a complete filtering step.
[0019] Furthermore, the process of creating component set C in step 5 involves creating any image I and the resulting set of component images segmented using an image segmentation model. Image encoder φ using a multimodal encoder img (·) After encoding all component images in the set, perform pairwise similarity comparisons and take the ten component images with the highest average similarity as the final component set.
[0020] Furthermore, in step 6, the component evaluation process first involves comparing the image I... f Use the component set creation process in step 5 to create component set C. f and using a multimodal encoder image encoder φ img (·) C f The similarity between the image and each component image in C1 and C2 is calculated. Finally, the image with the highest average similarity is taken as the optimal visual image for text fusion, and its corresponding column swap vector is the optimal swap vector f. best .
[0021] Furthermore, in the column swap vector generation network in step 7, the text encodings of the two prompt words (p1, p2) are first concatenated and input into the column swap vector generation network, which outputs the predicted column swap vector, and then compared with the sampled optimal swap vector. The formula for calculating the L2 norm loss is as follows:
[0022]
[0023] in, Let ψ be the set of prompt words (p1, p2), and let ψ be the learning parameters in the column swap vector generation network.
[0024] In a second aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the AI-generated image method for text fusion described in the first aspect.
[0025] Compared with the prior art, the significant advantages of this invention are: (1) This invention no longer operates on objects that exist in reality, but starts from the original prompt words to explore the unknown text fusion image generation; (2) This invention does not require additional training or fine-tuning of the generative model, and can directly use the generative model as a black box for text fusion image generation.
[0026] The present invention will now be described in further detail with reference to the accompanying drawings. Attached Figure Description
[0027] Figure 1 This is a schematic diagram of the process of the present invention.
[0028] Figure 2 This is a framework diagram of the TESN module in this invention.
[0029] Figure 3 Figures showing some results of the present invention.
[0030] Figure 4 These are some different styles of result diagrams of the present invention.
[0031] Figure 5 This is a comparison diagram of the swapping method in this invention with other common swapping methods.
[0032] Figure 6 This diagram illustrates the process of evaluating the innovation of image generation through text fusion in the IE module of this invention.
[0033] Figure 7 This is a comparison chart showing the effect of the present invention in text fusion image generation with other existing generative models.
[0034] Figure 8 This is a quantitative comparison chart of the image generation of text fusion based on the present invention with other existing generative models. Detailed Implementation
[0035] This invention follows three fundamental criteria for evaluating the creativity of generated objects in T2I synthesis: novelty, surprise, and value. It is noteworthy that T2I models rely heavily on datasets independently sampled from training, validation, and testing data, all drawn from the same distribution. Based on this observation, we reconsider the creativity criteria. Novelty measures the degree of difference between the creative object and the data distribution of a given concept. Surprise and value, on the other hand, measure the unexpectedness and appeal of the creative object compared to the data distribution, respectively. While many T2I models can generate diverse objects, they are essentially simulations of the data distribution, thus limiting the creativity of these machines. Therefore, we are compelled to explore new mechanisms to generate high-quality, novel objects that deviate from the data distribution and to develop new evaluation methods to assess the creativity of newly generated object images.
[0036] In this work, we propose a learning strategy to generate novel, surprising, and valuable objects by combining two seemingly unrelated object concepts and their cues. Our method comprises a text encoder, a neural exchange module, an image generator, and a CLIP-based evaluation method. The text encoder and image generator can be pre-trained using state-of-the-art T2I models. First, we compute two original embeddings by inputting a given pair of cue words into the text encoder. Next, we propose a neural exchange process that trains a neural network to exchange the column vectors of the cue embeddings. This exchange generates a new embedding, enabling the generation of fresh and unique images. We introduce an evaluation method that measures the surprise and value of the new image by comparing the CLIP distance between the newly generated image and the image generated from the original concepts. We use the evaluation method to select the most promising exchange embedding from a set of random embeddings for training the neural exchange network.
[0037] This invention proposes an AI-generated image method based on text fusion. It provides designers with auxiliary references and inspiration in fusion design scenarios. When the text names of two objects are input, this method fuses the text codes of the two objects and inputs the fused text codes into a text-image generative model. The final output is a stunning and creative image of the fused object. The fused object no longer shares the same category as the original two objects, but its structure, material, texture, and other characteristics are extremely similar to the two original objects. This method is named Text-Fusion-to-Image Synthesis (TF2I), and it consists of two parts: a Text EmbeddingSwapping Network (TESN) module and an Image Evaluation (IE) module. The IE module aims to determine the optimal swap vector for fusion of two texts during the sampling phase. It uses a CLIP feature encoder to measure the distance between the single-text generated object image and the fused object image, selecting the optimal swap vector for the fused object. This ensures that the texture or components of the fused image sample retain important details of the original single-text generated object, thus forming a sample pair (two text codes, optimal swap vector). The TESN module uses the sample pairs sampled by the IE module to supervise the training of a text encoding swap network from the two text codes to the optimal swap vector, achieving rapid generation of fused encodings of two texts and thus broadly generating fused visual images. The attached figure demonstrates the impressive results of TF2I in multi-text fusion image generation.
[0038] An AI-generated image method based on text fusion includes the following steps:
[0039] Step 1: Given an arbitrary text-based graph model encoder ε(·), generator Randomly generate cue word pairs p1 and p2, and use a text encoder to extract their text E1 = ε(p1) ∈ R. h×w E2=ε(p2)∈R h×w Where h and w are the lengths of the second and third dimensions of the character encoding; then the two encodings are input into the diffusion model to generate the baseline object image. and
[0040] Step 2: Randomly sample columns and swap vector f and its corresponding 0-1 inverse vector f. -1 The sampled code E is obtained by fusing it with the character code. f Then the encoding is input into the diffusion model, and the resulting image is viewed. For each sample, repeat the process multiple times until a suitable set of sample cases is obtained.
[0041] Step 3: Perform semantic filtering and calculate The semantic encoding of all sampled examples is less than the hard threshold θ when the distance between the two cue words is less than the distance between the two cue words. p set
[0042] Step 4: Conduct innovation screening and calculate... The set of all sampled examples whose feature encodings differ from the baseline images I1 and I2 generated by the two prompt words by a distance less than the soft threshold θ1, and whose sum of distances to the baseline images I1 and I2 generated by the two prompt words is less than the soft threshold θ2.
[0043] Step 5: Create a baseline component set using an image segmentation model. Perform image segmentation on I1 and I2, and retain the ten images with the highest confidence scores as component sets C1 and C2 respectively.
[0044] Step 6: Perform component evaluation using an image segmentation model for the set. The image is segmented and a set of components C to be compared is created. f Furthermore, the similarity between the segmented results and the baseline component set is calculated, and the image with the highest score is selected as the visual image with optimal text fusion, and its corresponding column swap vector is the optimal swap vector f. best ;
[0045] Step 7: Repeat steps 1-6 to obtain several... Create a dataset and train a column swap vector generation network.
[0046] Step 8: For the new prompt word pair The column-swap vector generation network directly generates column-swap vectors and ultimately generates the optimal visual image for text fusion.
[0047] Preferably, in step 1, a pre-trained large model image generator and its text encoder are used directly, which saves the most time-consuming and computationally demanding training process.
[0048] Preferably, step 2 performs sampling operations at the text encoding level, and the sampling effect is indirectly evaluated by assessing the generation effect. This allows the method to be used in any text-generated image model, and we have verified through multiple experiments that the column-to-vector swapping method is a learnable matrix operation that can maximize the balance between the quality of the sampled image and the degree of innovation of the image content.
[0049] Preferably, the semantic-level evaluation process in step 3 can significantly reduce the time complexity to O(n^2). 2 The subsequent steps reduce the amount of data and thus reduce computation time. On the other hand, since the robustness of multimodal encoders is worse than that of image encoders, step 4 is still needed for a more granular comparison.
[0050] Preferably, the method of comparing the features of the images generated by the two prompt words in step 4 and retaining the sample examples that are similar to the features of the two images can greatly ensure that the sample examples can contain the image features of the two prompt words at the same time. This ensures that the most innovative image is closely related to the original two prompt words when conducting subsequent innovation evaluation. At the same time, setting an upper bound on the feature distance ensures that the image of the final selected sample example is not simply a fusion of the two prompt words, but generates some amazing innovative objects while fusing them.
[0051] Preferably, a soft threshold is selected for screening in step 4. The advantage of doing so is that, since the sampling is not limited to a single category of objects (plants, animals, etc.), and when performing step 4, the sample size left by the screening in the previous step is positively correlated with the creativity of the original two prompt words that can be combined, so using a dynamic soft threshold determined according to the sample size ratio can make the final selected fusion sample more innovative and representative.
[0052] Preferably, the image segmentation model in step 5 often segments 100-200 images with a lot of repetition. Therefore, it is necessary to use confidence to filter the segmentation results. The confidence result in the segmentation model is mostly based on whether the segmentation result is complete. Therefore, it is necessary to use an additional image encoder to evaluate it again. The image encoder of the multimodal encoder used in the previous step has certain semantic information. Therefore, it is used to encode and calculate the feature distance.
[0053] Preferably, in step 6, an image segmentation model is used for component evaluation. Since it is desired that the image is innovative while also being similar to its source prompt words, whether from the perspective of overall feature encoding, semantics, or specific component content, the component evaluation method is used to impose certain restrictions on it, so that the final result is innovative while retaining some of the component content of the source prompt words.
[0054] Preferably, in step 7, the model output needs to be converted into a hard swap vector. Since the swap vector itself provides enough creativity, it is only necessary to learn the swap vector to generate sufficiently innovative samples.
[0055] This invention fuses the text codes of two objects and inputs the fused text codes into a text-image generative model. The final output is a stunning and creative image of the two objects. The fused object no longer has the same type as the original two objects, but its structure, material, texture and other contents are extremely similar to the two original objects.
[0056] The present invention will now be described in detail with reference to the embodiments and accompanying drawings.
[0057] Example
[0058] like Figure 1 As shown, an AI-generated image method for text fusion is proposed. Given an arbitrary text-generated image model encoder ε(·), the generator... Randomly generate cue word pairs (p1, p2), and use a text encoder to extract the text E1 = ε(p1) ∈ R for each pair. h×w E2=ε(p2)∈R h×w Then, input the diffusion model to generate a baseline object image. and Randomly sampled columns swap vector f and its corresponding 0-1 inverse vector f -1 The sampled code E is obtained by fusing it with the character code. f Then the encoding is input into the diffusion model, and the resulting image is viewed. For each sample, repeat the process multiple times until a suitable set of sample cases is obtained. Perform preliminary semantic-level screening and calculation. The semantic encoding of all sampled examples is less than the hard threshold θ when the distance between the two cue words is less than the distance between the two cue words. p set Perform fine-grained filtering at the feature level and calculate... The set of all sampled examples whose feature encodings have an absolute difference between the distances to the two prompt words that is less than the soft threshold θ1, and whose mean sum of the distances to the two prompt words is less than the soft threshold θ2. Using image segmentation models Image segmentation is performed on I1 and I2, and the ten images with the highest confidence scores are retained as component sets C1 and C2, respectively; the image segmentation model is then used for the sets. The image is segmented and a set of components C to be compared is created. f Furthermore, the similarity between the segmented results and the baseline component sets C1 and C2 is calculated, and the image with the highest score is selected as the optimal visual image for text fusion, with its corresponding column swap vector being the optimal swap vector f. best Repeat the above steps to obtain several Create a dataset and train a column swap vector generation network. For new cue word pairs The column-transformation vector generation network directly generates column-transformation vectors and ultimately produces a text-fused visual image. The specific steps are as follows:
[0059] Step 1: Given an arbitrary text-based graph model encoder ε(·), the generator... Randomly generate cue word pairs (p1, p2), and use a text encoder to extract the text E1 = ε(p1) ∈ R for each pair. 77×1024 E2=ε(p2)∈R 77×1024 In this embodiment, the generator is the Stable-Diffusion2 model, the multimodal and image encoders are the CLIP model using ViT-L / 14@336px, and the prompt word pair is "a photo of [word]", where the word in [word] is a word from the ImageNet dataset.
[0060] Step 2: Randomly sample columns and swap vector f and its corresponding 0-1 inverse vector f. -1 For this example, the character encoding E1∈R 77×1024 Then the column swap vector generated during sampling should be f∈{0,1} 1024×1 And random The value at position is 1. Then find the 0-1 inverse vector f of the column swap vector f. -1 ,Right now The merged text encoding E can then be obtained. f =E1·f+E2·f -1 Then, for the sampled column-transformation vector f, the corresponding sampling example of the generative model is: See the generated result image To obtain a sample set, the experiment was repeated 200 times.
[0061] Step 3: Perform semantic filtering and calculate The semantic encoding of all sampled examples is less than the hard threshold θ when the distance between the two cue words is less than the distance between the two cue words. p set Using CLIP encoder φ img,txt (·,·) for sampled example I f Encode the prompt words p1 and p2 respectively and calculate the cosine distance, denoted as r(I f p1) and r(I f The absolute value of the difference of the cosine distances of the encoded data, p2), is |r(I f ,p1)-r(I f ,p2)|, and the hard threshold θ p The method for determining this value is to first set it to infinity during the first two random prompts and observe the calculated value of the sample. In this example, it was finally determined to be 0.05 through manual observation.
[0062] Step 4: Perform feature distance filtering and calculate. The set of feature codes for all sampled examples and the sets of two cue words whose distance difference is less than a soft threshold θ1 and whose distance sum is less than a soft threshold θ2. First, a standard image is generated based on the two prompt words. and Image encoder φ using CLIP model img (•) Set I1, I2, I f Encode the values, then calculate the absolute value of the difference in cosine distances |r(I) f ,I1)-r(I f The average value of the sum of cosine distances (r(I2)| and I2)| is given by the sum of cosine distances. f ,I1)+r(I f The set of images with the highest average cosine distance sum among those whose absolute difference is less than the soft threshold θ1 and whose average sum is less than the soft threshold θ2 is the fine-sampling set. In this example, after generating all the sampling results for the three sets of prompt words, the soft threshold was finally adjusted after manual observation. The ratio is 0.4. The ratio is 0.1. The final soft thresholds are set in descending order. as well as The value at position, where l is The total number of sample cases in the sample;
[0063] Step 5: Create a baseline component set using an image segmentation model. Image segmentation is performed on I1 and I2, and the ten segmented component images with the highest confidence scores are retained as component sets C1 and C2, respectively. The specific process for creating the component sets is as follows: for any image I and the set of segmentation results using the image segmentation model... Image encoder φ using CLIP img(·) After encoding all images in the set, pairwise similarity comparisons are performed, and the ten images with the highest average similarity are selected as the final component set. In this example, Segment-Anything is used as the image segmentation model.
[0064] Step 6: Perform component evaluation using an image segmentation model for the set. The image is segmented and a set of components C to be compared is created. f Furthermore, it evaluates the similarity between the image and the benchmark component set, and selects the image with the highest score as the fusion innovation image, whose corresponding column swap vector is the optimal swap vector f. best The calculation process in this example is as follows: First, for the image I to be compared... f Use the component set creation process in step 5 to create component set C. f and using CLIP's image encoder φ img (·) C f The similarity score is calculated with each image in C1 and C2. The sample with the highest average similarity score is then selected as the most innovative image, and its corresponding column swap vector is the optimal swap vector f. best ;
[0065] Step 7: Repeat the above steps to obtain several... Create a dataset and train a column swap vector generation network. like Figure 2 As shown, the text encodings of the two prompt words are first concatenated and then input into a column swap vector generation network. The network outputs a predicted column swap vector, which is then compared with the sampled optimal swap vector. The formula for calculating the L2 norm loss is as follows:
[0066]
[0067] Step 8: For the new prompt word pair The column-swap vector generation network directly generates column-swap vectors and ultimately generates the optimal visual image for text fusion.
[0068] Table 1 User Survey.
[0069]
[0070] We conducted a user study to evaluate our model in terms of creativity compared to four other T2I methods. Each user was presented with 10 pairs of prompts to vote on, with a total of 106 users casting 1,060 votes. The voting results are summarized in Table 1. Our model received the most votes, with 62% of users indicating that our model generated more creative samples. Furthermore, 18.5% of users expressed interest in the Bing model, while the DALLE2 model received only 5% of the votes, despite providing the model structure to the Bing model. Our baseline model, Stable-Diffusion2, received 9% of the votes, while only 4.6% of users preferred the ERNIE-ViLG2 model.
[0071] Figure 3 The text fusion effect of this invention is demonstrated, showcasing its innovation. For example, kangaroo and pear (kangaroo-pears) generate a pear-shaped kangaroo, and lionfish and abacus (lionfish-abacus) generate an abacus-shaped fish artwork.
[0072] Figure 4 The presentation showcases text fusion generation effects of this invention under different styles. The styles primarily include aquarelle, line art, cartoon, and ink painting. For example, king crab and gorilla images generate novel effects in these different styles.
[0073] Figure 5 An example of vector swapping based on kangaroos and pears is shown. Dots and crosses represent meaningful and meaningless objects, respectively. Dashed dot-line diagrams show similar objects using linear interpolation. In this method, a linear embedding space is constructed using the formula αE1 + (1-α)E2, where α ranges from 0 to 1. However, this method often produces predictable and unimpressive embedding results. Secondly, to achieve more surprising combinations, an efficient method is to swap the corresponding elements of E1 and E2. However, due to the large size of the swap matrix, sampling to obtain the swap matrix may require more computational resources. Furthermore, extensive experiments show that when their row vectors are swapped multiple times, the resulting images often lack coherence or meaning.
[0074] Figure 6 This diagram illustrates the process of innovation evaluation in the IE module of this invention, showcasing its surprise and value. In the diagram, the shaded area represents the combined screening of distance difference and distance sum in step 4. The distance difference limits the selection of I... fThe distance difference between I1 and I2 will not be too large to cause a significant bias in the fused image; it is essentially a hyperbolic constraint with I1 and I2 as foci. The sum of the distances limits I. f The vectors are not too close to I1 and I2, resulting in a more stunning fused image than a simple combination of the original prompt text. Essentially, the image is constrained by an ellipse with I1 and I2 as the focal points. The circles in the shaded area represent vectors that satisfy the innovation assessment; they indicate a high probability of producing stunning and valuable object images. The solid dots represent the five vectors with the largest sum of distances among those satisfying the innovation assessment, indicating their highest novelty. The dot pointed to by the arrow is the final vector, its selection determined by the component evaluation process.
[0075] Figure 7 This paper presents a comparison of the visual effects generated by fusing creative objects. We compared the method of this invention with state-of-the-art (SOTA) T2I models, including Stable-Diffusion2, DALLE2, ERNIE-ViLG2 (Baidu), and Bing (Microsoft). It can be seen that the results of this invention are visually more creative than these models. Furthermore, the results of this invention differ significantly from the most similar images retrieved from the LAION-5B dataset in the last row.
[0076] Figure 8 A quantitative comparison of creative object generation is presented. We encode the images generated by our method with other T2I models using the CLIP encoder and directly compare them with the cue words (p1, p2) and the original images I1, I2 generated by the cue words. Larger values are marked as the average encoding distance. Clearly, our model outperforms other models in combining text alignment and image alignment. This indicates that the images generated by our model are more likely to contain semantic and content information from both cues.
[0077] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A text fusion-based AI-generated image method, characterized in that, Based on the cue word pairs of the original object text, a text-fused visual image is generated, including the following steps: Step 1: Given an arbitrary text-based graph model encoder ε(·), the generator... Randomly generate cue word pairs (p1, p2), and use a text encoder to extract the text E1 = ε(p1) ∈ R for each pair. h×w E2=ε(p2)∈R h×w , where h and w are the lengths of the second and third dimensions of the character encoding; Step 2: Randomly sample columns and swap vector f and its corresponding 0-1 inverse vector f. -1 The sampled code E is obtained by fusing it with the character code. f Then, the fusion encoding is input into the diffusion model to generate an object image. For each sample, repeat the process multiple times until a suitable set of sample cases is obtained. Step 3: Perform semantic filtering and calculate The distance between the semantic encoding of all object images and the CLIP features of the two cue words is less than the hard threshold θ. p set Step 4: Perform distance filtering and calculation. Feature encoding of all images and two reference images and The five images with the largest distance sum among those whose distance difference is less than the soft threshold θ1 and whose sum of distances to the two reference images I1 and I2 is less than the soft threshold θ2. Step 5: Create a baseline component set, using the image segmentation model afterward. Image segmentation is performed on I1 and I2 to obtain component images, and the ten segmented component images with the highest confidence are retained as component sets C1 and C2 respectively; Step 6: Perform component evaluation using an image segmentation model for the set. The image is segmented and a set of components C to be compared is created. f Furthermore, the similarity between the segmented results and the baseline component set is calculated, and the image with the highest score is selected as the optimal fused image, with its corresponding column swap vector being the optimal swap vector f. best ; Step 7: Repeat steps 1-6 to obtain several... Create a dataset and train a column swap vector generation network. Step 8: For new prompt words The column-swap vector generation network directly generates column-swap vectors and ultimately generates the optimal visual image for text fusion.
2. The AI-generated image method for text fusion according to claim 1, characterized in that, The sampling method for the randomly generated column swap vector in step 2; for the text encoding E1∈R of the prompt word p1 h×w Then the column swap vector generated during sampling should be f∈{0,1} w×1 And random The value at position 1.
3. The AI-generated image method for text fusion according to claim 1, characterized in that, Step 2 utilizes the fusion method of column swap vector and two original character codes; firstly, it calculates the 0-1 inverse vector f of the column swap vector f. -1 ,Right now The resulting fused character encoding E can then be obtained. f =E1·f+E2·f -1 Then, for the sampled column-transformation vector f, the corresponding sampled example of the generative model is:
4. The AI-generated image method for text fusion according to claim 1, characterized in that, The semantic-level encoding distance in step 3 is calculated using a multimodal encoder φ. img,txt (·,·) for sampled example I f Encode the prompt words p1 and p2 respectively and calculate the cosine distance, denoted as r(I f The absolute value of the difference of the cosine distances of the encoded data, p1), is |r(I) f ,p1)-r(I f ,p2)|, additional hard threshold θ p The method for determining the value is to first set it to infinity during the first two random prompts, observe the calculated value of the sample, and finally determine it through manual observation.
5. The AI-generated image method for text fusion according to claim 1, characterized in that, The encoding distance at the feature level in step 4 is, firstly, the standard image generated based on the prompt words. The image encoder φ then uses a multimodal encoder. img (·) Let I1, I2, I f Encode the values, then calculate the absolute value of the difference in cosine distances |r(I) f ,I1)-r(I f The average of the absolute values of the sum of the sine and cosine distances (|r(I2)|) f ,I1)+r(I f ,I2)|) / 2.
6. The AI-generated image method for text fusion according to claim 1, characterized in that, The soft threshold setting method in step 4 is as follows: during the sampling process of the first three groups of prompt words, only semantic filtering is performed, skipping the steps of innovation filtering, benchmark component set creation, and component evaluation. After the sampling of the first three groups is completed, the threshold set to be set is then... First, obtain the sample size l of the set and sort the set in descending order. Then, determine the proportion through manual observation. The final soft threshold is set to the first one in the set. The values at the location are set, and then feature distance filtering, benchmark component set creation, and component evaluation steps are performed on these three groups. The subsequent sampling process of prompt words uses the determined soft threshold to perform a complete filtering step.
7. The AI-generated image method for text fusion according to claim 1, characterized in that, The process of creating component set C in step 5 involves creating any image I and the resulting set of component images segmented using an image segmentation model. Image encoder φ using a multimodal encoder img (·) After encoding all component images in the set, perform pairwise similarity comparisons and take the ten component images with the highest average similarity as the final component set.
8. The AI-generated image method for text fusion according to claim 1, characterized in that, The component evaluation process in step 6 first involves comparing the image I. f Use the component set creation process in step 5 to create component set C. f and an image encoder φ using a multimodal encoder. img (·) C f The similarity between the image and each component image in C1 and C2 is calculated. Finally, the image with the highest average similarity is taken as the optimal visual image for text fusion, and its corresponding column swap vector is the optimal swap vector f. best .
9. The AI-generated image method for text fusion according to claim 1, characterized in that, In step 7, the column swap vector generation network first concatenates the text encodings of the two cue words (p1, p2) and inputs them into the column swap vector generation network. The network outputs the predicted column swap vector, which is then compared with the sampled optimal swap vector. The formula for calculating the L2 norm loss is as follows: in, Let ψ be the set of prompt words (p1, p2), and let ψ be the learning parameters in the column swap vector generation network.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the AI-generated image method for text fusion as described in any one of claims 1-9.
