Material map generation method and device
By introducing an independent attention module into the diffusion model and decoupling the control conditions, the efficiency and quality of material map generation in three-dimensional modeling are improved, and the problems of low efficiency and poor quality of material map reconstruction in the existing technology are solved. It is suitable for Large-scale commodity material reconstruction.
Patent Information
- Application Number
- CN202410671370.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-05-28
Smart Images

Figure CN118247411B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of three-dimensional modeling technology, and more particularly, to a material map generation method and device. Background Art
[0002] Three-dimensional reconstruction (3D reconstruction) is a technology that restores real-world objects in computers. It is currently widely used in movies, game scenes, product displays, and digital human scenes. Currently, 3D modeling mainly uses a texture-based modeling method, in which material mapping is the key factor for the model to appear realistic and exquisite, so the reconstruction effect of material mapping is crucial.
[0003] In the related art, material mapping reconstruction usually requires expensive equipment and complex technical personnel to operate, and is inefficient when dealing with large-scale commodity material reconstruction tasks. Summary of the invention
[0004] To improve the efficiency and quality of three-dimensional texture mapping, one or more embodiments of the present specification provide a material mapping generation method and device, a three-dimensional model reconstruction method and device, an electronic device, a storage medium, and a computer program product.
[0005] In a first aspect, one or more embodiments of this specification provide a method for generating a material map, including:
[0006] Extracting edge features from an initial material map of a target object to obtain an edge feature map, wherein the edge feature map is used to characterize an image range of the material map;
[0007] Performing noise processing on the plane image of the target object to obtain a noise image;
[0008] Inputting the noise image and the edge feature map into a pre-trained diffusion model to obtain a target material map corresponding to the target object output by the diffusion model;
[0009] Among them, the diffusion model is used to extract the first attention weight corresponding to the edge feature map and the second attention weight corresponding to the noise image, and denoise the noise image based on the first attention weight and the second attention weight to obtain the target material map, the first attention weight is used to constrain the image range of the material map, and the second attention weight is used to constrain the difference between the material map and the plane image.
[0010] In one or more embodiments of the present specification, the step of extracting edge features from an initial material map of a target object to obtain an edge feature map includes:
[0011] Acquire a rough geometric model of the target object;
[0012] Performing texture separation on the coarse geometric model to obtain the initial material texture of the surface of the coarse geometric model;
[0013] Edge feature extraction is performed on the initial material map to obtain the edge feature map.
[0014] In one or more embodiments of the present specification, the step of performing noise processing on the planar image of the target object to obtain a noise image includes:
[0015] Acquire a captured image of the target object;
[0016] Performing image segmentation on the captured image to obtain a planar image including the target object;
[0017] Performing feature extraction on the plane image to obtain a feature map corresponding to the plane image;
[0018] The feature map is subjected to noise processing based on a randomly sampled Gaussian noise map to obtain the noise image.
[0019] In one or more embodiments of the present specification, the diffusion model includes a plurality of intermediate layers, each of which is connected to a first attention module and a second attention module; the diffusion model is used to:
[0020] For each first attention module, determining the first attention weight based on the output of the previous intermediate layer and the edge feature map;
[0021] For each second attention module, the second attention weight is determined based on the output of the previous intermediate layer and the noise image.
[0022] In one or more embodiments of the present specification, using the diffusion model to denoise the noise image based on the first attention weight and the second attention weight to obtain the target material map includes:
[0023] The diffusion model is used to denoise the noisy image time step by time according to the first attention weight and the second attention weight, and for each time step, the denoising result corresponding to the current time step is calculated based on the denoising result of the previous time step and the plane image until the convergence condition is met to obtain the target material map.
[0024] In a second aspect, one or more embodiments of this specification provide a three-dimensional model reconstruction method, including:
[0025] A pre-generated rough geometric model of a target object is rendered using a target material map to obtain a three-dimensional model of the target object, wherein the target material map is obtained by the method described in any embodiment of the first aspect.
[0026] In a third aspect, one or more embodiments of this specification provide a material map generation device, including:
[0027] An edge extraction module is configured to extract edge features from an initial material map of a target object to obtain an edge feature map, wherein the edge feature map is used to characterize an image range of the material map;
[0028] A noise adding module is configured to perform noise adding processing on the planar image of the target object to obtain a noise image;
[0029] A diffusion model module is configured to input the noise image and the edge feature map into a pre-trained diffusion model to obtain a target material map corresponding to the target object output by the diffusion model;
[0030] Among them, the diffusion model is used to extract the first attention weight corresponding to the edge feature map and the second attention weight corresponding to the noise image, and denoise the noise image based on the first attention weight and the second attention weight to obtain the target material map, the first attention weight is used to constrain the image range of the material map, and the second attention weight is used to constrain the difference between the material map and the plane image.
[0031] In one or more implementations of this specification, the edge extraction module is configured as follows:
[0032] Acquire a rough geometric model of the target object;
[0033] Performing texture separation on the coarse geometric model to obtain the initial material texture of the surface of the coarse geometric model;
[0034] Edge feature extraction is performed on the initial material map to obtain the edge feature map.
[0035] In one or more embodiments of this specification, the noise adding module is configured as follows:
[0036] Acquire a captured image of the target object;
[0037] Performing image segmentation on the captured image to obtain a planar image including the target object;
[0038] Performing feature extraction on the plane image to obtain a feature map corresponding to the plane image;
[0039] The feature map is subjected to noise processing based on a randomly sampled Gaussian noise map to obtain the noise image.
[0040] In one or more embodiments of the present specification, the diffusion model includes a plurality of intermediate layers, each intermediate layer is connected to a first attention module and a second attention module; the diffusion model module is configured as follows:
[0041] For each first attention module, determining the first attention weight based on the output of the previous intermediate layer and the edge feature map;
[0042] For each second attention module, the second attention weight is determined based on the output of the previous intermediate layer and the noise image.
[0043] In one or more embodiments of this specification, the diffusion model module is configured as follows:
[0044] The noisy image is denoised time step by time step according to the first attention weight and the second attention weight, and for each time step, the denoising result corresponding to the current time step is calculated based on the denoising result of the previous time step and the plane image until the convergence condition is met to obtain the target material map.
[0045] In a fourth aspect, one or more embodiments of this specification provide a three-dimensional model reconstruction device, including:
[0046] The three-dimensional rendering module is configured to render a pre-generated rough geometric model of a target object using a target material map to obtain a three-dimensional model of the target object, wherein the target material map is obtained by the method of any implementation method of the first aspect.
[0047] In a fifth aspect, one or more embodiments of this specification provide an electronic device, including:
[0048] Processor; and
[0049] A memory stores computer instructions, wherein the computer instructions are used to enable a processor to execute the method described in any of the above embodiments.
[0050] In a sixth aspect, one or more embodiments of this specification propose a storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in any of the aforementioned embodiments.
[0051] In a seventh aspect, one or more embodiments of this specification propose a computer program product, which implements the method described in any of the aforementioned embodiments when running.
[0052] The material map generation method of one or more embodiments of the present specification includes extracting edge features from an initial material map to obtain an edge feature map, performing noise processing on a plane image and inputting the noise image and the edge feature map into a diffusion model, using the diffusion model to determine a first attention weight based on the edge feature map, determining a second attention weight based on the noise image, and denoising the noise image according to the first attention weight and the second attention weight to obtain a target material map. In the embodiments of the present specification, by constructing an independent two-part attention module, a variety of control conditions can be decoupled, so that when the diffusion model is trained, the two parts of the attention weights will not interfere with each other, and the diffusion model can have a good learning effect for both material consistency and map range accuracy, so that the generated material map has a high quality in terms of consistency and map accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 It is a schematic diagram of the architecture of the generative model in the related technology.
[0054] Figure 2 It is a schematic diagram of the architecture of the generative model in the related technology.
[0055] Figure 3 It is a schematic diagram of a material map generation method in some implementation modes of this specification.
[0056] Figure 4 It is a flowchart of a material map generation method according to some implementation methods of this specification.
[0057] Figure 5 It is a flowchart of a material map generation method according to some implementation methods of this specification.
[0058] Figure 6 It is a flowchart of a material map generation method according to some implementation methods of this specification.
[0059] Figure 7 It is a structural block diagram of a material map generating device in some implementation modes of this specification.
[0060] Figure 8 It is a structural block diagram of an electronic device in some implementation modes of this specification. DETAILED DESCRIPTION
[0061] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0062] It should be noted that: in other implementations, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other implementations, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other implementations; and multiple steps described in this specification may be combined into a single step for description in other implementations.
[0063] In addition, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0064] Three-dimensional reconstruction (3D reconstruction) is a technology that restores real-world objects in computers. 3D reconstruction is an important technology for realizing 3D games, virtual reality (VR), and augmented reality (AR). It is currently widely used in movies, game scenes, product displays, and digital human scenes.
[0065] At present, 3D modeling mainly adopts the modeling method based on texture, that is, the geometric model is separated from the material texture, and the geometric model and the material texture are reconstructed separately, and then the geometric model is rendered according to the material texture to obtain the 3D model. Among them, the material texture is the key factor for the 3D model to show realism and exquisiteness, so the reconstruction effect of the material texture is crucial.
[0066] In the early days, the material reconstruction methods for 3D model surfaces mainly included: 1) acquisition through professional material acquisition equipment. This method requires expensive professional equipment and is only suitable for laboratory scenarios such as scientific research. It is not applicable enough and is difficult to promote; 2) manual production. This method requires professionals with rich experience, has a long production cycle and low efficiency.
[0067] With the development of machine learning technology, AI generated content (AIGC) technology has become a hot topic. Using generative models to reconstruct texture maps has become a major research direction. The captured two-dimensional image can be used as the model input, and the model presets the three-dimensional texture map of the object. This method is efficient and low-cost, and is very suitable for large-scale commodity material reconstruction tasks. However, the current image generation model has a good effect in two-dimensional image tasks, but for three-dimensional material reconstruction tasks, the quality of the generated texture map is very low, the three-dimensional modeling effect is very poor, and it is difficult to implement.
[0068] Based on the above, the embodiments of this specification provide a material map generation method and device, a three-dimensional model reconstruction method and device, an electronic device, a storage medium, and a computer program product, which aim to use a diffusion model to generate material maps, add a decoupled attention module to the diffusion model, improve the consistency between the material map and the real object, and at the same time will not affect the original control conditions of the model, thereby improving the generation quality of the material map.
[0069] The Stable Diffusion Model (Diffusion Model for short) is a generative model that can be used to generate images, data, and text. The core idea of the diffusion model is to define a Markov chain of diffusion steps, gradually add random noise to the image, and then learn the reverse denoising process to generate the desired generated image from the noise. The diffusion model consists of two stages, namely forward diffusion (Diffusion Process) and reverse denoising (Denoise Process).
[0070] The most common diffusion models include DDPM (Denoising Diffusion Probalistic Models). The core architecture of DDPM is the denoising model UNet, which is used to predict noise and achieve reverse denoising. UNet is an end-to-end convolutional neural network, which mainly includes an encoder and a decoder. The encoder uses a convolutional layer to extract features and gradually compress the image size, while the decoder gradually restores the image size through upsampling. Since the compression and amplification process presents a U-shaped structure, it is called UNet.
[0071] The UNet network architecture also includes an attention layer. Generally, each convolutional layer is connected to an attention layer. The attention layer is a network layer based on the attention mechanism. The attention mechanism is a mechanism that can align the internal experience of the model with external features, thereby increasing the observation precision of some areas. The attention mechanism can quickly extract important features of sparse data, thereby effectively using limited resources to quickly filter out high-value information from a large amount of information and improve the model effect.
[0072] Taking the scene of text and image as an example, users can input text information and use the text information to describe the content of the image they want to generate, so that the model can generate the corresponding image based on the text information. Figure 1 The generative model architecture shown illustrates this process.
[0073] See also Figure 1 As shown in the figure, the network architecture of the generative model is DDPM UNet, which includes several layers of convolutional layers (Conv) and attention layers corresponding to each convolutional layer. In the text image scene, the user can input text information, so that the model encodes the text information to obtain text features. Then, the random noise image and text features are input into the UNet network, the attention weight of each layer is calculated based on the text features, and then the feature map extracted by the convolution layer is denoised layer by layer based on the attention weight. After several rounds of denoising, the original random noise image is generated as the target image desired by the user, and the target image is output through the output layer.
[0074] In the above-mentioned scene of Wensheng, the generated image is mainly a two-dimensional plane image, which generally includes only one layer. For the three-dimensional modeling scene, since the material map needs to meet the three-dimensional model rendering of most general scenes, the material map needs to include at least three material layers, namely diffuse map, roughness map and metal map. Among them, the diffuse map represents the color and basic texture of the object itself; the roughness map represents the glossiness of the object, such as the smoothness or roughness of the object surface; the metal map represents the intensity of the light reflected by the object under the light, which can reflect the highlight effect of the object.
[0075] Figure 2 The principle of the material map generation method based on the generative model in the related art is shown, see Figure 2As shown in the figure, the core network architecture of the generation model is the same as the above, which is DDPM UNet. In the material map generation scenario, the input of the model is a two-dimensional image of the target object. The random noise map and the two-dimensional image are input into the UNet network. The contour features of the target object are obtained by extracting the edge features of the two-dimensional image, and the attention weight of each layer is calculated based on the contour features. The image range of the generated image is constrained within the map range by using the attention weight. The random noise map is denoised layer by layer based on the attention weight. After several rounds of denoising, the corresponding material map can be obtained, and the material map is output through the output layer.
[0076] exist Figure 2 In the material map generation scheme shown, due to the complexity of lighting and texture of the material map, the quality of the material map generated based on the generative model is very poor, and the consistency between the map area generated by the model and the surface material of the real object is not high, resulting in the rendered three-dimensional model not being realistic enough.
[0077] For example, in the e-commerce scenario, merchants have the need to perform 3D modeling of products and display them to users, so the e-commerce platform can provide merchants with the function of 3D modeling of products. However, some products may only have 2D images from a certain perspective. For example, taking a cubic packaging box as an example, the product image used for 3D modeling may only contain the top and two side surfaces of the packaging box. Therefore, it is necessary to Figure 2 In this scenario, if the texture area generated based on the generated model is not consistent with the surface material of the real object, the materials of each surface in the rendered 3D model will be very different, resulting in poor quality of the 3D model.
[0078] Therefore, in order to improve the quality of the material maps generated by the generative model, Figure 3 The structure and principle diagram of the generation model in some embodiments of this specification are shown. Figure 3 In the example, the core of the generative model used to generate the material map is the diffusion model. The diffusion model can be, for example, DDPM, and the core structure used for denoising in the diffusion model is the UNet network.
[0079] In the implementation manner of this specification, in the process of generating a three-dimensional texture map, in order to improve the quality of the texture map, the control conditions mainly include the following two aspects:
[0080] 1) The image range of the generated material map is within the outline range of the 3D model map. This control condition constrains the generated material map to fit correctly on the surface of the 3D model without problems such as surface material penetration and mapping errors.
[0081] 2) The generated material map is highly consistent with the surface material of the real object. This control condition constrains the generated material map to be as similar as possible to the real object material to ensure the authenticity of the generated material. For example, the two-dimensional image of a real object has only the front side. This control condition constrains the back side material map generated by the diffusion model to be consistent with the front side, so that the rendered 3D model has higher quality.
[0082] exist Figure 2 Based on the relevant technical solutions, a relatively easy way to think of is to use the above two control conditions as the control targets of the attention layer to optimize the quality of the generated material map. However, it is found through practice that although the consistency control condition is newly introduced, the quality of the material map generated by the actual diffusion model has not improved. On the contrary, the fitting effect with the 3D model has become worse. Through further research, it is found that this is because the above two control conditions are coupled in the same attention module. There may be a conflict between the two control conditions, resulting in the diffusion model's learning effect for the two control conditions is not high, resulting in the generated material map The quality is not high in terms of both material consistency and accuracy of the mapping range.
[0083] Based on this finding, see Figure 3 As shown, in the implementation manner of the present specification, the attention module in the diffusion model UNet architecture is improved, and the attention modules of each layer are decoupled, that is, the attention modules of each layer include a first attention module Atten1 and a second attention module Atten2. The first attention module Atten1 and the second attention module Atten2 are used to realize the decoupling of the aforementioned two control conditions, so that the weights of the two parts of attention do not affect each other, and the diffusion model can have a good learning effect on both material consistency and mapping range accuracy, thereby improving the generation quality of material mapping.
[0084] exist Figure 3 Based on the example, the following combination Figure 4 The flowchart shown is used to illustrate the material map generation method according to the embodiment of this specification.
[0085] like Figure 4 As shown, in some embodiments, the material map generation method of the example of this specification includes:
[0086] S410, extracting edge features from the initial material map of the target object to obtain an edge feature map.
[0087] In the implementation manner of this specification, the target object refers to an object that needs to be reconstructed into a 3D model, which can be any object in the real world. For example, in some implementation manners, the material map generation method exemplified in this specification can be applied to a commodity model reconstruction scenario, so that the target object can be a commodity such as clothes, shoes, watches, accessories, etc., and this specification does not impose any restrictions.
[0088] It can be understood that one of the control conditions for the generation of the texture map is to constrain the image range of the texture map to be within the contour range of the 3D model map. Therefore, it is necessary to give the contour range of the 3D model surface as the input of the diffusion model. In the implementation of this specification, the initial texture map is a map representing the contour range of the surface expansion of the D3 model. Figure 5 This process is described.
[0089] like Figure 5 As shown, in some embodiments, the method for generating a material map in the example of this specification, the process of extracting edge features from the initial material map to obtain an edge feature map, includes:
[0090] S411. Obtain a rough geometric model of the target object.
[0091] S412, performing texture separation on the coarse geometric model to obtain an initial material texture of the surface of the coarse geometric model.
[0092] S413, extracting edge features from the initial material map to obtain an edge feature map.
[0093] In the implementation manner of this specification, the coarse geometric model refers to a mesh model obtained by three-dimensional modeling of a target object. In the field of computer graphics, a mesh model is usually used to represent the geometry of a three-dimensional object. The mesh model is composed of a large number of discrete vertices, edges connecting two vertices, and mesh surfaces composed of multiple edges.
[0094] For example, in some embodiments, the mesh patch may be a triangular patch, that is, a triangular face composed of three vertices is a mesh patch, so that the mesh model is composed of a continuous surface composed of a large number of triangular face patches. For example, in other embodiments, the mesh patch may be a quadrilateral, that is, a quadrilateral face composed of four vertices is a mesh patch, so that the mesh model is composed of a continuous surface composed of a large number of quadrilateral face patches.
[0095] In the implementation manner of this specification, the coarse geometric model of the target object can be pre-built. For example, taking the commodity modeling scenario as an example, coarse geometric models corresponding to multiple commodities can be pre-built, so that when a certain commodity needs to be 3D modeled, the pre-built coarse geometric model of the commodity can be directly called. The modeling process of the coarse geometric model can be understood and fully implemented by referring to the relevant technology, and this specification will not be repeated.
[0096] For example, Figure 3In the example, the target object is a T-shirt, and the coarse geometric model is the mesh model of the T-shirt, that is, the coarse geometric model has the same geometry as the target object, but does not have a real material map, and its surface is generally a solid color map, such as a pure black or pure white map. In some implementations of this specification, the solid color map on the surface of the coarse geometric model can be separated from the mesh model by performing surface map separation on the coarse geometric model, and the obtained solid color map is the initial material map in this specification.
[0097] It can be understood that the initial material map is separated from the surface of the coarse geometric model, so that the initial material map can accurately fit the coarse geometric model. In the implementation mode of this specification, when the diffusion model is used to generate the material map, the image range of the generated target material map must be as similar as possible to the image range of the initial material map, thereby improving the mapping accuracy of the material map.
[0098] In some embodiments, in combination Figure 3 For example, after obtaining the initial material map, edge feature extraction can be performed on the initial material map to obtain an edge feature map, which can reflect the contour range in the initial material map. There are many edge extraction algorithms, which are not limited in this specification. For example, in an example, the ControlNet model can be used to extract the edge feature map of the initial material map.
[0099] S420: Perform noise processing on the planar image of the target object to obtain a noise image.
[0100] In the embodiments of this specification, the planar image of the target object refers to a two-dimensional image containing the target object. In some embodiments, the planar image of the target object may include a photographed image of the target object under at least one viewing angle.
[0101] For example, in one example, a camera can be used to capture RGB images of a target object at different viewing angles, and these RGB images are used as the plane images in this specification. Of course, those skilled in the art can understand that the plane image can also be other image types, such as HSV images, HSL images, grayscale images, etc. The image type is related to the corresponding color space, and this specification does not limit this.
[0102] In some implementations, it is considered that the captured image captured by the camera includes not only the target object in the foreground, but also the background. Therefore, in order to reduce the interference of background noise, after the captured image is acquired, the captured image can be segmented, so that only the foreground image including the target object is retained as the image to be processed, and the interference of background noise is removed. Figure 6 The implementation method is described.
[0103] like Figure 6As shown, in some embodiments, the material map generation method of the example of this specification, the process of performing noise processing on the plane image of the target object to obtain a noise image, includes:
[0104] S421: Acquire a captured image of the target object.
[0105] S422: Perform image segmentation on the captured image to obtain a planar image including the target object.
[0106] S423: Extract features from the plane image to obtain a feature map corresponding to the plane image.
[0107] S424, performing noise processing on the feature map based on the randomly sampled Gaussian noise map to obtain a noise image.
[0108] In the implementation manner of this specification, the image acquisition device may be, for example, a camera, which may be used to acquire images of the target object at one or more different viewing angles. The captured images may be, for example, RGB images, HSV images, HSL images, grayscale images, etc., and this specification does not impose any limitation on this.
[0109] For example, in some implementations, an image segmentation model may be used to segment the captured image to obtain a planar image of the target object. The image segmentation model may be an image segmentation model such as SAM (Segment Anything Model), and this specification does not limit this.
[0110] It can be seen from the above that in the implementation of this specification, by performing image segmentation on the captured image to obtain a planar image of the target object, the interference of background noise can be reduced, providing a data basis for subsequent high-quality material map generation.
[0111] Combination Figure 3 As shown, after obtaining the planar image, the planar image can be encoded using an image encoder. The image encoding process is the image feature extraction process, thereby obtaining a feature map. In some embodiments, the image encoder can use any neural network model suitable for implementation. For example, in one example, the image encoder is a CLIP (Contrastive Language-Image Pre-Training) model. The CLIP model is a multimodal pre-trained neural network model. Of course, those skilled in the art can also use other models, and this specification does not limit this.
[0112] Combined with the above, it can be known that the core of the diffusion model is to add random noise to the image, and then gradually denoise the noisy image to obtain the generated image. In the implementation mode of this specification, after extracting features from the plane image to obtain a feature map, the feature map can be denoised based on the randomly sampled Gaussian noise map to obtain a noisy image after denoising. It can be understood that in the process of denoising, Gaussian noise can be gradually added to the plane image at a fixed time step to obtain a noisy image, or the plane image can be directly denoised based on the reparameterization technique to obtain a noisy image. This can be understood and fully realized by referring to the relevant technologies of the diffusion model, and the implementation mode of this specification will not be repeated in detail.
[0113] S430: Input the noise image and the edge feature map into a pre-trained diffusion model to obtain a target material map corresponding to the target object output by the diffusion model.
[0114] Combination Figure 3 As shown, the edge feature map and the noise image are input into the UNet network of the diffusion model. In this example, the UNet network includes several intermediate layers, the intermediate layers are convolutional layers (Conv), and each intermediate layer is respectively connected to a first attention module Atten1 and a second attention module Atten2 that are independent of each other.
[0115] In the implementation manner of this specification, for each layer of the network, the first attention module Atten1 determines the first attention weight based on the output of the previous layer and the edge feature map, and the second attention module Atten2 determines the second attention weight based on the output of the previous layer and the noise image. Therefore, the output of each intermediate layer is the result of denoising the noisy image based on the first attention weight and the second attention weight.
[0116] In some embodiments, the expression of the attention function exemplified in this specification is as follows:
[0117] (1)
[0118] In formula (1), is the output of the network layer, represents the attention function of the first attention module, Represents the attention function of the second attention module.
[0119] Based on the relevant knowledge of the attention mechanism, it can be understood that the essence of the attention function can be described as a mapping from a query matrix Q (Query) to a series of matrix key-value pairs (KV, Key-Value), where d is the dimension of K. There are three main steps in calculating the attention weight: the first step is to calculate the similarity between Q and each K to obtain the weight, and the commonly used similarity functions are such as dot product, concatenation, perceptron, etc.; the second step is generally to use a Softmax function to normalize these weights; the third step is to perform weighted summation of the weight and the corresponding V to obtain the final attention weight. Those skilled in the art can undoubtedly understand and fully implement it by referring to the relevant technology, and this specification will not go into details.
[0120] In the above formula (1), the attention function It is used to constrain the image range accuracy of the texture map, that is, to make the generated texture map as consistent as possible with the image range of the initial texture map, so that the generated texture map can fit the rough geometric model correctly. It is used to constrain the image features of the material map to be as consistent as possible with the plane image, that is, to make the generated map part the same as or close to the original image, so that the generated material map has better image quality.
[0121] Combined with the aforementioned diffusion model principle, we can know that the core of the diffusion model is to add random noise to the image, and then gradually denoise the noisy image to obtain the generated image. Therefore, in the denoising process, the UNet network gradually denoises the noisy image according to the first attention weight and the second attention weight based on the aforementioned attention function until the convergence condition is met, and the target material map corresponding to the target object can be obtained.
[0122] For the diffusion model, the reverse denoising process is to gradually denoise the noise image according to the time step. After multiple rounds of denoising, the original noise image is gradually generated into an output image, which is also the target material map in this manual. For the reverse denoising (Denoise Process) of the diffusion model, you can refer to the relevant technology to understand and fully implement it, and this manual will not repeat it.
[0123] From the above, it can be seen that in the implementation mode of this specification, by constructing an independent two-part attention module, the control conditions of the above two aspects can be decoupled, so that when the diffusion model is trained, the two parts of the attention weights will not interfere with each other, and the diffusion model can have a good learning effect on both material consistency and mapping range accuracy, so that the generated material map has high quality in terms of consistency and mapping accuracy.
[0124] In some implementations, considering that in some scenarios, the material map generated by the diffusion model may have abnormal results such as map errors, for example Figure 3 Example of clothes, in the use of Figure 3 When the method generates material maps, pockets may be incorrectly generated on the back, or unusual results may appear in the position of the arms, etc.
[0125] Therefore, in order to further optimize the accuracy and aesthetics of the material map, the implementation method of this specification can further optimize the denoising process of the diffusion model. Specifically, the original plane image can be introduced in the denoising process at each time step, so that the original plane image can be used as a priori. During the denoising process, image content is generated based on the priori knowledge for places where abnormalities are likely to occur, thereby improving the quality of the generated target material map.
[0126] For example, in an example, the denoising formula of the diffusion model is expressed as:
[0127]
[0128] (2)
[0129] In formula (2), T represents the total time step. represents the image generated at each time step, where represents the original plane image, represents a noise image. N represents a normal distribution. express Under the condition x= The probability distribution of . Represents a series of constants, similar to hyperparameters, which become smaller and smaller as T increases. Represents a series of constants, which are set hyperparameters and become larger as T increases.
[0130] in, represents the weight value of the original plane image, so That is, in the denoising of each time step, a plane image is introduced as a priori to calculate the noise of the current time step, and then the noise of the current time step is subtracted from the noise image to complete the denoising process of one time step, and so on, until the convergence condition is met. The convergence condition is, for example, completing n rounds of denoising to obtain the final generated target material map.
[0131] It is worth mentioning that in the above-mentioned material map generation process, by introducing a plane image as a priori in the denoising process at each time step, the diffusion model can realize local redrawing (Inpainting) of the generated image based on the information of the plane image. For image areas prone to abnormal results, since the prior information of the original plane image is learned, the image content can be correctly drawn, reducing the risk of generating abnormal results.
[0132] From the above, it can be seen that in the implementation mode of this specification, by introducing a plane image as a priori in the denoising process at each time step, the risk of abnormal results in the generated texture map is reduced, and the quality of the texture map is optimized.
[0133] In some embodiments, this specification provides a three-dimensional model reconstruction method, which can be used to generate a 3D model, and the method process includes:
[0134] The target material map is used to render the pre-generated rough geometric model of the target object to obtain a three-dimensional model of the target object.
[0135] In the implementation manner of this specification, the target material map and the coarse geometric model can be obtained by referring to the method process of any of the aforementioned implementation embodiments, and then, the target material map and the coarse geometric model are rendered to obtain a 3D model of the target object with the surface effect of the target material map.
[0136] From the above, it can be seen that in the implementation mode of this specification, by separating the material map from the three-dimensional model, when performing three-dimensional modeling of the target object, it is only necessary to generate a material map based on a plane image, and then render the material map onto a coarse geometric model to complete the three-dimensional model reconstruction. This has extremely high modeling efficiency and is suitable for large-scale commodity modeling scenarios.
[0137] In some embodiments, this specification provides a material map generation device, see Figure 7 As shown, the device comprises:
[0138] The edge extraction module 10 is configured to extract edge features from the initial material map of the target object to obtain an edge feature map, wherein the edge feature map is used to characterize the image range of the material map;
[0139] The noise adding module 20 is configured to perform noise adding processing on the planar image of the target object to obtain a noise image;
[0140] The diffusion model module 30 is configured to input the noise image and the edge feature map into a pre-trained diffusion model to obtain a target material map corresponding to the target object output by the diffusion model;
[0141] Among them, the diffusion model is used to extract the first attention weight corresponding to the edge feature map and the second attention weight corresponding to the noise image, and denoise the noise image based on the first attention weight and the second attention weight to obtain the target material map, the first attention weight is used to constrain the image range of the material map, and the second attention weight is used to constrain the difference between the material map and the plane image.
[0142] In one or more embodiments of the present specification, the edge extraction module 10 is configured as follows:
[0143] Acquire a rough geometric model of the target object;
[0144] Performing texture separation on the coarse geometric model to obtain the initial material texture of the surface of the coarse geometric model;
[0145] Edge feature extraction is performed on the initial material map to obtain the edge feature map.
[0146] In one or more embodiments of this specification, the noise adding module 20 is configured as follows:
[0147] Acquire a captured image of the target object;
[0148] Performing image segmentation on the captured image to obtain a planar image including the target object;
[0149] Performing feature extraction on the plane image to obtain a feature map corresponding to the plane image;
[0150] The feature map is subjected to noise processing based on a randomly sampled Gaussian noise map to obtain the noise image.
[0151] In one or more embodiments of the present specification, the diffusion model includes a plurality of intermediate layers, each of which is connected to a first attention module and a second attention module; the diffusion model module 30 is configured as follows:
[0152] For each first attention module, determining the first attention weight based on the output of the previous intermediate layer and the edge feature map;
[0153] For each second attention module, the second attention weight is determined based on the output of the previous intermediate layer and the noise image.
[0154] In one or more embodiments of the present specification, the diffusion model module 30 is configured as follows:
[0155] The noisy image is denoised time step by time step according to the first attention weight and the second attention weight, and for each time step, the denoising result corresponding to the current time step is calculated based on the denoising result of the previous time step and the plane image until the convergence condition is met to obtain the target material map.
[0156] In some embodiments, the present specification provides a three-dimensional model reconstruction device, comprising:
[0157] The three-dimensional rendering module is configured to render a pre-generated rough geometric model of a target object using a target material map to obtain a three-dimensional model of the target object, wherein the target material map is obtained by the method of any of the above-mentioned implementations.
[0158] In some implementations, this specification example provides an electronic device, including:
[0159] Processor; and
[0160] A memory stores computer instructions, wherein the computer instructions are used to enable a processor to execute the method described in any of the above embodiments.
[0161] In some embodiments, the present specification provides an example storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in any of the above embodiments.
[0162] In some implementations, the examples in this specification provide a computer program product, which implements the method of any of the aforementioned implementations when running.
[0163] Figure 8 is a schematic structural diagram of a device provided by an exemplary embodiment. Figure 8 At the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and may also include hardware required for other scenarios. One or more embodiments of this specification may be implemented based on software, such as the processor 702 reading the corresponding computer program from the non-volatile memory 710 into the memory 708 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0164] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0165] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0166] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0167] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0168] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0169] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0170] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "one", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0171] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0172] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of this specification shall be included in the scope of protection of one or more embodiments of this specification.
Claims
1. A material map generation method, characterized in that: include: Extracting edge features from an initial material map of a target object to obtain an edge feature map, wherein the edge feature map is used to characterize an image range of the material map; wherein the initial material map is a map separated from a rough geometric model surface of the target object; Performing noise processing on the plane image of the target object to obtain a noise image; Inputting the noise image and the edge feature map into a pre-trained diffusion model to obtain a target material map corresponding to the target object output by the diffusion model; Among them, the diffusion model is used to extract the first attention weight corresponding to the edge feature map and the second attention weight corresponding to the noise image, and denoise the noise image based on the first attention weight and the second attention weight to obtain the target material map, the first attention weight is used to constrain the image range of the material map, and the second attention weight is used to constrain the difference between the material map and the plane image.
2. The method according to claim 1, characterized in that The step of extracting edge features from the initial material map of the target object to obtain an edge feature map includes: Acquire a rough geometric model of the target object; Performing texture separation on the coarse geometric model to obtain the initial material texture of the surface of the coarse geometric model; Edge feature extraction is performed on the initial material map to obtain the edge feature map.
3. The method according to claim 1, characterized in that The step of performing noise processing on the planar image of the target object to obtain a noise image includes: Acquire a captured image of the target object; Performing image segmentation on the captured image to obtain a planar image including the target object; Performing feature extraction on the plane image to obtain a feature map corresponding to the plane image; The feature map is subjected to noise processing based on a randomly sampled Gaussian noise map to obtain the noise image.
4. The method according to claim 1, characterized in that: The diffusion model includes a plurality of intermediate layers, each of which is connected to a first attention module and a second attention module; the diffusion model is used to: For each first attention module, determining the first attention weight based on the output of the previous intermediate layer and the edge feature map; For each second attention module, the second attention weight is determined based on the output of the previous intermediate layer and the noisy image.
5. The method according to any one of claims 1 to 4, characterized in that: Using the diffusion model to denoise the noisy image based on the first attention weight and the second attention weight to obtain the target material map, including: The diffusion model is used to denoise the noisy image time step by time according to the first attention weight and the second attention weight, and for each time step, the denoising result corresponding to the current time step is calculated based on the denoising result of the previous time step and the plane image until the convergence condition is met to obtain the target material map.
6. A three-dimensional model reconstruction method, characterized in that: include: A pre-generated rough geometric model of a target object is rendered using a target material map to obtain a three-dimensional model of the target object, wherein the target material map is obtained by the method described in any one of claims 1 to 5.
7. A material map generating device, characterized in that: include: An edge extraction module is configured to extract edge features from an initial material map of a target object to obtain an edge feature map, wherein the edge feature map is used to characterize an image range of the material map; wherein the initial material map is a map separated from a rough geometric model surface of the target object; A noise adding module is configured to perform noise adding processing on the planar image of the target object to obtain a noise image; A diffusion model module is configured to input the noise image and the edge feature map into a pre-trained diffusion model to obtain a target material map corresponding to the target object output by the diffusion model; Among them, the diffusion model is used to extract the first attention weight corresponding to the edge feature map and the second attention weight corresponding to the noise image, and denoise the noise image based on the first attention weight and the second attention weight to obtain the target material map, the first attention weight is used to constrain the image range of the material map, and the second attention weight is used to constrain the difference between the material map and the plane image.
8. A three-dimensional model reconstruction device, characterized in that: include: A three-dimensional rendering module is configured to render a pre-generated rough geometric model of a target object using a target material map to obtain a three-dimensional model of the target object, wherein the target material map is obtained by the method described in any one of claims 1 to 5.
9. An electronic device, characterized in that: include: processor; and A memory storing computer instructions, wherein the computer instructions are used to enable a processor to execute the method according to any one of claims 1 to 6.
10. A storage medium, characterized in that: Computer instructions are stored, and the computer instructions are used to make a computer execute the method according to any one of claims 1 to 6.
11. A computer program product, characterized in that The computer program product implements the method according to any one of claims 1 to 6 when running.
Citation Information
Patent Citations
Image processing method of shooting entity, storage medium and system
CN116664770A
Three-dimensional model mapping method and device
CN116958431A
Training method and application method of multi-view image generation model
CN117372631A
Material chartlet generation method and system and electronic equipment
CN117475064A
Texture map generation method and device, electronic equipment and storage medium
CN117496036A
