Urban scene generation method based on artificial intelligence and computer readable storage medium
By using an AI-based urban scene generation method, functional areas are automatically identified and vectorized, differentiable objective functions and boundary constraint functions are constructed, and the layout of the 3D model is optimized using the gradient descent method. This solves the problems of insufficient generation efficiency and layout rationality in existing technologies, and realizes efficient and automated 3D urban scene generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-22
- Publication Date
- 2026-03-31
AI Technical Summary
Existing technologies struggle to achieve a good balance between generation efficiency, layout rationality, and user controllability, and their low level of automation results in severe phenomena such as floating objects, interpenetration, and structural distortion in the generated 3D city scenes, making it difficult to meet actual planning needs.
An AI-based urban scene generation method is adopted, which automatically identifies and vectorizes functional areas through a semantic segmentation model, constructs a differentiable objective function and boundary constraint function, and uses gradient descent to optimize the layout of the 3D model to ensure legal areas and avoid collisions.
It has achieved automated and intelligent generation from two-dimensional graphic data to three-dimensional urban scenes, improving generation efficiency and layout rationality, reducing manual intervention, and ensuring the physical regularity and diversity of the generated results.
Smart Images

Figure CN121767557A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of urban design, and in particular to an artificial intelligence-based method for generating urban scenes and a computer-readable storage medium. Background Technology
[0002] In fields such as urban planning, digital twins, and virtual reality, the rapid generation of 3D urban scene layouts that conform to physical rules and functional requirements plays an increasingly important role and is a key link in realizing scene digitization and intelligent construction.
[0003] Currently, mainstream 3D generation technologies face severe challenges in this task. First, most advanced generation models (such as Generative Adversarial Networks) are essentially designed for generating single objects. When directly applied to complex urban scenes containing numerous objects such as buildings, roads, and vegetation, they often fall short. These models typically use a global encoding to describe the entire scene, ignoring the inherent compositional logic of the scene and the independent properties between objects. This leads to phenomena in the generated results that severely violate physical laws, such as floating objects, interlocking objects, and structural distortions, significantly reducing their practicality. Second, existing technologies have significant bottlenecks in the controllability of the generation process. Although control methods such as GAN inversion exist, their optimization processes are often computationally expensive, inefficient, and prone to getting trapped in local optima. This makes it difficult for users to effectively intervene and finely adjust the scene layout through intuitive commands, greatly limiting the application and widespread adoption of these technologies in real-world projects requiring clear planning intentions.
[0004] In summary, existing technologies struggle to achieve a good balance between generation efficiency, layout rationality, and user controllability, and rely heavily on manual design and adjustments, resulting in a low level of automation. Therefore, there is an urgent need for a generation method that can generate urban scenes with a high degree of automation. Summary of the Invention
[0005] In order to overcome the above-mentioned technical defects, the purpose of this invention is to provide an artificial intelligence-based urban scene generation method and a computer-readable storage medium.
[0006] This invention discloses an artificial intelligence-based urban scene generation method, comprising: Based on the input graphic data, different functional areas are automatically identified and extracted, and each functional area is vectorized into a polygon; and each polygon is given structural features including shape, area and orientation. Based on the structured features of polygons, the corresponding 3D models are matched for each functional area from a pre-set model library, and an initial layout of the 3D models is generated; the initial layout includes the position information and orientation of the models. Construct differentiable boundary constraint functions for each functional area, and define the legal regions of each functional area through the boundary constraint functions; Define a differentiable objective function, which includes a boundary loss term based on the boundary constraint function and a collision loss term to prevent cross-model penetration. Starting with the initial layout, the differentiable objective function is optimized using the gradient descent method, and the layout of each 3D model is iteratively adjusted to obtain the final urban scene.
[0007] Preferably, based on the input graphic data, automatically identifying and extracting different functional areas includes: The graphic data, including remote sensing images and vector base maps, is processed using a semantic segmentation artificial intelligence model.
[0008] Preferably, the semantic segmentation AI model includes SegFormer, which integrates a DeepLabv3+ module with an ASPP module and / or a Transformer encoder.
[0009] Preferably, matching 3D model categories are selected from a predefined set of models based on the geometric properties of each polygon; For each functional area, construct a set of candidate placement points, where: For building functional areas, a uniform point cloud is generated inside its polygon using the graph Laplacian operator; For road functional zones, the skeleton is extracted by eroding its polygons to obtain the centerline, and interpolation sampling is performed along the centerline to generate facility placement points; For vegetation functional zones, random planting points with controlled minimum spacing are generated within their polygons; After obtaining candidate placement points, a parametric layout strategy is applied to determine the initial position of each 3D model, where: For the building model, the model is scaled, rotated and staggered according to the floor area ratio or height limit corresponding to the functional area; For the road facility model, based on the road grade and node topology, smooth arches are automatically inserted at road intersections and the road edges are offset. For vegetation models, model selection is based on tree canopy diameter and terrain elevation, and models with different levels of detail are assigned according to visual importance.
[0010] Preferably, the differentiable boundary constraint function is a signed distance function; the signed distance function represents the shortest distance from any point in two-dimensional space to the boundary of the polygon, and the sign of the function value distinguishes whether the point is inside or outside the polygon.
[0011] Preferably, the symbolic distance function specifically includes: Decompose the boundary of the polygon into n boundary line segments; Calculate the shortest distance from any point to be projected to each boundary line segment; Take the minimum of all shortest distances as the distance from any point to be projected to the polygon boundary; The method of ray casting or angle rotation is used to determine whether any point to be projected is inside or outside the polygon, and the distance is assigned a corresponding positive or negative sign to obtain the final signed distance function value.
[0012] Preferably, a signed distance function is constructed for each polygon corresponding to a functional area, including: A high-resolution SDF value grid is pre-constructed for the polygon; During the optimization process, the SDF value corresponding to any point is queried through bilinear interpolation.
[0013] Preferably, starting from the initial layout, optimizing the differentiable objective function using gradient descent includes: The Adam optimizer is used to iteratively update the initial layout of each 3D model, using the initial layout of each model as the optimization variable. The differentiable objective function is a weighted sum of the boundary loss term and the collision loss term. During the optimization process, the boundary loss term is calculated based on the differentiable boundary constraint function and is used to generate gradients to place out-of-bounds 3D models into the legal functional area. The collision loss term is used to generate gradients to separate models that overlap or are too close to each other.
[0014] Preferably, the collision loss term is calculated based on the intersection-union ratio of the bounding boxes of any two 3D models and the normalized distance between the center points of the two bounding boxes.
[0015] A second aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the artificial intelligence-based urban scene generation method described above.
[0016] Compared with existing technologies, the above technical solution has the following advantages: 1. This invention provides an artificial intelligence-based method for generating urban scenes, which can intelligently transform input two-dimensional graphic data into a reasonable three-dimensional urban scene layout. This method automatically identifies and vectorizes urban functional areas, laying a structured foundation for 3D generation; subsequently, it automatically matches 3D assets and generates a high-quality initial layout, greatly improving the efficiency of scene construction. Its core lies in introducing a differentiable optimization framework, transforming complex spatial layout rules (such as boundary compliance and collision avoidance) into a computable loss function. This allows the use of gradient descent algorithms to automatically and efficiently solve for a final layout that conforms to real-world constraints and is rationally arranged, thus generating a relatively reliable urban model without human intervention. 2. Advanced semantic segmentation models (such as DeepLabv3+ and SegFormer) enable accurate and automated identification and extraction of urban functional zones, providing a reliable data foundation for the entire process. Furthermore, its innovative initial layout strategy intelligently generates layout drafts that are reasonably distributed and conform to actual planning parameters (such as plot ratio and road grade) for different functional zones, including buildings, roads, and vegetation. This not only ensures the diversity and practicality of the generated scenarios but also provides an excellent starting point for subsequent optimization, significantly reducing the overall computational burden. 3. Furthermore, a differentiable optimization mechanism is employed. By constructing a symbolic distance function (SDF) as a differentiable boundary constraint, the boundary rules are transformed into a differentiable mathematical expression, enabling the optimization process to automatically and smoothly "pull" out-of-bounds assets back into the legal region. Simultaneously, by comprehensively considering the collision loss function of intersection-union ratio and spacing, overlapping or overly close models are intelligently "pushed apart." This mechanism ensures that the final layout strictly satisfies all spatial physical constraints while maintaining high computational efficiency and fully utilizing hardware resources. Attached Figure Description
[0017] Figure 1 A flowchart of the AI-based urban scene generation method provided in this application. Detailed Implementation
[0018] The advantages of the present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments.
[0019] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0020] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0021] It should be understood that although the terms first, second, third, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, without departing from the scope of this disclosure, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0022] In the description of this invention, it should be understood that the terms "longitudinal", "lateral", "up", "down", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0023] In the description of this invention, unless otherwise specified and limited, it should be noted that the terms "installation", "connection" and "linking" should be interpreted broadly. For example, they can refer to mechanical or electrical connections, or internal connections between two components. They can be direct connections or indirect connections through an intermediate medium. Those skilled in the art can understand the specific meaning of the above terms according to the specific circumstances.
[0024] In the following description, suffixes such as "module," "part," or "unit" used to denote elements are used only for the convenience of the description of the invention and have no specific meaning in themselves. Therefore, "module" and "part" can be used interchangeably.
[0025] Please see Figure 1 , Figure 1 A flowchart of the AI-based urban scene generation method provided in this application.
[0026] like Figure 1 As shown, this invention discloses an artificial intelligence-based urban scene generation method, including: Based on the input graphic data, different functional areas are automatically identified and extracted, and each functional area is vectorized into a polygon; and each polygon is given structural features including shape, area and orientation. Based on the structured features of polygons, the corresponding 3D models are matched for each functional area from a pre-set model library, and an initial layout of the 3D models is generated; the initial layout includes the position information and orientation of the models. Construct differentiable boundary constraint functions for each functional area, and define the legal regions of each functional area through the boundary constraint functions; Define a differentiable objective function, which includes a boundary loss term based on the boundary constraint function and a collision loss term to prevent cross-model penetration. Starting with the initial layout, the differentiable objective function is optimized using the gradient descent method, and the layout of each 3D model is iteratively adjusted to obtain the final urban scene.
[0027] This can be understood as follows: the core of this invention lies in constructing a complete differentiable computational process, transforming the complex urban scene layout problem into an automatically optimizable mathematical problem. First, the system automatically identifies and extracts different functional areas based on the input graphic data, and converts each functional area into a polygon representation with structured features. For example, the system can accurately divide different types of functional areas such as building land, road traffic, and green areas, and assign geometric attributes, including shape, area, and orientation, to each polygon, establishing an accurate semantic foundation for subsequent 3D layout.
[0028] Next, based on the structured features of each polygon, the system automatically matches the corresponding 3D model from a pre-set 3D model library and generates an initial layout. At this stage, the system intelligently selects appropriate building, road infrastructure, or vegetation models according to the type and characteristics of the functional areas, and determines their initial positions and orientations within the scene. In this way, the system can quickly construct a basic scene framework that conforms to the functional area division and has reasonable spatial relationships.
[0029] The system then constructs differentiable boundary constraint functions for each functional area to explicitly define the legal area range of each functional area. This step transforms the spatial constraint that "the model must be located within a specific area" into a mathematical expression that can be processed by a computer. In practical applications, this constraint ensures that buildings are strictly located within the building site, and that vegetation elements such as trees remain within the green area.
[0030] Based on this, the system defines a comprehensive differentiable objective function to maintain a reasonable spatial layout. For example, this can be specifically reflected in practical engineering requirements such as building spacing, fire lane width, and road connectivity.
[0031] Finally, starting from the initial layout, the system iteratively optimizes the differentiable objective function using gradient descent. During optimization, the system continuously adjusts the layout parameters of each 3D model based on the gradient information provided by the objective function until a final city scene that simultaneously satisfies all spatial constraints is obtained. After optimization, the system outputs structured data containing complete scene information, which can be directly used to drive mainstream rendering engines for scene visualization.
[0032] Through this complete technical solution, the present invention realizes the automated and intelligent generation of three-dimensional urban scenes from two-dimensional graphic data and data assets (three-dimensional models), effectively solving the technical problems of traditional methods that rely on manual labor, are inefficient, and have difficulty in ensuring the rationality of the layout, and providing efficient and reliable technical support for application fields such as digital twins and urban planning.
[0033] The above is an explanation of the basic concept of this application. The following will provide a detailed explanation of each step provided in this application.
[0034] First, based on the input graphic data, the specific implementation methods of different functional areas can be automatically identified and extracted.
[0035] In one possible implementation, based on the input graphical data, different functional areas are automatically identified and extracted, including: The graphic data, including remote sensing images and vector base maps, is processed using a semantic segmentation artificial intelligence model.
[0036] By introducing an advanced semantic segmentation AI model, this solution achieves accurate and automated identification and extraction of different functional areas from urban graphic data. This replaces the traditional method that relies on manual interpretation and delineation, and can efficiently process multi-source data, including remote sensing imagery and vector base maps. It ensures the ability to quickly and finely divide large-scale urban areas, providing accurate and reliable regional input for subsequent 3D layout, which is a key prerequisite for achieving a high degree of automation in the entire process.
[0037] Furthermore, the semantic segmentation AI model includes SegFormer, which integrates the ASPP module with DeepLabv3+ and / or the Transformer encoder.
[0038] By employing advanced semantic segmentation model architectures such as DeepLabv3+ with integrated ASPP modules or SegFormer based on Transformer, this solution can more accurately understand and segment complex urban landscapes. These models possess powerful multi-scale feature extraction and global contextual information capture capabilities, effectively distinguishing functional areas with blurred boundaries and diverse shapes, significantly improving the accuracy and robustness of region segmentation, thus laying a solid data foundation for generating high-quality, high-fidelity 3D scene layouts.
[0039] This application also provides an exemplary implementation of this step: First, collect vector base maps (such as building footprints, road networks, and green space boundaries) and high-resolution aerial images registered with the plan view to provide rich semantic and geometric information for the segmentation model, and rasterize the vector layers into pixel-level labels (buildings, roads, vegetation, and background) using GDAL or Rasterio; then, select a high-performance semantic segmentation network (such as DeepLabv3+ with an integrated ASPP module or SegFormer with a Transformer encoder), take multi-channel data such as RGB, near-infrared (NIR), and digital elevation model (DSM) as input, train it using cross-entropy, Dice, and edge-aware loss, and enhance the model's robustness to complex terrain features through data enhancements such as rotation, scaling, color jitter, and cloud shadow simulation. After training, a probability map is output for the overall tiled inference. Preliminary hard segmentation results are generated based on maximum probability and thresholding strategies. Then, opening and closing operations are used to remove noise and fill holes, and connected component analysis is used to eliminate excessively small patches, ensuring the coherence and integrity of each category's region. Next, the boundaries of each connected component are extracted, and the boundary coordinates are mapped back to the geographic projection coordinate system. Through this multi-stage, multi-technology fusion approach, high-precision segmentation can be maintained while generating functional area polygons that conform to planning specifications, have a clear structure, and can be directly used as the basis for 3D asset layout or digital twin scene construction.
[0040] Once the functional area polygons are obtained, the 3D model can be matched.
[0041] For example, in one possible implementation, matching 3D model categories are filtered from a predefined set of models based on the geometric properties of each polygon; For each functional area, construct a set of candidate placement points, where: For building functional areas, a uniform point cloud is generated inside its polygon using the graph Laplacian operator; For road functional zones, the skeleton is extracted by eroding its polygons to obtain the centerline, and interpolation sampling is performed along the centerline to generate facility placement points; For vegetation functional zones, random planting points with controlled minimum spacing are generated within their polygons; After obtaining candidate placement points, a parametric layout strategy is applied to determine the initial position of each 3D model, where: For the building model, the model is scaled, rotated and staggered according to the floor area ratio or height limit corresponding to the functional area; For the road facility model, based on the road grade and node topology, smooth arches are automatically inserted at road intersections and the road edges are offset. For vegetation models, model selection is based on tree canopy diameter and terrain elevation, and models with different levels of detail are assigned according to visual importance.
[0042] This provides an intelligent and efficient initial layout generation strategy. It utilizes specialized algorithms (such as the Laplacian operator, skeleton extraction, and random planting) to generate reasonably distributed candidate points based on the geometric characteristics of different functional areas (buildings, roads, and vegetation), and then performs parametric layout based on these points. This strategy can automatically adjust the model's orientation and type according to actual planning parameters such as floor area ratio and road grade, thus providing a diverse and structurally sound layout draft before optimization begins. This significantly reduces the computational burden of subsequent optimization processes and ensures the diversity and practicality of the generated scenarios.
[0043] Here is an exemplary implementation of this step: First, for each functional area (building footprint, road polygon, vegetation patch), the system selects the model category that best matches the area's attributes from a pre-built asset library (containing residential, commercial, industrial, road surfaces, streetlights, and various tree and lawn prefabricated structures) based on the previously vectorized polygon boundaries and their geometric attributes (area, aspect ratio, principal direction, centroid, etc.). Next, a set of "candidate placement points" is constructed for each area. This can be achieved by using the graph Laplacian operator to generate a uniform point cloud on the building footprint, or by uniformly distributing points along the edges based on the area's principal axis to support a linear arrangement along the road. For the road centerline, the skeleton is extracted by eroding the polygon and then placed along the centerline at the minimum lane width. Interpolation sampling of height and pedestrian width generates facility points such as streetlights and traffic signs; in vegetation areas, random planting points are generated within the area to control the minimum canopy spacing; subsequently, a "parametric layout" strategy is applied to these candidate points: building models are scaled, rotated, and staggered according to the area's floor area ratio and height limits through random distribution or design templates (such as matrix grids, semi-random force-guided layouts) to ensure that adjacent models face the center of the road or square to optimize accessibility; road facilities are automatically inserted with smooth arches at intersections and pedestrian and vehicle lane boundaries are generated by offsetting the curb according to road grade and node topology; vegetation models are automatically selected according to canopy diameter and terrain elevation, with complete grids placed in the foreground and simplified versions or grass textures placed in the background to balance visual effects and performance. Finally, all 3D assets that pass the initial screening and their pose parameters (position, rotation, scaling) are organized into batch data for subsequent constraint optimization or engine rendering calls, thus efficiently and reproducibly completing the integrated automated process from 2D vectorized areas to the initial placement of 3D scene assets.
[0044] A simple layout example: { "scene_id": "district_001", "assets": [ { "id": "building_01", "type": "residential_building", "position": [120.123, 30.456], "rotation": 90.0, "scale": [1.0, 1.0, 3.5], "region_id": "plot_A01" }, { "id": "building_02", "type": "residential_building", "position": [120.128, 30.456], "rotation": 85.0, "scale": [1.0, 1.0, 4.0], "region_id": "plot_A01" }, { "id": "tree_01", "type": "tree_oak", "position": [120.130, 30.459], "rotation": 0.0, "scale": [1.0, 1.0, 1.0], "region_id": "green_B04" }, { "id": "lamp_01", "type": "street_lamp", "position": [120.126, 30.454], "rotation": 0.0, "scale": [1.0, 1.0, 1.0], "region_id": "road_C01" } ] } Those skilled in the art will understand that the specific implementation methods described above for constructing differentiable boundary constraint functions for each functional area and defining the legal regions of each functional area through the boundary constraint functions are also not limited.
[0045] In one possible implementation, the differentiable boundary constraint function is a signed distance function; the signed distance function represents the shortest distance from any point in two-dimensional space to the boundary of the polygon, and the sign of the function value distinguishes whether the point is inside or outside the polygon.
[0046] In the generation of 3D urban layouts, to ensure that all assets are strictly within their legal functional areas (such as buildings falling within building sites and trees not exceeding green boundaries), the traditional approach often uses hard projection (that is, directly clipping or "dragging" out out-of-bounds locations into the area). However, this approach is not available in differentiable optimization. Therefore, the introduction of the Signed Distance Function (SDF) as a differentiable "soft projection" mechanism has become a key solution.
[0047] By specifying the differentiable boundary constraint function as the signed distance function (SDF), this scheme provides a precise and continuous mathematical tool for the legality constraints of spatial layout. The SDF can quantify the distance and orientation relationship from any point to the functional area boundary. Its key advantage lies in the differentiability of the function, allowing the hard rule of "assets cannot cross the boundary" to be seamlessly integrated into the gradient optimization framework. This enables the automatic and smooth guidance of out-of-bounds assets back to the legal area through mathematical calculations, achieving soft enforcement and efficient optimization of constraints.
[0048] Furthermore, the symbolic distance function specifically includes: Decompose the boundary of the polygon into n boundary line segments; Calculate the shortest distance from any point to be projected to each boundary line segment; Take the minimum of all shortest distances as the distance from any point to be projected to the polygon boundary; The method of ray casting or angle rotation is used to determine whether any point to be projected is inside or outside the polygon, and the distance is assigned a corresponding positive or negative sign to obtain the final signed distance function value.
[0049] This can be understood as follows: The core idea of SDF (Shortest Distance Function) is to construct a continuously differentiable function for any region (such as a polygon), representing the shortest distance from any point to the boundary of that region, with a positive or negative sign to distinguish whether it is inside or outside the region. Thus, during the optimization process, assets are naturally pushed back to the target region by minimizing the "boundary loss." When constructing the SDF, the region boundary first needs to be transformed into an ordered set of line segments, typically achieved using a list of polygon vertices. For any point to be projected, the system calculates its distance to all boundary line segments in batches and takes the minimum value as the shortest boundary distance from that point to the polygon. Then, it uses ray casting or parity rules to determine whether the point is inside the region, thus determining the sign of the final SDF. This ensures that during optimization iterations, every out-of-bounds asset receives a "push" of the correct direction and appropriate magnitude to return it to the legal region, fundamentally guaranteeing that the final generated 3D scene layout strictly adheres to the preset functional area boundaries.
[0050] Furthermore, a signed distance function is constructed for each polygon corresponding to a functional area, including: A high-resolution SDF value grid is pre-constructed for the polygon; During the optimization process, the SDF value corresponding to any point is queried through bilinear interpolation.
[0051] For large-scale or complex-shaped urban functional areas, this solution provides an efficient method for approximating the signed distance function (SDF). By pre-compiling and storing high-resolution SDF meshes, the required SDF value can be retrieved during optimization simply through fast bilinear interpolation. This strategy cleverly balances computational accuracy and efficiency, avoiding the huge overhead of real-time precise calculations, and forming a continuous, smooth, and gradient-transmissible "force field" that gradually pushes all illegal points back into the region over multiple iterations, achieving flexible geometric constraints without projection. This mechanism not only ensures differentiability and optimization efficiency but also greatly improves the accuracy and stability of polygon layout control, making it particularly suitable for gradient-driven optimization of large-scale asset layouts in complex urban scenarios.
[0052] Specifically, based on the above method, for a two-dimensional region Ω (e.g., a polygon), the SDF at any point The value on is defined as: in: : Represents the boundary of the region (i.e., all the edges of the polygon). Euclidean distance (SDF) represents the straight-line distance from point x to point y on the boundary. The sign of an SDF indicates the spatial location of a point (negative sign indicates inside the region, positive sign indicates outside). The calculation process for an SDF is as follows: A region (such as building land or green space) can be represented as a closed polygon whose boundary can be decomposed into a series of ordered vertices: The boundary line segments formed are: ek = [vk, v(k+1) mod n]. For the point x to be calculated, calculate the shortest distance from it to each boundary line segment ek in turn: in: ak is the starting point of the line segment. It is a direction vector; It is the parameterized position of the projection point on the boundary line segment (restricted to [0,1]); This formula calculates the distance from x to the nearest point on the line segment.
[0053] After calculating the above distances for all edges ek, take the minimum value: To determine whether point x is inside polygon Ω, we can use: Ray method: Draw a ray from point x along a certain direction and calculate the number of intersections with the polygon boundary. An odd number of intersections indicates the interior, and an even number indicates the exterior. Winding number method: Calculate the sum of the angles of all edges around the x-point. If the sum is 2π (or -2π), then it is inside.
[0054] After obtaining the symbols, construct the complete SDF value: Preferably, starting from the initial layout, optimizing the differentiable objective function using gradient descent includes: The Adam optimizer is used to iteratively update the initial layout of each 3D model, using the initial layout of each model as the optimization variable. The differentiable objective function is a weighted sum of the boundary loss term and the collision loss term. During the optimization process, the boundary loss term is calculated based on the differentiable boundary constraint function and is used to generate gradients to place out-of-bounds 3D models into the legal functional area. The collision loss term is used to generate gradients to separate models that overlap or are too close to each other.
[0055] By employing the Adam optimizer and constructing a differentiable objective function that combines boundary loss and collision loss, a powerful and efficient automated layout optimization engine was implemented. This engine can simultaneously handle the two major spatial constraint problems of "avoiding out-of-bounds errors" and "preventing collisions." It dynamically adjusts the position of all models through gradient signals, intelligently "pulling" out-of-bounds models back into the legal region and "pushing" conflicting models apart. This mechanism ensures the physical rationality and feasibility of the final layout, comprehensively improving the quality of the generated results.
[0056] Furthermore, the collision loss term is calculated based on the intersection-union ratio of the bounding boxes of any two 3D models and the normalized distance between the center points of the two bounding boxes.
[0057] Specifically, after defining the scenario, a joint optimization objective function needs to be defined, incorporating physical and boundary constraints into a differentiable framework, and the optimal layout parameters are solved iteratively through gradient descent. The objective function is: The optimization objectives at this time are: (1) to avoid any asset collision overlap (constrained by collision loss Lcol); (2) to ensure that all assets fall within their legal functional areas (constrained by boundary loss Lbound).
[0058] Explanation of differentiable optimization mechanism: The pose parameters pi=(xi,yi,θi) for each asset are optimization variables; The optimizer (such as Adam) continuously adjusts the asset's position and orientation based on the gradients provided by these two loss functions; If an asset goes out of bounds, the gradient derived from SDF will "pull" it back into the legal polygon. If assets are too close together (boundary boxes overlap or DIoU distance is too small), collision loss will "push" them apart; All operations remain continuously differentiable and can be linked with other modules (such as asset selection and LOD control) within the neural network framework.
[0059] Collision loss is defined as follows: Where: Bi, Bj: the bounding box of the asset (calculated by location + size); ci,cj: The center points of the two bounding boxes; d: Length of the diagonal of the two smallest bounding boxes; When IoU > 0, it indicates that the two overlap, resulting in a strong penalty; even if there is no overlap, if they are too close, a spacing penalty will still be applied. This loss provides a strong gradient at collisions but has almost no effect at long distances, and the computational cost can be further reduced by setting a threshold.
[0060] The boundary loss is defined as the aforementioned SDF function.
[0061] In summary, the entire process is as follows: First, high-resolution city base maps or geographic data (such as OpenStreetMap, remote sensing imagery, etc.) are used as input. Deep learning semantic segmentation networks (such as DeepLabv3+ or SegFormer) are used to extract major functional areas such as buildings, roads, and vegetation. Each functional area is converted into a clearly structured polygon (GeoJSON or Shapefile format) through contour extraction and coordinate transformation, with accompanying geometric attributes such as area, aspect ratio, and main orientation. Then, initial asset placement is performed: based on the geometric characteristics of the area, suitable assets are selected from a 3D model library of buildings, road facilities, and vegetation, and initial placement points are generated within each area. The method of point generation varies depending on the functional area. Each asset is initially assigned parameters such as position (x, y), orientation (θ), and scale, forming a complete layout candidate. Subsequently, the system introduces a differentiable optimization module, iteratively adjusting these parameters based on a continuously differentiable objective function to ensure the final layout meets spatial constraints. Through gradient correction of asset positions, out-of-bounds points are gradually pushed back into the area. The optimization process typically employs the Adam optimizer for gradient updates and sets dynamic loss weights, emphasizing boundary validity in the early stages and strengthening collision constraints in the later stages. After optimization, the location parameters of all assets are updated to the optimal solution, possessing semantic matching, spatial validity, and physical feasibility. Finally, it is serialized into a standard scene description file (such as CityGML, glTF, or JSON), which can be directly used for visualization rendering, digital twin platform integration, or subsequent human-machine collaborative fine-tuning.
[0062] A second aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the artificial intelligence-based urban scene generation method described above.
[0063] By programming and storing the aforementioned AI-based urban scene generation method in a computer-readable medium, this solution achieves high replicability and ease of deployment. This allows the advanced automatic urban 3D model generation capability to be easily integrated into various digital twin, urban planning, and game development platforms. Users can quickly obtain high-quality, compliant 3D scenes simply by calling the program, greatly reducing the barriers and costs of technology application.
[0064] It should be noted that the embodiments of the present invention have better implementability and are not intended to limit the present invention in any way. Any person skilled in the art may use the above-disclosed technical content to change or modify it into equivalent effective embodiments. However, any modifications or equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention shall still fall within the scope of the technical solution of the present invention.
Claims
1. A method for generating an urban scene based on artificial intelligence, characterized by, The urban scene generation method comprises: Based on the input graphic data, different functional areas are automatically identified and extracted, and each functional area is vectorized into a polygon; and each polygon is assigned a structured feature including shape, area, direction, etc. Based on the structured feature of the polygon, a corresponding three-dimensional model is matched for each functional area from a pre-set model library, and an initial layout of the three-dimensional model is generated; the initial layout includes position information and orientation of the model. A differentiable boundary constraint function is constructed for each functional area, and the legal area of each functional area is defined by the boundary constraint function. A differentiable objective function is defined, wherein the differentiable objective function includes a boundary loss term based on the boundary constraint function and a collision loss term for preventing model penetration. Starting from the initial layout, the differentiable objective function is optimized by gradient descent method to iteratively adjust the layout of each three-dimensional model, and the final urban scene is obtained.
2. The city scene generation method according to claim 1, wherein The automatic identification and extraction of different functional areas based on input graphic data comprises: The graphic data is processed by a semantic segmentation artificial intelligence model; the graphic data includes remote sensing images and vector base maps.
3. The city scene generation method according to claim 2, wherein The semantic segmentation artificial intelligence model comprises DeepLabv3+ integrated with an ASPP module and / or SegFormer with a Transformer encoder.
4. The city scene generation method according to claim 1, wherein Based on the geometric properties of each polygon, the matching three-dimensional model category is selected from a pre-defined model set; A set of candidate placement points is constructed for each functional area, wherein: For building functional areas, a uniform point cloud is generated inside the polygon using a graph Laplacian operator; For road functional areas, a center line is obtained by eroding the polygon to extract the skeleton, and facility placement points are generated by interpolating sampling along the center line; For vegetation functional areas, random planting points are generated inside the polygon with a minimum spacing control; After obtaining the candidate placement points, a parameterized layout strategy is applied to determine the initial position of each three-dimensional model, wherein: For building models, scaling, rotation, and staggered arrangement are performed on the model according to the volume rate or height limit of the functional area; For road facility models, smooth arches are automatically inserted at road intersections and road curbs are offset according to road grades and node topologies; For vegetation models, model selection is performed according to tree crown diameter and terrain elevation, and different levels of detail are assigned to models according to visual importance.
5. The city scene generation method according to claim 1, wherein The differentiable boundary constraint function is a signed distance function; the signed distance function represents the shortest distance from any point in two-dimensional space to the boundary of the polygon, and distinguishes whether the point is inside or outside the polygon by the positive or negative function value.
6. The city scene generation method according to claim 5, wherein The signed distance function specifically comprises: The boundary of the polygon is decomposed into n boundary line segments; The shortest distance from any projection point to each boundary line segment is calculated; The minimum value of all the shortest distances is taken as the distance from the arbitrary projection point to the polygon boundary; The arbitrary point to be projected is determined to be inside or outside the polygon by a ray method or a winding angle method, and a corresponding positive or negative sign is assigned to the distance to obtain a final signed distance function value.
7. The city scene generation method according to claim 5, wherein The signed distance function is constructed for each polygon corresponding to the functional area, including: A high-resolution SDF value grid is constructed for the polygon in advance; During optimization, the SDF value corresponding to an arbitrary point is queried by bilinear interpolation.
8. The city scene generation method according to claim 1, wherein The initial layout is taken as a starting point, and the differentiable objective function is optimized by a gradient descent method, including: An Adam optimizer is adopted to iteratively update the initial layout by taking the initial layout of each three-dimensional model as an optimization variable. The differentiable objective function is a weighted sum of the boundary loss term and the collision loss term; during optimization, the boundary loss term is calculated according to the differentiable boundary constraint function, and is used to generate a gradient to place the three-dimensional model that is out of bounds to a legal functional area; the collision loss term is used to generate a gradient to separate the models that overlap or are too close to each other.
9. The city scene generation method according to claim 8, wherein The collision loss term is calculated based on the intersection-over-union of the bounding boxes of any two three-dimensional models and the normalized distance between the centers of the two bounding boxes.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the artificial intelligence-based city scene generation method of any one of claims 1 to 9.
Citation Information
Cited By
A hybrid optimization-based PCB layout compliance method and system
CN122133592A