Building texture generation method and system based on building texture perception color loss function

By introducing building texture-aware color loss function and pix2pix network in building texture generation, the problem of difficulty in generating high-quality building texture images in the prior art is solved, and a more realistic and consistent building three-dimensional reconstruction effect is achieved.

CN119648889BActive Publication Date: 2025-06-06WUHAN UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411677213.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-06-06
Estimated Expiration
2044-11-22

AI Technical Summary

Technical Problem

The prior art is difficult to generate high-quality texture images that match the facade of real buildings, especially when dealing with complex texture details and color consistency, it is difficult to take into account the structural integrity and visual reality.

Method used

A building texture generation method based on building texture-aware color loss function is proposed. Through foreground and background segmentation, pix2pix network is used to train high-quality texture images similar to the real building facade.

Benefits of technology

It realizes the generation of high-quality texture images that match the facade of the real building, improves the realism and visual consistency of the three-dimensional reconstruction of the building, and solves the problems of blurred textures and loss of details in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648889B_ABST
    Figure CN119648889B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for generating building texture based on a building texture perception color loss function. The present invention provides a method for generating building texture based on a building texture perception color loss function based on a color loss function based on a color loss function, so as to solve the common problems of texture blurring and model detail loss in traditional three-dimensional reconstruction. The method first uses semantic labels to extract windows from the real facade texture image of the building and the corresponding Mesh map texture image, and separates the foreground and background; constructs a color loss function using the color histogram and color gradient of the real image and the generated image; constructs a color loss function using the texture histogram and texture gradient of the real image and the generated image; trains a pix2pix network using the building texture perception color loss function for texture generation; generates a building facade texture image using the trained network, and fuses the window with the background to obtain a complete building texture image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer vision image synthesis, and mainly proposes a building texture generation method based on building texture-aware color loss function (Building Texture-Aware Color Loss, BTACL), which will be applied to related fields such as building three-dimensional reconstruction and digital city construction. Background Art

[0002] The Mesh model can fully display the structural characteristics of the building facade texture, but there are deficiencies in the quality of the texture image; although the texture mapping based on the real building image can provide high-quality detail representation, it often causes texture loss due to occlusion of ground objects. How to use the complete semantic information extracted from the Mesh model texture, combined with the texture advantages of the real image, and generate the building facade texture through image generation technology is the key to improving the realism and visual consistency of the building single model.

[0003] Traditional image generation methods usually rely on simple pixel-level loss functions, which often make it difficult to balance structural integrity and visual realism when dealing with complex texture details and color consistency. Summary of the invention

[0004] The technical problem solved by the present invention is how to generate a texture image that matches a real building facade. Based on a color loss function and a texture loss function, a building texture generation method based on a building texture perception color loss function is provided. The present invention performs foreground and background segmentation based on the real building facade texture image and the corresponding Mesh map texture image and their semantic label data, and uses the building texture perception color loss function to train a pix2pix network to generate a high-quality texture image similar to a real building facade.

[0005] The technical solution adopted by the present invention to solve the technical problem is: a method for generating building texture based on building texture perception color loss function, the method comprising the following steps:

[0006] Step 1, preparation of building texture dataset;

[0007] Step 2, color loss function construction: The color loss function is constructed using the color histogram and color gradient of the real image and the generated image; the generated image is obtained using the mesh map texture image and the pix2pix model;

[0008] Step 3: Constructing texture loss function: Constructing color loss function using texture histogram and texture gradient of real image and generated image;

[0009] Step 4, texture generation network training: using the building texture perception color loss function to train the pix2pix network for texture generation; wherein the building texture perception color loss function includes a color loss function texture and a loss function;

[0010] Step 5, texture generation and fusion: Use the network trained in step 4 to generate the building facade texture image, and fuse the window with the background to obtain a complete building texture image.

[0011] Furthermore, in step 1, the initial data includes the real facade texture image of the building and the corresponding Mesh map texture image, and at least the semantic label of the window category, and the semantic label is used to extract the window from the real facade texture image of the building and the corresponding Mesh map texture image, and separate the foreground and background. The specific method is as follows:

[0012] Step 1.1, determine the window label position: record the coordinates of the upper left corner and lower right corner of each window on the same facade, and calculate the length a and width b of the window;

[0013] Step 1.2, preliminary classification based on aspect ratio: Calculate the aspect ratio t = a / b for each window, and classify the windows into three categories based on the aspect ratio interval: Category I is square, Category II is horizontally long, and Category III is vertically long;

[0014] Step 1.3, refinement based on shape features: calculate the diagonal length of the window and area S = a × b, using the K clustering algorithm to refine the classification;

[0015] For Category I, define Where L1, L2 are the diagonal lengths of the two windows in category I; definition Where S1 and S2 are the areas of the two windows in category I. The feature matrix is ​​constructed with ΔL and ΔS as features, the number of clusters k=2 is selected, and the K-means algorithm is applied to perform cluster analysis on the feature matrix, and category I is divided into two categories. The same operation is performed on category II and category III.

[0016] Step 1.4, real image extraction: using the window coordinates and classification results of steps 1.1, 1.2 and 1.3, the corresponding real image is extracted and classified to separate the window and the background;

[0017] Step 1.5, Mesh map image extraction: Use the window coordinates and classification results of steps 1.1, 1.2 and 1.3 to extract and classify the corresponding Mesh map images to separate the windows and background.

[0018] Furthermore, in step 2, the color loss function includes a color histogram loss function and a color gradient loss function, and the specific method of constructing them is as follows:

[0019] Step 2.1, color histogram loss function construction: color histogram loss function The definition is as follows:

[0020]

[0021] Among them, H c,real (i) is the value of the color histogram of the real image in the i-th channel, H c,gen (i) is the value of the color histogram of the generated image in the i-th channel, and n is the number of channels of the color histogram;

[0022] Step 2.2, color gradient loss function construction: color gradient loss function The definition is as follows:

[0023]

[0024] Among them G c,real (x, y) is the value of the color gradient of the real image at the pixel position (x, y), G c,gen (x, y) is the value of the color gradient of the generated image at the pixel position (x, y), and W and H are the number of columns and rows of the image.

[0025] Furthermore, for the color histogram of the image, the image is converted to the HSV color space, the three channels of H, S, and V are merged into one channel and quantized, and each pixel in the image is traversed to obtain the color histogram of the image according to its quantized color value;

[0026] For the color gradient of the image, the image is converted to the HSV color space, the H, S, and V channels are merged into one channel, the Sobel operator is used to calculate the gradient of the image in the x and y directions, and the gradients in the x and y directions are merged to obtain the color gradient of each pixel.

[0027] Furthermore, in step 3, the texture loss function includes a texture histogram loss function and a texture gradient loss function, and the specific method of constructing them is as follows:

[0028] Step 3.1, texture histogram loss function construction: texture histogram loss function The definition is as follows:

[0029]

[0030] Where T t,real (i) is the value of the texture histogram of the real image in the i-th channel, T t,gen(i) is the value of the texture histogram of the generated image in the i-th channel, and m is the number of channels of the texture histogram;

[0031] Step 3.2, texture gradient loss function construction: texture gradient loss function The definition is as follows:

[0032]

[0033] Among them TG t,real (x, y) is the value of the texture gradient of the real image at the pixel position (x, y), TG t,gen (x, y) is the value of the texture gradient of the generated image at the pixel position (x, y), and W and H are the number of columns and rows of the image.

[0034] Furthermore, for the texture histogram of the image, the LBP value of each pixel in the image is calculated using the local feature pattern, and the LBP value is quantized to generate the texture histogram;

[0035] For the texture gradient of the image, the Gabor filter is used to obtain the texture gradient of each pixel.

[0036] Furthermore, in step 4, the pix2pix network is an image translation model based on a conditional generative adversarial network, which realizes the mapping from the input image to the output image. The specific training method is as follows:

[0037] Step 4.1, define the building texture perceived color loss function, which is defined as follows:

[0038]

[0039] where α C , β C , α T , β T are weight constants, They are color histogram loss function, color gradient loss function, texture histogram loss function, and texture gradient loss function respectively;

[0040] Step 4.2, train the texture generation network: train the pix2pix model using the building texture-aware color loss function.

[0041] Furthermore, the specific implementation method of step 4.2 is as follows:

[0042] Step 4.2.1, initialize the parameters of the generator G and the discriminator D;

[0043] Step 4.2.2, input the Mesh map texture image into the generator G, and the generator G generates the initial building facade texture image;

[0044] Step 4.2.3, calculate the generator loss function L Pix2Pix (G);

[0045] The generator loss consists of three parts: adversarial loss, L1 loss, and building texture-aware color loss. The formula is as follows:

[0046]

[0047] Where L GAN (G, D) is the adversarial loss, and the formula is as follows:

[0048]

[0049] Where x is the input mesh map image, y is the real texture image, z is a random vector, G(x, z) is the texture image generated by the generator, D(x, y) is the judgment result of the discriminator D on (x, y), and D(x, G(x, z)) is the judgment result of the discriminator D on (x, G(x, z));

[0050] Where L L1 (G) is the L1 loss, and the formula is as follows:

[0051]

[0052] where ||yG(x,z)|| 1 The L1 distance between the generated texture image G(x, z) and the real texture image y;

[0053] λ GAN , L1 is a constant weight, Perceived color loss for building textures;

[0054] Step 4.2.4, calculate the discriminator loss L D :L D With L Pix2Pix (G) The difference is L D Try to maximize L GAN (G, D) adversarial loss, while L Pix2Pix (G) Try to minimize L GAN (G, D) Fighting Loss;

[0055] Step 4.2.5, use the back propagation algorithm to calculate the total loss function L Pix2Pix (G) The gradient of the parameters of the generator G is updated using the Adam optimizer, and the discriminator loss L is calculated using the back-propagation algorithm. D For the gradient of the parameters of the discriminator D, use the Adam optimizer to update the parameters of the discriminator D;

[0056] Step 4.2.6, repeat steps 4.2.2 to 4.2.5 until the network converges or the stopping condition is met, and the network training is completed.

[0057] Furthermore, in step 5, the specific method of texture generation and fusion is as follows:

[0058] Step 5.1, building facade texture image generation: input Mesh map texture, use the training network in step 4 to generate building foreground and background textures, and only generate one image for the same type of windows;

[0059] Step 5.2, texture fusion: fuse the windows belonging to the same facade with the background to obtain a complete building texture image.

[0060] The present invention also provides a building texture generation system based on a building texture perception color loss function, comprising:

[0061] A processor and a memory, the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute the building texture generation method based on the building texture perception color loss function as described in the above technical solution.

[0062] Compared with the existing methods, the present invention combines the high integrity of mesh map images with the high accuracy of real texture images, obtains high-quality texture images that can be used for 3D reconstruction of buildings, and can be used to solve the common problems of texture blur and loss of model details in traditional 3D reconstruction. Therefore, the method has important practical value and broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] The present invention will be further described below in conjunction with the accompanying drawings and embodiments, the accompanying drawings are as follows:

[0064] Figure 1 It is a general flow chart for the implementation of the present invention;

[0065] Figure 2 It is a schematic diagram of the principle of the present invention;

[0066] Figure 3 These are two building facade texture images with similar textures;

[0067] Figure 4 Texture histogram loss function values ​​under different conditions for the number of neighborhood points. DETAILED DESCRIPTION

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

[0069] like Figure 1 As shown, the present invention combines the structural advantages of the Mesh model and the texture advantages of the real image, and proposes a building texture generation method based on the building texture perception color loss function based on the color loss function, so as to obtain high-quality texture maps that can be used for three-dimensional reconstruction of buildings. Specifically, the following steps are included:

[0070] Step 1: Prepare the building texture dataset. The specific implementation method is as follows:

[0071] The initial data includes the real building facade texture image and the corresponding Mesh map texture image, as well as at least the semantic label of the window category. In the building texture image, the windows are generally regarded as rectangles, and the windows on the same facade have similar styles. Therefore, we use semantic labels to extract windows from the real building facade texture image and the corresponding Mesh map texture image, and perform foreground and background separation.

[0072] Step 1.1, determine the window label position. Record the coordinates of the upper left corner and lower right corner of each window on the same facade, and calculate the length a and width b of the window.

[0073] Step 1.2, preliminary classification based on aspect ratio. Calculate the aspect ratio t = a / b for each window, and divide the windows into three categories based on the aspect ratio range: if 0.95≤t≤1.05, the window is classified as category I "square"; if 1.10≤t, the window is classified as category II "horizontally long"; if t≤0.90, the window is classified as category III "vertically long".

[0074] Step 1.3, refinement classification based on shape features. Calculate the diagonal length of the window And the area S = a × b, use the K clustering algorithm to refine the classification.

[0075] For Category I, define Where L1, L2 are the diagonal lengths of the two windows in category I; definition Where S1 and S2 are the areas of the two windows in category I. Using ΔL and ΔS as features, construct a feature matrix, select the number of clusters k = 2, apply the K-means algorithm to perform cluster analysis on the feature matrix, and divide category I into two categories. Perform the same operation on category II and category III.

[0076] Step 1.4, real image extraction. Use the window coordinates and classification results of steps 1.1, 1.2 and 1.3 to extract and classify the corresponding real image to separate the window and background.

[0077] Step 1.5, mesh map image extraction. Use the window coordinates and classification results of steps 1.1, 1.2 and 1.3 to extract and classify the corresponding mesh map images to separate the windows and background.

[0078] Step 2: Color loss function construction. The specific implementation method is as follows:

[0079] The color loss function is constructed using the color histogram and color gradient of the real image and the generated image. The generated image is obtained using the mesh map texture image and the pix2pix model, and the mesh map texture image is input into the pix2pix model to obtain the corresponding generated image.

[0080] Step 2.1, color histogram loss function construction, color histogram loss function The definition is as follows:

[0081]

[0082] Among them, H c,real (i) is the value of the color histogram of the real image in the i-th channel, H c,gen (i) is the value of the color histogram of the generated image in the i-th channel, and n is the number of channels of the color histogram;

[0083] For the color histogram of the image, the image is converted to the HSV color space, the H, S, and V channels are merged into one channel and quantized, each pixel in the image is traversed, and the color histogram of the image is obtained according to its quantized color value.

[0084] Step 2.2, color gradient loss function construction, color gradient loss function The definition is as follows:

[0085]

[0086] Among them G c,real (x, y) is the value of the color gradient of the real image at the pixel position (x, y), G c,gen (x, y) is the value of the color gradient of the generated image at the pixel position (x, y), W and H are the number of columns and rows of the image;

[0087] For the color gradient of the image, the image is converted to the HSV color space, the H, S, and V channels are merged into one channel, the Sobel operator is used to calculate the gradient of the image in the x and y directions, and the gradients in the x and y directions are merged to obtain the color gradient of each pixel.

[0088] Step 3: Construct the texture loss function. The specific implementation method is as follows:

[0089] The color loss function is constructed using the texture histogram and texture gradient of the real image and the generated image. The generated image is obtained using the mesh texture image and the pix2pix model, and the mesh texture image is input into the pix2pix model to obtain the corresponding generated image.

[0090] Step 3.1: Construct texture histogram loss function. Texture histogram loss function The definition is as follows:

[0091]

[0092] Where T t,real (i) is the value of the texture histogram of the real image in the i-th channel, T t,gen (i) is the value of the texture histogram of the generated image in the i-th channel, and m is the number of channels of the texture histogram;

[0093] For the texture histogram of the image, the local binary pattern (LBP) is used to calculate the LBP value of each pixel in the image, and the LBP value is quantized to generate the texture histogram.

[0094] Step 3.2: Construct the texture gradient loss function. Texture gradient loss function The definition is as follows:

[0095]

[0096] Among them TG t,real (x, y) is the value of the texture gradient of the real image at the pixel position (x, y), TG t,gen (x, y) is the value of the texture gradient of the generated image at the pixel position (x, y), W and H are the number of columns and rows of the image;

[0097] For the texture gradient of the image, the Gabor filter can be used to obtain the texture gradient of each pixel.

[0098] Step 4: Texture generation network training. The specific implementation method is as follows:

[0099] The pix2pix network is trained using a building texture-aware color loss function for texture generation.

[0100] Step 4.1, define the building texture perceived color loss function. The definition is as follows:

[0101]

[0102] where α C , β C , α T , βT are all weight constants.

[0103] Step 4.2, train the texture generation network. Train the pix2pix model using the building texture-aware color loss function.

[0104] The pix2pix network is an image translation model based on a conditional generative adversarial network, which can achieve mapping from input images to output images. Specifically, the input image (such as a sketch) is generated through the network to generate the corresponding output image (such as a colorful photo), and the adversarial training between the generator and the discriminator makes the generated image as visually realistic as possible while retaining the key features of the input image.

[0105] Furthermore, the specific implementation method of step 4.2 is as follows:

[0106] Step 4.2.1, initialize the parameters of the generator G and the discriminator D.

[0107] Step 4.2.2, input the Mesh map texture image into the generator G, and the generator G generates the initial building facade texture image.

[0108] Step 4.2.3, calculate the generator loss function L Pix2Pix (G).

[0109] The generator loss consists of three parts: adversarial loss, L1 loss, and building texture-aware color loss. The formula is as follows:

[0110]

[0111] Where L GAN (G, D) is the adversarial loss, and the formula is as follows:

[0112]

[0113] Where x is the input mesh map image, y is the real texture image, z is a random vector, G(x, z) is the texture image generated by the generator, D(x, y) is the judgment result of the discriminator D on (x, y), and D(x, G(x, z)) is the judgment result of the discriminator D on (x, G(x, z)).

[0114] Where L L1 (G) is the L1 loss, and the formula is as follows:

[0115]

[0116] where ||yG(x,z)|| 1 is the L1 distance between the generated texture image G(x, z) and the real texture image y.

[0117] λ GAN , L1 is a constant weight, The perceived color loss of building texture can be obtained by steps 2, 3, and 4.1.

[0118] Step 4.2.4, calculate the discriminator loss L D .L D With L Pix2Pix (G) The difference is L D Try to maximize L GAN (G, D) adversarial loss, while L Pix2Pix (G) Try to minimize L GAN (G, D) Adversity loss.

[0119] Step 4.2.5, use the back propagation algorithm to calculate the total loss function L Pix2Pix (G) Gradients of the parameters of the generator G. The parameters of the generator G are updated using the Adam optimizer. The discriminator loss L is calculated using the backpropagation algorithm. D Gradients of the parameters of the discriminator D. The parameters of the discriminator D are updated using the Adam optimizer.

[0120] Step 4.2.6, repeat steps 4.2.2 to 4.2.5 until the model converges or the stopping condition is met, and the network training is completed.

[0121] Step 5: Texture generation and fusion. The specific implementation method is as follows:

[0122] Use the network trained in step 4 to generate the building facade texture image, and merge the windows with the background to obtain a complete building texture image.

[0123] Step 5.1: Generate building facade texture images. Input the Mesh map texture and use the trained network in step 4 to generate the building foreground and background textures. Only one image is generated for the same type of windows.

[0124] Step 5.2: Texture fusion: The windows on the same facade are fused with the background to obtain a complete building texture image.

[0125] To ensure the effectiveness of the building texture-aware color loss function, we take the texture histogram loss function in step 3.1 as an example:

[0126] We prepared two building facade texture images with large color difference and small texture difference, such as Figure 3 As shown. The LBP algorithm generates a binary pattern by comparing the grayscale values ​​of the central pixel with the surrounding pixels. Therefore, when calculating the LBP value of a pixel, we set different numbers of neighborhood points to calculate and combine Figure 3 The texture histogram loss function value is calculated for two building texture images. The results are as follows Figure 4 shown.

[0127] As the number of neighborhood points increases, the sensitivity of LBP features to texture details increases, and the value of texture histogram loss function decreases and approaches 0, proving that Figure 3 The texture difference between the two building facade texture images in is small, so the texture histogram loss function can be used to measure the texture similarity of the two images.

[0128] In specific operations, the method proposed in the present invention can be implemented with the aid of computer software technology to achieve automated process execution. It should be emphasized that these implementations are within the scope of protection of the present invention and can be adopted by professionals in the technical field.

[0129] On the other hand, an embodiment of the present invention also provides a building texture generation system based on a building texture perception color loss function, comprising:

[0130] A processor and a memory, the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute the building texture generation method based on the building texture perception color loss function as described in the above technical solution.

[0131] It should be understood that those skilled in the art can make improvements or changes based on the above description, and all these improvements and changes should fall within the scope of protection of the appended claims of the present invention.

Claims

1. A method for generating building texture based on building texture perception color loss function, characterized in that: The following steps are involved: Step 1, preparation of building texture dataset; Step 2, color loss function construction: The color loss function is constructed using the color histogram and color gradient of the real image and the generated image; the generated image is obtained using the mesh map texture image and the pix2pix model; In step 2, the color loss function includes the color histogram loss function and the color gradient loss function. The specific method of constructing them is as follows: Step 2.1, color histogram loss function construction: color histogram loss function The definition is as follows: Among them, H c,real (i) is the value of the color histogram of the real image in the i-th channel, H c,gen (i) is the value of the color histogram of the generated image in the i-th channel, and n is the number of channels of the color histogram; Step 2.2, color gradient loss function construction: color gradient loss function The definition is as follows: Among them G c,real (x, y) is the value of the color gradient of the real image at the pixel position (x, y), G c,gen (x, y) is the value of the color gradient of the generated image at the pixel position (x, y), W and H are the number of columns and rows of the image; Step 3, texture loss function construction: Use the texture histogram and texture gradient of the real image and the generated image to construct the color loss function; In step 3, the texture loss function includes the texture histogram loss function and the texture gradient loss function. The specific method of constructing them is as follows: Step 3.1, texture histogram loss function construction: texture histogram loss function The definition is as follows: Where T t,real (i) is the value of the texture histogram of the real image in the i-th channel, T t,gen (i) is the value of the texture histogram of the generated image in the i-th channel, and m is the number of channels of the texture histogram; Step 3.2, texture gradient loss function construction: texture gradient loss function The definition is as follows: Among them TG t,real (x, y) is the value of the texture gradient of the real image at the pixel position (x, y), TG t,gen (x, y) is the value of the texture gradient of the generated image at the pixel position (x, y), W and H are the number of columns and rows of the image; Step 4, texture generation network training: using the building texture perception color loss function to train the pix2pix network for texture generation; wherein the building texture perception color loss function includes a color loss function texture and a loss function; In step 4, the pix2pix network is an image translation model based on a conditional generative adversarial network, which realizes the mapping from the input image to the output image. The specific training method is as follows: Step 4.1, define the building texture perceived color loss function, which is defined as follows: where α C , β C , α T , β T are weight constants, They are color histogram loss function, color gradient loss function, texture histogram loss function, and texture gradient loss function respectively; Step 4.2, train the texture generation network: train the pix2pix model using the building texture-aware color loss function; Step 5, texture generation and fusion: Use the network trained in step 4 to generate the building facade texture image, and fuse the window with the background to obtain a complete building texture image.

2. The method for generating building texture based on building texture perceived color loss function according to claim 1, characterized in that: In step 1, the initial data includes the real facade texture image of the building and the corresponding Mesh map texture image, as well as at least the semantic label of the window category, and the semantic label is used to extract the window from the real facade texture image of the building and the corresponding Mesh map texture image, and separate the foreground and background. The specific method is as follows: Step 1.1, determine the window label position: record the coordinates of the upper left corner and lower right corner of each window on the same facade, and calculate the length a and width b of the window; Step 1.2, preliminary classification based on aspect ratio: Calculate the aspect ratio t = a / b for each window, and classify the windows into three categories based on the aspect ratio interval: Category I is square, Category II is horizontally long, and Category III is vertically long; Step 1.3, refinement based on shape features: calculate the diagonal length of the window and area S = a × b, using the K clustering algorithm to refine the classification; For Category I, define Where L1, L2 are the diagonal lengths of the two windows in category I; definition Where S1 and S2 are the areas of the two windows in category Ⅰ; Using ΔL and ΔS as features, construct a feature matrix, select the number of clusters k = 2, apply the K-means algorithm to perform cluster analysis on the feature matrix, and divide category I into two categories; and perform the same operation on category II and category III; Step 1.4, real image extraction: using the window coordinates and classification results of steps 1.1, 1.2 and 1.3, the corresponding real image is extracted and classified to separate the window and the background; Step 1.5, Mesh map image extraction: Use the window coordinates and classification results of steps 1.1, 1.2 and 1.3 to extract and classify the corresponding Mesh map images to separate the windows and background.

3. The method for generating building texture based on building texture perceived color loss function according to claim 1, characterized in that: For the color histogram of the image, convert the image to the HSV color space, merge the H, S, and V channels into one channel and quantize it, traverse each pixel in the image, and obtain the color histogram of the image based on its quantized color value; For the color gradient of the image, the image is converted to the HSV color space, the H, S, and V channels are merged into one channel, the Sobel operator is used to calculate the gradient of the image in the x and y directions, and the gradients in the x and y directions are merged to obtain the color gradient of each pixel.

4. The method for generating building texture based on building texture perceived color loss function according to claim 1, characterized in that: For the texture histogram of the image, the LBP value of each pixel in the image is calculated using the local feature pattern, and the LBP value is quantified to generate the texture histogram; For the texture gradient of the image, the Gabor filter is used to obtain the texture gradient of each pixel.

5. The method for generating building texture based on building texture perceived color loss function according to claim 1, characterized in that: The specific implementation method of step 4.2 is as follows: Step 4.2.1, initialize the parameters of the generator G and the discriminator D; Step 4.2.2, input the Mesh map texture image into the generator G, and the generator G generates the initial building facade texture image; Step 4.2.3, calculate the generator loss function L Pis2Pix (G); The generator loss consists of three parts: adversarial loss, L1 loss, and building texture-aware color loss. The formula is as follows: Where L GAN (G, D) is the adversarial loss, and the formula is as follows: Where x is the input mesh map image, y is the real texture image, z is a random vector, G(x,z) is the texture image generated by the generator, D(x,y) is the judgment result of the discriminator D on (x,y), and D(x,G(x,z)) is the judgment result of the discriminator D on (x,G(x,z)); Where L L1 (G) is the L1 loss, and the formula is as follows: Where ||yG(x,z)||1 is the L1 distance between the generated texture image G(x,z) and the real texture image y; λ GAN , L1 is a constant weight, Perceived color loss for building textures; Step 4.2.4, calculate the discriminator loss L D :L D With L Pix2Pix (G) The difference is L D Try to maximize L GAN (G,D) against loss, while L Pix2Pix (G) Try to minimize L GAN (G,D) Fighting losses; Step 4.2.5, use the back propagation algorithm to calculate the total loss function L Pix2Pix (G) The gradient of the parameters of the generator G is updated using the Adam optimizer, and the discriminator loss L is calculated using the back-propagation algorithm. D For the gradient of the parameters of the discriminator D, use the Adam optimizer to update the parameters of the discriminator D; Step 4.2.6, repeat steps 4.2.2 to 4.2.5 until the network converges or the stopping condition is met, and the network training is completed.

6. The method for generating building texture based on building texture perceived color loss function according to claim 1, characterized in that: In step 5, the specific method of texture generation and fusion is as follows: Step 5.1, building facade texture image generation: input Mesh map texture, use the training network in step 4 to generate building foreground and background textures, and only generate one image for the same type of windows; Step 5.2, texture fusion: fuse the windows belonging to the same facade with the background to obtain a complete building texture image.

7. A building texture generation system based on building texture perception color loss function, characterized in that: include: A processor and a memory, the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute the building texture generation method based on the building texture perception color loss function as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method for training apparel generation model and method for generating apparel

    CN116416374A

  • Gesture-guided figure image generation method based on generative adversarial network

    CN118052904A