A method and system for generating a design plan scheme of residential community arbor and shrub planting
By constructing a plant attribute database and a conditional generative adversarial network model, the system automatically generates planar designs for tree and shrub planting, solving the problems of complex operation and long cycle in existing technologies, and realizing the rapid and convenient conversion of tree and shrub planting designs into CAD drawings.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU S P I DESIGN CO LTD
- Filing Date
- 2025-05-22
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies cannot automatically generate planting design plans for trees and shrubs. The operation is complex and the design cycle is long. It is difficult to handle the complex combination of trees and shrubs, and conventional parameter setting software is difficult to operate.
A plant attribute database was constructed, and a tree and shrub planting design generation model was trained using a conditional generative adversarial network model. The model was trained using an image dataset to generate tree and shrub planting prediction maps, which were then converted into CAD drawings.
It enables the automation and rapid generation of tree and shrub planting designs, reduces manual operations, shortens the design cycle, and directly converts predicted plans into editable CAD drawings, making it easy for designers to modify them.
Smart Images

Figure CN120448565B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of greening design technology, and in particular to a method and system for generating a plan of planting design for trees and shrubs in residential communities. Background Technology
[0002] Green space design is a crucial component of landscape architecture design and a key characteristic that distinguishes it from architectural design and urban planning. It plays a vital role in enhancing spatial aesthetics, improving the ecological environment, and enhancing user comfort. Plant designers configure and plan plants based on site conditions and functional requirements, ultimately presenting the result in a green space plan. Trees and shrubs, with their unique ecological and landscape value, occupy an extremely important position in green space design. Currently, in the actual design process, green space plans are primarily drawn manually by green space designers using a CAD platform. The specific process involves: considering basic plant configuration principles, copying plant legends in DWG format to the CAD platform, pasting the legends to the planting locations, modifying plant names, heights, diameter at breast height (DBH), crown widths, and other information in the legends, and repeating this process until the green space plan is finalized, typically taking 3 to 5 days. Existing green space design methods include parametric techniques, which extract various parameters and rules from the influencing mechanisms of environment, topography, and plant characteristics. By constructing design logic, the design problem is abstracted, and relationships between parameters are established based on these rules. Using software such as Rhino and Grasshopper for computational set compilation and data calculation, a series of algorithms are used to describe the design logic, construct a parameterized generation model, and finally form a reference scheme for the overall layout of trees and shrubs. Artificial intelligence technology, based on artificial neural networks, uses a plant species database as the input layer, and related factors such as the natural environmental factors of plants and planting matching methods as the hidden layer. By adjusting the input information, parameter thresholds and activation functions, diverse tree and shrub planting design schemes are output.
[0003] However, due to the diversity and complexity of tree and shrub selection and combination, there is currently no research on using generative adversarial networks to generate planar solutions for trees and shrubs; parameterization is derived through forward deduction using human logic, rather than automated design; when using artificial neural networks for plant design, the program continuously configures the number of plants until the sum of the projected area of the tree and shrub canopy and the area of tree and shrub vegetation reaches the greening rate index or other design index settings, which results in a significant amount of time being spent generating each solution; parametric design tools such as Rhino and Grasshopper are difficult to operate, and designers need to have good parametric logic skills, otherwise it is difficult to understand and operate the relevant programs. Summary of the Invention
[0004] In order to overcome the shortcomings of the existing technology, the purpose of this invention is to provide a method and system for generating a plan of tree and shrub planting design in residential communities, so as to realize the automated and rapid generation of tree and shrub planting plan.
[0005] To achieve the above objectives, the present invention provides the following solution:
[0006] A method for generating a plan of tree and shrub planting design for a residential community, comprising:
[0007] Construct a plant attribute database;
[0008] Assign a plant legend to each type of plant in the plant attribute database to obtain a CAD plant library;
[0009] Obtain the floor plan and construction drawings of the target residential community's landscape and greening design;
[0010] The plan construction drawings are simplified, labeled, and sized to obtain an image dataset; the image dataset includes: site environment labeled images and tree and shrub planting labeled images.
[0011] The pre-constructed conditional generative adversarial network model is trained using the image dataset to obtain a trained tree and shrub planting design generation model.
[0012] Determine the landscape design of the residential community to be predicted, and obtain the site environmental label map;
[0013] The site environment label map to be predicted is input into the tree and shrub planting design generation model for prediction and generation, and a tree and shrub planting prediction map is obtained.
[0014] The label information in the tree and shrub planting prediction map is extracted and transformed to obtain the original predicted tree and shrub planting JSON dataset; the label information includes: the color of the tree and shrub label, the coordinates of the center point, and the crown width data;
[0015] The plant name, standard crown width, diameter at breast height (DBH), and height data of the original predicted tree and shrub planting JSON dataset are matched according to the plant attribute database to obtain the final predicted tree and shrub planting JSON dataset. The final predicted tree and shrub planting JSON dataset is imported into the CAD platform, and the final predicted tree and shrub planting JSON dataset is matched with the CAD plant library to obtain the predicted tree and shrub planting drawing file.
[0016] Preferably, the planar construction drawings are simplified, labeled, and sized to obtain an image dataset, including:
[0017] The plan construction drawings are simplified and redundant elements are removed to obtain the landscape element drawing and the plant layout drawing;
[0018] Based on the aforementioned construction plan drawings, labels are created for the landscape element diagrams to obtain the site environment label diagram.
[0019] The site environment label map and the plant layout map are combined to obtain the overall map;
[0020] The overall map is divided into regions to obtain several dividing frames and the divided site environment label map, and the site environment label map is converted into PNG file format;
[0021] Using a preset plugin, the world coordinates of the upper left corner of each segmentation box and the variety and crown width data of the tree and shrub legends in the segmentation box are read. The world coordinates of the upper left corner of the segmentation box are determined as the origin of the segmentation box. The coordinate data of the center point of the tree and shrub legends relative to the origin are read to obtain the relative coordinates of the center point. The world coordinates of the upper left corner of the segmentation box, the variety and crown width data, and the relative coordinates of the center point are converted into JSON format to obtain the real design tree and shrub JSON dataset.
[0022] The relative coordinates of the center point and the world size of the crown in the real design tree and shrub JSON dataset are converted into pixel coordinates and pixel size. Based on the variety, crown pixel size, center point pixel coordinate data of the tree and shrub legend and the RGB color data in the plant attribute database, the plant layout map is labeled to obtain the tree and shrub planting label map.
[0023] Preferably, the conditional generative adversarial network model is a pix2pix model.
[0024] Preferably, the label information in the tree and shrub planting prediction map is extracted and transformed to obtain the original predicted tree and shrub planting JSON dataset, including:
[0025] The tree and shrub planting prediction map is color restored according to the preset color tolerance value to obtain the restored tree and shrub planting map.
[0026] The density-based noise spatial clustering method is used to cluster the pixel positions of trees and shrubs of the same color in the restored tree and shrub planting map to obtain the clustered tree and shrub planting map after clustering.
[0027] Based on the plant attribute database, the colors in the clustered tree and shrub planting map are converted into corresponding numerical serial numbers. The pixel coordinates of the center point of the tree and shrub in the clustered tree and shrub planting map and the pixel size of the crown data are converted into world coordinates and world size relative to the origin, thus obtaining the original predicted tree and shrub planting JSON dataset.
[0028] Preferably, the plant attribute database includes: tree species name, standard diameter at breast height (DBH) data, height data, crown width data, numerical serial number, and label color RGB.
[0029] Preferably, the format of the tree and shrub prediction planting drawing file is dwg format.
[0030] Preferably, the expression for the loss function during training of the conditional generative adversarial network model is:
[0031]
[0032] Among them, L cGAN (G,D)=E x,y [logD(x,y)]+E x,z [log(1-D(x,G(x,z)))];
[0033] L L1 (G)=E x,y,z [||yG(x,z)||1];
[0034] G * The final loss value is denoted by ; x represents the input image; y represents the real image paired with x; z represents a random noise vector; G(x,z) is the image generated by the generator G based on x and z; D(x,y) is the probability that the discriminator D judges the real image pair (x,y) as real; D(x,G(x,z)) represents the probability that the discriminator D judges the generated image pair (x,G(x,z)) as real; ||yG(x,z)||1 represents the L1 distance between y and G(x,z); λ is the weighting coefficient; L cGAN (G,D) represents the high-frequency feature loss value; E x,y E represents the mathematical expectation of the joint probability distribution of x and y; x,z E represents the mathematical expectation of the joint probability distribution of x and z; x,y,z It represents the mathematical expectation of the joint probability distribution of x, y, and z.
[0035] Preferably, the input and output resolution of the conditional generative adversarial network model is 2048x2048 pixels.
[0036] Preferably, the preset color tolerance value is 5.
[0037] Preferably, a system for generating a plan of tree and shrub planting design for residential communities includes:
[0038] The dataset construction module is used to construct the plant attribute database, assign plant legends to each type of plant in the plant attribute database to obtain the CAD plant library, obtain the plan construction drawings of the target residential community garden construction and greening design, and simplify, label and size the plan construction drawings to obtain the image dataset.
[0039] The model training module is used to train a pre-built conditional generative adversarial network model using the image dataset to obtain the tree and shrub planting design generation model.
[0040] The image output module is used to determine the landscape design of the residential community to be predicted, obtain the environmental label map of the site to be predicted, and input the environmental label map of the site to be predicted into the tree and shrub planting design generation model for prediction generation to obtain the tree and shrub planting prediction map.
[0041] The data extraction module is used to extract and transform the label information in the tree and shrub planting prediction map to obtain the original predicted tree and shrub planting JSON dataset;
[0042] The format conversion module is used to match the plant name, standard crown width, diameter at breast height, and height data of the original predicted tree and shrub planting JSON dataset according to the plant attribute database to obtain the final predicted tree and shrub planting JSON dataset. The final predicted tree and shrub planting JSON dataset is imported into the CAD platform, and the final predicted tree and shrub planting JSON dataset is matched with the map blocks according to the CAD plant library to obtain the predicted tree and shrub planting drawing file.
[0043] The present invention discloses the following technical effects:
[0044] This invention provides a method and system for generating planting design plans for trees and shrubs in residential communities. By training a tree and shrub planting design generation model using a constructed image dataset, it solves the problems of existing methods being unable to handle complex tree and shrub combinations, the high difficulty of operating conventional parameter setting software, and the long design cycle. It realizes the function of directly generating planting design plans for trees and shrubs using site environment label maps. By extracting label information from the predicted tree and shrub planting maps and converting the predicted maps into CAD drawings, it solves the problem that existing generation methods cannot directly and accurately convert the predicted plan maps into editable files, realizing the automatic conversion of plan maps into CAD drawings. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is a schematic diagram illustrating the process of generating a plan of tree and shrub planting design in a residential community, as provided in an embodiment of the present invention.
[0047] Figure 2 A schematic diagram of a plant attribute database provided in an embodiment of the present invention;
[0048] Figure 3 A schematic diagram of a CAD plant library provided in an embodiment of the present invention;
[0049] Figure 4 Site environment labeling diagram provided for embodiments of the present invention;
[0050] Figure 5 Tree and shrub planting label diagram provided in an embodiment of the present invention;
[0051] Figure 6 This is a schematic diagram of an image dataset provided in an embodiment of the present invention;
[0052] Figure 7 This is a schematic diagram of the training of a conditional generative adversarial network model provided in an embodiment of the present invention;
[0053] Figure 8 This is a tree and shrub planting prediction diagram provided in an embodiment of the present invention;
[0054] Figure 9 This invention provides a clustering diagram of tree and shrub planting and a schematic diagram of data extraction and transformation.
[0055] Figure 10 This is a schematic diagram of a CAD file for predicting tree and shrub planting provided in an embodiment of the present invention. Detailed Implementation
[0056] 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.
[0057] The purpose of this invention is to provide a method and system for generating planting plan schemes for trees and shrubs in residential communities, so as to achieve automated and rapid generation of planting plan schemes for trees and shrubs.
[0058] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0059] Figure 1 This is a schematic diagram illustrating the process of generating a plan view of tree and shrub planting design in a residential community, as provided in an embodiment of the present invention. Figure 1 As shown, the present invention provides a method for generating a plan design scheme for planting trees and shrubs in a residential community, comprising:
[0060] Step 100: Construct a plant attribute database;
[0061] Step 200: Assign plant legends to each type of plant in the plant attribute database to obtain a CAD plant library;
[0062] Step 300: Obtain the floor plan and construction drawings of the landscape and greening design of the target residential community;
[0063] Step 400: Simplify, label, and dimensionalize the planar construction drawing to obtain an image dataset; the image dataset includes: site environment labeled images and tree and shrub planting labeled images;
[0064] Step 500: Use the image dataset to train the pre-constructed conditional generative adversarial network model to obtain a trained tree and shrub planting design generation model;
[0065] Step 600: Determine the landscape design of the residential community to be predicted and obtain the site environment label map;
[0066] Step 700: Input the site environment label map to be predicted into the tree and shrub planting design generation model for prediction and generation to obtain the tree and shrub planting prediction map;
[0067] Step 800: Extract and transform the label information from the tree and shrub planting prediction map to obtain the original predicted tree and shrub planting JSON dataset; the label information includes: the color of the tree and shrub label, the coordinates of the center point, and the crown width data;
[0068] Step 900: Match the plant name, standard crown width, diameter at breast height (DBH), and height data of the original predicted tree and shrub planting JSON dataset according to the plant attribute database to obtain the final predicted tree and shrub planting JSON dataset. Import the final predicted tree and shrub planting JSON dataset into the CAD platform and perform tile matching on the final predicted tree and shrub planting JSON dataset according to the CAD plant library to obtain the predicted tree and shrub planting drawing file.
[0069] Specifically, the planar construction drawings are simplified, labeled, and sized to obtain an image dataset, including:
[0070] The plan construction drawings are simplified and redundant elements are removed to obtain the landscape element drawing and the plant layout drawing;
[0071] Based on the aforementioned construction plan drawings, labels are created for the landscape element diagrams to obtain the site environment label diagram.
[0072] The site environment label map and the plant layout map are combined to obtain the overall map;
[0073] The overall map is divided into regions to obtain several dividing frames and the divided site environment label map, and the site environment label map is converted into PNG file format;
[0074] Using a preset plugin, the world coordinates of the upper left corner of each segmentation box and the variety and crown width data of the tree and shrub legends in the segmentation box are read. The world coordinates of the upper left corner of the segmentation box are determined as the origin of the segmentation box. The coordinate data of the center point of the tree and shrub legends relative to the origin are read to obtain the relative coordinates of the center point. The world coordinates of the upper left corner of the segmentation box, the variety and crown width data, and the relative coordinates of the center point are converted into JSON format to obtain the real design tree and shrub JSON dataset.
[0075] The relative coordinates of the center point and the world size of the crown in the real design tree and shrub JSON dataset are converted into pixel coordinates and pixel size. Based on the variety, crown pixel size, center point pixel coordinate data of the tree and shrub legend and the RGB color data in the plant attribute database, the plant layout map is labeled to obtain the tree and shrub planting label map.
[0076] Preferably, the conditional generative adversarial network model is a pix2pix model.
[0077] Specifically, the label information in the tree and shrub planting prediction map is extracted and transformed to obtain the original predicted tree and shrub planting JSON dataset, including:
[0078] The tree and shrub planting prediction map is color restored according to the preset color tolerance value to obtain the restored tree and shrub planting map.
[0079] Density-based spatial clustering of applications with noise is used to cluster the pixel positions of trees and shrubs of the same color in the restored tree and shrub planting map to obtain the clustered tree and shrub planting map after clustering.
[0080] Based on the plant attribute database, the colors in the clustered tree and shrub planting map are converted into corresponding numerical serial numbers. The pixel coordinates of the center point of the tree and shrub in the clustered tree and shrub planting map and the pixel size of the crown data are converted into world coordinates and world size relative to the origin, thus obtaining the original predicted tree and shrub planting JSON dataset.
[0081] Preferably, the plant attribute database includes: tree species name, standard diameter at breast height (DBH) data, height data, crown width data, numerical serial number, and label color RGB.
[0082] Specifically, the format of the tree and shrub prediction planting drawing file is dwg.
[0083] Preferably, the expression for the loss function during training of the conditional generative adversarial network model is:
[0084]
[0085] Among them, L cGAN (G,D)=E x,y [logD(x,y)]+E x,z [log(1-D(x,G(x,z)))];
[0086] L L1 (G)=E x,y,z [||yG(x,z)||1];
[0087] G * The final loss value is denoted by ; x represents the input image; y represents the real image paired with x; z represents a random noise vector; G(x,z) is the image generated by the generator G based on x and z; D(x,y) is the probability that the discriminator D judges the real image pair (x,y) as real; D(x,G(x,z)) represents the probability that the discriminator D judges the generated image pair (x,G(x,z)) as real; ||yG(x,z)||1 represents the L1 distance between y and G(x,z); λ is the weighting coefficient; L cGAN (G,D) represents the high-frequency feature loss value; E x,y E represents the mathematical expectation of the joint probability distribution of x and y; x,z E represents the mathematical expectation of the joint probability distribution of x and z; x,y,z It represents the mathematical expectation of the joint probability distribution of x, y, and z.
[0088] Specifically, the input and output resolution of the conditional generative adversarial network model is 2048x2048 pixels.
[0089] Optionally, the preset color tolerance value is 5.
[0090] Furthermore, a system for generating a plan of tree and shrub planting design for residential communities includes:
[0091] The dataset construction module is used to construct the plant attribute database, assign plant legends to each type of plant in the plant attribute database to obtain the CAD plant library, obtain the plan construction drawings of the target residential community garden construction and greening design, and simplify, label and size the plan construction drawings to obtain the image dataset.
[0092] The model training module is used to train a pre-built conditional generative adversarial network model using the image dataset to obtain the tree and shrub planting design generation model.
[0093] The image output module is used to determine the landscape design of the residential community to be predicted, obtain the environmental label map of the site to be predicted, and input the environmental label map of the site to be predicted into the tree and shrub planting design generation model for prediction generation to obtain the tree and shrub planting prediction map.
[0094] The data extraction module is used to extract and transform the label information in the tree and shrub planting prediction map to obtain the original predicted tree and shrub planting JSON dataset;
[0095] The format conversion module is used to match the plant name, standard crown width, diameter at breast height, and height data of the original predicted tree and shrub planting JSON dataset according to the plant attribute database to obtain the final predicted tree and shrub planting JSON dataset. The final predicted tree and shrub planting JSON dataset is imported into the CAD platform, and the final predicted tree and shrub planting JSON dataset is matched with the map blocks according to the CAD plant library to obtain the predicted tree and shrub planting drawing file.
[0096] Preferably, data such as the names, diameter at breast height (DBH), height, and crown width of commonly used tree species in the target area are collected and assigned numerical serial numbers and RGB colors to form a plant attribute database. Different RGB colors from the site environment labeling map are randomly assigned to plants in the plant attribute database. A plant legend is assigned to each type of plant in the plant attribute database to form a CAD plant library. The landscape architecture and greening design plans for residential communities are obtained, simplified, labeled, and sized to obtain site environment labeling maps and tree / shrub planting labeling maps corresponding to the landscape architecture and greening design plans. An image dataset is then constructed based on these site environment labeling maps and tree / shrub planting labeling maps.
[0097] Specifically, Figure 2 This is a schematic diagram of a plant attribute database that includes data such as the names of commonly used tree species in the target area, diameter at breast height, height, and crown width, provided by an example of the present invention. Figure 3 This is a schematic diagram of a CAD plant library including plant illustrations and attributes provided by an example of the present invention. Figure 4 This is a schematic diagram illustrating how to obtain a site environment label map corresponding to a landscape design plan construction drawing by labeling the drawing. Figure 5 This is a schematic diagram illustrating how to create tree and shrub planting labels corresponding to a landscaping design plan construction drawing by labeling the drawing. (See also...) Figure 4 and Figure 5 The plan drawings are simplified, labeled, and sized to obtain site environment label maps and tree and shrub planting label maps corresponding to the landscape and greening design plan construction drawings, including:
[0098] Preferably, the landscape and greening design plan construction drawings in the drawing library are simplified and redundant elements are deleted. Only the outlines of each functional area in the landscape design plan construction drawings and the plant legends containing information such as location, variety, and crown width in the greening design plan construction drawings are retained, so as to obtain the landscape element diagram and plant layout diagram corresponding to the landscape and greening design plan construction drawings.
[0099] Furthermore, based on the landscape element diagrams corresponding to the landscape design plan and construction drawings, labels are created to obtain site environment label diagrams corresponding to the landscape elements in the landscape design plan and construction drawings. Using an RGB three-color channel mode, different color markers are used in CAD to fill and distinguish each functional area. The site environment label diagrams and plant layout diagrams are merged into a single DWG file to form a master plan. The master plan is then divided into several regions: in CAD, an A2-sized drawing frame (594×420mm) in world coordinates is enlarged by 300 times (178200×126000mm) to segment the master plan. ExtractData is used to read the world coordinates of the upper left corner of each segmentation frame, generating a coordinate JSON file, with the upper left corner coordinates of the segmentation frame used as the origin (0,0) of that region. The segmented site environment label diagrams are exported as PDF files of the corresponding size (178200×126000mm). After converting the data to A2-sized PNG files (7016×4961 pixels), it was scaled proportionally and filled to 2048×2048 pixels for easier training later. ExtractData was used to extract the names of the tree and shrub legends, the coordinates of the center point relative to the origin, and the crown width data from the plant arrangement diagram within each segmentation box. This data was then merged with the coordinate JSON file to generate a real-world design tree and shrub JSON dataset. The world-size coordinates of the relative coordinates of the tree and shrub center points and the crown width from the real-world design tree and shrub JSON dataset were converted to pixel coordinates and dimensions. Using the center point coordinates as the center and the crown width as the diameter, and based on the RGB colors assigned to the plants, solid circles were drawn on a 2048x2048 pixel PNG format site environment label map using the Circle command to create labels. This resulted in a tree and shrub planting label map corresponding to the landscape elements in the greening design plan construction drawing.
[0100] Furthermore, the implementation process of the ExtractData plugin includes:
[0101] 1) Create a JSON file.
[0102] 2) Record the coordinates of the selected area: prompt the user to start from the top left corner and select the four corner points of the area frame in CAD in the order of top left, bottom left, top right, and bottom right, convert the coordinates from the user coordinate system to the world coordinate system, and save (if the points are not successfully specified, the process will not continue).
[0103] 3) Record the world coordinates of the top-left corner of the selected area and set it as the origin (0, 0).
[0104] 4) Calculate the size of the selected area: Calculate the length and width of the selected area based on the 4 points.
[0105] 5) Extract CAD plant legend data: Prompt the user to select a region in CAD, filter out plant legends with the block reference attribute within the selected area, iterate through the selected plant legends, and perform the following operations for each legend:
[0106] Check if the legend is located within the tree and shrub layer (excluding content from other layers);
[0107] Check if the legend has attribute information such as type, crown width, height, and diameter at breast height;
[0108] If so, extract the coordinates and attribute information of the legend, and use regular expressions to clean and format the attribute values;
[0109] Record the coordinates of the center point of the plant illustration relative to the origin of the region's bounding box;
[0110] The extracted coordinates and attribute information are populated into a JsonData object and added to a list.
[0111] 5) Serialize the data structure into a JSON string, write it to the created JSON file, and output it at the user-specified location.
[0112] Specifically, a conditional generative adversarial network (GAN) model is trained using an image dataset to obtain a trained GAN model. The GAN model employs a pix2pix model, which includes a generator G and a discriminator D.
[0113] Furthermore, the generator G employs a U-net network structure to generate a predicted layout map based on the site environment label map and tree / shrub planting label map in the image dataset. The generator contains 8 convolutional layers and 8 deconvolutional layers. The input 2048×2048 image is progressively downsampled to 8×8 through an 8-layer encoder (4×4 convolution per layer, stride 2, number of channels 64→128→256→512→512→512→512), and then progressively upsampled back to 2048×2048 through an 8-layer decoder (4×4 deconvolution per layer, stride 2, number of channels 512→512→512→512→256→128→64→3). The encoder features are then fused through skip connections.
[0114] Furthermore, the discriminator D employs a PatchGAN network structure to determine the similarity between the layout image and the corresponding layout images in the image dataset, comprising six convolutional layers. The input, 2048×2048×6 (a concatenation of real and generated images), is progressively downsampled to 64×64 through five 4×4 convolutional layers (stride 2, number of channels 64→128→256→512→512). Finally, a 4×4 convolutional layer outputs a 64×64×1 probability map to determine the realism of each region in the image.
[0115] Specifically, Figure 6 This embodiment provides a schematic diagram of an image dataset composed of site environment label maps and tree and shrub planting label maps. Figure 7 This is a schematic diagram illustrating the training principle of a conditional generative adversarial network model provided in this embodiment. See also... Figure 6 and Figure 7 The process of training a conditional generative adversarial network model using an image dataset is as follows:
[0116] The conditional generative adversarial network (GAN) model was trained using an image dataset, resulting in a pre-trained GAN model. The training process is as follows:
[0117] 1) Define the loss function for the conditional generative adversarial network model.
[0118] The objective function of a conditional generative adversarial network is defined as follows:
[0119] L cGAN (G,D)=E x,y [logD(x,y)]+E x,z [log(1-D(x,G(x,z)))]
[0120] Specifically, the generator G is used to minimize the above objective function, and the discriminator D is used to maximize the above objective function. The two optimize their respective performance through a zero-sum game, which can effectively learn the high-frequency features between corresponding images.
[0121] Furthermore, an L1 loss function is introduced to ensure the similarity of the input site environment label map and the corresponding tree and shrub planting label map on low-frequency features:
[0122] L L1 (G)=E x,y,z [||yG(x,z)||1]
[0123] Where represents the value of the L1 loss function, which is the loss function for low-frequency features.
[0124] Specifically, based on the loss functions for high-frequency features and low-frequency features, the final loss function, i.e., the loss function of the conditional generative adversarial network model, can be obtained:
[0125]
[0126] Where arg represents the value of the independent variable that causes the loss function to reach its extreme value; min G Let max denote the objective function that minimizes the generator G. D argmin represents the objective function that maximizes the discriminator D. G maxD E represents the search for a parameter combination of a generator G and a discriminator D such that, under this combination, the generator G generates fake data as realistic as possible (i.e., minimizing the loss function with respect to G), while the discriminator D identifies real and fake data as accurately as possible (i.e., maximizing the loss function with respect to D). x,y E represents the mathematical expectation of the joint probability distribution of x and y; x,y [logD(x,y)] represents the expectation of the log-likelihood of a pair of real images (x,y), which measures the discriminator's average ability to recognize real images. x,z E represents the mathematical expectation of the joint probability distribution of x and y; x,z [log(1-D(x,G(x,z)))] represents the expectation of the log-likelihood of the generated image pair (x,G(x,z)), which measures the discriminator's average ability to recognize the generated image pairs. E x,y,z E represents the mathematical expectation of the joint probability distribution of x, y, and z, used to represent the mean or central location of a random variable. x,y,z [||yG(x,z)||1] represents a weighted average of all possible values of x, y, and z, where the weights are the joint probability density function values corresponding to these values.
[0127] 2) The Conditional Generative Adversarial Network (CGN) model is iteratively trained using an image dataset. The parameters of the generator and discriminator are updated in real-time via backpropagation. Training is complete when the loss function converges, resulting in a trained CGN model. Based on the trained CGN model, the mapping relationship between the site environment label map and the tree and shrub planting label map can be obtained.
[0128] Furthermore, the landscape design of each residential community to be predicted is determined according to the design requirements, and the site environment label map of the required layout is obtained. The site environment label map of the required layout is input into the trained conditional generative adversarial network model to obtain the tree and shrub planting prediction map as the layout of tree and shrub planting in the residential community to be predicted.
[0129] Specifically, Figure 8 This embodiment provides a method for training a conditional generative adversarial network (GAN) model and generating a tree and shrub planting prediction map based on the trained GAN model. See also... Figure 8 The process of generating a tree and shrub planting prediction map using a site environment label map of the residential area to be predicted includes:
[0130] 1) Based on the boundaries and functions of the landscaping elements of the residential community to be predicted, labels are created for the landscaping construction drawings.
[0131] 2) Divide the site environment label map of the residential community to be predicted and convert it into a 2048×2048 pixel PNG file.
[0132] 3) In this process, based on the boundaries and functions of the garden construction elements of the residential community to be predicted, labels are created on the garden construction plan drawings to obtain site environment label maps.
[0133] 4) Input the site environment label map of the residential area to be predicted to obtain the tree and shrub planting prediction map.
[0134] Furthermore, the colors, center point coordinates, and sizes of the tree and shrub labels in the tree and shrub planting prediction map are extracted and transformed to obtain a JSON dataset for tree and shrub planting prediction.
[0135] See Figure 9 The process of extracting and transforming the tree and shrub planting prediction map processed by density-based noise spatial clustering to obtain the final predicted tree and shrub planting JSON dataset includes:
[0136] 1) Due to image loss during the generation and compression processes of conditional generative adversarial networks, color differences occur. Based on RGB colors, the color tolerance value is set to 5, and the colors of the predicted tree and shrub planting map are matched with the RGB colors in the plant attribute database, converting them into corresponding numerical serial numbers for each plant.
[0137] 2) Using density-based noise spatial clustering, cluster all tree and shrub pixel locations of the same color, calculate the center point and radius of each cluster, thereby identifying the distribution of plant color blocks in the prediction map and obtaining the tree and shrub planting prediction map processed by the clustering algorithm.
[0138] 3) The plant center point and crown width data in the tree and shrub planting prediction map processed by the clustering algorithm are transformed from pixel coordinates and size into coordinates and world size relative to the origin of the upper left corner of the segmentation map.
[0139] 4) Match Chinese plant names in the plant attribute database based on the numeric ID.
[0140] 5) Using the predicted tree and shrub dataset converted to relative coordinates and world size, the closest standard crown width, diameter at breast height, and height data are matched in the plant attribute database based on the Chinese plant name and crown width to generate the final predicted tree and shrub planting JSON dataset.
[0141] Furthermore, the final predicted tree and shrub planting JSON dataset is imported into the CAD platform and converted into a visual and editable dwg file.
[0142] See Figure 10Import the obtained JSON file of tree and shrub planting into the CAD platform to obtain a dwg file.
[0143] Preferably, the implementation process of the InsertTree plugin includes:
[0144] 1) Users import tree and shrub planting prediction JSON files.
[0145] 2) Parse the JSON file: Read the contents of the JSON file and deserialize the JASON string into an object; obtain the value of the top left corner origin (here, the origin is the world coordinate of the top left corner of the A2-sized drawing frame when dividing the landscape environment label map); extract tree and shrub information (name, coordinates, height, diameter at breast height, crown width, etc.).
[0146] 3) Matching plant illustrations:
[0147] Iterate through the tree and shrub information extracted from the JSON file;
[0148] The program searches for the corresponding legend (without attributes) in the CAD plant library based on the plant name;
[0149] After finding the corresponding legend, modify the text string of the legend attributes according to the height, diameter at breast height, crown width, etc. in the JSON;
[0150] 4) Plant coordinate restoration: The relative origin coordinates of the plant center point in the JSON are added in CAD according to the world coordinates of the upper left corner of the segmentation diagram, and the corresponding plant legend with the modified attributes is inserted into the CAD landscape drawing;
[0151] 5) Create a planting layer: Create a new layer named "Trees and Shrubs-AI", add the generated plant legend to the new layer, and add the new layer to the CAD layer table.
[0152] 6) Displayed as a visual and editable plant legend in CAD.
[0153] The beneficial effects of this invention are as follows:
[0154] This invention trains a tree and shrub planting design generation model using a constructed image dataset, which can automatically and quickly generate tree and shrub planting prediction schemes that conform to landscape design, reducing a large amount of repetitive manual operations and shortening the design cycle. By extracting the label information from the tree and shrub planting prediction map, the prediction map is converted into CAD drawings, which facilitates visualization and subsequent modifications by designers, improving the system's flexibility and convenience.
[0155] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0156] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for generating a plan design scheme for planting trees and shrubs in a residential community, characterized in that, include: Construct a plant attribute database; Assign a plant legend to each type of plant in the plant attribute database to obtain a CAD plant library; Obtain the floor plan and construction drawings of the target residential community's landscape and greening design; The plan construction drawings are simplified, labeled, and sized to obtain an image dataset; the image dataset includes: site environment labeled images and tree and shrub planting labeled images. The pre-constructed conditional generative adversarial network model is trained using the image dataset to obtain a trained tree and shrub planting design generation model. Determine the landscape design of the residential community to be predicted, and obtain the site environmental label map; The site environment label map to be predicted is input into the tree and shrub planting design generation model for prediction and generation, and a tree and shrub planting prediction map is obtained. The label information in the tree and shrub planting prediction map is extracted and transformed to obtain the original predicted tree and shrub planting JSON dataset; the label information includes: the color of the tree and shrub label, the coordinates of the center point, and the crown width data; The plant name, standard crown width, diameter at breast height, and height data of the original predicted tree and shrub planting JSON dataset are matched according to the plant attribute database to obtain the final predicted tree and shrub planting JSON dataset. The final predicted tree and shrub planting JSON dataset is imported into the CAD platform, and the final predicted tree and shrub planting JSON dataset is matched with the CAD plant library to obtain the tree and shrub predicted planting drawing file. The 2D construction drawings are simplified, labeled, and sized to obtain an image dataset, including: The plan construction drawings are simplified and redundant elements are removed to obtain the landscape element drawing and the plant layout drawing; Based on the aforementioned construction plan drawings, labels are created for the landscape element diagrams to obtain the site environment label diagram. The site environment label map and the plant layout map are combined to obtain the overall map; The overall map is divided into regions to obtain several dividing frames and the divided site environment label map, and the site environment label map is converted into PNG file format; Using a preset plugin, the world coordinates of the upper left corner of each segmentation box and the variety and crown width data of the tree and shrub legends in the segmentation box are read. The world coordinates of the upper left corner of the segmentation box are determined as the origin of the segmentation box. The coordinate data of the center point of the tree and shrub legends relative to the origin are read to obtain the relative coordinates of the center point. The world coordinates of the upper left corner of the segmentation box, the variety and crown width data, and the relative coordinates of the center point are converted into JSON format to obtain the real design tree and shrub JSON dataset. The relative coordinates of the center point and the world size of the crown in the real design tree and shrub JSON dataset are converted into pixel coordinates and pixel size. Based on the variety, crown pixel size, center point pixel coordinate data of the tree and shrub legend and the RGB color data in the plant attribute database, the plant layout map is labeled to obtain the tree and shrub planting label map.
2. The method for generating a plan of tree and shrub planting design in a residential community according to claim 1, characterized in that, The conditional generative adversarial network model is a pix2pix model.
3. The method for generating a plan of tree and shrub planting design in a residential community according to claim 1, characterized in that, The plant attribute database includes: tree species name, standard diameter at breast height (DBH) data, height data, crown width data, numerical serial number, and label color RGB.
4. The method for generating a plan of tree and shrub planting design in a residential community according to claim 1, characterized in that, The format of the predicted planting drawings for trees and shrubs is dwg.
5. The method for generating a plan of tree and shrub planting design in a residential community according to claim 1, characterized in that, Data extraction and transformation are performed on the label information in the tree and shrub planting prediction map to obtain the original predicted tree and shrub planting JSON dataset, including: The tree and shrub planting prediction map is color restored according to the preset color tolerance value to obtain the restored tree and shrub planting map. The density-based noise spatial clustering method is used to cluster the pixel positions of trees and shrubs of the same color in the restored tree and shrub planting map to obtain the clustered tree and shrub planting map after clustering. Based on the plant attribute database, the colors in the clustered tree and shrub planting map are converted into corresponding numerical serial numbers. The pixel coordinates of the center point of the tree and shrub in the clustered tree and shrub planting map and the pixel size of the crown data are converted into world coordinates and world size relative to the origin, thus obtaining the original predicted tree and shrub planting JSON dataset.
6. The method for generating a plan of tree and shrub planting design in a residential community according to claim 2, characterized in that, The expression for the loss function during training of the conditional generative adversarial network model is: ; in, ; ; This is the final loss value; Indicates the input image; Represents the real image paired with x; Represents a random noise vector; The image generated by generator G based on x and z; To help discriminator D determine the true image pair The probability of it being true; This indicates that the discriminator D judges the generated image pairs. The probability of it being true; express and Between distance; These are the weighting coefficients; These are high-frequency feature loss values; It represents the mathematical expectation of the joint probability distribution of x and y; Indicates the relationship between x and The mathematical expectation of the joint probability distribution; It represents the mathematical expectation of the joint probability distribution of x, y, and z; for Loss value.
7. The method for generating a plan of tree and shrub planting design in a residential community according to claim 2, characterized in that, The input and output resolution of the conditional generative adversarial network model is 2048x2048 pixels.
8. The method for generating a plan of tree and shrub planting design in a residential community according to claim 5, characterized in that, The preset color tolerance value is 5.
9. A system for generating a plan of tree and shrub planting design in a residential community, characterized in that, The system applied to the method for generating a plan of tree and shrub planting design in a residential community as described in claim 1, comprises: The dataset construction module is used to construct the plant attribute database, assign plant legends to each type of plant in the plant attribute database to obtain the CAD plant library, obtain the plan construction drawings of the target residential community garden construction and greening design, and simplify, label and size the plan construction drawings to obtain the image dataset. The model training module is used to train a pre-built conditional generative adversarial network model using the image dataset to obtain the tree and shrub planting design generation model. The image output module is used to determine the landscape design of the residential community to be predicted, obtain the environmental label map of the site to be predicted, and input the environmental label map of the site to be predicted into the tree and shrub planting design generation model for prediction generation to obtain the tree and shrub planting prediction map. The data extraction module is used to extract and transform the label information in the tree and shrub planting prediction map to obtain the original predicted tree and shrub planting JSON dataset; The format conversion module is used to match the plant name, standard crown width, diameter at breast height, and height data of the original predicted tree and shrub planting JSON dataset according to the plant attribute database to obtain the final predicted tree and shrub planting JSON dataset. The final predicted tree and shrub planting JSON dataset is imported into the CAD platform, and the final predicted tree and shrub planting JSON dataset is matched with the map blocks according to the CAD plant library to obtain the predicted tree and shrub planting drawing file.
Citation Information
Patent Citations
CAD design drawing generation method and system
CN119180071A
Subway room layout design method and system based on conditional generative adversarial network
CN119293920A