Residence community tree and shrub planting design plane scheme generation method and system
By constructing a plant attribute database and conditional generation adversarial network model, and automatically generating a tree and shrub planting design solution, the complexity of tree and shrub planting design and the operation problems of parameterization tool are solved, and the function of rapid generation and direct conversion to CAD drawings is realized.
Patent Information
- Application Number
- CN202510662029.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-22
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-05-22
AI Technical Summary
The existing technology cannot automatically handle the complexity of tree and shrub planting design, the parameterized design tool is difficult to operate, the design cycle is long, and the generation plan cannot be directly converted into editable CAD drawings.
The plant attribute database is constructed, and the conditional generation adversarial network model is used to train the tree shrub planting design generation model, and the tree shrub planting prediction diagram is generated through the picture data set, and the label information is converted into CAD drawings.
It realizes the automation and rapid generation of tree and shrub planting design, reduces manual operations, shortens the design cycle, and directly converts the prediction solution into editable CAD drawings, improving the flexibility and convenience of the system.
Smart Images

Figure CN120448565A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of greening design, and in particular to a method and system for generating a design plane plan for planting trees and shrubs in a residential area. Background Art
[0002] Greenery design is a crucial component of landscape architecture and a key feature distinguishing it from architectural design and urban planning. It plays a crucial role in enhancing spatial aesthetics, improving the ecological environment, and enhancing user comfort. Plant designers arrange and plan plants based on the site's environmental conditions and functional requirements, ultimately presenting them in the form of a greenery plan. Trees and shrubs, with their unique ecological and landscape value, play a crucial role in greenery design. Currently, in actual design, greenery plans are primarily drawn manually by landscape designers using a CAD platform. The specific process involves considering basic plant arrangement principles, copying a plant legend in DWG format into the CAD platform, pasting the legend to the planting location, and then modifying information such as plant name, height, diameter at breast height, and crown width. This process repeats repeatedly until the greenery plan is finally created, typically taking three to five days. Existing greenery design methods include parametric technology, which extracts various parameters and rules based on influencing mechanisms such as the environment, topography, and plant characteristics. This abstracts the design problem through the construction of design logic, and establishes relationships between parameters based on these rules. Relying on software such as Rhino and Grasshopper for operation set compilation and data calculation, a series of algorithms are used to describe the design logic, and a parametric generation model is constructed to ultimately form a reference plan for the overall layout of trees and shrubs. Artificial intelligence technology, based on artificial neural networks, uses the plant species database as the input layer, and the natural environmental factors of plants, planting matching methods and other related factors constitute the hidden layer. By adjusting the input information, parameter thresholds and incentive functions, a variety of tree and shrub planting design plans are output.
[0003] However, due to the diversity and complexity of tree and shrub selection and matching, there is currently no research on using generative adversarial networks to generate tree and shrub plan solutions; parameterization is forward deduced through artificial logic, not automated design; when using artificial neural networks for plant design, the program will continue to configure the number of plants until the sum of the projected area of the tree and shrub crowns and the tree and shrub vegetation area reaches the greening rate index or other design indicator settings, resulting in a lot of time required to generate each solution; parametric design tools such as Rhino and Grasshopper are difficult to operate, and designers need to have good parametric logic, otherwise it will be difficult to understand and operate related programs. Summary of the Invention
[0004] In order to overcome the deficiencies of the prior art, the present invention aims to provide a method and system for generating a design plan for tree and shrub planting in a residential area, thereby realizing automatic and rapid generation of a tree and shrub planting plan.
[0005] To achieve the above object, the present invention provides the following solutions:
[0006] A method for generating a plan design for tree and shrub planting in a residential area, comprising:
[0007] Build a plant attribute database;
[0008] Assigning a plant legend to each type of plant in the plant attribute database to obtain a CAD plant library;
[0009] Obtain the plan construction drawings of the garden construction and greening design of the target residential area;
[0010] Simplifying, labeling, and resizing the planar construction drawings to obtain an image dataset; the image dataset includes: a site environment label map and a tree and shrub planting label map;
[0011] Using the image dataset to train a pre-built conditional generative adversarial network model to obtain a trained tree and shrub planting design generation model;
[0012] Determine the garden design of the residential area to be predicted and obtain the environmental label map of the predicted site;
[0013] Inputting the to-be-predicted site environment label map into the tree and shrub planting design generation model for prediction generation to obtain a tree and shrub planting prediction map;
[0014] Data extraction and conversion 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; the label information includes: the color, center point coordinates and crown width data of the tree and shrub labels;
[0015] According to the plant attribute database, the original predicted tree and shrub planting JSON dataset is matched with plant name, standard crown width, diameter at breast height and height data to obtain a 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 block matched according to the CAD plant library to obtain a tree and shrub predicted planting drawing file.
[0016] Preferably, the planar construction drawing is simplified, labeled, and resized to obtain an image dataset, including:
[0017] Simplifying the plan construction drawing and deleting redundant elements to obtain a garden construction element diagram and a plant arrangement diagram;
[0018] Labeling the garden construction element map according to the plan construction drawing to obtain the site environment label map;
[0019] Combining the site environment label map and the plant arrangement map to obtain a general map;
[0020] Divide the general map into regions to obtain a plurality of segmentation frames and the segmented site environment label map, and convert the site environment label map into a PNG file format;
[0021] Use a preset plug-in to read the world coordinates of the upper left corner of each segmentation frame and the variety and crown width data of the tree and shrub legend in the segmentation frame, determine the world coordinates of the upper left corner of the segmentation frame as the origin of the segmentation frame, read the coordinate data of the center point of the tree and shrub legend relative to the origin, obtain the relative coordinates of the center point, convert the world coordinates of the upper left corner of the segmentation frame, the variety and crown width data, and the relative coordinates of the center point into JSON format, and obtain a real designed tree and shrub JSON dataset;
[0022] The relative coordinates of the center point and the world size of the crown in the real designed tree and shrub JSON dataset are converted into pixel coordinates and pixel size, and the plant arrangement diagram is labeled according to the variety, crown pixel size, center point pixel coordinate data of the tree and shrub legend and the color RGB in the plant attribute database to obtain the tree and shrub planting label diagram.
[0023] Preferably, the conditional generative adversarial network model is a pix2pix model.
[0024] Preferably, data extraction and conversion 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:
[0025] Performing color restoration on the tree and shrub planting prediction map according to a preset color tolerance value to obtain a restored tree and shrub planting map;
[0026] Clustering the positions of tree and shrub pixels of the same color in the restored tree and shrub planting map using a density-based noise spatial clustering method to obtain a clustered tree and shrub planting map after clustering processing;
[0027] According to the plant attribute library, the colors in the clustered tree and shrub planting map are converted into corresponding digital serial numbers, and the pixel coordinates of the center points of the trees and shrubs 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 to obtain the original predicted tree and shrub planting JSON dataset.
[0028] Preferably, the plant attribute database includes: tree species name, standard diameter at breast height data, height data, crown width data, digital serial number and label color RGB.
[0029] Preferably, the format of the tree and shrub predicted planting drawing file is dwg format.
[0030] Preferably, the loss function during training of the conditional generative adversarial network model is expressed as:
[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 * is the final loss value; x represents the input image; y represents the real image paired with x; z represents the 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 that the real image pair (x,y) is real; D(x,G(x,z)) represents the probability that the discriminator D judges that the generated image pair (x,G(x,z)) is real; ||yG(x,z)||1 represents the L1 distance between y and G(x,z); λ is the weight coefficient; L cGAN (G, D) is the high-frequency feature loss value; E x,y Represents the mathematical expectation of the joint distribution probability of x and y; E x,z represents the mathematical expectation of the joint distribution probability of x and z; E x,y,z Represents the mathematical expectation of the joint probability distribution of x, y, and z.
[0035] Preferably, the resolution of the input and output 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 for designing tree and shrub planting in a residential area includes:
[0038] a data set construction module for constructing a plant attribute database, assigning a plant legend to each plant type in the plant attribute database to obtain the CAD plant library, obtaining plan construction drawings of the garden construction and greening design of the target residential area, and simplifying, labeling, and resizing the plan construction drawings to obtain the image dataset;
[0039] A 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] An image output module is used to determine the garden design of the residential area to be predicted, obtain the label map of the site environment to be predicted, input the label map of the site environment to be predicted into the tree and shrub planting design generation model for prediction and generation, and obtain the tree and shrub planting prediction map;
[0041] A 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] A 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, import the final predicted tree and shrub planting JSON dataset into the CAD platform, and perform block matching on the final predicted tree and shrub planting JSON dataset according to the CAD plant library to obtain the tree and shrub predicted planting drawing file.
[0043] The present invention discloses the following technical effects:
[0044] The present invention provides a method and system for generating a plan plan for tree and shrub planting designs in a residential area. By using a constructed image data set to train a tree and shrub planting design generation model, the problems that existing methods are unable to handle complex tree and shrub combinations, conventional parameter setting software is difficult to operate, and the design cycle is long are solved. The function of directly generating a plan plan for tree and shrub planting designs using a site environment label map is realized. By extracting label information from a tree and shrub planting prediction map and converting the prediction map into a CAD drawing, the problem that existing generation methods are unable to directly and accurately convert the prediction plan map into an editable file is solved, and the automatic conversion of the plan drawing to the CAD drawing is realized. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0046] Figure 1 A schematic diagram of the process for generating a plan design for tree and shrub planting in a residential area according to an embodiment of the present invention;
[0047] Figure 2 A schematic diagram of a plant attribute database provided by an embodiment of the present invention;
[0048] Figure 3 Schematic diagram of the CAD plant library provided by an embodiment of the present invention;
[0049] Figure 4 A site environment label diagram provided by an embodiment of the present invention;
[0050] Figure 5 A tree and shrub planting label diagram provided by an embodiment of the present invention;
[0051] Figure 6 A schematic diagram of an image dataset provided by an embodiment of the present invention;
[0052] Figure 7 A schematic diagram of the conditional generative adversarial network model training provided by an embodiment of the present invention;
[0053] Figure 8 A tree and shrub planting prediction map provided by an embodiment of the present invention;
[0054] Figure 9 Clustered tree and shrub planting diagram and data extraction and conversion diagram provided by an embodiment of the present invention;
[0055] Figure 10 A schematic diagram of a CAD file for predicting tree and shrub planting provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0056] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0057] The purpose of the present invention is to provide a method and system for generating a design plan for tree and shrub planting in a residential area, so as to realize automatic and rapid generation of a tree and shrub planting plan.
[0058] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0059] Figure 1 The schematic diagram of the process of generating a design plan for planting trees and shrubs in a residential area according to an embodiment of the present invention is as follows: Figure 1 As shown, the present invention provides a method for generating a plan design scheme for tree and shrub planting in a residential area, comprising:
[0060] Step 100: Building a plant attribute database;
[0061] Step 200: assigning a plant legend to each type of plant in the plant attribute database to obtain a CAD plant library;
[0062] Step 300: Obtaining plan construction drawings of the garden construction and greening design of the target residential area;
[0063] Step 400: Simplify, label, and size the planar construction drawing to obtain an image dataset; the image dataset includes: a site environment label image and a tree and shrub planting label image;
[0064] Step 500: using the image dataset to train a pre-built conditional generative adversarial network model to obtain a trained tree and shrub planting design generation model;
[0065] Step 600: Determine the garden design of the residential area to be predicted and obtain a label map of the site environment to be predicted;
[0066] Step 700: inputting the to-be-predicted site environment label map into the tree and shrub planting design generation model for prediction generation to obtain a tree and shrub planting prediction map;
[0067] Step 800: extracting and transforming the label information in the tree and shrub planting prediction map to obtain an original predicted tree and shrub planting JSON dataset; the label information includes: the color, center point coordinates, and canopy data of the tree and shrub labels;
[0068] Step 900: 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 a final predicted tree and shrub planting JSON dataset, import the final predicted tree and shrub planting JSON dataset into the CAD platform, and perform block matching on the final predicted tree and shrub planting JSON dataset according to the CAD plant library to obtain a tree and shrub predicted planting drawing file.
[0069] Specifically, the planar construction drawings are simplified, labeled, and resized to obtain an image dataset, including:
[0070] Simplifying the plan construction drawing and deleting redundant elements to obtain a garden construction element diagram and a plant arrangement diagram;
[0071] Labeling the garden construction element map according to the plan construction drawing to obtain the site environment label map;
[0072] Combining the site environment label map and the plant arrangement map to obtain a general map;
[0073] Divide the general map into regions to obtain a plurality of segmentation frames and the segmented site environment label map, and convert the site environment label map into a PNG file format;
[0074] Use a preset plug-in to read the world coordinates of the upper left corner of each segmentation frame and the variety and crown width data of the tree and shrub legend in the segmentation frame, determine the world coordinates of the upper left corner of the segmentation frame as the origin of the segmentation frame, read the coordinate data of the center point of the tree and shrub legend relative to the origin, obtain the relative coordinates of the center point, convert the world coordinates of the upper left corner of the segmentation frame, the variety and crown width data, and the relative coordinates of the center point into JSON format, and obtain a real designed tree and shrub JSON dataset;
[0075] The relative coordinates of the center point and the world size of the crown in the real designed tree and shrub JSON dataset are converted into pixel coordinates and pixel size, and the plant arrangement diagram is labeled according to the variety, crown pixel size, center point pixel coordinate data of the tree and shrub legend and the color RGB in the plant attribute database to obtain the tree and shrub planting label diagram.
[0076] Preferably, the conditional generative adversarial network model is a pix2pix model.
[0077] Specifically, 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:
[0078] Performing color restoration on the tree and shrub planting prediction map according to a preset color tolerance value to obtain a restored tree and shrub planting map;
[0079] Clustering the positions of tree and shrub pixels of the same color in the restored tree and shrub planting map using a density-based spatial clustering of applications with noise to obtain a clustered tree and shrub planting map after clustering processing;
[0080] According to the plant attribute library, the colors in the clustered tree and shrub planting map are converted into corresponding digital serial numbers, and the pixel coordinates of the center points of the trees and shrubs 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 to obtain the original predicted tree and shrub planting JSON dataset.
[0081] Preferably, the plant attribute database includes: tree species name, standard diameter at breast height data, height data, crown width data, digital serial number and label color RGB.
[0082] Specifically, the format of the tree and shrub predicted planting drawing file is dwg format.
[0083] Preferably, the loss function during training of the conditional generative adversarial network model is expressed as:
[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 * is the final loss value; x represents the input image; y represents the real image paired with x; z represents the 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 that the real image pair (x,y) is real; D(x,G(x,z)) represents the probability that the discriminator D judges that the generated image pair (x,G(x,z)) is real; ||yG(x,z)||1 represents the L1 distance between y and G(x,z); λ is the weight coefficient; L cGAN (G, D) is the high-frequency feature loss value; E x,y Represents the mathematical expectation of the joint distribution probability of x and y; E x,z represents the mathematical expectation of the joint distribution probability of x and z; E x,y,z 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 for designing tree and shrub planting in a residential area includes:
[0091] a data set construction module for constructing a plant attribute database, assigning a plant legend to each plant type in the plant attribute database to obtain the CAD plant library, obtaining plan construction drawings of the garden construction and greening design of the target residential area, and simplifying, labeling, and resizing the plan construction drawings to obtain the image dataset;
[0092] A 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] An image output module is used to determine the garden design of the residential area to be predicted, obtain the label map of the site environment to be predicted, input the label map of the site environment to be predicted into the tree and shrub planting design generation model for prediction and generation, and obtain the tree and shrub planting prediction map;
[0094] A 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] A 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, import the final predicted tree and shrub planting JSON dataset into the CAD platform, and perform block matching on the final predicted tree and shrub planting JSON dataset according to the CAD plant library to obtain the tree and shrub predicted planting drawing file.
[0096] Preferably, data such as the name, diameter at breast height, 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. RGB colors different from those in the site environment label map are randomly assigned to the plants in the plant attribute database. A plant legend is assigned to each plant type in the plant attribute database to form a CAD plant library. Construction drawings of the garden and greening design for residential community landscape architecture are obtained, simplified, labeled, and resized to obtain the site environment label maps and tree and shrub planting label maps corresponding to the garden and greening design plan drawings. An image dataset is then constructed based on the corresponding site environment label maps and tree and shrub planting label maps.
[0097] Specifically, Figure 2 This is a schematic diagram of a plant attribute database provided by an example of the present invention, which includes data such as the names, diameter at breast height, height, and crown width of commonly used tree species in the target area. Figure 3 This is a schematic diagram of a CAD plant library including plant legends and attributes provided by an example of the present invention. Figure 4 This is a schematic diagram of a method of labeling a garden construction plan drawing to obtain a site environment label map corresponding to the garden construction plan drawing, provided by an embodiment of the present invention. Figure 5 This is a schematic diagram of labeling a greening design plane construction drawing to obtain a tree and shrub planting label map corresponding to the greening design plane construction drawing provided by an example of the present invention, see Figure 4 and Figure 5 , simplify, label and size the plane drawings, and obtain the site environment label map and tree and shrub planting label map corresponding to the garden construction and greening design plane construction drawings, including:
[0098] Preferably, the garden construction and greening design plan construction drawings in the drawing library are simplified and redundant elements are deleted, and only the outlines of each functional area in the garden construction design plan construction drawings and the plant legends containing information such as position, variety, and crown width in the greening design plan construction drawings are retained, so as to obtain the garden construction element drawings and plant arrangement drawings corresponding to the garden construction and greening design plan construction drawings.
[0099] Furthermore, based on the garden construction element map corresponding to the garden construction plan construction drawing, labels are produced to obtain the site environment label map corresponding to the garden construction elements corresponding to the garden construction plan construction drawing; the RGB three-color channel mode is used to use different color tags in CAD to fill and distinguish each functional area; the site environment label map and the plant arrangement map are merged into a dwg file to form a general map; the general map is divided into several areas: in CAD, the A2 size frame (594×420mm) in the world coordinate is enlarged 300 times (178200×126000mm) to segment the general map; ExtractData is used to read the world coordinates of the upper left corner of each segmentation frame, generate a coordinate JSON file, and use the coordinates of the upper left corner of the segmentation frame as the origin of the area (0,0); the segmented site environment label map is exported as a pdf file of the corresponding size (178200×126000mm ), converted into an A2-sized PNG file (7016×4961Pixel), and then proportionally scaled and filled to 2048×2048Pixel size for easy training later; ExtractData was used to extract the name of the tree and shrub legend in the plant layout diagram within each segmentation frame, the coordinates of the center point relative to the origin, and the crown width data, and merged with the coordinate JSON file to generate a real design tree and shrub JSON dataset; the world size coordinates of the center point relative coordinates and crown width size of the trees and shrubs in the real design tree and shrub JSON dataset were converted into pixel coordinates and sizes. With the center point coordinates as the center of the circle and the crown width as the diameter, a solid circle was drawn on the site environment label map in 2048x2048Pixel PNG format using the Circle command for labeling according to the RGB color assigned to the plant, and the tree and shrub planting label map corresponding to the garden construction elements corresponding to the greening design plan construction drawing was obtained.
[0100] Furthermore, the implementation of the ExtractData plugin includes:
[0101] 1) Create a JSON file.
[0102] 2) Record the coordinates of the selected range: Prompt the user to start from the point in the upper left corner, and select the four corner points of the divided area frame in the order of upper left, lower left, upper right, and lower right in CAD, convert from the user coordinate system to the world coordinate system, and store them (if the point is not successfully specified, the execution will not continue).
[0103] 3) Record the world coordinates of the upper left corner of the selection range 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 four points.
[0105] 5) Extract CAD plant legend data: prompt the user to select a divided area in CAD, filter out plant legends with block reference attributes in the selected content, traverse the selected plant legends, and perform the following operations on each legend:
[0106] Check whether the legend is in the trees and shrubs layer (excluding other layers);
[0107] Check whether the legend contains attribute information such as species, 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 legend relative to the origin of the dividing area frame;
[0110] Fill the extracted coordinate and attribute information into a JsonData object and add it to the list.
[0111] 5) Serialize the data structure into a JSON string, write it into the created JSON file, and output it in the user-specified location.
[0112] Specifically, a conditional generative adversarial network model is trained using an image dataset to obtain a trained conditional generative adversarial network model. The conditional generative adversarial network model uses a pix2pix model; the pix2pix model includes a generator G and a discriminator D.
[0113] Furthermore, the generator G uses a U-net network structure to generate a predicted layout map based on the site environment label map and tree and shrub planting label map in the image dataset. The generator consists of 8 convolutional layers and 8 deconvolutional layers. The input 2048×2048 image is gradually downsampled to 8×8 through an 8-layer encoder (4×4 convolution per layer, stride 2, 64→128→256→512→512→512→512→512). It is then gradually upsampled back to 2048×2048 through an 8-layer decoder (4×4 deconvolution per layer, stride 2, 512→512→512→512→256→128→64→3). The encoder features are then fused through skip connections.
[0114] Furthermore, the discriminator D uses a PatchGAN network structure to determine the similarity between the layout diagram and the corresponding layout diagram in the image dataset. It consists of six convolutional layers. The input 2048×2048×6 (the concatenation of the real and generated images) is gradually downsampled to 64×64 through five layers of 4×4 convolution (stride 2, number of channels 64→128→256→512→512). Finally, a layer of 4×4 convolution outputs a 64×64×1 probability map to determine the authenticity of each area of the image.
[0115] Specifically, Figure 6 This is a schematic diagram of a picture dataset based on a site environment label map and a tree and shrub planting label map provided in this embodiment. Figure 7 This is a schematic diagram of the training principle of a conditional generative adversarial network model provided in this embodiment, see Figure 6 and Figure 7 , the process of training the conditional generative adversarial network model using the image dataset is as follows:
[0116] Use the image dataset to train the conditional generative adversarial network model to obtain a trained conditional generative adversarial network model. The training process is as follows:
[0117] 1) Define the loss function of the conditional generative adversarial network model.
[0118] The objective function of the conditional generative adversarial network is defined as:
[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 approach, and can effectively learn the high-frequency features between corresponding images.
[0121] Furthermore, the L1 loss function is introduced to ensure the similarity between the input site environment label map and the corresponding tree and shrub planting label map in low-frequency features:
[0122] L L1 (G)=E x,y,z [||yG(x,z)||1]
[0123] Among them, represents the value of the L1 loss function, which is the loss function of low-frequency features.
[0124] Specifically, based on the loss function of high-frequency features and the loss function of low-frequency features, we can obtain the final loss function, that is, the loss function of the conditional generative adversarial network model:
[0125]
[0126] Among them, arg represents the value of the independent variable when the loss function reaches the extreme value; min G Represents the objective function of minimizing the generator G, max D Represents the objective function of maximizing the discriminator D; argmin G maxD It means finding a parameter combination of generator G and discriminator D so that under this combination, the fake data generated by generator G is as real as possible (that is, the part of the loss function about G is minimized), and the discriminator D distinguishes the real data from the fake data as accurately as possible (that is, the part of the loss function about D is maximized). x,y Represents the mathematical expectation of the joint distribution probability of x and y; E x,y [logD(x,y)] represents the expectation of the log-likelihood of the real image pair (x, y), which measures the average recognition ability of the discriminator for the real image. x,z Represents the mathematical expectation of the joint distribution probability of x and y; E x,z [log(1-D(x,G(x,z)))] represents the expected logarithmic likelihood of the generated image pair (x,G(x,z)), which measures the average recognition ability of the discriminator relative to the generated image. E x,y,z Represents the mathematical expectation of the joint probability distribution of x, y, and z, and is used to represent the mean or center position of a random variable. x,y,z [||yG(x,z)||1] represents the 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 model is iteratively trained using the image dataset. Backpropagation is used to update the parameters of the generator and discriminator in real time. When the loss function converges, training is complete, resulting in a trained conditional generative adversarial network model. This trained conditional generative adversarial network model can be used to map the site environment label map to the tree and shrub planting label map.
[0128] Furthermore, the garden design of each residential area 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 a tree and shrub planting prediction map as the layout of tree and shrub planting in the residential area to be predicted.
[0129] Specifically, Figure 8 This embodiment provides a method for training a conditional generative adversarial network model and generating a tree and shrub planting prediction map based on the trained conditional generative adversarial network model. Figure 8 The process of generating a tree and shrub planting prediction map using the site environment label map of the required layout of the residential area to be predicted includes:
[0130] 1) Label the garden construction plan drawings according to the boundaries and functions of the garden construction elements to be predicted in the residential area.
[0131] 2) The predicted residential area site environment label map is divided and converted into a 2048×2048 pixel PNG file.
[0132] 3) According to the boundaries and functions of the garden construction elements of the residential area to be predicted, the garden construction plan drawings are labeled to obtain the site environment label map.
[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 color, center point coordinates, and size of the tree and shrub labels in the tree and shrub planting prediction map are extracted and converted to obtain a tree and shrub planting prediction JSON dataset.
[0135] See also Figure 9 The process of extracting and transforming the tree and shrub planting prediction map processed by the density-based noise spatial clustering method to obtain the final predicted tree and shrub planting JSON dataset includes:
[0136] 1) Due to image loss during the generation and compression process of the conditional generative adversarial network, color differences occur. Based on the RGB color, the color tolerance value is set to 5. The color of the tree and shrub planting prediction map is matched with the RGB color in the plant attribute database and converted into the corresponding numerical serial number of the plant.
[0137] 2) Using the density-based noise spatial clustering method, all the pixel positions of trees and shrubs with the same color are clustered, and the center point and radius of each cluster are calculated to identify the distribution of plant color blocks in the prediction map, and obtain 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 converted from pixel coordinates and sizes to coordinates and world sizes relative to the origin in the upper left corner of the segmentation map.
[0139] 4) Match the Chinese plant name in the plant attribute database based on the digital ID.
[0140] 5) Using the predicted tree and shrub dataset converted into relative coordinates and world size, the closest standard crown width, diameter at breast height, and height data are matched in the plant attribute database according to 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 was imported into the CAD platform and converted into a visual and editable dwg file.
[0142] See also Figure 10, import the obtained tree and shrub planting JSON file into the CAD platform to obtain a dwg file.
[0143] Preferably, the implementation process of the InsertTree plug-in includes:
[0144] 1) The user imports the tree and shrub planting prediction JSON file.
[0145] 2) Parsing the JSON file: Read the JSON file content and deserialize the JSON string into an object; obtain the value of the upper left corner origin (the origin here is the world coordinate of the upper left corner of the A2-sized frame when the garden environment label map is divided into an A2-sized frame); extract the tree and shrub information (name, coordinates, height, diameter at breast height, crown width, etc.).
[0146] 3) Matching plant legend:
[0147] Traverse 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 according to the plant name;
[0149] After finding the corresponding legend, modify the text string of the legend attribute 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 JSON are added and restored in CAD according to the world coordinates of the upper left corner of the segmentation diagram, and the corresponding plant legend with modified properties is inserted into the CAD garden construction 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 the present invention are as follows:
[0154] The present invention uses the constructed image dataset to train the tree and shrub planting design generation model, which can automatically and quickly generate tree and shrub planting prediction plans that conform to the garden design, reducing a large number of repetitive manual operations and shortening the design cycle; by extracting label information from the tree and shrub planting prediction map, the prediction map is converted into a CAD drawing, which is convenient for visualization and subsequent modification by designers, thereby improving the flexibility and convenience of the system.
[0155] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0156] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only intended to help understand the method and core concept of the present invention. At the same time, those skilled in the art will find that the specific implementation methods and application scopes may vary based on the concept of the present invention. In summary, the contents of this specification should not be construed as limiting the present invention.
Claims
1. A method for generating a plan design for tree and shrub planting in a residential area, characterized in that: include: Build a plant attribute database; Assigning a plant legend to each type of plant in the plant attribute database to obtain a CAD plant library; Obtain the plan construction drawings of the garden construction and greening design of the target residential area; Simplifying, labeling, and resizing the planar construction drawings to obtain an image dataset; the image dataset includes: a site environment label map and a tree and shrub planting label map; Using the image dataset to train a pre-built conditional generative adversarial network model to obtain a trained tree and shrub planting design generation model; Determine the garden design of the residential area to be predicted and obtain the environmental label map of the predicted site; Inputting the to-be-predicted site environment label map into the tree and shrub planting design generation model for prediction generation to obtain a tree and shrub planting prediction map; Data extraction and conversion 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; the label information includes: the color, center point coordinates and crown width data of the tree and shrub labels; According to the plant attribute database, the original predicted tree and shrub planting JSON dataset is matched with plant name, standard crown width, diameter at breast height and height data to obtain a 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 block matched according to the CAD plant library to obtain a tree and shrub predicted planting drawing file.
2. The method for generating a plan plan for planting trees and shrubs in a residential area according to claim 1, characterized in that: The planar construction drawings are simplified, labeled, and resized to obtain an image dataset, including: Simplifying the plan construction drawing and deleting redundant elements to obtain a garden construction element diagram and a plant arrangement diagram; Labeling the garden construction element map according to the plan construction drawing to obtain the site environment label map; Combining the site environment label map and the plant arrangement map to obtain a general map; Divide the general map into regions to obtain a plurality of segmentation frames and the segmented site environment label map, and convert the site environment label map into a PNG file format; Use a preset plug-in to read the world coordinates of the upper left corner of each segmentation frame and the variety and crown width data of the tree and shrub legend in the segmentation frame, determine the world coordinates of the upper left corner of the segmentation frame as the origin of the segmentation frame, read the coordinate data of the center point of the tree and shrub legend relative to the origin, obtain the relative coordinates of the center point, convert the world coordinates of the upper left corner of the segmentation frame, the variety and crown width data, and the relative coordinates of the center point into JSON format, and obtain a real designed tree and shrub JSON dataset; The relative coordinates of the center point and the world size of the crown in the real designed tree and shrub JSON dataset are converted into pixel coordinates and pixel size, and the plant arrangement diagram is labeled according to the variety, crown pixel size, center point pixel coordinate data of the tree and shrub legend and the color RGB in the plant attribute database to obtain the tree and shrub planting label diagram.
3. The method for generating a residential area tree and shrub planting design plan according to claim 1, characterized in that: The conditional generative adversarial network model is a pix2pix model.
4. The method for generating a residential area tree and shrub planting design plan according to claim 1, characterized in that: The plant attribute database includes: tree species name, standard breast diameter data, height data, crown width data, digital serial number and label color RGB.
5. The method for generating a residential area tree and shrub planting design plan according to claim 1, characterized in that: The format of the tree and shrub predicted planting drawing file is dwg format.
6. The method for generating a plan plan for planting trees and shrubs in a residential area according to claim 2, characterized in that: Data extraction and conversion 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: Performing color restoration on the tree and shrub planting prediction map according to a preset color tolerance value to obtain a restored tree and shrub planting map; Clustering the positions of tree and shrub pixels of the same color in the restored tree and shrub planting map using a density-based noise spatial clustering method to obtain a clustered tree and shrub planting map after clustering processing; According to the plant attribute library, the colors in the clustered tree and shrub planting map are converted into corresponding digital serial numbers, and the pixel coordinates of the center points of the trees and shrubs 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 to obtain the original predicted tree and shrub planting JSON dataset.
7. The method for generating a residential area tree and shrub planting design plan according to claim 3, characterized in that: The expression of the loss function during the training of the conditional generative adversarial network model is: Among them, L cGAN (G,D) = E x,y [logD(x,y)] + E x,z [log(1 - D(x,G(x,z)))]; L L1 (G) = E x,y,z [||y - G(x,z)||1]; G * is the final loss value; x represents the input image; y represents the real image paired with x; z represents the 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 that the real image pair (x,y) is real; D(x,G(x,z)) represents the probability that the discriminator D judges that the generated image pair (x,G(x,z)) is real; ||yG(x,z)||1 represents the L1 distance between y and G(x,z); λ is the weight coefficient; L cGAN (G, D) is the high-frequency feature loss value; E x,y Represents the mathematical expectation of the joint distribution probability of x and y; E x,z represents the mathematical expectation of the joint distribution probability of x and z; E x,y,z Represents the mathematical expectation of the joint probability distribution of x, y, and z.
8. The method for generating a residential area tree and shrub planting design plan according to claim 3, characterized in that: The input and output resolution of the conditional generative adversarial network model is 2048x2048 pixels.
9. The method for generating a design plan for planting trees and shrubs in a residential area according to claim 6, characterized in that: The preset color tolerance value is 5.
10. A system for generating a plan for designing trees and shrubs for planting in residential areas, characterized in that: The method for generating a residential area tree and shrub planting design plan according to claim 1 includes: a data set construction module for constructing a plant attribute database, assigning a plant legend to each plant type in the plant attribute database to obtain the CAD plant library, obtaining plan construction drawings of the garden construction and greening design of the target residential area, and simplifying, labeling, and resizing the plan construction drawings to obtain the image dataset; A 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; An image output module is used to determine the garden design of the residential area to be predicted, obtain the label map of the site environment to be predicted, input the label map of the site environment to be predicted into the tree and shrub planting design generation model for prediction and generation, and obtain the tree and shrub planting prediction map; A 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; A 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, import the final predicted tree and shrub planting JSON dataset into the CAD platform, and perform block matching on the final predicted tree and shrub planting JSON dataset according to the CAD plant library to obtain the tree and shrub predicted planting drawing file.
Citation Information
Patent Citations
Greening construction drawing template and method
CN108920756A
Image processing method and system in garden design based on generative adversarial network
CN112861217A
Semantic segmentation and point cloud processing combined plant recognition and model construction method
CN113128405A
Garden concept graph generation method and system based on image recognition
CN113689522A
3D vegetation map generation method and device, electronic equipment and storage medium
CN114969917A