Homestead point cloud classification method based on k-nearest neighbor feature extraction and deep learning
Through methods based on k-nearest neighbor feature extraction and deep learning, the problems of low efficiency of traditional homestead measurement methods and insufficient point cloud classification accuracy are solved, and more efficient homestead rights confirmation and point cloud classification are achieved, which improves the complex environment Classification accuracy and efficiency.
Patent Information
- Application Number
- CN202011019957.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-25
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2040-09-25
AI Technical Summary
Traditional homestead measurement methods consume a lot of manpower, have low measurement efficiency, high cost and long cycles. Traditional point cloud classification technology has low accuracy in complex environments, which is prone to problems of misidentification and insufficient feature extraction.
Using the homestead point cloud classification method based on k-nearest neighbor feature extraction and deep learning, the optimal neighborhood range, inverse distance interpolation and full convolutional neural network training model is calculated through the principles of data denoising, farthest point sampling, and fragrant entropy to improve the training model of the training model of the above-mentioned neighborhood range, inverse distance interpolation and full convolutional neural network to improve the Accuracy and efficiency of point cloud classification.
The anti-noise capability of point cloud classification algorithm in complex environments has been enhanced, classification accuracy and feature calculation accuracy of different point cloud density areas have been improved, and the homestead rights confirmation efficiency has been significantly improved.
Smart Images

Figure CN112101278B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a homestead point cloud classification method based on k-nearest neighbor feature extraction and deep learning. Background Art
[0002] With the continuous development of my country's rural economy, in order to safeguard the legitimate rights and interests of farmers, the country is accelerating the registration of rural homesteads and real estate rights. The traditional measurement method of homesteads usually adopts the field measurement method of GPS-RTK combined with total station. This method not only consumes a lot of manpower and physics, but also has low measurement efficiency, high cost and long cycle. In recent years, as an emerging observation method for obtaining high temporal and spatial resolution spatial information, the laser radar system (LiDAR) has been widely used in the fields of geographic information acquisition, power line inspection, forest monitoring, road detection, unmanned driving and urban three-dimensional modeling. Airborne LiDAR technology combines high-precision GPS-RTK positioning technology and high-precision ranging technology to obtain three-dimensional information of the measurement scene and characterize it in the form of point cloud. Traditional point cloud filtering and classification technology often has low accuracy and low computational efficiency in large scene applications. The reasons for this result include: 1) Due to complex environments, point clouds of large scenes often contain a large number of noise points. Traditional classification algorithms are sensitive to noise points and are prone to misidentification; 2) Due to the uneven distribution of point cloud density during point cloud sampling, the point cloud has high redundancy in local areas and missing information in local areas. Traditional classification algorithms cannot perform good feature extraction in both areas at the same time, resulting in low classification accuracy. Summary of the invention
[0003] In order to solve the technical problems existing in the above-mentioned prior art, the present invention provides a homestead point cloud classification algorithm based on k-nearest neighbor feature extraction and deep learning. The specific technical solution is as follows:
[0004] A method for classifying homestead point clouds based on k-nearest neighbor feature extraction and deep learning, the method comprising:
[0005] S1, collecting a data set, the data set includes homestead point clouds with a number above a preset value, performing point cloud denoising by using a statistical method, and dividing the data set into a training set and a test set;
[0006] S2, classify the point cloud to obtain labeled point cloud data;
[0007] S3, downsample the point cloud using the farthest point sampling to reduce the point cloud density;
[0008] S4, based on the Shannon entropy principle, calculates the optimal neighborhood range of the point cloud, calculates local features point by point based on the optimal neighborhood range, and constructs the feature matrix of the entire point cloud after upsampling through inverse distance interpolation;
[0009] S5, build a full convolutional neural network training model and use the feature matrix of the training set for training;
[0010] S6, use the neural network to predict the data in the test set and verify the trained model.
[0011] In one possible design, step S1 further includes:
[0012] S101, use the UAV equipped with laser radar to scan the area to be measured, and obtain the las file through point cloud solution;
[0013] S102, segmenting the collected point cloud on TerraSolid to obtain point cloud blocks of a preset size, and dividing them into a training set and a test set in proportion;
[0014] S103, performing statistical filtering on each point cloud.
[0015] In one possible design, step S2 further includes:
[0016] S201, extracting a low point, where the low point is an error point that is lower than the actual ground;
[0017] S202, extracting ground points;
[0018] S203, extracting vegetation points and building points;
[0019] S204, performing manual correction on the misclassified points.
[0020] In one possible design, step S3 further includes:
[0021] Assume there are n points in total, and the entire point set is N = {X1, X2, ..., X n}The goal is to select K points;
[0022] S301, randomly select a point X i As the starting point, and write point set B = {X i};
[0023] S302, select the remaining n-1 points to calculate and X i The distance between the points, select the farthest point X j Write point set B = {X i ,X j};
[0024] S303, select the remaining n-2 points to calculate the distance with each point in point set B, and take the shortest distance as the distance between the point and the point set. In this way, the distances between n-2 points and the point set are obtained, and the point X with the largest distance is selected.k , write point set B = {X i ,X j ,X k};
[0025] S304, repeat the above steps to select the remaining points one by one, select the point with the farthest distance and write it into point set B until the number of points in point set B is equal to k, and then end the iteration.
[0026] In one possible design, step S4 further includes:
[0027] S401, using a fast nearest neighbor algorithm to calculate the first k nearest neighbor points point by point;
[0028] S402, optimizing and solving the neighborhood size by using an algorithm based on minimizing Shannon entropy;
[0029] S403, calculating local features of the point cloud and constructing a feature matrix, where the local features include three-dimensional features and two-dimensional features;
[0030] S404, using the k-neighborhood based inverse distance interpolation algorithm to perform interpolation on the point cloud features, the calculation formula is as follows:
[0031]
[0032] Where p is the weighted power index, d(x,x i ) is the distance between this point and the center point.
[0033] In one possible design, step S402 further includes:
[0034] In [k min ,k max ] and calculate the covariance matrix at intervals of Δ=5;
[0035] Let m be the total number of samples, that is, the total number of point clouds in the neighborhood, and each point is represented by a three-dimensional vector, then the sample matrix is:
[0036]
[0037] Find the sample mean of each dimension, that is, the centroid of the neighborhood:
[0038]
[0039] Compute the three-dimensional covariance matrix of this neighborhood:
[0040]
[0041] Where wi is the weight of point pi;
[0042] By singular value decomposition covariance matrix, namely V-1 CV=D, and a diagonal matrix D is obtained, which contains three non-negative eigenvalues {λ1,λ2,λ3}, and V is an orthogonal matrix, which consists of three eigenvectors corresponding to the eigenvalues and perpendicular to each other. The eigenvalues are sorted to obtain λ1>λ2>λ3;
[0043] Normalize the eigenvalues and calculate the Shannon entropy of the neighborhood:
[0044] E λ =-e1ln(e1)-e2ln(e2)-e3ln(e3)
[0045] in, is the normalized eigenvalue, whose cumulative sum is 1. Compare the Shannon entropy at different neighborhood ranges, and take the k with the minimum Shannon entropy as the optimal neighborhood.
[0046] In one possible design, step S403 further includes:
[0047] The characteristics based on the three-dimensional covariance matrix are shown in the following table:
[0048]
[0049]
[0050] Among them, {λ1,λ2,λ3} are the eigenvalues of the three-dimensional covariance matrix, and {e1,e2,e3} are the normalized eigenvalues;
[0051] The two-dimensional local features of the point cloud are shown in the following table:
[0052]
[0053] In the table (x k ,y k ) is the neighboring point with the largest distance from a point in the optimal neighborhood of a point, and k is the optimal neighborhood value of the point; the three-dimensional geometric structure characteristics of the point cloud are shown in the following table:
[0054]
[0055]
[0056] In the table (x k ,y k ,z k ) is the coordinate of the neighbor point farthest from the optimal neighborhood of a point, k is the optimal neighborhood range, is the average elevation of all neighborhood points, is the unit normal vector, which is obtained by normalizing the eigenvector corresponding to the eigenvalue of the minimum three-dimensional variance matrix. is the z-axis unit vector.
[0057] In one possible design, step S5 further includes:
[0058] S501, establishing a multilayer perceptron, the multilayer perceptron comprising an input layer, a hidden layer and an output layer, the neurons in the hidden layer are fully connected with the neurons in the input layer and the output layer respectively;
[0059] S502, establishing a global feature extraction module, which performs maximum pooling on all features of the point cloud through a maxpooling function, and obtains global features after aggregating the features of the points;
[0060] S503, establishing a semantic segmentation module, the semantic segmentation module aggregates global features and local features, outputs the probability of each category of each point cloud through a multi-layer perceptron, and selects the category with the largest probability value as the category of the point cloud;
[0061] S504, define a loss function.
[0062] In a possible design, in step S501, the multilayer perceptron calculates the output according to the following formula:
[0063] H=φ(BN(XW h +b h ))
[0064] O=Hw o +b o
[0065] Where W h and b h are the weight coefficient and bias term of the hidden layer, W o and b o are the weight coefficient and bias term of the output layer respectively, X represents the input of the hidden layer of this layer, which is also the output feature of the previous hidden layer or the input vector of the input layer, H represents the feature map of the hidden layer, O represents the feature map of the output layer of the multilayer perceptron, and BN represents the batch normalization layer, which is used to solve the problem of internal covariate offset of the input after feature mapping as the number of hidden layers increases;
[0066] The input is a d-dimensional vector x=(x (1) ...x (d) ), whose expression is:
[0067]
[0068] Among them, E[x (k) ] is the mean of the input quantity, Var[x (k) ] is the variance of the input, β=E[x (k) ];
[0069] φ represents the activation function, and the ReLU function is selected as the activation function. The expression is:
[0070]
[0071] In one possible design, in a multi-layer perceptron, a dropout mechanism is used to retain each neuron with probability P when training the network. The calculation formula is as follows:
[0072]
[0073] The Bernoulli (p) function generates a probability vector r, which is used to implement dropout by masking some output neurons of the previous layer and performing feature mapping of this layer.
[0074] The main advantages of the technical solution of the present invention are as follows:
[0075] The homestead point cloud classification method based on k-nearest neighbor feature extraction and deep learning of the present invention enhances the anti-noise ability of the point cloud classification algorithm in complex environments, improves classification accuracy, improves the feature calculation accuracy of areas with different point cloud density and the classification accuracy of point clouds in complex scenarios, and can greatly improve the efficiency of homestead title confirmation. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] The drawings described herein are used to provide a further understanding of the embodiments of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0077] Figure 1 A flowchart of a method for classifying homestead point cloud based on k-nearest neighbor feature extraction and deep learning provided by an embodiment of the present invention;
[0078] Figure 2 A system block diagram of a homestead point cloud classification method based on k-nearest neighbor feature extraction and deep learning provided by an embodiment of the present invention;
[0079] Figure 3 A dropout schematic diagram provided by an embodiment of the present invention;
[0080] Figure 4 A deep neural network architecture diagram provided for one embodiment of the present invention;
[0081] Figure 5 A point cloud segmentation effect diagram provided by an embodiment of the present invention;
[0082] Figure 6 A schematic diagram of point cloud building classification provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0083] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in combination with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0084] The technical solution provided by the embodiments of the present invention is described in detail below with reference to the accompanying drawings.
[0085] As attached Figure 1 and 2 As shown, an embodiment of the present invention provides a method for classifying homestead point clouds based on k-nearest neighbor feature extraction and deep learning, the method comprising:
[0086] S1, collecting a data set, the data set includes homestead point clouds with a number above a preset value, performing point cloud denoising by using a statistical method, and dividing the data set into a training set and a test set;
[0087] S2, classify the point cloud to obtain labeled point cloud data;
[0088] S3, downsample the point cloud using the farthest point sampling to reduce the point cloud density;
[0089] S4, based on the Shannon entropy principle, calculates the optimal neighborhood range of the point cloud, calculates local features point by point based on the optimal neighborhood range, and constructs the feature matrix of the entire point cloud after upsampling through inverse distance interpolation;
[0090] S5, build a full convolutional neural network training model and use the feature matrix of the training set for training;
[0091] S6, use the neural network to predict the data in the test set and verify the trained model.
[0092] The homestead point cloud classification method based on k-nearest neighbor feature extraction and deep learning provided in the embodiment of the present invention enhances the anti-noise ability of the point cloud classification algorithm in complex environments, improves the classification accuracy, improves the feature calculation accuracy of areas with different point cloud density and the classification accuracy of point clouds in complex scenarios, and can greatly improve the efficiency of homestead title confirmation.
[0093] Specifically, the steps of the homestead point cloud classification method based on k-nearest neighbor feature extraction and deep learning provided by an embodiment of the present invention are described in detail below:
[0094] Wherein, step S1 further includes the following steps:
[0095] S101 uses a DJI drone equipped with a laser radar to scan the area to be measured and obtains a las file through point cloud solution.
[0096] S102, segment the collected point cloud on TerraSolid to obtain several point cloud blocks of 100m*100m in size, and manually separate the training set and the test set. For example, the ratio of the training set to the test set can be 4:1. The effect diagram of the point cloud segmentation can be seen in the attached figure. Figure 5 .
[0097] S103, statistical filtering is performed on each point cloud. The probability density function formula of the neighborhood average distance is:
[0098]
[0099] Where xi is the distance of any point in the neighborhood, μ is the average distance of the neighborhood, and σ is the standard deviation of the neighborhood distance. Points whose average distance is outside the standard deviation range, i.e., μ+n·σ, can be defined as outliers and removed.
[0100] Step S2 further comprises the following steps:
[0101] S201, extract low points. This step is mainly to extract erroneous points that are lower than the actual ground points due to multipath reflection. The principle is to give a point as the center point, and compare the elevations of the points within the specified range with the point. If the point is significantly lower than the points within the specified range, for example, the elevation of the point is more than 50 cm lower than the average elevation of the points within the specified range, then the point is determined as a low point. The specific value of "significantly lower than" such as the above 50 cm can be set by those skilled in the art according to actual conditions.
[0102] S202, extract ground points. This step mainly extracts ground points through an algorithm based on progressive encryption of irregular triangulated networks. It mainly includes two stages. 1) Given the size of the largest building, divide the point cloud according to the size, extract the lowest point in each divided area as the ground seed point, and build a TIN model. 2) Calculate the angle and distance between each point and the TIN model, set the points within the set threshold range as ground points, and build a TIN model here and iterate repeatedly until the ground point density meets the set value.
[0103] S203, extracting vegetation points and building points. Normalizing the point cloud by ground points, and classifying vegetation points and building points by elevation division.
[0104] S204: Manual correction is required for the misclassified points. For example, a building point is mistakenly identified as a high vegetation point. The correction method uses a cross-sectional view to observe the point cloud structure in different directions, and selects the misclassified points to change their categories. Finally, labeled point cloud data is obtained, which includes four categories: ground points, building points, vegetation points, and other unclassified points.
[0105] Step S3 further comprises the following steps:
[0106] Assume there are n points in total, and the entire point set is N = {X1, X2, ..., X n The goal is to select K points:
[0107] S301, randomly select a point X i As the starting point, and write point set B = {X i}.
[0108] S302, select the remaining n-1 points to calculate and X i The distance between the points, select the farthest point X j Write point set B = {X i ,X j}.
[0109] S303, select the remaining n-2 points to calculate the distance with each point in point set B, and take the shortest distance as the distance between the point and the point set. In this way, the distances between n-2 points and the point set are obtained, and the point X with the largest distance is selected. k , write point set B = {X i ,X j ,X k}.
[0110] S304, repeat the above steps until the number of points in point set B is equal to K, and then the iteration ends.
[0111] Through this step, a point set B including K points is obtained, and the point cloud density is reduced.
[0112] Step 4 further includes the following steps:
[0113] S401, using the fast nearest neighbor algorithm to calculate the first k nearest neighbor points point by point. The distance metric standard uses the Euclidean distance, and the calculation formula is as follows:
[0114]
[0115] Where P is the center point, P i is the neighboring point of P.
[0116] S402, using a method based on minimizing Shannon entropy to optimize the domain size. min ,kmax ] within the range of Δ = 5 to calculate the covariance matrix. The specific solution process is as follows:
[0117] 1) Let m be the total number of samples, that is, the total number of point clouds in the neighborhood. Each point is represented by a three-dimensional vector, then the sample matrix is:
[0118]
[0119] 2) The sample mean of each dimension can be obtained, that is, the centroid of the neighborhood:
[0120]
[0121] 3) Calculate the three-dimensional covariance matrix of the neighborhood
[0122]
[0123] where w i For point p i The weight, generally w i =1.
[0124] 4) Since the covariance matrix is a semi-positive symmetric matrix, it can be decomposed by singular value decomposition, that is, V -1 CV=D, and we get a diagonal matrix D, which contains three non-negative eigenvalues {λ1,λ2,λ3}. And V is an orthogonal matrix, which consists of three eigenvectors corresponding to the eigenvalues and perpendicular to each other. Sorting the eigenvalues, we get λ1>λ2>λ3.
[0125] 5) Normalize the eigenvalues and calculate the Shannon entropy of the neighborhood:
[0126] E λ =-e1ln(e1)-e2ln(e2)-e3ln(e3) (6)
[0127] in, is the normalized eigenvalue, and its cumulative sum is 1. Compare the Shannon entropy at different neighborhood ranges, and take the k with the minimum Shannon entropy as the optimal neighborhood.
[0128] S403, calculate the local features of the point cloud and construct a feature matrix. The local features include three-dimensional features and two-dimensional features. The calculation process is as follows:
[0129] 1) The feature types and calculation formulas based on the three-dimensional covariance matrix are shown in the following table.
[0130]
[0131] In the table, {λ1,λ2,λ3} are the eigenvalues of the three-dimensional covariance matrix, and {e1,e2,e3} are the normalized eigenvalues.
[0132] 2) Extraction of 2D local features of point cloud
[0133] Project all three-dimensional points in the optimal neighborhood into the XY plane, calculate the two-dimensional structure tensor of each point, and calculate the two-dimensional variance matrix based on the two-dimensional structure tensor. After the matrix singular value decomposition, the eigenvalues {λ1,λ2} of the two-dimensional variance matrix are obtained. And the sum of the eigenvalues Σ λ,2D , eigenvalue ratio R λ,2D , the radius of the circle in the two-dimensional plane is r k-NN,2D and the 2D local density D of the point cloud 2D The calculation formula is shown in the following table.
[0134]
[0135]
[0136] In the table (x k ,y k ) is the neighboring point with the largest distance from a point in the optimal neighborhood of the point, and k is the optimal neighborhood value of the point.
[0137] 3) Three-dimensional geometric structure features
[0138] Analyze the 3D geometric structure of all neighboring points within the optimal neighborhood of each point in the data set. The radius r of the 3D sphere of the 3D neighborhood can be calculated. k-NN,3D , the local 3D point density D of the point cloud 3D , elevation range δ z , elevation variance and verticality θ.
[0139] The calculation formula is shown in the following table.
[0140]
[0141] In the table (x k ,y k ,z k ) is the coordinate of the neighbor point farthest from the optimal neighborhood of a point, k is the optimal neighborhood range, is the average elevation of all neighborhood points, is the unit normal vector, which can be obtained by normalizing the eigenvector corresponding to the eigenvalue of the minimum three-dimensional variance matrix. is the z-axis unit vector.
[0142] S403, due to the large number of point clouds in large scenes, usually in the order of tens of millions or even hundreds of millions. Step S3 uses the farthest point sampling to downsample the point cloud and then extract features, which can reduce the computational cost. In order to obtain the feature vectors of all original point clouds, upsampling can be performed by interpolation from the downsampled data. The k-neighborhood-based inverse distance interpolation algorithm is used to interpolate the point cloud features, and the calculation formula is as follows:
[0143]
[0144] Where p is the weighted power index, and p=2 is selected here. d(x,x i ) is the distance between the point and the center point. After upsampling by inverse distance interpolation, the feature matrix of the entire point cloud can be obtained.
[0145] Step S5 further includes the following steps:
[0146] A deep neural network is constructed, and the N*18 feature matrix composed of eigenvalue-based features, point cloud geometric features, local density and other features is used as the input of the network to achieve automatic classification of point clouds. The deep neural network designed in this patent is based on the PointNet network architecture, which consists of a multi-layer perceptron, a global feature extraction module and a semantic segmentation module.
[0147] S501, build a multi-layer perceptron
[0148] The multilayer perceptron consists of an input layer, a hidden layer, and an output layer. The neurons in the hidden layer are fully connected to the input layer, and the neurons in the output layer are also fully connected to the hidden layer. The multilayer perceptron can calculate the output according to the following formula:
[0149]
[0150] Where W h and b h are the weight coefficient and bias term of the hidden layer respectively. o and b o are the weight coefficient and bias term of the output layer respectively. X represents the input of the hidden layer of this layer, which is also the output feature of the previous hidden layer or the input vector of the input layer. H represents the feature map of the hidden layer, and O represents the feature map of the output layer of the multilayer perceptron. BN represents the batch normalization layer, which mainly solves the problem of internal covariate offset of the input after feature mapping as the number of hidden layers increases. For the input d-dimensional vector x=(x (1) ...x (d) ), whose expression is:
[0151]
[0152] Where E[x (k)] is the mean of the input quantity, Var[x (k) ] is the variance of the input quantity. β=E[x (k) ].
[0153] φ represents the activation function. Generally, we choose the ReLU function as the activation function, and the expression is:
[0154]
[0155] The ReLU function only retains the positive input terms and can greatly accelerate the convergence speed of the stochastic gradient descent method. Since it is a linear function, there is no problem of gradient disappearance.
[0156] S502, global feature module
[0157] Since the feature matrix is obtained by extracting features based on the local neighborhood of the point cloud, it cannot represent the global features of the point cloud. Point clouds are not structured data storage methods because they are arranged in a non-deformable manner and cannot be operated on by sliding convolution. The arrangement invariance can be solved by using a symmetric function. All features of the point cloud are pooled by the maxpooling function. After aggregating the features of the points, global features can be obtained. The symmetric function is approximately defined as a general function on a point set:
[0158] f({x1,...,x m})≈g(h(x1),...,h(x n ))(11)
[0159] Where f: h: And g: is a symmetric function. This module uses a multi-layer perceptron network to approximate h, and g consists of a single variable function and a maximum pooling function.
[0160] S503, semantic segmentation module
[0161] The semantic segmentation module aggregates global features and local features, and then passes through a multi-layer perceptron to output the probability of each category of each point cloud. The category of the point cloud with the highest probability is the category of the point cloud. In the multi-layer perceptron, in order to avoid overfitting, the dropout mechanism is used. Its core idea is to retain each neuron according to probability P when training the network. The calculation formula is as follows:
[0162]
[0163] The Bernoulli (p) function generates a probability vector r, which is used to implement dropout by shielding some output neurons of the previous layer and performing feature mapping of this layer. Figure 3 shown.
[0164] S504, define the loss function
[0165] This is a multi-classification problem, and we use the cross entropy loss function here:
[0166]
[0167] in, is the predicted value of the i-th point, y (i) is the true value of the i-th point, Θ is the model parameter. The optimal model parameter is obtained by minimizing the loss function.
[0168] In step S5, the constructed neural network model is as shown in the attached figure. Figure 4 shown.
[0169] The final completed point cloud building classification diagram is as follows Figure 6 shown.
[0170] In summary, the beneficial effects of the homestead point cloud classification method based on k-nearest neighbor feature extraction and deep learning provided by the embodiment of the present invention are as follows:
[0171] 1. It can automatically classify large scene point clouds and use nearest neighbor optimization to improve feature extraction accuracy to ensure classification accuracy.
[0172] 2. It can obtain the three-dimensional structure of the homestead, automatically identify the building range, and measure the building area.
[0173] 3. It can greatly improve the efficiency of homestead title confirmation.
[0174] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In addition, "front", "back", "left", "right", "upper" and "lower" in this article are all referenced to the placement state shown in the accompanying drawings.
[0175] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A homestead point cloud classification method based on k-nearest neighbor feature extraction and deep learning, It is characterized in that The method comprises: S1, collecting a data set, the data set includes homestead point clouds with a number above a preset value, performing point cloud denoising by using a statistical method, and dividing the data set into a training set and a test set; S2, classify the point cloud to obtain labeled point cloud data; S3, downsample the point cloud using the farthest point sampling to reduce the point cloud density; S4, based on the Shannon entropy principle, calculates the optimal neighborhood range of the point cloud, calculates local features point by point based on the optimal neighborhood range, and constructs the feature matrix of the entire point cloud after upsampling through inverse distance interpolation; S5, build a full convolutional neural network training model and use the feature matrix of the training set for training; S6, using the fully convolutional neural network training model to predict the data in the test set and verify the fully convolutional neural network training model; Step S1 further comprises: S101, using a drone equipped with a laser radar to scan the area to be measured, and obtaining a las file through point cloud solution; S102, segmenting the collected point cloud on TerraSolid to obtain point cloud blocks of a preset size, and dividing them into a training set and a test set in proportion; S103, performing statistical filtering on each point cloud; Step S2 further comprises: S201, extracting a low point, where the low point is an error point that is lower than the actual ground; S202, extracting ground points; S203, extracting vegetation points and building points; S204, performing manual correction on the misclassified points; Step S3 further comprises: Assume there are n points in total, and the entire point set is N = {X 1 ,X 2 ,...,X n }, the goal is to select K points; S301, randomly select a point X i As the starting point, and write point set B = {X i }; S302, select the remaining n-1 points to calculate and X i The distance between the points, select the point with the largest distance X j Write point set B = {X i ,X j }; S303, select the remaining n-2 points to calculate the distance with each point in point set B, take the shortest distance as the distance from the point to the point set, obtain the distances from n-2 points to point set B, select the point X corresponding to the maximum distance from the n-2 points to point set B k , write point set B = {X i ,X j ,X k }; S304, repeat the above steps to select the remaining points one by one, select the point with the largest distance and write it into point set B until the number of points in point set B is equal to K, and then the iteration ends; Step S4 further comprises: S401, use the fast nearest neighbor algorithm to calculate the first k points one by one max nearest neighbor points; S402, optimizing and solving the neighborhood size based on the Shannon entropy minimization algorithm; S403, calculating local features of the point cloud and constructing a feature matrix, where the local features include three-dimensional features and two-dimensional features; S404, using an inverse distance interpolation algorithm based on a k-neighborhood to perform interpolation on the point cloud features; Step S402 further includes: In [k min ,k max ] to calculate the three-dimensional covariance matrix with a step size of 5; Let m be the total number of samples, that is, the total number of point clouds in the neighborhood, and each point is represented by a three-dimensional vector, then the sample matrix is: Find the sample mean of each dimension, that is, the centroid of the neighborhood: Compute the three-dimensional covariance matrix of this neighborhood: where w i For point p i The weight of By singular value decomposition of the three-dimensional covariance matrix, namely V -1 C(P)V=D, and we get a diagonal matrix D, which contains three non-negative eigenvalues λ 1 ,λ 2 ,λ 3 , and V is an orthogonal matrix, which consists of three eigenvectors corresponding to the eigenvalues and perpendicular to each other. Sorting the eigenvalues, we get λ 1 >λ 2 >λ 3 ; Normalize the eigenvalues and calculate the Shannon entropy of the neighborhood: HAVE BEEN λ =-e 1 ln(ie 1 )-have been 2 ln(ie 2 )-have been 3 ln(ie 3 ) Among them, e i =λ i / ∑λ i ,i∈{1,2,3},e i is the normalized eigenvalue, e i The cumulative sum is 1, and the Shannon entropy at different neighborhood ranges is compared. The k with the minimum Shannon entropy is taken as the optimal neighborhood value; The calculation formula for the difference of point cloud features using the inverse distance interpolation algorithm based on the k-neighborhood is as follows: Where p is the weighted power index, d(x,x i ) is the point (x i ,y i ,z i ) and the distance between the center point (x,y,z); Step S403 further includes: The three-dimensional covariance matrix features include: curvature, linearity, flatness, dispersion, isotropy, anisotropy, eigenentropy, and sum of eigenvalues; Curvature C λ Calculated by the following formula: Linearity L λ Calculated by the following formula: Flatness P λ Calculated by the following formula: Discreteness S λ Calculated by the following formula: Isotropic λ Calculated by the following formula: Anisotropy A λ Calculated by the following formula: Intrinsic entropy E λ Calculated by the following formula: The sum of eigenvalues Σ λ Calculated by the following formula: Σ λ =and 1 +e 2 +e 3 Among them, λ 1 ,λ 2 ,λ 3 is the eigenvalue of the three-dimensional covariance matrix, e 1 ,e 2 ,e 3 is the normalized eigenvalue; The two-dimensional local features of the point cloud include: the sum of eigenvalues, the eigenvalue ratio, the radius of the circle and the discreteness of the two-dimensional plane; the sum of eigenvalues Σ λ,2D Calculated by the following formula: S λ,2D =λ 1 +λ 2 Eigenvalue ratio R λ2D Calculated by the following formula: The radius r of a two-dimensional circle k-NN,2D Calculated by the following formula: Discreteness D 2D Calculated by the following formula: Among them, (x k ,y k ) is the neighboring point with the largest distance from a point in the optimal neighborhood of a point, and k is the optimal neighborhood value of the point; The 3D geometric structure features of point clouds include: 3D sphere radius, 3D point density, elevation range, elevation variance, and verticality; Radius of the three-dimensional sphere r k-NN,3D Calculated by the following formula: 3D point density D 3D Calculated by the following formula: Elevation range δ z Calculated by the following formula: δ z =from max -With min Elevation variance Calculated by the following formula: The verticality θ is calculated by the following formula: Among them, (x k ,y k ,z k ) is the coordinate of the point farthest from the optimal neighbor of a point, k is the optimal neighbor value, is the average elevation of all neighborhood points, is the unit normal vector, which is obtained by normalizing the eigenvector corresponding to the eigenvalue of the minimum three-dimensional variance matrix. is the z-axis unit vector; Step S5 further comprises: S501, establishing a multilayer perceptron, the multilayer perceptron comprising an input layer, a hidden layer and an output layer, the neurons in the hidden layer are fully connected with the neurons in the input layer and the output layer respectively; S502, establishing a global feature extraction module, which performs maximum pooling on all features of the point cloud through a maxpooling function, and obtains global features after aggregating the features of the point cloud; S503, establishing a semantic segmentation module, the semantic segmentation module aggregates global features and local features, outputs the probability of each category of each point cloud through a multi-layer perceptron, and selects the category with the largest probability value as the category of the point cloud; S504, define a loss function.
2. The homestead point cloud classification method based on k-nearest neighbor feature extraction and deep learning according to claim 1, It is characterized in that In step S501, the multilayer perceptron calculates the output according to the following formula: H=φ(BN(XW h +b h )) O=Hw o +b o Where W h and b h are the weight coefficient and bias term of the hidden layer, w o and b o are the weight coefficient and bias term of the output layer, X represents the input of the hidden layer, H represents the feature map of the hidden layer, O represents the feature map of the output layer of the multilayer perceptron, and BN represents the batch normalization layer; The input is a d-dimensional vector x=(x (1) ...x (d) ), whose expression is: Among them, E[x (k) ] is the mean of the input quantity, Var[x (k) ] is the variance of the input, β (k) =E[x (k) ]; φ represents the activation function, and the ReLU function is selected as the activation function. The expression is: Among them, the feature matrix composed of eigenvalue-based features and point cloud features is used as the input of the fully convolutional neural network training model to achieve automatic classification of point clouds.
3. The homestead point cloud classification method based on k-nearest neighbor feature extraction and deep learning according to claim 2, It is characterized in that In the multi-layer perceptron, the dropout mechanism is used to retain each neuron with probability P when training the network. The calculation formula is as follows: The Bernoulli(p) function is the generation probability Vector, dropout is achieved by shielding some output neurons of the previous layer and then performing feature mapping of this layer.
