Machine Learning-Based Intelligent Drawing Recognition Method
By training the Mask R-CNN model, the segmentation mask skeleton and skeleton endpoints of terrain elements in the topographic map are extracted, and the reliability and connectivity are analyzed, which solves the problem of discontinuity of linear elements segmentation in the topographic map, and achieves more accurate intelligent drawing recognition.
Patent Information
- Application Number
- CN202510607165.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-13
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-05-13
AI Technical Summary
In the prior art, when using Mask R-CNN to segment the topographic map, some elongated and interrupted linear elements (such as contour lines, rivers, etc.) cannot be accurately segmented, resulting in discontinuity of the mask, affecting the accuracy of the identification results.
By training the Mask R-CNN model, the segmented mask skeleton and skeleton endpoints of terrain elements in the topographic map are extracted, the reliability and connectivity of the skeleton endpoints are analyzed, and the endpoints with high reliability are connected to achieve intelligent identification of the drawings.
It improves the accuracy of intelligent identification of drawings, ensures the feature integrity of linear elements, reduces false connections, and improves the accuracy of segmentation masks.
Smart Images

Figure CN120148063B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of topographic data processing. More specifically, the present invention relates to an intelligent drawing recognition method based on machine learning. Background Art
[0002] A topographic map consists of topographic elements, mainly including landforms and ground features. Landforms refer to the undulating forms on the earth's surface, such as mountains, hills, plains, basins, etc. Generally, contour lines are used to represent the height changes of the terrain. Through the density and shape of the contour lines, the steepness and slope changes of the terrain can be intuitively seen. Ground features refer to artificial or natural objects on the earth's surface, such as buildings, roads, rivers, lakes, forests, etc. These ground features are represented by different symbols and colors for easy identification and distinction.
[0003] Currently, during the process of manually identifying and annotating topographic maps, it is usually affected by the subjective ideas and experience of the staff, with low efficiency and prone to errors. Therefore, it is necessary to study an intelligent recognition method for drawings with the help of algorithms. Mask Region-based Convolutional Neural Network (MaskR-CNN for short) is an instance segmentation model. This algorithm can accurately detect targets and segment contours. In topographic maps, it can accurately distinguish different ground features such as buildings and vegetation, refine the boundaries and categories, and obtain the segmentation masks of each topographic element, providing technical support for the refined extraction of topographic elements and complex scene analysis.
[0004] However, when directly using Mask R-CNN to segment topographic maps, for some slender and interrupted linear elements (such as contour lines, rivers, etc.), the segmentation masks output by the model will have discontinuous problems. Some features of the linear elements are not correctly segmented or marked, resulting in the loss of the overall target information, thus affecting the accuracy of the final recognition result.
[0005] Therefore, how to accurately output the masks according to the landforms and ground features existing in the topographic map is an urgent problem to be solved currently. Summary of the Invention
[0006] To solve the above technical problem of how to accurately output the masks according to the landforms and ground features existing in the topographic map, the present invention proposes an intelligent drawing recognition method based on machine learning, and this method includes the following steps:
[0007] Obtain the categories and segmentation masks of each topographic feature in the topographic map through a pre-trained Mask R-CNN model, extract the skeleton and skeleton endpoints corresponding to each segmentation mask; obtain all the pixel points and the number of all pixel points between the skeleton endpoint and the nearest branch point on the skeleton where the skeleton endpoint is located, and use them as the branch and branch distance of the skeleton endpoint respectively; determine the reliability of the skeleton endpoint according to the pixel curvature, branch distance and skeleton length in the skeleton endpoint branch on the skeleton; determine the true endpoints among the skeleton endpoints in response to the comparison result between the reliability of the skeleton endpoint and the reliability threshold; determine the neighboring endpoints of the true endpoints according to the distance and category between the true endpoints and other true endpoints, and determine the connectability between the true endpoints and their respective neighboring endpoints according to the cosine similarity of the direction vectors and the Euclidean distance between the true endpoints and their respective neighboring endpoints; connect the true endpoints and neighboring endpoints with the maximum connectability greater than the connection threshold to obtain the complete skeleton of the topographic feature, so as to realize the intelligent recognition of the drawing.
[0008] The present invention realizes the intelligent recognition of the drawing by training the Mask R-CNN model, and can accurately obtain the intelligent recognition result of the drawing. When extracting the recognition result of each topographic feature on the drawing according to the trained Mask R-CNN model, the present invention takes into account that some linear features in the topographic features may be broken during the recognition of the segmentation mask, which ultimately affects the integrity of the features of the linear features; therefore, the present invention accurately evaluates the possibility that the two can be connected together by analyzing the feature consistency between each skeleton endpoint on the segmentation mask skeleton and the nearest adjacent skeleton endpoint, so as to realize the accurate connection of the segmentation mask and effectively improve the accuracy of the intelligent recognition of the drawing. In the process of evaluating the possibility that the skeleton endpoint and the nearest adjacent skeleton endpoint can be connected together, the present invention also takes into account that some skeleton endpoints belong to false endpoints on short branches, and participating in the connection of the segmentation mask of the linear feature may cause incorrect connection; therefore, the present invention calculates the reliability of the skeleton endpoint by analyzing the pixel curvature, branch distance and skeleton length in each skeleton endpoint branch, so as to accurately screen false endpoints and effectively improve the accuracy of the intelligent recognition of the drawing.
[0009] According to the method for intelligent recognition of drawings based on machine learning provided by the present invention, a Mask R-CNN model is pre-trained, including: obtaining a topographic electronic image, preprocessing it to obtain a training sample set, and training a Mask R-CNN model for extracting topographic features in the topographic map according to the training sample set.
[0010] The present invention takes into account that the efficiency of model construction can be improved through some preprocessing means, so the topographic electronic image is preprocessed to improve the overall quality and facilitate model construction.
[0011] According to the machine learning-based intelligent drawing recognition method provided by the present invention, a classical thinning algorithm is used to extract the skeleton and the skeleton endpoints corresponding to each segmentation mask.
[0012] According to the machine learning-based intelligent drawing recognition method provided by the present invention, before obtaining all the pixel points and the number of all pixel points between the skeleton endpoint and the nearest branch point on the skeleton where the skeleton endpoint is located, it further includes: screening out the noisy skeletons according to the comparison result between the number of pixel points on the skeleton and the number threshold.
[0013] The present invention takes into account that the number of pixel points of some skeletons is very small, which are noise points generated by factors such as noise shadows, etc. Therefore, they are removed by threshold screening, so as to improve the quality of the skeletons and prepare for subsequent data processing.
[0014] According to the machine learning-based intelligent drawing recognition method provided by the present invention, obtaining all the pixel points and the number of all pixel points between the skeleton endpoint and the nearest branch point on the skeleton where the skeleton endpoint is located, and respectively taking them as the branch and the branch distance of the skeleton endpoint, further includes: if the number of skeleton endpoints on the skeleton is two, then taking the skeleton as the branch of the skeleton endpoint and taking the skeleton length as the branch distance of the skeleton endpoint.
[0015] According to the machine learning-based intelligent drawing recognition method provided by the present invention, determining the reliability of the skeleton endpoint according to the pixel curvature, branch distance and skeleton length in the branch of the skeleton endpoint on the skeleton includes: calculating the reliability of the j-th skeleton endpoint of the i-th skeleton :
[0016] ;
[0017] is the sum of curvatures of all pixel points in the branch of the j-th skeleton endpoint of the i-th skeleton, is the maximum value of the sum of curvatures of all pixel points in the branches of all skeleton endpoints on all skeletons, is the branch roughness of the j-th skeleton endpoint of the i-th skeleton, is the average length of all skeletons, is the branch distance of the j-th skeleton endpoint of the i-th skeleton, is the exponential function with e as the base, is the positive value-taking function.
[0018] In view of the fact that some skeleton endpoints belong to false endpoints on short branches, and participating in the segmentation mask connection of linear elements may result in incorrect connections, the present invention provides a reliable method for calculating the reliability of accurate skeleton endpoints. By comprehensively considering the pixel curvature, branch distance, and skeleton length in each skeleton endpoint branch, the reliability of each skeleton endpoint can be accurately calculated, so that false endpoints in the skeleton endpoints can be accurately screened out subsequently.
[0019] According to the machine learning-based intelligent drawing recognition method provided by the present invention, determining the true endpoints in the skeleton endpoints in response to the comparison result between the reliability of the skeleton endpoints and the reliability threshold includes: if the reliability of the skeleton endpoint is not less than the reliability threshold, then the skeleton endpoint is a true endpoint; otherwise, discard the skeleton endpoint, and obtain the adjacent pixel points of the skeleton endpoint along the branch direction of the skeleton endpoint as the new skeleton endpoints of the branch to continue calculating the reliability for judgment, and so on in a loop until the reliability of the new skeleton endpoints is not less than the reliability threshold or a branch point is reached.
[0020] According to the machine learning-based intelligent drawing recognition method provided by the present invention, determining the neighboring endpoints of the true endpoints according to the distance and category between the true endpoints and other true endpoints includes: obtaining the ascending order of the Euclidean distances between the true endpoints and other true endpoints that have the same category but are on different skeletons; sequentially obtaining a preset number of other true endpoints corresponding to the Euclidean distances in the ascending order of the Euclidean distances as the neighboring endpoints of the true endpoint.
[0021] According to the machine learning-based intelligent drawing recognition method provided by the present invention, determining the connectability between the true endpoints and their respective neighboring endpoints according to the cosine similarity of the direction vectors and the Euclidean distances between the true endpoints and their respective neighboring endpoints includes: calculating the connectability of the th true endpoint of the th skeleton and its th neighboring endpoint
[0022] ;
[0023] 、 are respectively the cosine similarity of the direction vectors and the Euclidean distance between the th true endpoint of the th skeleton and its th neighboring endpoint, is the branch roughness of the th true endpoint of the th skeleton, is the branch roughness of the th neighboring endpoint of the It is a function to take the maximum value.
[0024] Considering that the two true endpoints at the break of the linear feature belong to the same category and have a high similarity in terms of distance and direction, the present invention provides an accurate calculation formula for the connectability between a true endpoint and its neighboring endpoint. By calculating the cosine similarity of the direction vectors, the Euclidean distance, and the similarity degree of branch roughness between the true endpoint and its neighboring endpoints of the same category, the connectability can be accurately obtained, so as to accurately evaluate the necessity of connecting the true endpoints.
[0025] According to the intelligent drawing recognition method based on machine learning provided by the present invention, connecting the true endpoints and neighboring endpoints with the maximum connectability greater than the connection threshold to obtain the complete skeleton of the terrain feature, so as to realize the intelligent recognition of the drawing, includes: recording the neighboring endpoint with the maximum connectability greater than the connection threshold to the true endpoint as the target endpoint; obtaining n pixel points on the branches of the true endpoint and the corresponding target endpoint respectively for polynomial fitting to obtain the fitting curve; connecting the true endpoint, the fitting curve, and the target endpoint in sequence to obtain the complete skeleton of the terrain feature; merging the segmentation masks belonging to the same complete skeleton to obtain the masked area with category labels, so as to realize the intelligent recognition of the drawing.
[0026] The present invention has the following beneficial effects:
[0027] Based on the above technical solutions, the intelligent drawing recognition method based on machine learning provided by the present invention can accurately obtain the intelligent recognition result of the drawing by training the Mask R-CNN model. When extracting the recognition result of each terrain feature on the drawing according to the trained Mask R-CNN model, the present invention considers that some linear features in the terrain feature may be broken during the recognition of the segmentation mask, which will ultimately affect the integrity of the features of the linear feature; therefore, the present invention analyzes the feature consistency between each skeleton endpoint on the segmentation mask skeleton and the nearest adjacent skeleton endpoint, accurately evaluates the possibility that the two can be connected together, so as to realize the accurate connection of the segmentation mask and effectively improve the accuracy of intelligent drawing recognition. In the process of evaluating the possibility that the skeleton endpoint and the nearest adjacent skeleton endpoint can be connected together, the present invention also considers that some skeleton endpoints belong to the false endpoints on the short branches, and participating in the connection of the segmentation mask of the linear feature may cause incorrect connection; therefore, the present invention calculates the reliability of the skeleton endpoint by analyzing the pixel point curvature, branch distance, and skeleton length in each skeleton endpoint branch, so as to accurately screen out the false endpoints and effectively improve the accuracy of intelligent drawing recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a flowchart of the steps of an intelligent drawing recognition method based on machine learning provided by an embodiment of the present invention. Detailed implementation manners
[0029] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments.
[0030] In order to accurately obtain the segmentation mask of terrain elements in a topographic map, an embodiment of the present invention discloses an intelligent drawing recognition method based on machine learning. This method can accurately realize the connection of broken regions in the same segmentation mask by analyzing the possibility that different segmentation masks belong to the same broken segmentation mask, effectively improving the accuracy of intelligent drawing recognition.
[0031] Please refer to Figure 1 , Figure 1 which is a step flowchart of an intelligent drawing recognition method based on machine learning provided by an embodiment of the present invention. The method includes the following steps:
[0032] S1: Obtain a set of terrain electronic images for training to obtain a Mask R-CNN model.
[0033] It should be noted that in order to adapt to the network structure, the sizes of the terrain electronic images in the training sample set need to be the same to facilitate subsequent batch processing. Before inputting the terrain electronic image set into the Mask R-CNN model, the terrain electronic image set needs to be preprocessed.
[0034] Among them, the size of the topographic map can be set to 800×800 pixels; specifically, the size of the topographic map can be set according to actual needs.
[0035] Exemplarily, in the embodiment of the present invention, training the Mask R-CNN model includes: obtaining a training sample set after preprocessing a set of terrain electronic images, and training a Mask R-CNN model for extracting terrain elements in the topographic map according to the training sample set.
[0036] Among them, the preprocessing can include normalizing the pixel values in each terrain electronic image in the training sample set to obtain the training sample set, and each topographic map in the training sample set is a training sample.
[0037] Specifically, when the Mask R-CNN model for extracting terrain features in a terrain map is obtained by training the training sample set, the corresponding labels can be set manually for each training sample in the training sample set to determine the category of each terrain feature in the training sample; the corresponding label file is generated using the annotation tool to obtain the annotated training sample set. ResNet-50 is selected as the backbone network. The input of the backbone network is the training sample set, and the output is the feature map set. The region proposal network RPN is constructed on the feature map in the feature map set. The RPN contains a 3×3 convolution layer for feature extraction, and then two 1×1 convolution layers are connected, one for regional classification of terrain features and background, and the other for predicting the bounding box coordinates of the terrain features for bounding box regression. The annotated training sample set is divided into a training set and a validation set according to a preset ratio, and the training set is used to train the Mask R-CNN model.
[0038] Among them, the preset ratio can be 80% training set and 20% validation set; the specific ratio can be set according to actual needs.
[0039] During the training process, the initial learning rate of the model can be set to 0.001, and the change mode of the initial learning rate is the attenuation strategy, that is, the learning rate is gradually reduced as the number of training times increases to ensure that the model can converge quickly in the early stage of training and the parameters can be adjusted more finely in the later stage.
[0040] The batch size can be set to 8; the larger the batch size, the more stable the model is, but it takes up more memory, so the batch size can be adjusted according to hardware resources.
[0041] The number of training rounds can be set to 100. During the training process, if the loss of the validation set no longer decreases or the accuracy no longer increases, the training process can be terminated early. The number of training rounds can be set according to actual needs.
[0042] The loss function of the model is composed of the sum of classification loss, bounding box regression loss, and mask loss, which correspond to the cross entropy loss function, SmoothL1 loss function, and binary cross entropy loss function respectively; the loss function can be set according to actual needs. The loss function is used to measure the difference between the model prediction result and the true label, and the optimization algorithm is used to update the model parameters to minimize the loss function; the optimization algorithm can be stochastic gradient descent SGD or Adam, which can be set according to actual needs.
[0043] Finally, the validation set was used to verify the model performance, and finally the Mask R-CNN model for extracting terrain features in topographic maps was obtained.
[0044] After obtaining the trained Mask R-CNN model based on the above steps, the latest acquired topographic map can be input into the trained Mask R-CNN model to obtain the relevant features of the terrain elements in the topographic map, that is, perform the following steps.
[0045] S2: Obtain the categories and segmentation masks of terrain features in the topographic map through the pre-trained Mask R-CNN model, and extract the skeleton and skeleton endpoints corresponding to each segmentation mask.
[0046] It should be noted that the segmentation masks of some linear features may be discontinuous. Although the Mask R-CNN model can accurately segment the terrain features in the topographic map and obtain their closed contour segmentation masks, it cannot extract the spatial skeleton structure and topological connection relationship of each terrain feature. It can only analyze the geometric representation surface and cannot accurately achieve continuous description of linear features with discontinuous segmentation masks in terrain features.
[0047] Based on this, the embodiment of the present invention can obtain the real skeleton of each segmentation mask through a skeleton extraction algorithm, so that the segmentation masks that belong to the same linear element but are not connected can be merged according to the characteristics of the skeleton.
[0048] It can be understood that the skeleton is a minimized representation of the shape of the terrain element, retaining only the topological and geometric properties of the shape (such as length, direction, bifurcation point, etc.). For linear elements or complete terrain elements that may have fractures in the terrain elements, the skeleton can provide a structural description for the connection of the fractured area, thereby capturing its potential linear direction. The skeleton arrangement direction near the skeleton endpoints on the skeleton represents the direction of the linear element, which can be used to identify the possible degree that the segmentation mask and the segmentation mask in the adjacent range belong to the same linear element. Therefore, when extracting each segmentation mask skeleton, the skeleton endpoints of each skeleton must also be extracted.
[0049] For example, in an embodiment of the present invention, a classic thinning algorithm may be used to extract a skeleton and skeleton endpoints corresponding to each segmentation mask.
[0050] Among them, the classic thinning algorithm can be Zhang-Suen algorithm, Hilditch algorithm, etc., which can be set according to actual needs. The specific steps of extracting the skeleton and skeleton endpoints according to the classic thinning algorithm can be implemented through existing technologies, and the embodiments of the present invention are not described here.
[0051] It should be noted that in the process of extracting the skeleton and the skeleton endpoints, there may be noise generated during the topographic map printing process, thereby generating speckles. Such speckles are noise points, which contain a small number of pixels and do not belong to the real skeleton, so they need to be screened out.
[0052] Exemplarily, in the embodiments of the present invention, noise skeletons are screened according to the comparison result between the number of pixel points on the skeleton and the number threshold.
[0053] Among them, the number threshold can be set to 5; specifically, the number threshold can be set according to actual needs.
[0054] Specifically, if the number of pixel points on the skeleton of the segmentation mask is greater than the number threshold, the skeleton is retained; otherwise, the skeleton is removed from the corresponding segmentation mask.
[0055] Based on the above steps, the skeletons and skeleton endpoints corresponding to each segmentation mask can be obtained. There may be branches on the skeleton (such as roads, contour lines, etc.). However, not every skeleton endpoint is a real skeleton endpoint. This is because there may be small protruding blocks (such as burrs) on some segmentation masks, and short branches may be generated on the skeleton after processing by the classical thinning algorithm. False endpoints may be formed at the ends of the short branches. Obviously, false endpoints do not represent the true extension direction of the linear feature, but will interfere with the subsequent connection judgment.
[0056] Based on this, the embodiments of the present invention can judge the possibility of each skeleton endpoint being a real endpoint according to the pixel point characteristics between the skeleton endpoint on the skeleton and the branch point closest to it, that is, the following steps are executed.
[0057] S3: Obtain all the pixel points and the number of all pixel points between the skeleton endpoint and the branch point closest to the skeleton where the skeleton endpoint is located, and use them as the branch and branch distance of the skeleton endpoint respectively; determine the reliability of the skeleton endpoint according to the pixel curvature, branch distance and skeleton length in the branch of the skeleton endpoint on the skeleton.
[0058] It can be understood that if the skeleton has branches, there are more than two skeleton endpoints; if the skeleton has no branches, there are two skeleton endpoints. Therefore, when obtaining the branch of each skeleton endpoint, for a skeleton without branches, the skeleton can be directly used as the branch for analysis.
[0059] Exemplarily, in the embodiments of the present invention, obtaining all the pixel points and the number of all pixel points between the skeleton endpoint and the branch point closest to the skeleton where the skeleton endpoint is located, and using them as the branch and branch distance of the skeleton endpoint respectively, further includes: if the number of skeleton endpoints on the skeleton is two, using the skeleton as the branch of the skeleton endpoint and using the skeleton length as the branch distance of the skeleton endpoint.
[0060] It should be noted that all the pixel points between the skeleton endpoint and the nearest branch point on the skeleton where the skeleton endpoint is located form the branch of the skeleton endpoint, and the number of all pixel points on the branch is the branch distance of the skeleton endpoint. Generally, the skeleton trend of the segmentation mask is relatively smooth and has a low roughness level. The branch distance between the short branches and branch points on the skeleton is usually relatively short.
[0061] Based on this, the embodiments of the present invention can evaluate the possibility that each skeleton endpoint is an upper endpoint on the real skeleton by analyzing the smoothness of the branch of each skeleton endpoint on the skeleton and the branch distance between the skeleton endpoint and its branch.
[0062] Exemplarily, the ratio of the sum of curvatures of all pixel points in the branch of the skeleton endpoint of the skeleton to the maximum value of the sum of curvatures of all pixel points in the branches of all skeleton endpoints on all skeletons can be used as the branch roughness of the skeleton endpoint.
[0063] Exemplarily, the curvature of each pixel point can be determined by the three-point method, and the specific steps can be obtained through the prior art. The embodiments of the present invention will not elaborate herein.
[0064] Exemplarily, in the embodiments of the present invention, to calculate the reliability of the skeleton endpoint of the skeleton, the following relational expression can be specifically referred to:
[0065] ;
[0066] is the reliability of the j-th skeleton endpoint of the i-th skeleton, is the sum of curvatures of all pixel points in the branch of the j-th skeleton endpoint of the i-th skeleton, is the maximum value of the sum of curvatures of all pixel points in the branches of all skeleton endpoints on all skeletons, is the branch roughness of the j-th skeleton endpoint of the i-th skeleton, is the average value of the lengths of all skeletons, is the branch distance of the j-th skeleton endpoint of the i-th skeleton, is the exponential function with base e, is the positive value-taking function.
[0067] In the above formula, represents the branch roughness of the j-th skeleton endpoint of the i-th skeleton. The larger this value is, the greater the overall curvature of the branch of the j-th skeleton endpoint of the i-th skeleton, the higher the corresponding roughness level, the higher the degree of not conforming to the characteristics of the branch on the linear feature, and the lower the reliability of the skeleton endpoint.
[0068] It represents the possibility that the branch of the j-th skeleton endpoint of the i-th skeleton is a real skeleton. When the branch distance of the j-th skeleton endpoint of the i-th skeleton is smaller, it indicates that the skeleton endpoint is closer to the branch point and the branch is shorter, and the possibility that the skeleton endpoint belongs to a false endpoint is greater; while when the branch distance of the j-th skeleton endpoint of the i-th skeleton reaches or exceeds the average length of all skeletons, the possibility of conforming to a real branch is higher, the possibility of being a real skeleton endpoint is higher, and the corresponding reliability is also higher.
[0069] The reliability of the j-th skeleton endpoint of the i-th skeleton is used to characterize the possibility that the skeleton endpoint is an upper endpoint of a real skeleton.
[0070] After obtaining the reliability of each skeleton endpoint based on the above steps, it is possible to determine whether it is a real endpoint according to the reliability of each skeleton endpoint.
[0071] S4: Determine the real endpoints among the skeleton endpoints in response to the comparison result between the reliability of the skeleton endpoints and the reliability threshold.
[0072] It should be noted that real endpoints can be identified through threshold judgment. On the short branches generated by small bump blocks, even if the skeleton endpoints are false endpoints, some pixel points closer to the branch point may still be real skeleton endpoints. Therefore, for false skeleton endpoints that do not belong to real endpoints after the first judgment, the reliability of the next adjacent pixel point along the branch direction can be continuously iteratively judged, and finally each real endpoint can be accurately obtained.
[0073] Exemplarily, in the embodiment of the present invention, determining the real endpoints among the skeleton endpoints in response to the comparison result between the reliability of the skeleton endpoints and the reliability threshold includes: if the reliability of the skeleton endpoint is not less than the reliability threshold, then the skeleton endpoint is a real endpoint; otherwise, discard the skeleton endpoint, obtain the adjacent pixel point of the skeleton endpoint along the branch direction of the skeleton endpoint as the new skeleton endpoint of the branch, and continue to calculate the reliability for judgment, and so on in a loop until the reliability of the new skeleton endpoint is not less than the reliability threshold or reaches the branch point.
[0074] Among them, the reliability threshold can be set to 0.6; the reliability threshold can be specifically set according to actual needs, and the embodiment of the present invention does not limit it too much here. The new skeleton endpoint is also a skeleton endpoint, so the steps for calculating its reliability are similar to the above steps for calculating the skeleton endpoint, and the embodiment of the present invention will not elaborate here.
[0075] It can be understood that if, during the above iteration, until reaching the branch point, there are no pixel points on this branch that are not less than the reliable threshold, it means that the reliability of all pixel points on this branch is relatively low, and this branch can be directly cancelled. The finally remaining skeleton only contains real endpoints. According to the connectability between a real endpoint and other real endpoints that are relatively close in distance, the connection of the fracture area of the accurate feature can be realized.
[0076] S5: Determine the neighboring endpoints of a real endpoint according to the distance and category between the real endpoint and other real endpoints, and determine the connectability between the real endpoint and its respective neighboring endpoints according to the cosine similarity of the direction vectors and the Euclidean distance between the real endpoint and its respective neighboring endpoints.
[0077] It should be noted that for the fracture part on the linear edge extracted from the topographic map, although the two real endpoints are on different skeletons, the categories of the two real endpoints are the same, the tangent directions will point to each other, the distance between the real endpoints will be very close, and the branch roughness of the two is also relatively similar.
[0078] Based on this, the embodiment of the present invention can obtain the connectability between a real endpoint and a neighboring real endpoint by analyzing the tangent direction pointing and roughness similarity degree between each real endpoint and the neighboring real endpoints of the same category that are relatively close in distance.
[0079] Among them, the ratio of the sum of curvatures of all pixel points in the real endpoint branch of the skeleton to the maximum value of the sum of curvatures of all pixel points in all real endpoint branches on all skeletons can be used as the branch roughness of this real endpoint.
[0080] Exemplarily, in the embodiment of the present invention, determining the neighboring endpoints of a real endpoint according to the distance and category between the real endpoint and other real endpoints includes: obtaining the ascending order of the Euclidean distances between the real endpoint and other real endpoints of the same category but on different skeletons; sequentially obtaining other real endpoints corresponding to a preset number of Euclidean distances in the ascending order of Euclidean distances as the neighboring endpoints of this real endpoint.
[0081] Among them, the preset number can be set to 3; the preset number can be specifically set according to actual needs.
[0082] It can be understood that in the ascending order of the Euclidean distances between the current real endpoint and other real endpoints, sequentially obtaining other real endpoints corresponding to a preset number of Euclidean distances is the neighboring endpoint closest to the current real endpoint.
[0083] Exemplarily, the direction pointing of a real endpoint can be characterized by obtaining its direction vector.
[0084] Specifically, when obtaining the direction vector of a true endpoint, n adjacent pixel points of the true endpoint can be obtained on the true endpoint branch for fitting to obtain the tangent of the true endpoint, and the unit vector along the tangent direction from the branch to the true endpoint is used as the direction vector of the true endpoint.
[0085] Among them, n can be set to 5; specifically, it can be set according to actual needs.
[0086] Exemplarily, in the embodiment of the present invention, the connectability between the th true endpoint of the i-th skeleton and its th neighboring endpoint is calculated. Specifically, the following relational expression can be referred to:
[0087] ;
[0088] is the connectability between the th true endpoint of the i-th skeleton and its th neighboring endpoint, is the cosine similarity of the direction vectors between the th true endpoint of the i-th skeleton and its th neighboring endpoint, is the Euclidean distance between the th true endpoint of the i-th skeleton and its th neighboring endpoint, is the branch roughness of the th true endpoint of the i-th skeleton, is the branch roughness of the th neighboring endpoint of the th true endpoint of the i-th skeleton, is the absolute value symbol, is the maximum value function, is the exponential function with e as the base.
[0089] Among them, e is the natural constant.
[0090] In the above formula, represents the pointing opposition between the th true endpoint of the i-th skeleton and its th neighboring endpoint. When the cosine similarity of the direction vectors between the th true endpoint of the i-th skeleton and its th neighboring endpoint is smaller, the degree to which the th true endpoint and its th neighboring endpoint point to each other is higher, and they are more connectable.
[0091] Denote the distance weight between the th true endpoint of the i-th skeleton and its th nearest neighbor endpoint. The closer the two distances are, but the true endpoints that do not belong to the same skeleton, the higher the possibility that they are the disconnection points of the same linear feature in the Mask R-CNN model recognition, and the more likely they can be connected.
[0092] Denote the similarity degree of the roughness between the th true endpoint of the i-th skeleton and its th nearest neighbor endpoint. is the maximum value of the roughness differences between all true endpoints of all skeletons and their nearest neighbor endpoints. The smaller it is, the smaller the roughness difference between the th true endpoint and its th nearest neighbor endpoint, the higher the similarity degree, and the higher the degree that they can be connected.
[0093] It can be understood that the higher the connectability between a true endpoint and its nearest neighbor endpoint, the greater the possibility that they can be connected. In the topographic map, the linear features disconnected by the segmentation mask usually only appear as being split into two. Therefore, each true endpoint at the linear feature can only have one adjacent endpoint that can be connected. Based on this, the connection of the fracture area can be realized.
[0094] S6: Connect the true endpoints and their nearest neighbor endpoints whose maximum connectability is greater than the connection threshold to obtain the complete skeleton of the topographic element, so as to realize the intelligent recognition of the drawing.
[0095] Among them, the connection threshold can be set to 0.6; specifically, the connection threshold can be set according to actual needs.
[0096] It can be understood that each true endpoint at the linear feature can only have one adjacent endpoint that can be connected. Therefore, only the nearest neighbor endpoint with the highest connectability to the true endpoint needs to be selected for connection to realize the connection of the linear feature disconnected by the segmentation mask. After connecting the skeletons, all segmentation masks belonging to the same complete skeleton can be merged according to the connection method of the skeletons, so as to accurately obtain the output result of the segmentation mask.
[0097] It should be noted that if the maximum connectability between a true endpoint and all its nearest neighbor endpoints is not greater than the connection threshold, it means that the true endpoint and all its nearest neighbor endpoints are not the disconnection points on the same linear feature. For such true endpoints, no connection needs to be made.
[0098] Exemplarily, in the embodiment of the present invention, real endpoints and neighboring endpoints with a maximum connectibility greater than the connection threshold are connected to obtain a complete skeleton of the terrain feature, so as to realize the intelligent recognition of the drawing, including: recording the neighboring endpoints with a maximum connectibility greater than the connection threshold to the real endpoints as target endpoints; obtaining n pixel points on the branches of the real endpoints and the corresponding target endpoints respectively for polynomial fitting to obtain a fitting curve; connecting the real endpoints, the fitting curve and the target endpoints in sequence to obtain a complete skeleton of the terrain feature; merging the segmentation masks belonging to the same complete skeleton to obtain a masked area with class labels, so as to realize the intelligent recognition of the drawing.
[0099] Specifically, when merging the segmentation masks belonging to the same complete skeleton to obtain a masked area with class labels, the distances from the real endpoints and n pixel points on their branches to the edge of the segmentation mask can be obtained respectively, and the average distance is used as the radius; the segmentation mask is expanded according to the radius on the fitting curve to obtain a masked area with class labels; the masked areas of all terrain features on the topographic map are obtained to obtain the intelligent recognition result of the topographic map.
[0100] It can be understood that for other normal terrain features other than the linear features with break points in the terrain features, their masked areas can be directly obtained in the model. By combining the other normal terrain features and the terrain features with the break points completed, the intelligent recognition result of the topographic map can be accurately obtained.
[0101] Exemplarily, after obtaining each masked area with class labels in the intelligent recognition result of the topographic map, the recognition result can also be transmitted to the host computer to complete the drawing marking work on the host computer.
[0102] Among them, the specific steps of uploading to the host computer can be realized by the prior art, and the embodiments of the present invention will not be elaborated herein.
[0103] It can be seen that in the embodiment of the present invention, when obtaining intelligent recognition of drawings, the category and segmentation mask of each topographic feature in the topographic map can be obtained through a pre-trained Mask R-CNN model, and the skeleton and skeleton endpoints corresponding to each segmentation mask are extracted; all the pixel points and the number of all pixel points between the skeleton endpoint and the nearest branch point on the skeleton where the skeleton endpoint is located are obtained, and are respectively used as the branch and branch distance of the skeleton endpoint; the reliability of the skeleton endpoint is determined according to the pixel curvature, branch distance and skeleton length in the branch of the skeleton endpoint on the skeleton; the true endpoints in the skeleton endpoints are determined in response to the comparison result between the reliability of the skeleton endpoint and the reliability threshold; the neighboring endpoints of the true endpoints are determined according to the distance and category between the true endpoints and other true endpoints, and the connectability between the true endpoints and their respective neighboring endpoints is determined according to the cosine similarity of the direction vectors and the Euclidean distance between the true endpoints and their respective neighboring endpoints; the true endpoints and neighboring endpoints with the maximum connectability greater than the connection threshold are connected to obtain the complete skeleton of the topographic feature, so as to realize the intelligent recognition of the drawing, effectively improving the accuracy of the intelligent recognition of the drawing.
[0104] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An intelligent drawing recognition method based on machine learning, characterized in that Including: Obtain the categories and segmentation masks of various terrain elements in the topographic map through a pre-trained Mask R-CNN model, and extract the skeleton and skeleton endpoints corresponding to each segmentation mask; Obtain all the pixel points between the skeleton endpoint and the nearest branch point on the skeleton where the skeleton endpoint is located, and the number of all pixel points, and use them as the branch and branch distance of the skeleton endpoint respectively; Determine the reliability of the skeleton endpoint according to the pixel curvature, branch distance and skeleton length in the branch of the skeleton endpoint on the skeleton, including: Calculate the reliability of the j-th skeleton endpoint of the i-th skeleton : ; is the sum of curvature values of all pixel points in the j-th skeleton endpoint branch of the i-th skeleton, is the maximum value of the sum of curvature values of all pixel points in all skeleton endpoint branches on all skeletons, is the branch roughness of the j-th skeleton endpoint of the i-th skeleton, is the average length of all skeletons, is the branch distance of the j-th skeleton endpoint of the i-th skeleton, is the exponential function with base e, is the positive value taking function; Determine the true endpoints among the skeleton endpoints in response to the comparison result between the reliability of the skeleton endpoint and the reliability threshold; Determine the neighboring endpoints of the true endpoint according to the distance and category between the true endpoint and other true endpoints. According to the cosine similarity of the direction vectors and the Euclidean distance between the true endpoint and its respective neighboring endpoints, determine the connectability between the true endpoint and its respective neighboring endpoints, including: Calculate the connectability between the th true endpoint of the th neighboring endpoint of the th skeleton: ; , are respectively the cosine similarity of the direction vector and the Euclidean distance between the -th true endpoint and the -th nearest neighbor endpoint of the i-th skeleton, is the branch roughness of the -th true endpoint of the i-th skeleton, is the branch roughness of the -th nearest neighbor endpoint of the -th true endpoint of the i-th skeleton, is the absolute value symbol, is the maximum value function; Connect the true endpoints and neighboring endpoints with the maximum connectability greater than the connection threshold to obtain the complete skeleton of the terrain element, so as to realize the intelligent recognition of the drawing.
2. The machine learning-based intelligent drawing recognition method according to claim 1, wherein Pre-train the Mask R-CNN model, including: Obtain the terrain electronic image, preprocess it to obtain the training sample set, and train the Mask R-CNN model for extracting terrain elements in the topographic map according to the training sample set.
3. The machine learning-based intelligent drawing recognition method according to claim 1, wherein Use the classical thinning algorithm to extract the skeleton and skeleton endpoints corresponding to each segmentation mask.
4. The machine learning-based intelligent drawing recognition method according to claim 1, wherein Before the step of obtaining all the pixel points between the skeleton endpoint and the nearest branch point on the skeleton where the skeleton endpoint is located, and the number of all pixel points, it also includes: Screen out the noisy skeletons according to the comparison result between the number of pixel points on the skeleton and the number threshold.
5. The machine learning-based intelligent drawing recognition method according to claim 1, wherein The step of obtaining all the pixel points between the skeleton endpoint and the nearest branch point on the skeleton where the skeleton endpoint is located, and the number of all pixel points, and using them as the branch and branch distance of the skeleton endpoint respectively, also includes: If the number of skeleton endpoints on the skeleton is two, use the skeleton as the branch of the skeleton endpoint, and use the skeleton length as the branch distance of the skeleton endpoint.
6. The machine learning-based intelligent drawing recognition method according to claim 1, wherein The step of determining the true endpoints among the skeleton endpoints in response to the comparison result between the reliability of the skeleton endpoint and the reliability threshold, including: If the reliability of the skeleton endpoint is not less than the reliability threshold, then the skeleton endpoint is a true endpoint; otherwise, discard the skeleton endpoint, and obtain the adjacent pixel points of the skeleton endpoint along the branch direction of the skeleton endpoint as the new skeleton endpoint of the branch, and continue to calculate the reliability for judgment. Repeat this process until the reliability of the new skeleton endpoint is not less than the reliability threshold or reaches the branch point.
7. The machine learning-based intelligent drawing recognition method according to claim 1, wherein The step of determining the neighboring endpoints of the true endpoint according to the distance and category between the true endpoint and other true endpoints, including: Obtain the ascending order of the Euclidean distances between the true endpoint and other true endpoints with the same category but different skeletons; sequentially obtain the other true endpoints corresponding to a preset number of Euclidean distances in the ascending order of Euclidean distances, and use them as the neighboring endpoints of the true endpoint.
8. The machine learning-based intelligent drawing recognition method according to claim 1, characterized in that The step of connecting the true endpoints and neighboring endpoints with the maximum connectability greater than the connection threshold to obtain the complete skeleton of the terrain element, so as to realize the intelligent recognition of the drawing, including: The neighboring endpoints with a maximum connectable degree greater than the connection threshold to the real endpoint are denoted as target endpoints; n pixel points are respectively obtained on the branches of the real endpoint and the corresponding target endpoint for polynomial fitting to obtain a fitting curve; the real endpoint, the fitting curve, and the target endpoint are sequentially connected to obtain the complete skeleton of the terrain feature; the segmentation masks belonging to the same complete skeleton are merged to obtain a masked area with class labels, realizing the intelligent recognition of the drawing.
Citation Information
Patent Citations
River network topology information extraction method and system
CN110688961A
Blood vessel image segmentation method and device, electronic equipment and storage medium
CN115861623A