Total planar graph color migration method and system based on depth diffusion model

By using a deep diffusion model and attention mechanism, the problem of time-consuming and labor-intensive coloring of the site plan line drawing was solved, achieving fast and accurate color transfer and ensuring consistency between the generated image and the line drawing structure and color.

CN121304432APending Publication Date: 2026-01-09WUHAN SURVEYING GEOTECHN RES INST OF MCC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511305657.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-12
Publication Date
2026-01-09

AI Technical Summary

Technical Problem

In existing technologies, the method of coloring the line drawing of the site plan relies on manual operation, which is time-consuming and has poor results, making it difficult to achieve fast and accurate semantic region color transfer.

Method used

We employ a deep diffusion model-based approach, combining semantic segmentation, deep diffusion model, ControlNet module, and region-aware attention mechanism with style consistency loss and color histogram matching loss, to achieve automatic color transfer from black and white line drawings to color reference images.

Benefits of technology

It achieves fast and accurate color transfer of the site plan, ensuring that the edge structure of the generated image is consistent with the line drawing, and that color features are accurately transferred according to semantic regions, thereby improving the efficiency and effect of color transfer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121304432A_ABST
    Figure CN121304432A_ABST
Patent Text Reader

Abstract

The invention provides a general plane graph color migration method and system based on a depth diffusion model, and the method comprises the following steps: (1) carrying out the semantic segmentation of a black and white general plane line draft graph, and generating a semantic mask graph; (2) extracting global style features of the color general plane reference image and local color distribution features of different semantic regions; (3) inputting color features of the line draft image, the semantic mask image and the reference image into a depth diffusion model, restraining the structure of the generated image to be consistent with that of the line draft through a ControlNet module, and migrating the color features of the reference image to a corresponding position of the line draft according to a semantic region through a region perception attention mechanism; and (4) in the de-noising process of the diffusion model, combining the style consistency loss function and the regional color histogram matching loss to generate an image after color migration. According to the method, the color of the reference picture is migrated to the black-and-white line draft according to the semantic region, meanwhile, the line draft structure is kept complete, and the requirement for rapid personalized drawing can be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of architecture and urban planning design, and more specifically to a method and system for color migration of site plans based on a depth diffusion model. Background Technology

[0002] In existing technologies, the coloring method for site plan line drawings mainly relies on traditional manual image processing. This involves using Adobe Photoshop to locally fill in areas such as buildings, roads, green spaces, and paving, based on the required line drawing. This method requires operators to have a certain level of color perception and experience in color and material matching for different areas, enabling them to design aesthetically pleasing and diverse colored site plans according to different project requirements. Therefore, this process is typically time-consuming. While this process can be further optimized by finding a reference image similar to the desired effect and then imitating it for different areas, in practice, limitations in site size, the proportion of different areas, and operator skill can lead to time-consuming and unsatisfactory results. Therefore, the main technical problem this invention aims to solve is how to quickly and accurately transfer colors to semantic regions using both black-and-white line drawings and colored reference images, while maintaining the integrity of the line drawing structure. Summary of the Invention

[0003] This invention provides a method and system for color migration of site plans based on a deep diffusion model, which solves the problems of slow and inaccurate color site plan generation in the prior art.

[0004] The technical solution provided by this invention: a method for color transfer of a total planar map based on a depth diffusion model, characterized by comprising the following steps:

[0005] (1) Input a black and white site plan line drawing and a color site plan reference drawing, perform semantic segmentation on the black and white site plan line drawing, and generate a semantic mask map containing buildings, green spaces, roads, and paved areas;

[0006] (2) Extract the global style features and local color distribution features of different semantic regions from the color site plan reference map;

[0007] (3) Input the color features of the black and white overall planar line drawing, semantic mask and reference image into the pre-trained deep diffusion model, constrain the structure of the generated image to be consistent with the line drawing through the ControlNet module, and transfer the color features of the reference image to the corresponding position of the line drawing according to the semantic region through the region-aware attention mechanism;

[0008] (4) In the denoising process of the deep diffusion model, the style consistency loss function and the region color histogram matching loss are combined to generate the color-transferred image.

[0009] Furthermore, the semantic segmentation in step (1) is achieved through a pre-trained semantic segmentation model, and the segmentation categories include at least buildings, green spaces, roads, and paving.

[0010] Furthermore, in step (1), a pre-trained DeepLabV3+ model is used to perform semantic segmentation on the input black and white line drawing, generating four types of mask maps M={M1,M2,M3,M4}, corresponding to buildings, green spaces, roads, and paved areas, respectively. After the segmentation model outputs a probability map, the mask for each region is obtained through threshold binarization:

[0011]

[0012] Where k∈{1,2,3,4}.

[0013] Furthermore, in step (2), the CLIP-ViT-L / 14 model is used to extract the global style feature vector of the color site plan reference map. For each semantic region R of the reference graph k Calculate the mean μ of its RGB three channels. k and standard deviation σ k , constitutes the color descriptor C k =(μ k , σ k ).

[0014] Furthermore, in step (3), the deep diffusion model uses the pre-trained Stable Diffusion v2.1 as the generation backbone, with a latent space dimension of 64×64×4. The Scribble pre-trained weights are loaded through the ControlNet module, and the line drawing is converted into a HED edge map as the structural control condition.

[0015] Furthermore, in step (3), a region-aware attention module is inserted into the cross-attention layer of the U-Net, as shown in the following formula:

[0016] This is used to weightedly inject color features into the cross-attention layer of U-Net, where Q is the query vector, K is the key vector representing the color features of the reference image (used to match Q and calculate similarity), and V is the value vector associated with K, representing the actual injected color feature values. The output V is the result of weighted attention, where d is the dimension of the key. For semantic region mask matrix, For regional weighting coefficients, The attention scores are spatially modulated using a region weight matrix. Element-wise multiplication applies region weights to the attention score matrix. Softmax normalizes the scores into a probability distribution.

[0017] Furthermore, during the denoising process, the diffusion range of color features is limited according to the region weight matrix, with a total number of iterations T=50. A DDIM sampler is used, and the noise scheduling coefficient β... t Set according to the cosine rule

[0018] During the denoising process at step t:

[0019] (1) Generate structural guidance feature S through ControlNet t ;

[0020] (2) The color feature of the reference image {C k The cross-attention layer of U-Net is injected with weighted injection based on region masks.

[0021] (3) Predicted noise ∈ θ (x t ,t,S t ,{C k}) and update the implicit variables, ,

[0022] in ,

[0023] in: : The hidden variable at the current time step t : Noise predicted by the diffusion model, where θ represents the model parameters. : Current hidden variable, t: Current time step, S t : ControlNet-generated structural bootstrap features, C k : The semantic region color features of the reference image Cumulative noise scheduling coefficient Noise scheduling coefficient : The cumulative coefficient of the previous time step.

[0024] Furthermore, in step (4), the histograms Earth Mover's Distance of each region of the generated graph G and the reference graph are calculated.

[0025] Among them, Hist 64 This represents the RGB histogram of 64-bin. In the generated graph G, the mask... Defined semantic region subgraph, Referring to Figure R, the mask... Defined semantic region subgraph, 64-bin RGB histogram, which quantizes the color distribution of a sub-image into a 64-dimensional vector. : Measures the distance between two histogram distributions;

[0026] Constraining global style consistency using the CLIP model:

[0027] L style =1-cos(f G ,f R ),

[0028] Among them, f G It is the global style feature vector of the generated graph G, extracted using the CLIP-ViT-L / 14 model, f R The global style feature vector of reference figure R is also extracted using the CLIP-ViT model.

[0029] cos is the cosine similarity function, which calculates f. G and f R The similarity when cos(f) G ,f R = 1 (completely similar), loss is 0, minimizing the loss makes the generated graph style identical to the reference. Figure 1 To,

[0030] The total loss is the weighted sum:

[0031] L total =0.7L color +0.3L style

[0032] Furthermore, after generating image G, Canny edge detection is used to extract lines, which are then alpha-fused with the original line drawing.

[0033] G final =α⋅G+(1-α)⋅Canny(G), where α is the weighting coefficient.

[0034] Histogram matching is performed on each semantic region to further align the color distribution of the reference image.

[0035] Another technical solution provided by this invention: a total planar color transfer system based on a depth diffusion model, comprising:

[0036] The semantic segmentation module is used to generate a semantic mask for the black and white site plan line drawing;

[0037] The feature extraction module is used to extract the color and style features of the color site plan reference map;

[0038] The diffusion generation module integrates line art structure control and reference image color migration;

[0039] The post-processing module is used to enhance the line sharpness and color consistency of the generated image.

[0040] The beneficial effects of this invention are:

[0041] Multi-condition controlled generation: ControlNet is used to treat the line art as a hard constraint to ensure that the edges of the generated image are strictly aligned with the input line art. The color features of the reference image are decomposed into global style (CLIP encoding) and local semantic color (region histogram), and the diffusion process is dynamically injected through an attention mechanism.

[0042] Region masking guidance: In the U-Net network of the diffusion model, an independent color adapter is designed for each semantic region (building / green space / road / paving) to avoid color contamination across regions. Attached Figure Description

[0043] Figure 1 A schematic flowchart of an embodiment of the site plan color migration method provided by the present invention;

[0044] Figure 2 The generated effect diagram provided by this invention;

[0045] Figure 3 This is a schematic diagram of an embodiment of the site plan color migration system provided by the present invention. Detailed Implementation

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

[0047] Reference Figure 1 The diagram illustrates a flowchart of an embodiment of the site plan color migration method provided by the present invention, the method comprising:

[0048] Input a black and white site plan line drawing and a color site plan reference drawing. Perform semantic segmentation on the black and white site plan line drawing to generate a semantic mask map containing building, green space, road, paving and water body areas. The black and white site plan line drawing serves as the basis for structural constraints.

[0049] Extract the global style features and local color distribution features of different semantic regions from the color site plan reference map;

[0050] The color features of the black and white overall planar line drawing, semantic mask, and reference image are input into the pre-trained deep diffusion model;

[0051] The deep diffusion model includes two steps: the first is a forward diffusion process, which gradually adds Gaussian noise to the image until pure noise is finally obtained. Since this invention generates and processes images based on a pre-trained deep diffusion model, it does not involve a denoising process.

[0052] Second, there is a trainable inverse denoising diffusion process. A neural network is trained to gradually remove noise, starting from pure noise, until a realistic image is obtained. Denoising is the core of the diffusion model, transforming noise latent variables into image data through multiple iterations. Before denoising, structural and color conditions are injected using ControlNet and attention mechanisms.

[0053] Among them, structural constraint injection: the line drawing is processed by the ControlNet module to generate edge structure guiding features S. t ControlNet ensures that the edge structure of the generated image is strictly aligned with the input line drawing.

[0054] Color feature injection involves injecting the color features of the reference image into the cross-attention layer of U-Net using a region-aware attention mechanism, weighted according to a semantic mask. For example, the color of a building region only affects the generation of the building portion, avoiding cross-regional contamination.

[0055] In the denoising process of the diffusion model, the style consistency loss function and the region color histogram matching loss are combined to generate the color-transferred image.

[0056] The image is generated directly after denoising, but it is not the final output and requires post-processing optimization.

[0057] The entire implementation process will be described in detail below.

[0058] 1. Input preparation:

[0059] (1) Black and white line drawing: as the basis for structural constraints.

[0060] (2) Semantic mask map: generated by the pre-trained segmentation model (DeepLabV3+), containing binary masks of areas such as buildings, green spaces, roads, and paving.

[0061] (3) Reference image color features: including global style features (vectors extracted by CLIP-ViT model) and local color distribution features (RGB mean / standard deviation of each semantic region).

[0062] 2. Denoising preprocessing (within the diffusion model):

[0063] (1) The diffusion model includes two steps:

[0064] Fixed (or preset) forward diffusion process: This process gradually adds Gaussian noise to the image until pure noise is finally obtained.

[0065] Trainable reverse denoising diffusion process: Train a neural network to gradually denoise from pure noise until a realistic image is obtained.

[0066] (2) Structural constraint injection: The line drawing is processed by the ControlNet module to generate edge structure guiding features S. t ControlNet ensures that the edge structure of the generated image is strictly aligned with the input line drawing.

[0067] (3) Color feature injection: The color features of the reference image are injected into the cross-attention layer of U-Net after being weighted by the semantic mask through the region-aware attention mechanism. For example, the color of the building area only affects the generation of the building part, avoiding cross-regional pollution.

[0068] (4) Variable initialization: The diffusion model starts from the latent variable x of random noise. t (Starting with dimensions 64×64×4), T is the total number of steps (e.g., T=50).

[0069] 3. Noise reduction process (iterative execution):

[0070] At each step t (from T to 1):

[0071] 1) Generate structure guidance: ControlNet outputs the structural features S of the current step. t .

[0072] 2) Injecting color features: Color features of the reference image Area masking After weighting, it is input into the cross-attention layer of U-Net.

[0073] 3) Noise prediction: The diffusion model predicts the current noise ϵ θ (x t ,t,S t ,{C k}).in:

[0074] x t : Noisy latent variables in the current step.

[0075] t: Current time step.

[0076] S t : Structural features of ControlNet.

[0077] {Ck} : Color features of semantic regions in the reference image.

[0078] 4) Update latent variables: Update latent variables using the DDIM sampler: ,

[0079] in , It is the noise dispatch coefficient (set according to the cosine rule).

[0080] Iterative reduction of noise and latent variables The image gradually recovers from a noisy state to a clear image representation.

[0081] 4. Output after noise reduction:

[0082] When t=0, the final hidden variable is obtained. This is then decoded into a preliminary color-transferred image (i.e., the color-transferred image).

[0083] At this point, the image has already incorporated the line drawing structure and reference image colors, but further post-processing optimization is required.

[0084] Example 1: Color Transfer of Architectural Line Drawings

[0085] 1. Input Preprocessing

[0086] Semantic segmentation:

[0087] A pre-trained DeepLabV3+ model is used to perform semantic segmentation on the input black-and-white line drawing, generating four types of mask images M={M1,M2,M3,M4}, corresponding to buildings, green spaces, roads, and paved areas, respectively. After the segmentation model outputs a probability map, threshold binarization is used to obtain the masks for each region.

[0088] ,

[0089] Where k∈{1,2,3,4}.

[0090] Reference image feature extraction:

[0091] Color features: For each semantic region R in the reference image k Calculate the mean μ of its RGB three channels. k and standard deviation σ k , constitutes the color descriptor C k =(μ k , σ k ).

[0092] Style features: The global style feature vector f of the reference graph is extracted using the CLIP-ViT-L / 14 model. R ∈ℝ768 .

[0093] 2. Diffusion Model Configuration

[0094] Base model: The pre-trained Stable Diffusion v2.1 is used as the generation backbone, with a latent space dimension of 64×64×4.

[0095] Control module:

[0096] ControlNet: Loads Scribble pre-trained weights, converts the line drawing into a HED edge map, and uses it as a structural control condition.

[0097] Region color adapter: Insert a region-aware attention module into the cross-attention layer of U-Net, as shown in the following formula. ,

[0098] This formula is the core of the region-aware attention module, used to weightedly inject color features into the cross-attention layer of U-Net. The characters have the following meanings:

[0099] Where Q is the query vector, representing the features of the current generation step (e.g., features from the line drawing). It is used to "ask" which color features should be focused on. K is the key vector, representing the color features of the reference image. It is used to match Q and calculate similarity. V is the value vector, associated with K, representing the actual injected color feature values. The output V is the attention-weighted value. d is the dimension of the key (scaling factor), used to prevent the gradient from vanishing due to an excessively large dot product. Usually, d = dim(K). Semantic region mask matrix (binary matrix, same size as feature map). =1 indicates that the pixel belongs to region k (such as a building), otherwise it is 0. Regional weighting coefficient (document example: architecture) =1.2, green space =0.9 etc.), adjusting the importance of different regions. : Region weight matrix, which spatially modulates the attention score. Element-wise multiplication (Hadamard product) applies region weights to the attention score matrix. λ k For the regional weighting coefficients (building λ1=1.2, green space λ2=0.9, road λ3=0.8, paving λ4=0.7), M k This is the region mask matrix. Softmax: normalization, converting scores into a probability distribution.

[0100] 3. Diffusion generation process

[0101] Denoising iteration: Total number of iterations T=50, using DDIM sampler, noise scheduling coefficient βt Set according to the cosine rule.

[0102] During the denoising process at step t:

[0103] (1) Generate structural guidance feature S through ControlNet t .

[0104] (2) The color feature of the reference image {C k The cross-attention layer of U-Net is injected with weighted injection based on the region mask.

[0105] (3) Predicting noise (x t ,t,S t ,{C k}) and update the implicit variables, ,

[0106] in .

[0107] in: : Latent variables (noisy latent representations) at the current time step t. : Noise predicted by the diffusion model. θ represents the model parameters, and the inputs include: : Current hidden variable. t: Current time step (controls noise intensity). S t : ControlNet-generated structural guidance features (ensure consistency with the line art structure). C k : Color features of semantic regions in the reference image (used for color transfer). : Cumulative noise scheduling coefficient. Noise scheduling coefficient (variance), set at time step s according to the cosine rule (controlling the intensity of noise addition / removal). : The cumulative coefficient of the previous time step.

[0108] Loss function:

[0109] Color loss: Calculate the histograms of each region in the generated image G and the reference image. Earth Mover's Distance: ,

[0110] Hist 64 This represents the RGB histogram of a 64-bin array. In the generated graph G, the mask... Defined semantic region subgraph. Example: If k=1 (building region), then It is the set of all building pixels in the generated image (other areas are ignored by the mask). Referring to Figure R, the mask... Defined semantic region subgraph. Example: If k=1 (building region), then It is a collection of all building pixels in the reference image. : 64-bin RGB histogram, which quantizes the color distribution of a sub-image into a 64-dimensional vector. (Earth Mover's Distance): Measures the distance between two histogram distributions (the smaller the value, the more similar the color distributions).

[0111] Style loss: Constraining global style consistency through the CLIP model:

[0112] L style =1-cos(f G ,f R ),

[0113] Among them, f G This is the global style feature vector of the generated graph G, extracted using the CLIP-ViT-L / 14 model. The dimension is... Capture the overall style (such as tone and texture).

[0114] f R The global style feature vector of reference figure R is also extracted using the CLIP-ViT model (and f). R (Same encoder).

[0115] cos is the cosine similarity function, which calculates f. G and f R The similarity (range [-1, 1]).

[0116] Loss formula: L style =1-cos(f G ,f R ).

[0117] When cos(f) G ,f R = 1 (completely similar), loss is 0.

[0118] Minimizing the loss makes the generated graph style similar to the reference. Figure 1 To.

[0119] Function: Ensures that the overall style of the generated image (such as "watercolor" or "realistic") matches the reference image, independent of semantic region color details.

[0120] The total loss is the weighted sum:

[0121] L total =0.7L color +0.3Lstyle ,

[0122] 4. Post-processing optimization

[0123] Line enhancement: Lines are extracted from the generated image G using Canny edge detection and then fused with the original line drawing using alpha (α=0.8).

[0124] G final =α⋅G+(1-α)⋅Canny(G),

[0125] Color fine-tuning: Histogram matching is performed on each semantic region to further align the color distribution of the reference image.

[0126] Reference Figure 3 The diagram illustrates a structural schematic of an embodiment of the site plan color migration system provided by the present invention. The system includes:

[0127] The semantic segmentation module is used to generate a semantic mask for the black and white site plan line drawing;

[0128] The feature extraction module is used to extract the color and style features of the color site plan reference map;

[0129] The diffusion generation module integrates line art structure control and reference image color migration;

[0130] The post-processing module is used to enhance the line sharpness and color consistency of the generated image.

[0131] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for color transfer of a site plan based on a depth diffusion model, characterized in that, Includes the following steps: (1) Input a black and white site plan line drawing and a color site plan reference drawing, perform semantic segmentation on the black and white site plan line drawing, and generate a semantic mask map containing buildings, green spaces, roads, and paved areas; (2) Extract the global style features and local color distribution features of different semantic regions from the color site plan reference map; (3) Input the color features of the black and white overall planar line drawing, semantic mask and reference image into the pre-trained deep diffusion model, constrain the structure of the generated image to be consistent with the line drawing through the ControlNet module, and transfer the color features of the reference image to the corresponding position of the line drawing according to the semantic region through the region-aware attention mechanism; (4) In the denoising process of the deep diffusion model, the style consistency loss function and the region color histogram matching loss are combined to generate the color-transferred image.

2. The method for color migration of a general planar map based on a depth diffusion model according to claim 1, characterized in that, The semantic segmentation in step (1) is achieved through a pre-trained semantic segmentation model, and the segmentation categories include at least buildings, green spaces, roads, and paving.

3. The method for color transfer of a general planar map based on a depth diffusion model according to claim 2, characterized in that, In step (1), a pre-trained DeepLabV3+ model is used to perform semantic segmentation on the input black and white line drawing, generating four types of mask images M={M1,M2,M3,M4}, corresponding to buildings, green spaces, roads, and paved areas, respectively. After the segmentation model outputs a probability map, the mask for each area is obtained by threshold binarization: , Where k∈{1,2,3,4}.

4. The method for color migration of a general planar map based on a depth diffusion model according to claim 1, characterized in that, In step (2), the CLIP-ViT-L / 14 model is used to extract the global style feature vector of the color site plan reference map. For each semantic region R of the reference graph k Calculate the mean μ of its RGB three channels. k and standard deviation σ k , constitutes the color descriptor C k =(μ k , σ k ).

5. The method for color transfer of a general planar map based on a depth diffusion model according to claim 1, characterized in that, In step (3), the deep diffusion model uses the pre-trained Stable Diffusion v2.1 as the generation backbone, with a latent space dimension of 64×64×4. The Scribble pre-trained weights are loaded through the ControlNet module, and the line drawing is converted into a HED edge map as the structural control condition.

6. The method for color migration of a general planar map based on a depth diffusion model according to claim 1, characterized in that, In step (3), a region-aware attention module is inserted into the cross-attention layer of the U-Net, as shown in the following formula: , This is used to weightedly inject color features into the cross-attention layer of U-Net, where Q is the query vector, K is the key vector representing the color features of the reference image (used to match Q and calculate similarity), and V is the value vector associated with K, representing the actual injected color feature values. The output V is the result of weighted attention, where d is the dimension of the key. For semantic region mask matrix, For regional weighting coefficients, The attention scores are spatially modulated using a region weight matrix. Element-wise multiplication applies region weights to the attention score matrix. Softmax normalizes the scores into a probability distribution.

7. The method for color migration of a general planar map based on a depth diffusion model according to claim 1, characterized in that, During the denoising process, the diffusion range of color features is limited according to the region weight matrix. The total number of iterations T=50, the DDIM sampler is used, and the noise scheduling coefficient β is... t Set according to the cosine rule During the denoising process at step t, (1) Generate structural guidance feature S through ControlNet t ; (2) The color feature of the reference image {C k The cross-attention layer of U-Net is injected with weighted injection based on region masks. (3) Predicted noise ∈ θ (x t ,t,S t ,{C k }) and update the implicit variables: , in , in: : The hidden variable at the current time step t : Noise predicted by the diffusion model, where θ represents the model parameters. : Current hidden variable, t: Current time step, S t : ControlNet-generated structural bootstrap features, C k : The semantic region color features of the reference image Cumulative noise scheduling coefficient Noise scheduling coefficient : The cumulative coefficient of the previous time step.

8. The method for color transfer of a general planar map based on a depth diffusion model according to claim 1, characterized in that, In step (4), the histograms of the generated graph G and the reference graph for each region are calculated: Earth Mover's Distance , Among them, Hist 64 This represents the RGB histogram of 64-bin. In the generated graph G, the mask... Defined semantic region subgraph, Referring to Figure R, the mask... Defined semantic region subgraph, 64-bin RGB histogram, which quantizes the color distribution of a sub-image into a 64-dimensional vector. : Measures the distance between two histogram distributions; Constraining global style consistency using the CLIP model: L style =1-cos(f G ,f R ) Among them, f G It is the global style feature vector of the generated graph G, extracted using the CLIP-ViT-L / 14 model, f R The global style feature vector of reference figure R is also extracted using the CLIP-ViT model. cos is the cosine similarity function, which calculates f. G and f R The similarity when cos(f) G ,f R If ) = 1, the graph is completely similar, and the loss is 0. Minimizing the loss makes the style of the generated graph consistent with the reference graph. The total loss is the weighted sum: L total =0.7L color +0.3L style。 9. A method for color transfer of a general planar map based on a depth diffusion model according to claim 8, characterized in that, After generating image G, Canny edge detection is used to extract lines, which are then alpha-fused with the original line drawing. G final =α⋅G+(1-α)⋅Canny(G), where α is the weighting coefficient. Histogram matching is performed on each semantic region to further align the color distribution of the reference image.

10. A site planar color transfer system based on a depth diffusion model, implemented using the method described in any one of claims 1-9, characterized in that, include: The semantic segmentation module is used to generate a semantic mask for the black and white site plan line drawing; The feature extraction module is used to extract the color and style features of the color site plan reference map; The diffusion generation module integrates line art structure control and reference image color migration; The post-processing module is used to enhance the line sharpness and color consistency of the generated image.