Optimization method and system for text generation material map based on diffusion model

By optimizing the material texture generation method using a diffusion model and a Transformer decoder, and leveraging a large-scale image dataset and text annotations, the problem of high professionalism and non-generalization of results in the material texture generation process is solved, achieving efficient and realistic material texture generation.

CN118230090BActive Publication Date: 2026-11-24NANJING UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410323843.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-21
Publication Date
2026-11-24
Estimated Expiration
2044-03-21

AI Technical Summary

Technical Problem

In existing technologies, creating high-quality material maps requires specialized knowledge and is costly. Furthermore, traditional methods suffer from blurring and loss of detail during the generation process, and the small size of text annotation datasets results in insufficient generalization of the results.

Method used

By utilizing large-scale pure image datasets and small-scale datasets with text annotations, and combining diffusion models and Transformer decoders, the material map generation process is optimized. Clip and T5 models are used for encoding, and multi-channel BRDF maps are reconstructed using latent space feature decoders.

Benefits of technology

It improves the generalization of material texture generation, reduces the need for datasets with text labels, and generates more realistic and detailed results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118230090B_ABST
    Figure CN118230090B_ABST
Patent Text Reader

Abstract

This invention discloses an optimized method and system for generating texture maps from text based on a diffusion model. The invention includes: acquiring a first image dataset without texture text annotations, and using the encoded generated data and corresponding images as samples, inputting them into a stable diffusion model's U-NET model for optimization training; acquiring a second image dataset containing texture text annotations, and using the encoded and noisy data of the images, as well as text embedding data of the image's texture text encoded in two different ways, as samples for training; combining the two different encoding methods with a trained Transformer decoder as an optimized text embedding generation module; expanding and training a latent space feature decoder as an optimized latent space feature decoder; replacing the corresponding modules in the stable diffusion model with the optimized modules to obtain an optimized texture map generation model; inputting the texture text to be generated into the optimized texture map generation model to obtain the texture map. This invention exhibits higher generalization ability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision and graphics, and in particular to an optimization method and system for generating texture maps for text based on a diffusion model. Background Technology

[0002] Physically based rendering is a commonly used technique in computer graphics, designed to simulate the behavior of light and the appearance of objects in a more realistic and accurate way. Material mapping is a two-dimensional image that applies specific material properties to the surface of a three-dimensional model to simulate the appearance and feel of an object. It can contain various information such as color, reflectivity, normals, roughness, and metallicity. This information is mapped onto the surface of the model to correctly represent the object's characteristics during the rendering process.

[0003] Creating and editing material maps typically requires professional computer graphics software, as well as a certain level of graphic design and artistic perception. For beginners, this presents a learning curve and challenges. For experienced professionals, creating high-quality material maps also requires attention to detail and realism, including the accurate capture and reproduction of color, texture, lighting, and surface features of objects, which is a very time-consuming and labor-intensive task.

[0004] Due to the high human and material costs of manually creating material maps, scholars have long been committed to researching the use of machine learning methods to reconstruct corresponding BRDF material maps for real-world media. However, reconstructing material maps is itself an underdetermined problem, meaning that the same rendered image can be interpreted by multiple sets of material maps; and when traditional generative models fail to infer, there are usually no additional hyperparameters to regenerate the rendered image.

[0005] In recent years, with the growth of computing power, some algorithms that were previously impossible to implement have become possible. Among them, diffusion models have shown great potential in the field of image generation, becoming the foundation of today's Stable Diffusion. Traditional diffusion algorithms may cause blurring and loss of detail when processing images. Stable diffusion algorithms solve this problem by employing a nonlinear diffusion process. It is based on partial differential equations, allowing the image to be smoothed while maintaining the sharpness of edges and details. The basic principle of stable diffusion algorithms is to use a diffusion coefficient in the image to control the propagation speed of pixel values. A higher diffusion coefficient allows pixel values ​​to propagate faster, thus smoothing the image. A lower diffusion coefficient slows down the propagation speed, allowing edges and details to be preserved.

[0006] Building on the significant success of large-scale models in text-to-image generation tasks, they can also be applied to text-to-text texture mapping. Furthermore, the availability of numerous large-scale model parameters pre-trained on real-world scenes avoids the previous problems of unrealistic training results due to insufficient datasets or imprecise textures. Controlling texture results through textual descriptions is also more convenient and efficient than manual drawing and parameter tuning within the software. However, the scarcity of multimodal datasets for texture mapping generation tasks, the difficulty of text annotation, and the challenge of standardizing textual descriptions make conventional training methods insufficient for achieving generalization. Summary of the Invention

[0007] To address the problems existing in the prior art, this invention provides an optimized method and system for generating text texture maps based on a diffusion model. This method can effectively utilize existing pure image datasets and small-scale datasets with text annotations to achieve the task of generating text texture maps, and has higher generalization.

[0008] To achieve the above-mentioned objectives, this invention provides an optimization method for text generation material mapping based on a diffusion model, comprising the following steps:

[0009] (1) Obtain the first image dataset without material text annotation, encode each image in the first image dataset to generate the first image embedding data, and use it together with the corresponding noisy image as a sample to input into the stable diffusion model for training. Use the U-NET model of the trained stable diffusion model as the optimized U-NET model.

[0010] (2) Obtain the second image dataset containing material text annotations, encode and add noise to each image in the second image dataset to generate second image embedding data, and encode the material text annotations of each image using two different encoding methods to generate second text embedding data and third text embedding data;

[0011] (3) Use the second image embedding data, the second text embedding data and the third text embedding data as samples to train the Transformer decoder, and combine the two different encoding methods and the trained Transformer decoder as an optimized text embedding generation module.

[0012] (4) Expand the latent space feature decoder of the stable diffusion model according to the number of channels of the required material texture, and use the output of the first image dataset after optimization of the U-NET model as a sample to train the latent space feature decoder, and use the trained latent space feature decoder as the optimized latent space feature decoder.

[0013] (5) Replace the corresponding modules in the stable diffusion model with the optimized text embedding generation module, the optimized U-NET model, and the optimized latent space feature decoder to obtain the optimized material texture generation model;

[0014] (6) Input the material text to be generated into the optimized material texture generation model to obtain the material texture.

[0015] Furthermore, step (1) specifically includes the following steps:

[0016] (1.1) Obtain a first image dataset without material text annotations. The first image dataset includes several rendered images of the same size, and the rendered images do not have material text annotations set.

[0017] (1.2) The latent space feature encoder of the stable diffusion model is used to encode each image in the first image dataset, and then the noisy encoded features are obtained by random noise addition;

[0018] (1.3) For each image in the first image dataset, the pre-trained Clip model is used for encoding, and then the encoded data is projected into eight vectors to form the first image embedding data;

[0019] (1.4) The first image embedding data and the corresponding noise-enhancing coding features are used as samples and input into the U-NET model of the stable diffusion model for training. The trained U-NET model of the stable diffusion model is used as the optimized U-NET model.

[0020] Furthermore, step (2) specifically includes the following steps:

[0021] (2.1) Obtain a second image dataset containing material text annotations, wherein the second image dataset includes several rendered images of the same size, and each rendered image is set with material text annotations for describing material features;

[0022] (2.2) Encode each image in the second image dataset using a pre-trained Clip model to obtain image encoded data;

[0023] (2.3) In the preset set of Gaussian distributions, calculate the index of the Gaussian distribution with the highest cosine similarity to the image encoded data, and use the embedded data representing the Gaussian distribution index to add noise to the image encoded data T times to obtain the second image embedded data;

[0024] (2.4) The material text annotations of each image in the second image dataset are encoded using the pre-trained Clip model and T5 model respectively to obtain the second text embedding data and the third text embedding data.

[0025] Furthermore, step (3) specifically includes the following steps:

[0026] (3.1) Randomly select the diffusion time step as the embedded data representing the diffusion time step;

[0027] (3.2) The second image embedding data, the second text embedding data, the third text embedding data, the embedding data representing the diffusion time step, and the embedding data representing the Gaussian distribution index are concatenated, and the concatenated data is used as a sample;

[0028] (3.3) The image encoded data is used as the ground truth distribution. The difference between the output distribution of the Transformer decoder calculated by KL divergence and the ground truth distribution is used as the loss function to train the Transformer decoder. The two different encoding methods and the trained Transformer decoder are combined as an optimized text embedding generation module.

[0029] Furthermore, step (4) specifically includes the following steps:

[0030] (4.1) Expand the latent space feature decoder of the stable diffusion model to the required number of channels of the material map by copying channels;

[0031] (4.2) The output of the latent space feature encoder of the first image dataset after passing through the stable diffusion model is used as the sample, and the latent space feature decoder is trained according to the following loss function:

[0032]

[0033] In the formula, loss represents the total loss, loss1 represents the L1 norm, and loss... pecp This represents the perceptual loss based on VGG feature structure extraction. render This represents the loss function based on differentiable rendering, where Ι represents the input texture label. This represents the decoder output, where x represents the input truth graph. This represents the rendering result of the center point light source obtained based on differentiable rendering;

[0034] (4.3) Use the trained latent space feature decoder as the optimized latent space feature decoder.

[0035] This invention also provides an optimization system for text generation material mapping based on a diffusion model, comprising:

[0036] The U-NET model optimization module is used to acquire the first image dataset without material text annotation, encode each image in the first image dataset to generate the first image embedding data, and use it together with the corresponding image as samples to input into the stable diffusion model for training. The U-NET model of the trained stable diffusion model is used as the optimized U-NET model.

[0037] The embedded data optimization module is used to obtain a second image dataset containing material text annotations, encode and add noise to each image in the second image dataset to generate second image embedded data, and encode the material text annotations of each image using two different encoding methods to generate second text embedded data and third text embedded data.

[0038] The text embedding generation module optimization module is used to train the Transformer decoder by using the second image embedding data, the second text embedding data and the third text embedding data as samples, and to combine the two different encoding methods and the trained Transformer decoder as the optimized text embedding generation module.

[0039] The latent space feature decoder optimization module is used to expand the latent space feature decoder of the stable diffusion model according to the required number of channels of the material texture, and use the output of the first image dataset after the U-NET model optimization as a sample to train the latent space feature decoder, and use the trained latent space feature decoder as the optimized latent space feature decoder.

[0040] The material texture generation model building module is used to replace the corresponding modules in the stable diffusion model with the optimized text embedding generation module, the optimized U-NET model, and the optimized latent space feature decoder, respectively, to obtain the optimized material texture generation model.

[0041] The material texture generation module is used to input the material text to be generated into the optimized material texture generation model to obtain the material texture.

[0042] Furthermore, the U-NET model optimization module specifically includes:

[0043] The first data acquisition unit acquires a first image dataset without material text annotations. The first image dataset includes several rendered images of the same size, and the rendered images do not have material text annotations.

[0044] The noisy coding unit uses the latent space feature encoder of the stable diffusion model to encode each image in the first image dataset, and then randomly adds noise to obtain the noisy coding features.

[0045] The first encoding unit encodes each image in the first image dataset using a pre-trained Clip model, and then projects the encoded data into eight vectors to form the first image embedding data.

[0046] The first training unit is used to input the first image embedding data and the corresponding noisy coding features as samples into the U-NET model of the stable diffusion model for training, and to use the trained U-NET model of the stable diffusion model as the optimized U-NET model.

[0047] Furthermore, the embedded data optimization module specifically includes:

[0048] The second data acquisition unit is used to acquire a second image dataset containing material text annotations, wherein the second image dataset includes several rendering images of the same size, and each rendering image is set with material text annotations for describing material features;

[0049] The second encoding unit is used to encode each image in the second image dataset using a pre-trained Clip model to obtain image encoded data;

[0050] The noise-adding unit is used to calculate the index of the Gaussian distribution with the highest cosine similarity to the image encoding data in a preset set of Gaussian distributions, and use the Gaussian distribution represented by the index to add noise to the image encoding data T times to obtain the second image embedding data.

[0051] The third encoding unit is used to encode the material text annotations of each image in the second image dataset using pre-trained Clip and T5 models respectively, to obtain the second text embedding data and the third text embedding data.

[0052] Furthermore, the latent space feature decoder optimization module specifically includes:

[0053] The step size selection unit is used to randomly select the diffusion time step as the embedded data representing the diffusion time step.

[0054] An embedded data generation unit is used to calculate the index of the Gaussian distribution with the highest cosine similarity to the image encoded data in a preset set of Gaussian distributions, and use it as embedded data representing the Gaussian distribution index.

[0055] The data splicing unit is used to splice the second image embedded data, the second text embedded data, the third text embedded data, the embedded data representing the diffusion time step, and the embedded data representing the Gaussian distribution index. The spliced ​​data is used as a sample.

[0056] The second training unit is used to train the Transformer decoder by taking the image encoded data as the ground truth distribution and using the difference between the output distribution of the Transformer decoder calculated by KL divergence and the ground truth distribution as the loss function. The two different encoding methods and the trained Transformer decoder are combined as an optimized text embedding generation module.

[0057] Furthermore, the latent space feature decoder optimization module specifically includes:

[0058] The channel expansion unit is used to expand the latent space feature decoder of the stable diffusion model to the required number of channels of the material map by copying channels;

[0059] The third training unit is used to train the latent space feature decoder by taking the output of the latent space feature encoder of the first image dataset after passing through the stable diffusion model as samples, and using the following loss function as the training latent space feature decoder. The trained latent space feature decoder is then used as the optimized latent space feature decoder.

[0060]

[0061] In the formula, loss represents the total loss, loss1 represents the L1 norm, and loss... pecp This represents the perceptual loss based on VGG feature structure extraction. render This represents the loss function based on differentiable rendering, where Ι represents the input texture label. This represents the decoder output, where x represents the input truth graph. This represents the rendering result of the center point light source obtained based on differentiable rendering.

[0062] Compared with existing technologies, the advantages of this invention are as follows: The method of this invention addresses the problem of insufficient generalization caused by the small size of datasets containing labeled text. First, it fine-tunes the diffusion stabilization model using a large-scale pure image dataset, replacing the original text embedding with Clip image encoding to fit the dataset distribution. Then, it trains a Transformer decoder using the diffusion model as its skeleton, generating suitable text embeddings using the encodings of the T5 model and the Clip model to replace the hidden encoding of the Clip-encoded image in the stable diffusion model. Finally, it uses a latent space feature decoder to reconstruct multi-channel BRDF maps from the hidden encoding generated in the diffusion model. This solves the problem of insufficient dataset size for text-description datasets, improves the generalization of results, and reduces the requirement for datasets containing text labels. Attached Figure Description

[0063] Figure 1 This is an architecture diagram of Stable Diffusion;

[0064] Figure 2 This is a flowchart illustrating the optimization method for generating text texture maps based on a diffusion model provided in an embodiment of the present invention.

[0065] Figure 3 An example flowchart of an optimized method for generating text texture maps based on a diffusion model provided in an embodiment of the present invention;

[0066] Figure 4 A schematic diagram illustrating the training process for optimizing the U-NET model;

[0067] Figure 5 A schematic diagram illustrating the training process for optimizing the text embedding generation module;

[0068] Figure 6 This is a schematic diagram of the training process for the latent space feature decoder.

[0069] Figure 7 This is an architecture diagram of the improved material texture generation model according to an embodiment of the present invention;

[0070] Figure 8 This is a schematic diagram illustrating some of the results of an example of the present invention;

[0071] Figure 9 This is a schematic diagram comparing the results of the present invention with those of other methods. Detailed Implementation

[0072] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0073] Because this invention improves upon existing stable diffusion models, the existing stable diffusion models are described first before describing the technical solutions of the embodiments of this invention. For example, the stable diffusion model StableDiffusion has the following architecture: Figure 1 As shown, it mainly includes a conditional coding module, a latent space feature encoder, a UNET, and a latent space feature decoder connected in sequence. The conditional coding module can be a Clip, the latent space feature encoder can be the encoder of the AutoEncoder, and the latent space feature decoder can be the decoder of the AutoEncoder. ε represents the encoder of the AutoEncoder. The original image x is encoded by the encoder of the AutoEncoder to obtain the initial latent code z, which is then randomly noise-added T times to obtain z. TIn the task of generating images from text, Clip is used to encode the text description, and the encoded result τ is used. θ As part of the conditionally guided UNET model, T denoising operations are performed to finally obtain the new denoised hidden code z. The decoder, represented as AutoEncoder, generates a new image after decoding.

[0074] Example 1

[0075] Based on existing stable diffusion models, this invention provides an optimized method for generating text texture maps based on a diffusion model, such as... Figure 2 and Figure 3 As shown, it includes the following steps:

[0076] (1) Obtain the first image dataset without material text annotation, encode each image in the first image dataset to generate the first image embedding data, and use it together with the corresponding image as a sample to input into the stable diffusion model for training. Use the U-NET model of the trained stable diffusion model as the optimized U-NET model.

[0077] In specific implementation, such as Figure 4 As shown, step (1) may include the following steps:

[0078] (1.1) Obtain a first image dataset without material text annotations. The first image dataset includes several rendered images of the same size, and the rendered images do not have material text annotations. The first image dataset can be an existing large-scale pure image dataset, for example, containing only images, all of which are 512-pixel center point light source rendered images.

[0079] (1.2) The input image is encoded using the encoder ε of the original AutoEncoder in the stable diffusion model to obtain q0, and then subjected to T random noise additions to obtain q. T .

[0080] (1.3) For each image in the first image dataset, a pre-trained Clip model is used for encoding, and the encoded data is then projected into eight vectors to form the first image embedding data c0; wherein, the pre-trained Clip model may include pre-trained ViT-B / 16, ViT-B / 32, RN-101, etc., and the images are encoded simultaneously using these three models, and then the encoded data is projected into eight vectors.

[0081] (1.4) The first image embedding data c0 and the corresponding noisy image q TTogether, they are used as samples and input into the U-NET model of the stable diffusion model for training. Finally, the denoised encoding p0 is obtained, and the trained U-NET model of the stable diffusion model is used as the optimized U-NET model.

[0082] The original stable diffusion model used text annotations and images as samples for training. This step replaces the text annotations with the first image embedding data, enabling the application of large-scale pure image datasets.

[0083] (2) Obtain the second image dataset containing material text annotations, encode and add noise to each image in the second image dataset to generate the second image embedding data, and encode the material text annotations of each image using two different encoding methods to generate the second text embedding data and the third text embedding data.

[0084] In specific implementation, such as Figure 5 As shown, step (2) can specifically include the following steps:

[0085] (2.1) Obtain a second image dataset containing material text annotations. The second image dataset includes several rendered images of the same size, each rendered image having a material text annotation to describe the material characteristics. The second image dataset can be a small dataset much smaller than the first image dataset, for example, containing a 512-pixel center point light source rendered image and a text description of the image, i.e., material text annotations. The text description manually defines the attributes that the text label should contain, describes the color, material and texture to express the visual characteristics of the material, removes semantically repetitive or contradictory labels, and manually defines the form of the text description content to ensure that all samples contain each type of prompt word, and the prompt words are sorted by type.

[0086] (2.2) Encode each image in the second image dataset using a pre-trained Clip model to obtain image encoded data.

[0087] (2.3) In a pre-defined set of Gaussian distributions, calculate the index of the Gaussian distribution with the highest cosine similarity to the image encoding data, and use it as the embedding data representing the Gaussian distribution index; wherein, during the training process, a set of Gaussian distributions is provided in advance, and the index of the Gaussian distribution with the highest cosine similarity to the image embedding generated by Clip is obtained by calculating the mean and variance of the data in the set of Gaussian distributions during the training iteration process, and the Gaussian distribution represented by this index is used to encode the image data. Perform T random noise additions to obtain the second image embedding data.

[0088] (2.4) The material text annotations of each image in the second image dataset are encoded using the pre-trained Clip model and T5 model respectively to obtain the second text embedding data c1 and the third text embedding data c2.

[0089] (3) The second image embedding data, the second text embedding data and the third text embedding data are used as samples to train the Transformer decoder. The two different encoding methods and the trained Transformer decoder are combined as an optimized text embedding generation module.

[0090] In practice, step (3) may include the following steps:

[0091] (3.1) Randomly select the diffusion time step as the embedded data representing the diffusion time step;

[0092] (3.2) The second image embedding data, the second text embedding data, the third text embedding data, the embedding data representing the diffusion time step, and the embedding data representing the Gaussian distribution index are concatenated, and the concatenated data is used as a sample;

[0093] (3.3) Encode the image data The Transformer decoder is calculated using KL divergence as the true value distribution. Figure 5 Transformer Decoder Output Distribution The difference between the true and false distributions is used as the loss function to train the Transformer decoder. The Clip model, T5 model and trained Transformer decoder are combined as an optimized text embedding generation module.

[0094] (4) Expand the latent space feature decoder of the stable diffusion model according to the number of channels of the required material map, and use the output of the first image dataset after optimizing the U-NET model as a sample to train the latent space feature decoder. Use the trained latent space feature decoder as the optimized latent space feature decoder.

[0095] In specific implementation, such as Figure 6 As shown, step (4) may include the following steps:

[0096] (4.1) Expand the latent space feature decoder of the stable diffusion model to the required number of channels of the material map by copying the channels; for example, when the latent space feature decoder is the decoder of AutoEncoder, the decoder of AutoEncoder will produce a single image result by default. Since the material map is expressed using 8 channels, the structure of the decoder of AutoEncoder needs to be modified from 3 channels to 8 channels. Figure 6In this code, the encoder portion ε of the AutoEncoder remains unchanged, while the decoder is modified to represent an 8-channel decoder.

[0097] (4.2) The output of the latent space feature encoder of the first image dataset after passing through the stable diffusion model is used as the sample, and the latent space feature decoder is trained according to the following loss function:

[0098]

[0099] In the formula, loss represents the total loss, loss1 represents the L1 norm, and loss... pecp This represents the perceptual loss based on VGG feature structure extraction. render This represents the loss function based on differentiable rendering, where Ι represents the input texture label. This represents the decoder output, where x represents the input truth graph. This represents the rendering result of the center point light source obtained based on differentiable rendering;

[0100] (4.3) Use the trained latent space feature decoder as the optimized latent space feature decoder

[0101] During training, the Cook-Torrance lighting model was used to render material maps. The formula is defined as follows: i represents the incident direction of the light, o represents the outgoing direction of the light, n represents the macroscopic normal direction, h = (i + o) / ||i + o|| represents the half-range vector, D is the normal distribution function, F is the Fresnel reflection function, and G is the shadow occlusion function (geometric factor).

[0102]

[0103] The BRDF (Bidirectional Reflectance Distribution Function) is a function used to describe the behavior of light as it is scattered and reflected at the surface of an object. The BRDF model defines the reflectance of light rays incident on the surface of an object from one direction and received by an observer from another direction.

[0104] (5) Optimize the text embedding generation module (Transformer Decoder), optimize the U-NET model, and optimize the latent space feature decoder. By replacing the corresponding modules in the stable diffusion model, the optimized material texture generation model is obtained, as detailed below. Figure 7 As shown.

[0105] (6) Input the material text to be generated into the optimized material texture generation model to obtain the material texture.

[0106] Finally, the required material textures can be generated.

[0107] Example 2

[0108] This invention also provides an optimization system for text generation texture mapping based on a diffusion model, comprising:

[0109] The U-NET model optimization module is used to acquire the first image dataset without material text annotation, encode each image in the first image dataset to generate the first image embedding data, and use it together with the corresponding image as samples to input into the stable diffusion model for training. The U-NET model of the trained stable diffusion model is used as the optimized U-NET model.

[0110] The embedded data optimization module is used to obtain a second image dataset containing material text annotations, encode and add noise to each image in the second image dataset to generate second image embedded data, and encode the material text annotations of each image using two different encoding methods to generate second text embedded data and third text embedded data.

[0111] The text embedding generation module optimization module is used to train the Transformer decoder by using the second image embedding data, the second text embedding data and the third text embedding data as samples, and to combine the two different encoding methods and the trained Transformer decoder as the optimized text embedding generation module.

[0112] The latent space feature decoder optimization module is used to expand the latent space feature decoder of the stable diffusion model according to the required number of channels of the material texture, and use the output of the first image dataset after the U-NET model optimization as a sample to train the latent space feature decoder, and use the trained latent space feature decoder as the optimized latent space feature decoder.

[0113] The material texture generation model building module is used to replace the corresponding modules in the stable diffusion model with the optimized text embedding generation module, the optimized U-NET model, and the optimized latent space feature decoder, respectively, to obtain the optimized material texture generation model.

[0114] The material texture generation module is used to input the material text to be generated into the optimized material texture generation model to obtain the material texture.

[0115] Furthermore, the U-NET model optimization module specifically includes:

[0116] The first data acquisition unit acquires a first image dataset without material text annotations. The first image dataset includes several rendered images of the same size, and the rendered images do not have material text annotations.

[0117] The noisy coding unit uses the latent space feature encoder of the stable diffusion model to encode each image in the first image dataset, and then randomly adds noise to obtain the noisy coding features.

[0118] The first encoding unit encodes each image in the first image dataset using a pre-trained Clip model, and then projects the encoded data into eight vectors to form the first image embedding data.

[0119] The first training unit is used to input the first image embedding data and the corresponding noisy coding features as samples into the U-NET model of the stable diffusion model for training, and to use the trained U-NET model of the stable diffusion model as the optimized U-NET model.

[0120] Furthermore, the embedded data optimization module specifically includes:

[0121] The second data acquisition unit is used to acquire a second image dataset containing material text annotations, wherein the second image dataset includes several rendering images of the same size, and each rendering image is set with material text annotations for describing material features;

[0122] The second encoding unit is used to encode each image in the second image dataset using a pre-trained Clip model to obtain image encoded data;

[0123] The noise-adding unit is used to calculate the index of the Gaussian distribution with the highest cosine similarity to the image encoding data in a preset set of Gaussian distributions, and use the Gaussian distribution represented by the index to add noise to the image encoding data T times to obtain the second image embedding data.

[0124] The third encoding unit is used to encode the material text annotations of each image in the second image dataset using pre-trained Clip and T5 models respectively, to obtain the second text embedding data and the third text embedding data.

[0125] Furthermore, the latent space feature decoder optimization module specifically includes:

[0126] The step size selection unit is used to randomly select the diffusion time step as the embedded data representing the diffusion time step.

[0127] An embedded data generation unit is used to calculate the index of the Gaussian distribution with the highest cosine similarity to the image encoded data in a preset set of Gaussian distributions, and use it as embedded data representing the Gaussian distribution index.

[0128] The data splicing unit is used to splice the second image embedded data, the second text embedded data, the third text embedded data, the embedded data representing the diffusion time step, and the embedded data representing the Gaussian distribution index. The spliced ​​data is used as a sample.

[0129] The second training unit is used to train the Transformer decoder by taking the image encoded data as the ground truth distribution and using the difference between the output distribution of the Transformer decoder calculated by KL divergence and the ground truth distribution as the loss function. The two different encoding methods and the trained Transformer decoder are combined as an optimized text embedding generation module.

[0130] Furthermore, the latent space feature decoder optimization module specifically includes:

[0131] The channel expansion unit is used to expand the latent space feature decoder of the stable diffusion model to the required number of channels of the material map by copying channels;

[0132] The third training unit is used to train the latent space feature decoder by taking the output of the latent space feature encoder of the first image dataset after passing through the stable diffusion model as samples, and using the following loss function as the training latent space feature decoder. The trained latent space feature decoder is then used as the optimized latent space feature decoder.

[0133]

[0134] In the formula, loss represents the total loss, loss1 represents the L1 norm, and loss... pecp This represents the perceptual loss based on VGG feature structure extraction. render This represents the loss function based on differentiable rendering, where Ι represents the input texture label. This represents the decoder output, where x represents the input truth graph. This represents the rendering result of the center point light source obtained based on differentiable rendering.

[0135] The apparatus provided in this embodiment of the invention can be used to execute the method provided in Embodiment 1 of the invention, and has the corresponding functions and beneficial effects of executing the method.

[0136] It is worth noting that in the embodiments of the above-mentioned determining device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.

[0137] The embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art will clearly understand that each implementation can be achieved using software plus necessary general-purpose hardware platforms, or it can be implemented solely through hardware, as long as the function or purpose can be achieved.

[0138] The present invention will now be simulated. Figure 8 The diagram shows some of the results of this invention. The results are arranged horizontally according to the input image, rendering result, Diffuse, Normal, Roughness, and Specular. Figure 9 The diagram below illustrates a comparison between the results of this invention and Text2Mat (Reference: He Z, Guo J, Zhang Y, et al. Text2Mat: Generating Materials from Text[J]. 2023.). In the example of black and blue checkboard tiled tiles, Text2Mat failed to reconstruct the blue color required in the text description; in the example of dirty ground, Text2Mat failed to generate a dirty description, causing the text to appear in the image. This invention, however, exhibits good generalization, without generating the above errors, and performs well on other text description materials as well.

[0139] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0140] In this document, the term "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. An optimization method for text generation material mapping based on a diffusion model, characterized in that, Includes the following steps: (1) Obtain the first image dataset without material text annotation, encode each image in the first image dataset, generate the first image embedding data, and use it together with the corresponding image as a sample to input into the stable diffusion model for training. Use the U-NET model of the trained stable diffusion model as the optimized U-NET model. (2) Obtain the second image dataset containing material text annotations, encode and add noise to each image in the second image dataset to generate second image embedding data, and encode the material text annotations of each image using two different encoding methods to generate second text embedding data and third text embedding data; (3) Use the second image embedding data, the second text embedding data and the third text embedding data as samples to train the Transformer decoder, and combine the two different encoding methods and the trained Transformer decoder as an optimized text embedding generation module. (4) Expand the latent space feature decoder of the stable diffusion model according to the number of channels of the required material texture, and use the output of the first image dataset after optimization of the U-NET model as a sample to train the latent space feature decoder, and use the trained latent space feature decoder as the optimized latent space feature decoder. (5) Replace the corresponding modules in the stable diffusion model with the optimized text embedding generation module, the optimized U-NET model, and the optimized latent space feature decoder to obtain the optimized material texture generation model; (6) Input the material text to be generated into the optimized material texture generation model to obtain the material texture.

2. The optimization method for text generation material mapping based on the diffusion model according to claim 1, characterized in that, Step (1) specifically includes the following steps: (1.1) Obtain a first image dataset without material text annotations. The first image dataset includes several rendered images of the same size, and the rendered images do not have material text annotations set. (1.2) The latent space feature encoder of the stable diffusion model is used to encode each image in the first image dataset, and then the noisy encoded features are obtained by random noise addition; (1.3) For each image in the first image dataset, the pre-trained Clip model is used for encoding, and then the encoded data is projected into eight vectors to form the first image embedding data; (1.4) The first image embedding data and the corresponding noise-enhancing coding features are used as samples and input into the U-NET model of the stable diffusion model for training. The trained U-NET model of the stable diffusion model is used as the optimized U-NET model.

3. The optimization method for text generation material mapping based on the diffusion model according to claim 1, characterized in that, Step (2) specifically includes the following steps: (2.1) Obtain a second image dataset containing material text annotations, wherein the second image dataset includes several rendered images of the same size, and each rendered image is set with material text annotations for describing material features; (2.2) Encode each image in the second image dataset using a pre-trained Clip model to obtain image encoded data; (2.3) In the preset set of Gaussian distributions, calculate the index of the Gaussian distribution with the highest cosine similarity to the image encoded data, and use the Gaussian distribution represented by the index to add noise to the image encoded data T times to obtain the second image embedding data; (2.4) The material text annotations of each image in the second image dataset are encoded using the pre-trained Clip model and T5 model respectively to obtain the second text embedding data and the third text embedding data.

4. The optimization method for text generation material mapping based on the diffusion model according to claim 3, characterized in that, Step (3) specifically includes the following steps: (3.1) Randomly select the diffusion time step as the embedded data representing the diffusion time step; (3.2) In the preset set of Gaussian distributions, calculate the index of the Gaussian distribution with the highest cosine similarity to the image encoded data, and use it as the embedded data representing the Gaussian distribution index; (3.3) The second image embedding data, the second text embedding data, the third text embedding data, the embedding data representing the diffusion time step, and the embedding data representing the Gaussian distribution index are concatenated, and the concatenated data is used as a sample; (3.4) The image encoded data is used as the ground truth distribution. The difference between the output distribution of the Transformer decoder calculated by KL divergence and the ground truth distribution is used as the loss function to train the Transformer decoder. The two different encoding methods and the trained Transformer decoder are combined as an optimized text embedding generation module.

5. The optimization method for text generation material mapping based on the diffusion model according to claim 1, characterized in that, Step (4) specifically includes the following steps: (4.1) Expand the latent space feature decoder of the stable diffusion model to the required number of channels of the material map by copying channels; (4.2) The output of the latent space feature encoder of the first image dataset after passing through the stable diffusion model is used as the sample, and the latent space feature decoder is trained according to the following loss function: In the formula, loss represents the total loss, loss1 represents the L1 norm, and loss... pecp This represents the perceptual loss based on VGG feature structure extraction. render This represents the loss function based on differentiable rendering, where Ι represents the input texture label. This represents the decoder output, where x represents the input truth graph. This represents the rendering result of the center point light source obtained based on differentiable rendering; (4.3) Use the trained latent space feature decoder as the optimized latent space feature decoder.

6. An optimization system for text generation texture mapping based on a diffusion model, characterized in that, include: The U-NET model optimization module is used to acquire the first image dataset without material text annotation, encode each image in the first image dataset to generate the first image embedding data, and use it together with the corresponding image as samples to input into the stable diffusion model for training. The U-NET model of the trained stable diffusion model is used as the optimized U-NET model. The embedded data optimization module is used to obtain a second image dataset containing material text annotations, encode and add noise to each image in the second image dataset to generate second image embedded data, and encode the material text annotations of each image using two different encoding methods to generate second text embedded data and third text embedded data. The text embedding generation module optimization module is used to train the Transformer decoder by using the second image embedding data, the second text embedding data and the third text embedding data as samples, and to combine the two different encoding methods and the trained Transformer decoder as the optimized text embedding generation module. The latent space feature decoder optimization module is used to expand the latent space feature decoder of the stable diffusion model according to the required number of channels of the material texture, and use the output of the first image dataset after the U-NET model optimization as a sample to train the latent space feature decoder, and use the trained latent space feature decoder as the optimized latent space feature decoder. The material texture generation model building module is used to replace the corresponding modules in the stable diffusion model with the optimized text embedding generation module, the optimized U-NET model, and the optimized latent space feature decoder, respectively, to obtain the optimized material texture generation model. The material texture generation module is used to input the material text to be generated into the optimized material texture generation model to obtain the material texture.

7. The optimization system for text generation material mapping based on the diffusion model according to claim 6, characterized in that, The U-NET model optimization module specifically includes: The first data acquisition unit acquires a first image dataset without material text annotations. The first image dataset includes several rendered images of the same size, and the rendered images do not have material text annotations. The noisy coding unit uses the latent space feature encoder of the stable diffusion model to encode each image in the first image dataset, and then randomly adds noise to obtain the noisy coding features. The first encoding unit encodes each image in the first image dataset using a pre-trained Clip model, and then projects the encoded data into eight vectors to form the first image embedding data. The first training unit is used to input the first image embedding data and the corresponding noisy coding features as samples into the U-NET model of the stable diffusion model for training, and to use the trained U-NET model of the stable diffusion model as the optimized U-NET model.

8. The optimization system for text generation material mapping based on the diffusion model according to claim 6, characterized in that, The embedded data optimization module specifically includes: The second data acquisition unit is used to acquire a second image dataset containing material text annotations, wherein the second image dataset includes several rendering images of the same size, and each rendering image is set with material text annotations for describing material features; The second encoding unit is used to encode each image in the second image dataset using a pre-trained Clip model to obtain image encoded data; The noise-adding unit is used to calculate the index of the Gaussian distribution with the highest cosine similarity to the image encoding data in a preset set of Gaussian distributions, and use the Gaussian distribution represented by the index to add noise to the image encoding data T times to obtain the second image embedding data. The third encoding unit is used to encode the material text annotations of each image in the second image dataset using pre-trained Clip and T5 models respectively, to obtain the second text embedding data and the third text embedding data.

9. The optimized system for text generation material mapping based on a diffusion model according to claim 8, characterized in that, The latent space feature decoder optimization module specifically includes: The step size selection unit is used to randomly select the diffusion time step as the embedded data representing the diffusion time step. An embedded data generation unit is used to calculate the index of the Gaussian distribution with the highest cosine similarity to the image encoded data in a preset set of Gaussian distributions, and use it as embedded data representing the Gaussian distribution index. The data splicing unit is used to splice the second image embedded data, the second text embedded data, the third text embedded data, the embedded data representing the diffusion time step, and the embedded data representing the Gaussian distribution index. The spliced ​​data is used as a sample. The second training unit is used to train the Transformer decoder by taking the image encoded data as the ground truth distribution and using the difference between the output distribution of the Transformer decoder calculated by KL divergence and the ground truth distribution as the loss function. The two different encoding methods and the trained Transformer decoder are combined as an optimized text embedding generation module.

10. The optimization system for text generation material mapping based on the diffusion model according to claim 6, characterized in that, The latent space feature decoder optimization module specifically includes: The channel expansion unit is used to expand the latent space feature decoder of the stable diffusion model to the required number of channels of the material map by copying channels; The third training unit is used to train the latent space feature decoder by taking the output of the latent space feature encoder of the first image dataset after passing through the stable diffusion model as samples, and using the following loss function as the training latent space feature decoder. The trained latent space feature decoder is then used as the optimized latent space feature decoder. In the formula, loss represents the total loss, loss1 represents the L1 norm, and loss... pecp This represents the perceptual loss based on VGG feature structure extraction. render This represents the loss function based on differentiable rendering, where Ι represents the input texture label. This represents the decoder output, where x represents the input truth graph. This represents the rendering result of the center point light source obtained based on differentiable rendering.

Citation Information

Patent Citations

  • Flexible and diversified face image aging generation system

    CN116342379A

  • Method and device for generating model material

    CN117523102A