A condition-controlled vector building sample data generation method and device
Patent Information
- Application Number
- CN202511731018.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-24
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2045-11-24
AI Technical Summary
然而,生成对抗网络模型在处理形态多样的矢量建筑物数据时,常面临训练不稳定和模式崩溃问题,导致生成的建筑物形态单一
[0015] This invention provides a method, apparatus, storage medium, and electronic device for generating vector building sample data under conditional control. This invention automatically generates vector building data based on set generation control conditions, thereby achieving controllable generation of building data with different morphological features, area sizes, and layout orientations, meeting the sample data requirements of relevant intelligent models. This invention enables precise control of generated building data under multiple constraints, reflecting the diversity and complexity of building morphology and structure, and providing sample data support for the development of intelligent building mapping models.
Smart Images

Figure CN121639953B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of geographic information technology, and in particular to a method, apparatus, storage medium, and electronic device for generating condition-controlled vector building sample data. Background Technology
[0002] As primary locations for human activity, buildings are fundamental geographic entities in map representation. Mapping involves a series of tasks related to the analysis and processing of vector building data, including geometric shape classification, distribution pattern recognition, and morphological contour simplification. As mapmaking technology gradually moves towards an intelligent stage, there is an urgent need to utilize artificial intelligence to develop intelligent models for vector building data analysis and processing. Against this backdrop, the importance of establishing vector building sample datasets is increasingly prominent, as it relates to the efficient training and testing of relevant machine learning models. However, manually collecting and labeling vector building sample data faces the challenges of long processing times and high labor costs. Simultaneously, vector building data in some special shapes or sparse scenarios is difficult to obtain, leading to imbalanced sample data categories and insufficient sample quantities for some types. This imbalanced data distribution may cause model bias, affecting its generalization performance. To address these issues, there is an urgent need to develop efficient and controllable methods for generating vector building data, thereby providing a comprehensive and reliable training sample dataset for the development of intelligent models related to building cartographic representation.
[0003] Traditional methods for generating vector building sample data primarily rely on rule-based modeling and parametric design. These methods use pre-defined geometric rules, shape templates, and parameter systems to parametrically control features such as building area, perimeter, and shape, thereby generating vector building data in batches. However, these methods heavily depend on human experience in rule definition and parameter setting, and due to the lack of flexibility in templates and parameter systems, the generated building forms often exhibit a strong tendency towards homogeneity, failing to reflect the diversity and complexity of building morphology and structure. Furthermore, simple rule combinations and parameter adjustments are insufficient for achieving precise control over generated building data under multiple constraints. In recent years, generative artificial intelligence models have been widely applied in the generation of image, audio, and text data, including methods based on generative adversarial networks (GANs) and variational autoencoders (VAEs). However, GAN models often face training instability and pattern collapse when processing diverse vector building data, resulting in homogeneous generated building forms. VAEs, on the other hand, are prone to posterior collapse, making it difficult to fully capture the diversity of building data forms and resulting in insufficient diversity of generated samples. Summary of the Invention
[0004] This invention provides a method, apparatus, storage medium, and electronic device for generating vector building sample data under conditional control, which can achieve precise control of the generated building data under multiple constraints.
[0005] This invention provides a method for generating conditionally controlled vector building sample data, comprising: The generation control conditions for vector building sample data are set, and the feature items of the generation control conditions include at least: building shape type feature, building area feature, building orientation feature, building circle approximation degree, and building elongation; The feature terms of the generation control conditions are integrated into a feature vector, and the feature vector is input into a generator based on the conditional diffusion model to obtain a building raster image that meets the generation control conditions. The raster image of the building is vectorized to obtain vector building data.
[0006] Furthermore, according to the vector building sample data generation method controlled by the above conditions, the calculation process of the building orientation feature is as follows: extract the minimum bounding rectangle of the building polygon, calculate the angle between the long side direction of the minimum bounding rectangle and the due east direction, and set the value of the orientation feature as the building orientation feature based on the angle. The circular approximation of the building is the ratio of the building's area to the square of its perimeter; The building extension length is the ratio of the shorter side to the longer side of the circumscribed rectangle of the building polygon.
[0007] Furthermore, in the vector building sample data generation method controlled by the above conditions, the generator includes a denoising network; The feature vector is input into a generator constructed based on a conditional diffusion model to obtain a building raster image that meets the generation control conditions, including: The noisy image at the current time step, the information at the current time step, and the feature vector are input into the trained denoising network to obtain the predicted noise. Based on the backward recursive formula of the diffusion model, the building raster image of the previous time step is calculated; Repeat the above steps until the time step is 0 to obtain a building raster image that meets the generation control conditions.
[0008] Furthermore, in the vector building sample data generation method controlled by the above conditions, the denoising network is a U-Net model, which includes an encoding layer, an intermediate layer, and a decoding layer. The processing steps of the denoising network include: Sine position coding is used to embed time step information in the diffusion process to obtain time step embedding vector; The feature vector is encoded into a conditional embedding vector using a conditional encoder; The time-step embedding vector and the conditional embedding vector are fused to obtain a fused control vector. The channel dimension is transformed by a multilayer perceptron, and the fused control vector after the channel dimension transformation is injected into the feature maps of each layer of the U-Net network. The noisy image is input into the encoder for downsampling, and constrained by the fused control vector to obtain the first feature; The first feature is input into the intermediate layer for residual connection and self-attention calculation to obtain the second feature; The second feature is input into the decoder for upsampling and constrained by the fusion control vector to obtain the predicted noisy image.
[0009] Furthermore, according to the vector building sample data generation method controlled by the above conditions, the training process of the denoising network includes: Construct training sample pairs, wherein the training sample pairs include binarized images and corresponding feature vectors; Randomly sample a time step t from the total number of time steps to generate a noisy image at time step t; The noisy image, time step t, and feature vector are input into the denoising network to obtain the predicted noise; The mean square error between the original noise and the predicted noise used during noise addition is used as the loss function, and the denoising network is iteratively trained using the loss function.
[0010] Furthermore, according to the vector building sample data generation method controlled by the above conditions, the binarized image is obtained based on the vector building data, and the processing includes: The vector building data is projected onto a unified local planar coordinate system, and the axis-aligned minimum bounding square of each building is calculated. The maximum value of the side length of the smallest circumscribed square is taken as the unified rasterization reference side length, and the rasterization sampling range is determined according to the rasterization reference side length. For each building, rasterization is performed within a square sampling area with the geometric center as the reference side length, and the vector building is converted into a binary image according to the preset resolution.
[0011] Furthermore, according to the vector building sample data generation method controlled by the above conditions, the vectorization process of the building raster image to obtain vector building data includes: The Suzuki-Abe algorithm is used to extract the outer contour of the building from the building raster image to obtain the boundary curve; The Douglas–Peucker algorithm is used to approximate the boundary curve into a polygon, and key vertices are extracted to simplify the boundary shape, ultimately obtaining vector building data that meets the generation control conditions.
[0012] The present invention also provides a condition-controlled vector building sample data generation device, comprising: The generation control condition setting module is used to set the generation control conditions for vector building sample data. The feature items of the generation control conditions include at least: building shape type feature, building orientation feature, building circle approximation degree, and building elongation. The image generation module is used to integrate the feature terms of the generation control conditions into a feature vector, and input the feature vector into a generator based on the conditional diffusion model to obtain a building raster image that meets the generation control conditions. The vectorization module is used to perform vectorization processing on the building raster image to obtain vector building data.
[0013] The present invention also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute a vector building sample data generation method controlled by any of the above conditions.
[0014] The present invention also provides an electronic device, including a processor and a memory, wherein the processor is electrically connected to the memory, the memory is used to store instructions and data, and the processor is used in the steps of the condition-controlled vector building sample data generation method described in any of the preceding claims.
[0015] This invention provides a method, apparatus, storage medium, and electronic device for generating vector building sample data under conditional control. This invention automatically generates vector building data based on set generation control conditions, thereby achieving controllable generation of building data with different morphological features, area sizes, and layout orientations, meeting the sample data requirements of relevant intelligent models. This invention enables precise control of generated building data under multiple constraints, reflecting the diversity and complexity of building morphology and structure, and providing sample data support for the development of intelligent building mapping models. Attached Figure Description
[0016] The technical solution and other beneficial effects of the present invention will become apparent from the following detailed description of specific embodiments of the invention, in conjunction with the accompanying drawings.
[0017] Figure 1 A flowchart of a method for generating vector building sample data under conditional control, provided in an embodiment of the present invention.
[0018] Figure 2This is a schematic diagram of a vector building provided in an embodiment of the present invention.
[0019] Figure 3 This is a flowchart for obtaining a building raster image that meets the generation control conditions, provided as an embodiment of the present invention.
[0020] Figure 4 This is a flowchart illustrating the processing of a denoising network provided in an embodiment of the present invention.
[0021] Figure 5 This is a flowchart for generating training sample pairs provided in an embodiment of the present invention.
[0022] Figure 6 This is a schematic diagram of vector building sample data generated under given generation control conditions, provided in an embodiment of the present invention.
[0023] Figure 7 A schematic diagram of the structure of the condition-controlled vector building sample data generation device provided in an embodiment of the present invention.
[0024] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] This invention provides a method, apparatus, storage medium, and electronic device for generating conditionally controlled vector building sample data. The apparatus for generating conditionally controlled vector building sample data provided in this invention can be integrated into an electronic device, such as a terminal or server. The terminal can include a tablet computer, laptop computer, personal computer (PC), microprocessor box, or other devices.
[0027] Please see Figure 1 , Figure 1 The flowchart illustrates a condition-controlled vector building sample data generation method provided in this embodiment of the invention, which is applied in an electronic device. This condition-controlled vector building sample data generation method includes the following steps: S1, set the generation control conditions for vector building sample data. The feature items of the generation control conditions shall include at least: building shape type feature, building area feature, building orientation feature, building circle approximation degree, and building elongation.
[0028] Specifically, for the vector building target to be generated Its generation conditions are expressed as .in, k The number of feature terms representing the generation conditions. Indicates the first i The features to be generated include shape type, area, orientation, circle approximation, elongation, etc. Figure 2 This is a schematic diagram of a vector building provided in an embodiment of the present invention. Figure 2 The relevant generation condition features are defined as follows: (1) Characteristics of building shape type The polygonal shapes of buildings include E-shape, F-shape, H-shape, I-shape, L-shape, O-shape, T-shape, U-shape, Y-shape, Z-shape, etc.
[0029] In one specific embodiment, a discretization encoding method is used for assignment, such as 0 representing E-shape, 1 representing F-shape, and 2 representing H-shape.
[0030] (2) Building orientation characteristics First, extract the minimum bounding rectangle (MBR) of the building polygon. Then, calculate the angle between the long side of the MBR and the due east direction. (Negative for north, positive for south), the angle setting determines the building's orientation characteristic. For example, east-west direction ( (-22.5°, 22.5°) settings =0, Northwest-Southeast direction ( (22.5°, 67.5°) settings =1, North-South direction ( (67.5°, 90°) (-90°, -67.5°) settings =2, Northeast-Southwest direction ( (-67.5°, -22.5°) settings =3. The direction encoding scheme can also be adjusted to 8 directions, 16 directions, etc., according to actual needs.
[0031] (3) Building circular approximation The circle approximation degree describes how closely the shape of a building's polygon approximates a circle, and is defined as the ratio of the building's area to the square of its perimeter. The formula is as follows:
[0032] in, It is a building circumference, It represents the area of the building. The closer the circle approximation is to 1, the closer the building's shape is to a circle.
[0033] (4) Building elongation The elongation describes the ratio of the shorter side to the longer side of the circumscribed rectangle of a building polygon. The calculation method is as follows:
[0034] in, It is the length of the shorter side of the building's circumscribed rectangle. It is the length of the longer side of the circumscribed rectangle of the building. The smaller the value of the elongation, the more elongated the shape of the building.
[0035] S2 integrates the feature terms of the generation control conditions into a feature vector, and inputs the feature vector into the generator based on the conditional diffusion model to obtain a building raster image that meets the generation control conditions.
[0036] Figure 3 A flowchart for obtaining a building raster image that meets the generation control conditions provided in an embodiment of the present invention is shown below. Figure 3 As shown, the generator includes a denoising network, and step S3 includes the following steps: S21, input the noisy image at the current time step, the information at the current time step, and the feature vector into the trained denoising network to obtain the predicted noise; S22, based on the reverse recursive formula of the diffusion model, the building raster image of the previous time step is calculated; S23, repeat the above steps until the time step is 0, and obtain a building raster image that meets the generation control conditions.
[0037] Specifically, first, the aforementioned feature vectors are input into the vector building data generator, which then initiates the inverse denoising process of the diffusion model. This process uses completely random Gaussian noise. Starting from the maximum time step (consistent with the target generated building image size),... T Iterate gradually towards time step 0. The core logic of each iteration is: set the current time step... t Noisy images Current time step information Building data generation conditions The images are input into a pre-trained building image denoising network, which then processes them. Predict noisy images Compared to the original clear image Introduced noise ( , t , ); then, based on the backward recursive formula of the diffusion model, the previous time step ( t Image 1) When the denoising iteration reaches t When = 0, the noise reduction operation stops, and the resulting image is... That is, it meets the generation conditions. Raster images of buildings.
[0038] Figure 4 This is a flowchart of the denoising network provided in an embodiment of the present invention, as shown below. Figure 4 As shown, the denoising network is the U-Net model, which includes an encoding layer, an intermediate layer, and a decoding layer.
[0039] Step S21 includes the following steps: S211, sinusoidal position coding is used to embed the time step information in the diffusion process to obtain the time step embedding vector.
[0040] This can be expressed by the following formula:
[0041] in, It is a two-layer fully connected network, using SiLU as the activation function, where t is the time step. For sinusoidal position encoding, Let D be the embedding vector at each time step, and D be the dimension of the embedding vector.
[0042] S212 encodes the feature vector into a conditional embedding vector using a conditional encoder.
[0043] Building shape type Orientation of the building For discrete attributes, encoded through a category embedding layer as and Building area Circular approximation With elongation For continuous numerical attributes, encoded using linear layers. and Finally, the vectors obtained after encoding multiple attributes are concatenated and projected to obtain the conditional embedding. The formula is as follows:
[0044] in, It is a linear projection matrix. This represents vector concatenation. This is the activation function.
[0045] S213, the time-step embedding vector and the conditional embedding vector are fused to obtain the fused control vector, the channel dimension is transformed by the multilayer perceptron, and the fused control vector after the channel dimension transformation is injected into the feature maps of each layer of the U-Net network.
[0046] S214, input the noisy image into the encoder for downsampling, and constrain it by fusing control vectors to obtain the first feature.
[0047] S215, the first feature is input into the intermediate layer for residual connection and self-attention calculation to obtain the second feature; S216, the second feature is input into the decoder for upsampling, and constrained by the fusion control vector to obtain the predicted noisy image.
[0048] Furthermore, the training process of the denoising network includes: (1) Construct training sample pairs, which include binarized images and corresponding feature vectors.
[0049] The method for calculating building feature vectors is the same as in step S1, and is applied to each vector building target. The shape type, area, orientation, circle approximation degree, elongation, and other features are extracted and encoded into feature vectors. It should be noted that the building feature vectors constructed in the training samples... It must be consistent with the "building generation control conditions" defined in step S1. The features in the model are consistent (i.e., the building feature information received by the model during training is completely matched in type and dimension with the conditional information used to control the generation during inference).
[0050] The binarized image is obtained based on vector building data, and the processing includes: Project the vector building data onto a uniform local plane coordinate system (such as Gauss-Kruger projection) and calculate the axis-aligned minimum bounding square (AAMBS) for each building. The maximum value of the side length of the smallest circumscribed square is taken as the uniform rasterization reference side length. And based on the rasterized reference side length Determine the rasterization sampling range; For each building, with the geometric center as the reference and the side length as the rasterized reference side length. The vector building is rasterized within a square sampling area and converted into a binary image according to a preset resolution (e.g., 256×256).
[0051] During rasterization, pixels falling within or around the building's boundaries are assigned a value of 1, while all other pixels are assigned a value of 0, resulting in a binarized image of the building. Because of the unified setting of sampling range and pixel resolution, there is a fixed mapping relationship between the number of pixels in the raster image and the actual area, thus the area information of the building can be recovered well during subsequent vectorization reconstruction. Through the above method, training sample pairs are finally formed, consisting of building feature vectors and corresponding raster images. , ). Figure 5 This is a flowchart for generating training sample pairs provided in an embodiment of the present invention.
[0052] (2) Randomly sample a time step t from the total number of time steps [1, T] to generate a noisy image at time step t. The formula is as follows:
[0053] in, This is the cumulative product of the noise scheduling parameters. For random Gaussian noise, the larger the time step t, the better. The smaller the value, the closer the noise-added image is to a pure noise image. In this embodiment of the invention, cosine noise scheduling is used, and the total time step T of the noise-adding process is set to 1000 steps.
[0054] (3) Input the noisy image, time step t, and feature vector into the denoising network to obtain the predicted noise. .
[0055] (4) The mean square error between the original noise and the predicted noise used during noise addition is used as the loss function (MSE), and the denoising network is iteratively trained through the loss function. By iteratively training the network at random sampling time steps t of different sample images, the network gradually learns the denoising rules and finally learns to denoise according to the building generation control conditions.
[0056] S3 performs vectorization processing on the building raster image to obtain vector building data.
[0057] Specifically, step S3 includes the following steps: S31, the outer contour of the building in the building raster image is extracted using the Suzuki-Abe algorithm (Suzuki-Abe Topological Structural Analysis of Digitized Binary Images by Border Following) to obtain the boundary curve; S32 uses the Douglas-Peucker algorithm to approximate the boundary curves into polygons, extracts key vertices to simplify the boundary shape, and finally obtains vector building data that meets the generation control conditions.
[0058] like Figure 6 As shown, Figure 6 This diagram illustrates vector building sample data generated under given generation control conditions (shape type s, area a, direction o, elongation e, and circle approximation c) as provided in an embodiment of the present invention. As can be seen from the diagram, the generated vector building sample data highly matches the preset control conditions in terms of shape type and geometric features, directly verifying the generator's precise conditional control capability over the generated vector building morphology.
[0059] Based on the method described in the above embodiments, this embodiment will further describe it from the perspective of a condition-controlled vector building sample data generation device. This condition-controlled vector building sample data generation device can be implemented as an independent entity or integrated into an electronic device. The electronic device can be a terminal, server, or other devices. The terminal can include a tablet computer, a laptop computer, a personal computer (PC), a microprocessor box, or other devices.
[0060] Please see Figure 7 , Figure 7 This invention specifically describes a condition-controlled vector building sample data generation device provided in an embodiment of the invention, which is applied in an electronic device. The condition-controlled vector building sample data generation device may include: The generation control condition setting module is used to set the generation control conditions for vector building sample data. The feature items of the generation control conditions include at least: building shape type feature, building orientation feature, building circle approximation degree, and building elongation. The image generation module is used to integrate the feature terms of the generation control conditions into a feature vector, and input the feature vector into a generator based on the conditional diffusion model to obtain a building raster image that meets the generation control conditions. The vectorization module is used to perform vectorization processing on the building raster image to obtain vector building data.
[0061] In specific implementation, the above modules and / or units can be implemented as independent entities, or they can be arbitrarily combined and implemented as the same or several entities. For the specific implementation of the above modules and / or units, please refer to the previous method embodiments. For the specific beneficial effects that can be achieved, please also refer to the beneficial effects in the previous method embodiments, which will not be repeated here.
[0062] In addition, this embodiment of the invention also provides an electronic device, which may be a computer, tablet computer, or other similar device. This electronic device can implement the steps of any embodiment of the condition-controlled vector building sample data generation method provided by this embodiment of the invention. Therefore, it can achieve the beneficial effects achievable by any condition-controlled vector building sample data generation method provided by this embodiment of the invention, as detailed in the preceding embodiments, and will not be repeated here.
[0063] Figure 8 A specific structural block diagram of an electronic device provided in an embodiment of the present invention is shown. This electronic device can be used to implement the vector building sample data generation method with condition control provided in the above embodiments. The electronic device 500 can be a terminal, server, or other device. The terminal can include a tablet computer, laptop computer, personal computer (PC), microprocessor box, or other devices.
[0064] The memory 520 can be used to store software programs and modules, such as the program instructions / modules corresponding to those in the above embodiments. The processor 580 executes various functional applications and data processing by running the software programs and modules stored in the memory 520. The memory 520 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 520 may further include memory remotely located relative to the processor 580, and these remote memories can be connected to the electronic device 500 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0065] The input unit 530 can be used to receive input numeric or character information, and to generate a keyboard and mouse related to user settings and function control. Display unit 540 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces, which can be composed of graphics, text, icons, video, and any combination thereof. Display unit 540 may include display panel 541, which may optionally be configured in the form of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or other similar forms.
[0066] Electronic device 500, through transmission module 570 (e.g., Wi-Fi module), can help users receive requests, send information, etc., providing users with wireless broadband internet access. Although transmission module 570 is shown in the figure, it is understood that it is not an essential component of electronic device 500 and can be omitted as needed without changing the essence of the invention.
[0067] The processor 580 is the control center of the electronic device 500. It connects to various parts of the phone via various interfaces and lines, and performs various functions and processes data of the electronic device 500 by running or executing software programs and / or modules stored in the memory 520, and by calling data stored in the memory 520, thereby providing overall monitoring of the electronic device. Optionally, the processor 580 may include one or more processing cores; in some embodiments, the processor 580 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 580.
[0068] Electronic device 500 also includes a power supply 590 (such as a battery) that supplies power to various components. In some embodiments, the power supply may be logically connected to processor 580 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 590 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0069] Although not shown, the electronic device 500 also includes cameras (such as front-facing cameras and rear-facing cameras), Bluetooth modules, etc., which will not be described in detail here. Specifically, in this embodiment, the display unit of the electronic device is a touch screen display, and the mobile terminal also includes a memory and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more processors. One or more programs contain instructions for performing the following operations: The generation control conditions for vector building sample data are set, and the feature items of the generation control conditions include at least: building shape type feature, building area feature, building orientation feature, building circle approximation degree, and building elongation; The feature terms of the generation control conditions are integrated into a feature vector, and the feature vector is input into a generator based on the conditional diffusion model to obtain a building raster image that meets the generation control conditions. The raster image of the building is vectorized to obtain vector building data.
[0070] In practice, the above modules can be implemented as independent entities or combined in any way to be implemented as the same or several entities. For the specific implementation of the above modules, please refer to the previous method implementation examples, which will not be repeated here.
[0071] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. Therefore, embodiments of the present invention provide a storage medium storing a plurality of instructions that can be loaded by a processor to execute the steps of any embodiment of the condition-controlled vector building sample data generation method provided by the present invention.
[0072] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0073] Since the instructions stored in the storage medium can execute the steps in any embodiment of the condition-controlled vector building sample data generation method provided in the embodiments of the present invention, the beneficial effects that the condition-controlled vector building sample data generation method provided in the embodiments of the present invention can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0074] The foregoing has provided a detailed description of a method, apparatus, storage medium, and electronic device for generating conditionally controlled vector building sample data according to embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for generating vector building sample data under conditional control, characterized in that, The method includes: The generation control conditions for vector building sample data are set, and the feature items of the generation control conditions include at least: building shape type feature, building area feature, building orientation feature, building circle approximation degree, and building elongation; The feature terms of the generation control conditions are integrated into a feature vector, and the feature vector is input into a generator constructed based on a conditional diffusion model to obtain a building raster image that meets the generation control conditions; the generator includes a denoising network, which is a U-Net model, and the U-Net model includes an encoding layer, an intermediate layer, and a decoding layer; the processing of the denoising network includes: A sinusoidal positional encoding method is used to embed time-step information during the diffusion process to obtain a time-step embedding vector. A conditional encoder encodes the feature vector into a conditional embedding vector. The time-step embedding vector and the conditional embedding vector are fused to obtain a fusion control vector. The channel dimension is transformed using a multilayer perceptron, and the fusion control vector after channel dimension transformation is injected into the feature maps of each layer of the U-Net network. A noisy image is input into the encoder for downsampling and constrained by the fusion control vector to obtain a first feature. The first feature is input into an intermediate layer for residual connection and self-attention calculation to obtain a second feature. The second feature is input into the decoder for upsampling and constrained by the fusion control vector to obtain the predicted noisy image. The raster image of the building is vectorized to obtain vector building data.
2. The method for generating vector building sample data under conditional control according to claim 1, characterized in that, The calculation process for the building orientation feature is as follows: extract the minimum bounding rectangle of the building polygon, calculate the angle between the long side of the minimum bounding rectangle and the due east direction, and set the value of the orientation feature based on the angle as the building orientation feature. The circular approximation of the building is the ratio of the building's area to the square of its perimeter; The building extension length is the ratio of the shorter side to the longer side of the circumscribed rectangle of the building polygon.
3. The method for generating vector building sample data under conditional control according to claim 1, characterized in that, The feature vector is input into a generator constructed based on a conditional diffusion model to obtain a building raster image that meets the generation control conditions, including: The noisy image at the current time step, the information at the current time step, and the feature vector are input into the trained denoising network to obtain the predicted noise. Based on the backward recursive formula of the diffusion model, the building raster image of the previous time step is calculated; Repeat the above steps until the time step is 0 to obtain a building raster image that meets the generation control conditions.
4. The method for generating vector building sample data under conditional control according to claim 1, characterized in that, The training process of the denoising network includes: Construct training sample pairs, wherein the training sample pairs include binarized images and corresponding feature vectors; Randomly sample a time step t from the total number of time steps to generate a noisy image at time step t; The noisy image, time step t, and feature vector are input into the denoising network to obtain the predicted noise; The mean square error between the original noise and the predicted noise used during noise addition is used as the loss function, and the denoising network is iteratively trained using the loss function.
5. The method for generating conditionally controlled vector building sample data according to claim 4, characterized in that, The binarized image is obtained based on vector building data, and the processing includes: The vector building data is projected onto a unified local planar coordinate system, and the axis-aligned minimum bounding square of each building is calculated. The maximum value of the side length of the smallest circumscribed square is taken as the unified rasterization reference side length, and the rasterization sampling range is determined according to the rasterization reference side length. For each building, rasterization is performed within a square sampling area with the geometric center as the reference side length, and the vector building is converted into a binary image according to the preset resolution.
6. The method for generating vector building sample data under conditional control according to claim 1, characterized in that, The raster image of the building is vectorized to obtain vector building data, including: The Suzuki-Abe algorithm is used to extract the outer contour of the building from the building raster image to obtain the boundary curve; The Douglas–Peucker algorithm is used to approximate the boundary curve into a polygon, and key vertices are extracted to simplify the boundary shape, ultimately obtaining vector building data that meets the generation control conditions.
7. A condition-controlled vector building sample data generation device, wherein the condition-controlled vector building sample data generation device is used to implement the condition-controlled vector building sample data generation method as described in claim 1, characterized in that, include: The generation control condition setting module is used to set the generation control conditions for vector building sample data. The feature items of the generation control conditions include at least: building shape type feature, building area feature, building orientation feature, building circle approximation degree, and building elongation. The image generation module is used to integrate the feature terms of the generation control conditions into a feature vector, and input the feature vector into a generator based on the conditional diffusion model to obtain a building raster image that meets the generation control conditions. The vectorization module is used to perform vectorization processing on the building raster image to obtain vector building data.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted to be loaded by a processor to execute the condition-controlled vector building sample data generation method according to any one of claims 1 to 6.
9. An electronic device, characterized in that, The method includes a processor and a memory, the processor being electrically connected to the memory, the memory being used to store instructions and data, and the processor being used to execute the steps in the condition-controlled vector building sample data generation method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Precise building contour extraction method based on prior information and related device
CN120953632A