A method for reconstructing building point clouds based on an improved KNN-DGCNN model

By improving the KNN algorithm and combining it with KD-tree to optimize the DGCNN model, the problem of high computational complexity in processing large-scale building point cloud data is solved, achieving faster processing speed and higher accuracy, and making it suitable for the 3D reconstruction of complex buildings.

CN120070746BActive Publication Date: 2025-12-02WUHU RES INST OF XIAN UNIV OF ELECTRONIC SCI & TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510094550.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-12-02
Estimated Expiration
2045-01-21

AI Technical Summary

Technical Problem

The KNN search method in the existing DGCNN model has high computational complexity, which leads to a sharp increase in computation time when processing large-scale building point cloud data, high hardware costs, difficulty in guaranteeing accuracy, and difficulty in handling complex building structures.

Method used

An improved KNN algorithm combined with KD-trees is used to construct neighborhood relationships for point cloud data. By recursively partitioning the data space, the complexity of KNN search is reduced, and the adjacency graph is dynamically adjusted during network training to optimize memory management.

Benefits of technology

It significantly improves the speed and accuracy of large-scale point cloud data processing, reduces computing and storage costs, enhances the performance and scalability of the DGCNN algorithm, and is better able to handle complex building structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120070746B_ABST
    Figure CN120070746B_ABST
Patent Text Reader

Abstract

This invention discloses a method for reconstructing building point clouds based on a DGCNN model with an improved KNN algorithm. The method includes: normalizing the original building point cloud to be reconstructed to obtain normalized point cloud data; constructing a DGCNN network based on the improved KNN algorithm and training the DGCNN network to obtain a trained DGCNN model. The DGCNN network based on the improved KNN algorithm includes a spatial transformation layer, four graph convolutional layers, a max pooling layer, a first multilayer perceptron, and a second multilayer perceptron connected sequentially; and inputting the normalized point cloud data into the trained DGCNN model to obtain the corresponding prediction results. This invention utilizes the local update mechanism of the KD tree to efficiently and dynamically adjust the adjacency graph during network training, avoiding the high computational cost of reconstructing the entire search tree.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of point cloud data processing technology, specifically relating to a method for reconstructing building point clouds based on an improved KNN-based DGCNN model. Background Technology

[0002] Point cloud data processing technology is a key technology in modern computer vision and robotics, widely used in 3D reconstruction, virtual reality, and other fields. In the modern architecture field, 3D reconstruction technology of building point clouds is of vital importance for architectural design, historical building preservation, and urban planning. By acquiring the point cloud information of buildings, their 3D form can be reconstructed, providing a reliable foundation for subsequent analysis and renovation. Point cloud information processing technology is crucial to achieving this goal, among which methods based on graph convolutional neural networks (GCNs), especially dynamic graph convolutional neural networks (DGCNNs), have demonstrated significant roles in the processing and analysis of point cloud information. DGCNNs extract local features by analyzing the neighborhood graph structure of each point and performing convolution operations on the graph structure, thereby achieving the classification, segmentation, and feature extraction of building point cloud data, providing technical support for 3D reconstruction.

[0003] In existing technologies, the KNN search method used in DGCNN mainly relies on brute-force search, which has a computational complexity of O(N). 2 ), where N is the number of points. This brute-force search method exposes many serious problems when processing building point cloud data. With the continuous expansion of building scale, the increasing richness of details, and the improvement of measurement technology accuracy, the amount of point cloud data is showing a rapid growth trend. For example, when collecting point clouds of building groups such as large commercial complexes, dense residential areas, or historical and cultural blocks, the number of data points often easily exceeds millions or even tens of millions. With such a massive scale of information, the computation time of brute-force search increases exponentially. Each additional data point requires distance calculation and comparison with all existing points, making the training and inference process extremely slow, severely restricting the speed and application scope of 3D reconstruction of building point clouds.

[0004] Moreover, this high computational complexity leads to exorbitant hardware costs and energy consumption. To perform nearest-neighbor searches on large-scale building point cloud data, powerful computing equipment and substantial memory resources are required. This not only increases the equipment procurement and maintenance costs for enterprises and research institutions but also makes it difficult for some resource-constrained organizations to carry out related work. Simultaneously, the lengthy computation process results in significant energy waste, which contradicts the current development philosophy of energy conservation and environmental protection.

[0005] Furthermore, brute-force search methods struggle to guarantee accuracy when dealing with complex building structures. Buildings exhibit diverse shapes and complex internal structures, with point cloud data exhibiting uneven distribution and noise interference. Brute-force search is susceptible to local extrema and noise points in these situations, leading to the discovery of unrepresentative and irrelevant nearest neighbors. This negatively impacts subsequent feature extraction and 3D reconstruction quality, resulting in deviations, loss of detail, and even overall structural distortion, failing to meet the high-precision reconstruction goals of the architectural field. Therefore, optimizing the KNN search algorithm is crucial for improving the performance of 3D reconstruction of building point clouds. Summary of the Invention

[0006] To address the problem of high computational resource consumption and complexity of the KNN algorithm in Dynamic Graph Convolutional Neural Networks (DGCNN) for large-scale point cloud data processing in 3D reconstruction, this invention provides a building point cloud reconstruction method based on an improved KNN-based DGCNN model. The technical problem to be solved by this invention is achieved through the following technical solution:

[0007] This invention provides a method for reconstructing building point clouds based on an improved KNN-based DGCNN model, comprising:

[0008] S1: Normalize the original building point cloud to be reconstructed to obtain normalized point cloud data;

[0009] S2: Construct a DGCNN network based on an improved KNN algorithm and train the DGCNN network to obtain a trained DGCNN model. The DGCNN network based on the improved KNN algorithm includes a spatial transformation layer, four graph convolutional layers, a max pooling layer, a first multilayer perceptron, and a second multilayer perceptron connected in sequence. The spatial transformation layer performs spatial transformation on the input normalized point cloud data to make the point cloud data spatially invariant. The graph convolutional layers use the improved KNN algorithm to obtain the k nearest neighbors of each point in the building point cloud, perform feature aggregation using these k nearest neighbors, and output the aggregated feature vector. The max pooling layer receives the feature vector output by the last graph convolutional layer and performs max pooling on the point dimension to obtain a global feature vector. The first multilayer perceptron abstracts and transforms the global feature vector to extract higher-level semantic information. The second multilayer perceptron includes multiple hidden layers to output the predicted category and corresponding predicted score.

[0010] S3: Input the normalized point cloud data into the trained DGCNN model to obtain the corresponding prediction results.

[0011] In one embodiment of the present invention, S1 includes:

[0012] The 6-dimensional feature vector of each point in the original building point cloud is normalized. The 6-dimensional feature vector includes 3-dimensional spatial coordinates (,y,z) and 3-dimensional color information (R,,).

[0013] In one embodiment of the present invention, the graph convolutional layer is specifically used for:

[0014] Construct a KD tree based on the data features input to the current graph convolutional layer;

[0015] Use the constructed KD-tree to search for the K nearest neighbors of each point in the point cloud;

[0016] The information of the K nearest neighbors is aggregated using predefined weighting rules to obtain the updated data features of the current point.

[0017] The aggregated data features are processed through an activation function to improve the accuracy of building point cloud data recognition.

[0018] In one embodiment of the present invention, constructing a KD tree based on the data features input to the current graph convolutional layer includes:

[0019] For k-dimensional data features, create an index array for each dimension to form a superkey (a1, a2, a2, ..., a...). k ), where a1, a2, a2, ..., a k These represent the data values ​​of the current point from the 1st dimension to the kth dimension;

[0020] The points are compared and sorted sequentially according to the superkey of each point to obtain a sorted index array of all points;

[0021] Based on the index array after sorting all points, all data features are partitioned according to the median element to obtain the left subtree and the right subtree, and then the KD tree structure is constructed progressively.

[0022] In one embodiment of the present invention, feature aggregation is performed on the information of the K nearest neighbors using a predefined weighting rule to obtain the updated data features of the current point, including:

[0023] In the graph convolutional layer, the improved KNN algorithm is used to obtain the K nearest neighbors of each point in the input feature vector for feature aggregation. The aggregation formula is as follows:

[0024]

[0025] Among them, H () This represents the input feature vector of the l-th graph convolutional layer, with a size of n×d. l d represents the number of points.l For the input feature vector H () The feature dimension, (), represents the set of the K nearest neighbors of point i found through the KD-tree, W () Let σ be the learnable weight matrix of the l-th graph convolutional layer, and σ be the activation function. Let H represent the feature vector of point j in the l-th graph convolutional layer, N(j) represent the set of the K nearest neighbors of point j found through the KD-tree, and H represent the feature vector of point j. (+1) This represents the aggregated feature vector.

[0026] In one embodiment of the present invention, the loss function of the DGCNN model is the cross-entropy loss, expressed as:

[0027]

[0028] Where M is the number of training samples used in the training process, Q is the number of class labels in the training samples, and y mq This represents the probability that the m-th training sample belongs to the q-th category. This represents the probability that the predicted value of the m-th training sample belongs to the q-th category.

[0029] In one embodiment of the present invention, training the DGCNN network to obtain a trained DGCNN model includes:

[0030] Set the initial learning rate, coefficient parameters, and training batches, and collect building point clouds to form a training dataset. Each building point cloud is labeled with a target type label.

[0031] During each batch of training, for each point cloud data sample in the training dataset, normalization is first performed. The normalized point cloud data sample is then input into the DGCNN network to be trained. The prediction result is calculated through forward propagation, and the loss value is calculated according to the loss function.

[0032] The gradient is calculated using the backpropagation algorithm based on the loss value, and the parameters of the DGCNN network are updated.

[0033] After every 5 training batches, the accuracy of the DGCNN network is evaluated on the validation dataset. If the accuracy does not improve for 3 consecutive batches, then the network is terminated according to formula η. new = old ×0.1 reduces the learning rate for subsequent training, where η old η represents the current learning rate. new This represents the updated learning rate.

[0034] Another aspect of the present invention provides a storage medium storing a computer program for performing the steps of the building point cloud reconstruction method based on the improved KNN DGCNN model described in any of the above embodiments.

[0035] Another aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor, when calling the computer program in the memory, implements the steps of the building point cloud reconstruction method based on the improved KNN DGCNN model as described in any of the above embodiments.

[0036] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0037] 1. This invention provides a building point cloud reconstruction method based on an improved KNN DGCNN model. It offers a KD-tree-based KNN search optimization scheme, using a KD-tree data structure to construct neighborhood relationships in the point cloud data. The KD-tree recursively divides the data space into hyperrectangular regions, reducing the query time complexity of the KNN search from O(N^2) to O(N^2). 2 The efficiency is reduced to O(logN). This invention brings extremely significant benefits to the field of 3D reconstruction of building point clouds.

[0038] 2. This invention utilizes the local update mechanism of the KD-tree to efficiently and dynamically adjust the adjacency graph during network training, avoiding the high computational cost of reconstructing the entire search tree. Simultaneously, this invention employs an optimized memory management strategy, effectively reducing memory consumption. This method not only improves the speed of processing large-scale point cloud data but also maintains the query efficiency for high-dimensional data, solving the computational and storage bottlenecks of existing KNN search algorithms, and enhancing the overall performance and scalability of the DGCNN algorithm. This method can also be extended to point cloud processing neural networks with similar structures.

[0039] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0040] Figure 1 This is a flowchart of a building point cloud reconstruction method based on an improved KNN DGCNN model provided in an embodiment of the present invention;

[0041] Figure 2 This is a schematic diagram of the structure of a DGCNN network based on an improved KNN algorithm for processing point cloud data, provided by an embodiment of the present invention.

[0042] Figure 3 This is a schematic diagram of a process for constructing and classifying large-scale point cloud data using KD-trees, provided by an embodiment of the present invention.

[0043] Figure 4 This is a schematic diagram of a KD-tree partitioning method for constructing subtrees from a set of specific 3D data, provided by an embodiment of the present invention.

[0044] Figure 5 This is a schematic diagram illustrating the effect of successfully visualizing point cloud semantic segmentation using an optimized nearest neighbor algorithm, as provided in an embodiment of the present invention.

[0045] Figure 6 This is a schematic diagram of a feature extraction route for a dynamic graph convolutional neural network based on an insertion-optimized KD-tree algorithm, provided by an embodiment of the present invention. Detailed Implementation

[0046] To further illustrate the technical means and effects adopted by the present invention to achieve the intended purpose, the following describes in detail a method for reconstructing building point clouds based on an improved KNN DGCNN model according to the present invention, in conjunction with the accompanying drawings and specific embodiments.

[0047] The foregoing and other technical contents, features, and effects of the present invention will be clearly presented in the following detailed description of specific embodiments in conjunction with the accompanying drawings. Through the description of the specific embodiments, a more in-depth and concrete understanding can be gained of the technical means and effects adopted by the present invention to achieve its intended purpose. However, the accompanying drawings are for reference and illustration only and are not intended to limit the technical solutions of the present invention.

[0048] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations are intended to cover non-exclusive inclusion, such that an article or apparatus comprising a list of elements includes not only those elements but also other elements not expressly listed. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the article or apparatus that includes said element.

[0049] This invention addresses the problems of high computational resource consumption and excessive complexity of the KNN algorithm in 3D reconstruction of building point clouds using Dynamic Graph Convolutional Neural Networks (DGCNN). It proposes a building point cloud reconstruction method based on an improved KNN-based DGCNN model. Please refer to [link to relevant documentation]. Figure 1 The method includes the following steps:

[0050] S1: Normalize the original building point cloud to be reconstructed to obtain normalized point cloud data.

[0051] This step involves feature extraction and normalization of the original building point cloud to be reconstructed, using the feature vector of each point in the point cloud as a data point. For point cloud data with n points and k-dimensional features, its statistical characteristics, such as mean and variance, are calculated, and the features are normalized to ensure they have similar scales.

[0052] Specifically, in the 3D reconstruction of buildings, this invention performs classification processing on the point cloud data collected by LiDAR. In this embodiment, each point in the point cloud has 3D spatial coordinates (x, y, z) and 3D color information (R, G, B), forming a total of 6-dimensional feature vectors to describe each point. To ensure better consistency and stability of the point cloud data in subsequent processes, each feature dimension of the point is normalized. For spatial coordinates (x, y, z), it is assumed that the x-coordinate range of all points in the current point cloud scene is [x...]. min ,x max ], then through the formula Normalize the x-coordinate of each point to the interval [0,1], where x represents the original x-coordinate of the current point. normalized This represents the normalized x-coordinate of the current point. Similarly, the y and z coordinates of all points are processed in the same way. For color values, they are directly divided by 255 (assuming the color value range is 0 to 255) to normalize to the [0,1] interval.

[0053] S2: Construct a DGCNN network based on the improved KNN algorithm, train the DGCNN network, and obtain a trained DGCNN model.

[0054] Please see Figure 2 , Figure 2 This is a schematic diagram of the structure of a DGCNN network based on an improved KNN algorithm for processing point cloud data, provided by an embodiment of the present invention. The DGCNN network includes a spatial transformation layer, four graph convolutional layers, a max-pooling layer, a first multilayer perceptron, and a second multilayer perceptron connected sequentially. The spatial transformation layer performs a spatial transformation on the input normalized point cloud data to make the point cloud data spatially invariant. The graph convolutional layers use the improved KNN algorithm to obtain the k nearest neighbors of each point in the building point cloud, perform feature aggregation using these k nearest neighbors, and output the aggregated feature vector. The max-pooling layer receives the feature vector output by the last graph convolutional layer and performs max-pooling on the point dimension to obtain a global feature vector. The first multilayer perceptron abstracts and transforms the global feature vector to extract higher-level semantic information. The second multilayer perceptron includes multiple hidden layers for outputting the predicted category and corresponding prediction score.

[0055] Specifically, the DGCNN network takes point cloud data normalized in step S1 as input. This normalized point cloud data is then fed into the spatial transformation layer. The spatial transformation layer performs spatial transformations on the input point cloud data, which may include operations such as rotation, translation, and scaling. The purpose is to make the point cloud data spatially invariant, so that the subsequent network can better learn features without being affected by the initial position and pose of the data. It should be noted that... Figure 2 In this context, n×3 indicates that the current point cloud data includes n points, and each point has 3 dimensions. The dimensions of the input and output data of the spatial transformation layer remain unchanged. For example, if the input data has a dimension of n×3, then the output data also has a dimension of n×3.

[0056] Subsequently, the data output from the spatial transformation layer is input into the first graph convolutional layer. Figure 2 The first graph convolutional layer (EdgeConvmlp 64) receives spatially transformed point cloud data, performs edge convolution operations, extracts and updates features, and enhances the understanding of local structures, making the feature dimension of the output data 64; then it is input into the second graph convolutional layer ( Figure 2 In the second EdgeConv mlp (64), edge convolution is performed again to further extract and update features, enhancing the understanding of local structures. The output is still n×64 data features. This is then fed into the third graph convolutional layer (...). Figure 2 In the third EdgeConv mlp 64 layer, convolution is performed based on the n×64 data features from the previous layer to further mine the details of the local features of the point cloud, while maintaining the output dimension of n×64. Then, the fourth graph convolutional layer ( Figure 2 In EdgeConv mlp 128, the input is the n×64 data features of the previous layer. Through the edge convolution of this layer, the feature dimension of the output data is increased to 128, which can capture more complex local geometric patterns and relationships, and provide richer information for subsequent global feature aggregation.

[0057] The max pooling layer then receives the n×128 feature vector output from the last graph convolutional layer and performs max pooling on the point dimension. That is, for each feature dimension, the maximum value of that dimension is selected from all points, resulting in a 1×128 global feature vector. This global feature vector integrates information from the entire point cloud and reflects its overall geometric characteristics and patterns. Next, the 1×128 global feature vector is passed through a multilayer perceptron (the first multilayer perceptron, corresponding to...). Figure 2 The output dimension of MLP1024 is changed to 1×1024, which further abstracts and transforms the global features to extract higher-level semantic information for better classification.

[0058] Finally, it passes through a multi-layer perceptron (the second multi-layer perceptron, corresponding to the Figure 2 MLP in it), which contains multiple hidden layers with dimensions of 512 and 256 in sequence, and finally the output dimension is c, where c represents the number of categories. This step maps the previously extracted features to the specific category space and can obtain the prediction scores for each category.

[0059] In each graph convolutional layer of the DGCNN network, the improved KNN algorithm is used to obtain the information of the K nearest neighbor points of the building point cloud data for feature aggregation. The improved KNN algorithm is a KNN search method based on the KD-tree (KD-TREE), specifically including: first, constructing a KD-tree according to the data features input to the current graph convolutional layer; using the predefined weight rule to perform feature aggregation on the information of the K nearest neighbor points to obtain the updated data features of the current point, and processing the aggregated data features through an activation function to improve the recognition accuracy of the building point cloud data.

[0060] Please refer to Figure 3 , when constructing a KD-tree according to the data features input to the current graph convolutional layer, use the KD-tree building algorithm to build a KD-tree for the normalized data features of the building point cloud. For k-dimensional data features, create index arrays for each dimension respectively to form a super key (a1, a2, a2, …, a k ), where a1, a2, a2, …, a k respectively represent the data values of the 1st to kth dimensions of the current point. For example, for 6-dimensional data features (x, y, z, R, G, B), during the construction process, create index arrays for each dimension respectively. During the merge sort process, use the super key (such as x:y:z:R:G:B) to determine the order of points, so as to ensure that duplicate point feature vectors can be correctly processed.

[0061] Subsequently, compare and sort the points in sequence according to the order of the super keys of each point to obtain the index array of all points after sorting. Specifically, assume that there are two points P1(x1, y1, z1, R1, G1, B1) and P2(x2, y2, z2, R2, G2, B2) in the point cloud data. When comparing their super keys, first compare x1 and x2. If x1 < x2, then arrange P2(x2, y2, z2, R2, G2, B2) behind P1(x1, y1, z1, R1, G1, B1). If x1 and x2 are equal, then continue to compare y1 and y2, and so on until the order is determined.

[0062] Next, based on the sorted index array, partition all data features according to the median element to obtain the left subtree and the right subtree, and gradually construct the KD-tree structure. Specifically, as Figure 4As shown, for example, for an index array of one dimension, after determining the value of the median element, elements less than this value are classified into the left subtree, and elements greater than this value are classified into the right subtree, thus progressively constructing a tree structure.

[0063] Subsequently, in the current graph convolutional layer, the constructed KD tree is used to search for the K nearest neighbors of each point in the point cloud, and the information of the K nearest neighbors is used for feature aggregation to obtain the updated data of the current point.

[0064] It should be noted that for the traditional KNN algorithm, when searching for the K nearest neighbors (i.e., the K nearest neighbor points), it is necessary to calculate the Euclidean distance between the selected point and every point in the current point cloud data. The Euclidean distance formula is:

[0065]

[0066] Where d(p,q) represents the distance between points p and q in the point cloud, p j and q j Let p and q represent the j-th eigenvalues ​​of points p and q, respectively, and n represent the number of dimensions. After obtaining the Euclidean distance between the selected point and every point in the current point cloud data, the Euclidean distances are compared, and the K points with the smallest Euclidean distances are selected as the target points, i.e., the K nearest neighbors. This type of method has high computational complexity and low efficiency in point cloud data with high information density.

[0067] In this invention, KNN search optimization is performed based on a constructed KD-tree. For a selected point, starting from the root node of the KD-tree, the subtree that may contain nearest neighbors is quickly located by comparing the selected point's feature value in the current dimension with the median of the current point. For example, if the selected point's k-th dimension feature value is less than the current point's median in that dimension, the left subtree is searched; otherwise, the right subtree is searched. During the search process, a priority queue is used to store the k nearest neighbors found and their distances. The priority queue is sorted in ascending order of distance. If the distance of a newly found point is less than the distance of the farthest point in the priority queue, the farthest point is popped and the new point is inserted, such as... Figure 6 As shown in the figure. This avoids calculating the distance between the selected point and all points in the dataset, greatly reducing the amount of computation.

[0068] In practical applications, during the computation of each graph convolutional layer in the DGCNN network, when it is necessary to find the K-nearest neighbors of points in the building point cloud, a pre-constructed KD-tree is used for the search. Starting from the root node, based on the comparison between the feature value of the building point cloud in the current dimension and the median (the feature value of the root node in that dimension), the subtree that may contain nearest neighbors is quickly located. For example, if a feature value of the current point (such as the height dimension) is less than the feature value of the root node in that dimension, the subtree region with a value less than this value (left subtree) is searched; otherwise, the subtree region with a value greater than this value (right subtree) is searched. During the search process, this process of comparison and selection of subtrees is repeated until a leaf point is reached or a sufficient number of nearest neighbors are found (for example, the set number of nearest neighbors is 20, i.e., K=20).

[0069] Subsequently, after obtaining the K nearest neighbors of the current point in the building point cloud using the improved KNN algorithm, feature aggregation is performed on the data features of these K nearest neighbors. For example, for each point in the building point cloud, after finding its K nearest neighbors using a KD-tree, the features of the K nearest neighbors are aggregated according to their features and predefined weighting rules (such as a weighted average considering building structural features) to obtain a new feature representation of the current point. The aggregated features are then processed through an activation function to improve the accuracy of identifying building point cloud data.

[0070] Specifically, in the graph convolutional layer, the improved KNN algorithm is used to obtain neighbor information of points and perform feature aggregation. Let H be the input feature matrix of the l-th graph convolutional layer. () (like Figure 4 As shown, it consists of 4 layers and has a size of n×d. l Where n is the number of points in the point cloud to be reconstructed from the input network, and d l Let be the feature dimension of the l-th graph convolutional layer, and let the i-th row represent the feature vector of the i-th point. Then, its feature aggregation formula is:

[0071]

[0072] Where N(i) represents the set of K nearest neighbors of point i found through the KD-tree, and W () Let σ represent the learnable weight matrix of the l-th layer, and σ be the activation function. Let H represent the feature vector of point j in the l-th graph convolutional layer, N(j) represent the set of the K nearest neighbors of point j found through the KD-tree, and H represent the feature vector of point j. (+1) This represents the aggregated feature vector.

[0073] Furthermore, the loss function used in this DGCNN network is cross-entropy loss, as shown in the formula:

[0074]

[0075] Where M is the number of training samples used in the training process, Q is the number of class labels in the training samples, and y mq This represents the probability that the m-th training sample belongs to the q-th category. This represents the probability that the predicted value of the m-th training sample belongs to the q-th category.

[0076] When performing point cloud classification, the Dynamic Graph Convolutional Neural Network (DGCNN) first performs data preprocessing. It reads in the raw point cloud data, represents each point using x, y, and z coordinates and any possible additional features, and then normalizes the coordinate values ​​to eliminate scale and positional differences. Next, it constructs a dynamic graph structure, using the K-nearest neighbor parameter to search for neighboring points, building an initial graph based on spatial proximity. As the network propagates forward, it dynamically updates neighborhood relationships based on point features. In the feature extraction and convolution operation stage, it focuses on extracting edge features based on the relative relationships between adjacent points, then feeds these features into the dynamic graph convolutional layer. The convolutional kernel slides across the irregular graph structure to aggregate neighborhood information, achieving hierarchical feature extraction. Afterward, it performs global feature aggregation through pooling operations, employing a max pooling strategy to summarize the local maximum features to obtain a global feature vector reflecting the overall geometric characteristics of the point cloud. Finally, it outputs the corresponding classification category.

[0077] Furthermore, after constructing the DGCNN network, it is necessary to train the DGCNN network before actual use. During the training process, a large number of building point clouds are first collected to form a dataset, and each building point cloud is labeled with a target type label.

[0078] This invention divides the dataset into a training set (80%), a validation set (10%), and a test set (10%). During training, a stochastic gradient descent algorithm is used with an initial learning rate of η0 = 0.01 and coefficients μ = 0.9, for 100 epochs. In each epoch, for each point cloud data sample in the training dataset, normalization is first performed. The normalized point cloud data sample is then input into the DGCNN network to be trained. Forward propagation is used to calculate the prediction result, and the loss value is calculated according to the loss function. Next, the gradient is calculated using the backpropagation algorithm based on the loss value, updating the parameters of the DGCNN network. Every 5 batches, the accuracy of the DGCNN network is evaluated on the validation dataset. If the accuracy does not improve for 3 consecutive batches, the algorithm is used to update the training set according to formula η0. new = old ×0.1 reduces the learning rate for subsequent training, where η old η represents the current learning rate. new This represents the updated learning rate.

[0079] After training, on the corresponding test set, based on the points in the input point cloud scene and the features of their nearest neighbors found through a KD-tree, the class prediction of the point cloud scene is output. For each point cloud scene in the test set, the test point cloud data is inferred by the trained model, and the class with the highest score is selected as the final result. Alternatively, points belonging to different objects in a single point cloud dataset can be marked with different colors to achieve visualization of point cloud semantic segmentation, such as... Figure 5 As shown.

[0080] Furthermore, model performance can be evaluated using metrics such as accuracy, recall, and F1 score. The formula for calculating accuracy is:

[0081]

[0082] Wherein, TP (True Positive) represents the number of true positive examples, TN (True Negative) represents the number of true negative examples, FP (False Positive) represents the number of false positive examples, and FN (False Negative) represents the number of false negative examples.

[0083] True positives are the number of samples that are actually positive and are predicted as positive by the model. For example, in a classification task using building point cloud data, if a building is actually of a certain type (such as an ancient building), and the model correctly predicts it as an ancient building, then the number of such samples is a true positive. True negatives are the number of samples that are actually negative and are predicted as negative by the model. False positives are the number of samples that are actually negative but are predicted as positive by the model.

[0084] Comparative experiments showed that, compared with the original KNN-DGCNN structure, the recognition accuracy of this method was improved by 4%, while the recognition precision of target point cloud data was improved by 11%, and the recall rate was improved by 12%, significantly improving the recognition effect of corresponding building data.

[0085] S3: Input the normalized point cloud data into the trained DGCNN model to obtain the corresponding prediction results.

[0086] The trained DGCNN model is applied to prediction tasks on real-world point cloud data, such as point classification. For point classification, the DGCNN model outputs a predicted point category based on the input point and the features of its nearest neighbors determined by the improved KNN algorithm. In the application process, the new graph structure data is preprocessed to construct a KD tree, and then the trained DGCNN model is used for prediction to obtain the final prediction result.

[0087] To illustrate the performance evaluation process of the 3D point cloud reconstruction method based on the improved KNN DGCNN model of the present invention, this embodiment further explains the performance evaluation process of the improved nearest neighbor sampling algorithm and the comparison process with the original algorithm based on the above embodiment.

[0088] During testing, 1000 test points were randomly selected, and K-nearest neighbor search was performed using both the traditional KNN algorithm and the optimized KNN algorithm based on KD-trees proposed in this invention. The average search time for the two methods was calculated. Under the same hardware environment, the traditional KNN algorithm, when processing these 1000 test points, had an average search time of T per test point. KNN =0.5 seconds. It is evident that traditional nearest neighbor sampling methods involve enormous computational demands for a dataset of 20,000 sample points. However, the optimized KNN algorithm based on KD-trees in this invention reduces the average search time to T for each test point. KD-tree =0.05 seconds, because the KD tree can quickly locate the area where possible nearest neighbors are located through the division of the tree structure, reducing unnecessary distance calculations.

[0089] The speedup ratio of the original KNN algorithm and the improved KD-tree algorithm is compared, and the formula is as follows: This shows that the DGCNN model based on the improved KNN is ten times faster than the traditional KNN algorithm. Furthermore, the accuracy of the nearest neighbor points found by both methods is evaluated by calculating the average relative error. It is the distance from test point i to its true nearest neighbor, while It is the distance to the nearest neighbor found by the algorithm, and the average relative error formula is:

[0090] To calculate the average relative error more accurately, for each test point, its true nearest neighbor is first found using a brute-force search method, and the true distance is calculated. Then, the traditional KNN algorithm and the KD-tree-based optimization algorithm were used to find nearest neighbors and calculate the corresponding distances. After calculation, the ARE using the original KNN KNN =0.02, while after replacing it with a KD-tree, the ARE of the KD-tree-based optimization algorithm... KD-tree =0.025. The similar errors indicate that the optimization algorithm can maintain accuracy similar to the traditional KNN algorithm while significantly improving search speed.

[0091] This invention proposes a building point cloud reconstruction method based on an improved KNN-based DGCNN model. In terms of computational efficiency, the improved KNN algorithm based on KD-trees significantly enhances the computational speed of the DGCNN model. The KD-tree structure, through its efficient spatial partitioning strategy, drastically reduces the computational load during KNN search, greatly accelerating the processing of building point cloud data. Compared to traditional methods, this invention can significantly shorten processing time and improve reconstruction efficiency when processing building point cloud data of the same scale, effectively reducing project timelines and providing more timely data support for architectural design, planning, and conservation.

[0092] In terms of reconstruction accuracy, the method of this invention demonstrates a significant performance improvement in 3D reconstruction tasks using building point clouds. By constructing neighborhood relationships of point cloud data more accurately, it can effectively capture the fine structure and complex features of buildings, reducing reconstruction deviations caused by nearest-neighbor search errors. Whether it's the intricate decorative elements such as carvings and eaves of ancient buildings, or the unique shape and internal structure of modern high-rise buildings, they can all be more accurately reproduced, thus providing highly reliable 3D models for architectural research, historical building preservation, and digital display.

[0093] In practical applications, this invention excels in building data registration, accurately matching and fusing building point cloud data collected from different perspectives or at different times, ensuring the integrity and consistency of the reconstruction results. During compressed reconstruction, the optimized algorithm effectively reduces data storage while maintaining reconstruction quality, improving data transmission and storage efficiency, and lowering hardware requirements. This provides a more economical, efficient, and reliable solution for the application of building point cloud data, with broad application prospects in urban planning, digital preservation of architectural heritage, real estate development, and many other fields.

[0094] In the several embodiments provided by this invention, it should be understood that the apparatus and methods disclosed in this invention can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of modules is merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0095] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or in the form of hardware plus software functional modules.

[0096] Another embodiment of the present invention provides a storage medium storing a computer program for executing the steps of the 3D point cloud reconstruction method based on the improved KNN-based DGCNN model described in the above embodiments. A further aspect of the present invention provides an electronic device including a memory and a processor. The memory stores a computer program, and the processor, when calling the computer program in the memory, implements the steps of the 3D point cloud reconstruction method based on the improved KNN-based DGCNN model described in the above embodiments. Specifically, the integrated modules implemented as software functional modules can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0097] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.

Claims

1. A method for reconstructing building point clouds based on an improved KNN-based DGCNN model, characterized in that, include: S1: Normalize the original building point cloud to be reconstructed to obtain normalized point cloud data; S2: Construct a DGCNN network based on the improved KNN algorithm and train the DGCNN network to obtain a trained DGCNN model. The DGCNN network based on the improved KNN algorithm includes a spatial transformation layer, four graph convolutional layers, a max pooling layer, a first multilayer perceptron, and a second multilayer perceptron connected in sequence. The spatial transformation layer is used to perform spatial transformation on the input normalized point cloud data to make the point cloud data spatially invariant. The graph convolutional layers are used to obtain the points in the building point cloud using the improved KNN algorithm. The nearest neighbor points, using the The nearest neighbor points are used to aggregate features, and the aggregated feature vector is output. The max pooling layer is used to receive the feature vector output by the last graph convolutional layer and perform max pooling operation on the dimension of the points to obtain the global feature vector. The first multilayer perceptron is used to abstract and transform the global feature vector to extract higher-level semantic information. The second multilayer perceptron includes multiple hidden layers to output the predicted category and the corresponding predicted score. The graph convolutional layer is specifically used for: Construct a KD tree based on the data features input to the current graph convolutional layer; Search each point in the point cloud using the constructed KD tree. K The nearest neighbor; Using predefined weighting rules to... K The information of the nearest neighbor points is used to aggregate features to obtain the updated data features of the current point. The aggregated data features are processed through an activation function to improve the accuracy of building point cloud data identification. Constructing a KD tree based on the data features input to the current graph convolutional layer includes: for k For each dimension of data features, create an index array to form a superkey. ,in, These represent the first to the second dimensions of the current point, respectively. k Dimensional data values; The points are compared and sorted sequentially according to the superkey of each point to obtain a sorted index array of all points; Based on the index array after sorting all points, all data features are partitioned according to the median element to obtain the left subtree and the right subtree, and then the KD tree structure is constructed progressively. S3: Input the normalized point cloud data into the trained DGCNN model to obtain the corresponding prediction results.

2. The method for reconstructing building point clouds based on the improved KNN-based DGCNN model according to claim 1, characterized in that, S1 includes: The 6-dimensional feature vector of each point in the original building point cloud is normalized. The 6-dimensional feature vector includes 3-dimensional spatial coordinates. and 3D color information .

3. The method for reconstructing building point clouds based on the improved KNN-based DGCNN model according to claim 2, characterized in that, Using predefined weighting rules to... K The information of the nearest neighbors is used to aggregate features to obtain the updated data features of the current point, including: In the graph convolutional layer, the improved KNN algorithm is used to obtain each point in the input feature vector. K Feature aggregation is performed on the nearest neighbor points, and the aggregation formula is: in, Indicates the first The input feature vector of the layer graph convolutional layer is of size . , For the number of points, Input feature vector Feature dimensions, Point Found using a KD-tree K The set of nearest neighbors The learnable weight matrix of a layered graph convolutional layer. For activation function, Indicates the first l Midpoint of layer convolution layer j eigenvectors, Point Found using a KD-tree K The set of nearest neighbors This represents the aggregated feature vector.

4. The method for reconstructing building point clouds based on the improved KNN-based DGCNN model according to claim 1, characterized in that, The loss function of the DGCNN model is the cross-entropy loss, expressed as: , in, This represents the number of training samples used during the training process. The number of class labels in the training samples. Indicates the first m The training sample belongs to the first... q The probability of different types Indicates the first m The predicted value of the training sample belongs to the th training sample. q The probability of different types.

5. The method for reconstructing building point clouds based on the improved KNN-based DGCNN model according to claim 1, characterized in that, The DGCNN network is trained to obtain a trained DGCNN model, including: Set the initial learning rate, coefficient parameters, and training batches, and collect building point clouds to form a training dataset. Each building point cloud is labeled with a target type label. During each batch of training, for each point cloud data sample in the training dataset, normalization is first performed. The normalized point cloud data sample is then input into the DGCNN network to be trained. The prediction result is calculated through forward propagation, and the loss value is calculated according to the loss function. The gradient is calculated using the backpropagation algorithm based on the loss value, and the parameters of the DGCNN network are updated. After every 5 training batches, the accuracy of the DGCNN network is evaluated on the validation dataset. If the accuracy does not improve for 3 consecutive batches, then the network is evaluated according to the formula. Reduce the learning rate for subsequent training, where... This represents the current learning rate. This represents the updated learning rate.

6. A storage medium storing a computer program, characterized in that, The computer program is used to perform the steps of the building point cloud reconstruction method based on the improved KNN DGCNN model as described in any one of claims 1 to 5.

7. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and when the processor calls the computer program in the memory, it implements the steps of the building point cloud reconstruction method based on the improved KNN DGCNN model as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Three-dimensional point cloud classification method based on sparse graph convolution

    CN114373099A

  • Deep learning-based high-precision point cloud completion method and apparatus

    WO2024060395A1