Pattern recognition method and system
By extracting the feature descriptor and shape matching operator of the hand-drawn figure, combined with geometric constraints, the adaptive completion of the nonlinear contour of the hand-drawn figure is achieved, solving the problem of contour discontinuity or fracture in hand-drawn figure recognition, and improving the accuracy and naturalness of the recognition.
Patent Information
- Application Number
- CN202510363529.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-07-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In hand-drawn scenes, the nonlinear contour of the hand-drawn figure is difficult to identify due to factors such as discontinuity or fracture during the drawing process, and it is difficult for the existing technology to effectively perform adaptive completion.
By obtaining the geometric figures drawn by the target user, extracting the element feature descriptor, determining the contour confidence and geometric constraints, combining the shape matching operator for contour completion, and processing the graph features using convolutional neural network and self-attention mechanism to achieve adaptive completion of nonlinear contours.
It improves the accuracy and nature of hand-drawn graphic recognition, can effectively complete the discontinuous or broken parts in hand-drawn graphic, and enhances the integrity of graphic recognition.
Smart Images

Figure CN120374920A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of graphic recognition technology. More specifically, this application relates to a graphic recognition method and system. Background Art
[0002] Graphic recognition is a process of using computer technology to recognize, analyze, and interpret the content in images or videos. By extracting features in the image, such as edges, textures, and shapes, different graphics can be recognized, from basic circles, squares, and triangles to complex traffic signs and industrial parts. Graphic recognition technology has applications in multiple fields, such as recognizing traffic signs in autonomous driving and detecting the shape and size of parts in industrial production. Graphic recognition generally involves steps such as image preprocessing, feature extraction, model training, and prediction. Among them, convolutional neural networks are commonly used technologies that can effectively process image data and recognize the graphics in them, providing strong support for the automation and intelligence of various industries. With the continuous progress of technology, the accuracy and efficiency of graphic recognition are constantly improving, bringing more convenience and innovation to our lives and work.
[0003] In the hand-drawn scenario, the recognition of hand-drawn graphics mainly relies on machine learning and deep learning technologies. By extracting features of hand-drawn graphics, such as edges, contours, and shapes, the basic structure of hand-drawn graphics can be recognized. However, during the hand-drawing process, the contours in hand-drawn graphics are usually non-linear, and the hand-drawn lines may be incomplete or broken due to factors such as discontinuity during drawing, hand shaking, or pen breakage. Therefore, how to adaptively complete the non-linear contours of hand-drawn graphics during the graphic recognition process has become a difficult problem faced by the industry. Summary of the Invention
[0004] This application provides a graphic recognition method and system, which can realize the adaptive completion of the non-linear contours of hand-drawn graphics during the graphic recognition process.
[0005] In the first aspect, this application provides a graphic recognition method, including the following steps: Obtain the geometric graphics drawn by the target user; Extract the feature descriptors of the geometric graphics during the graphic recognition process from each primitive in the geometric graphics; Determine the contour confidence of each primitive in the geometric graphics according to the position features of each primitive in the geometric graphics and the connection relationship between each primitive, and determine the geometric constraint conditions between each primitive in the geometric graphics through all the contour confidences and the feature descriptors; Obtain multiple example graphics during the graphic matching process, and determine the shape matching operator between each example graphic and the geometric graphic according to each matching feature point within each example graphic and the shape similarity between each example graphic and the geometric graphic; Determine the recognition contribution degree of the outlines of each primitive within the geometric graphic through all the shape matching operators and the geometric constraint conditions between each primitive within the geometric graphic, and complete the outline of the geometric graphic based on the recognition contribution degree of each primitive outline.
[0006] In some embodiments, extracting the feature descriptor of the geometric graphic during the graphic recognition process from each primitive within the geometric graphic specifically includes: Perform convolution processing on the geometric graphic to obtain the convolution feature map of the geometric graphic; Classify all the primitives within the geometric graphic to obtain different types of primitive sets; Extract weights for different types of primitive sets based on the self-attention mechanism to obtain the attention weights of each primitive set; Determine the feature descriptor of the geometric graphic during the graphic recognition process according to the convolution feature map of the geometric graphic and the attention weights of each primitive set.
[0007] In some embodiments, determining the contour confidence of each primitive within the geometric graphic according to the position feature of each primitive within the geometric graphic and the connection relationship between each primitive specifically includes: Determine the dependency relationship between each primitive within the geometric graphic according to the position feature of each primitive within the geometric graphic; Determine the connection strength between each primitive within the geometric graphic through the connection relationship between each primitive within the geometric graphic; Determine the contour confidence of each primitive within the geometric graphic according to the connection strength between each primitive within the geometric graphic and the dependency relationship between each primitive within the geometric graphic.
[0008] In some embodiments, determining the geometric constraint conditions between each primitive within the geometric graphic through all the contour confidences and the feature descriptor specifically includes: Determine the contour recognition coefficient of each primitive within the geometric graphic according to the topological constraint of each primitive within the geometric graphic and all the contour confidences; Determine the geometric constraint conditions between each primitive within the geometric graphic through the contour recognition coefficient of each primitive within the geometric graphic and the feature descriptor.
[0009] In some embodiments, determining the shape matching operator between each sample graph and the geometric graph according to each matching feature point within each sample graph and the shape similarity between each sample graph and the geometric graph specifically includes: Extract feature points from each sample graph to obtain each matching feature point within each sample graph; Cluster all the matching feature points to obtain multiple data clusters of the matching feature points; Determine the shape matching operator between each sample graph and the geometric graph according to all the data clusters and the shape similarity between each sample graph and the geometric graph.
[0010] In some embodiments, determining the recognition contribution degree of each primitive contour within the geometric graph through all the shape matching operators and the geometric constraint conditions between each primitive within the geometric graph specifically includes: Perform linear fitting on all the shape matching operators to obtain a fitting curve of the shape matching operators; Determine the recognition contribution degree of each primitive contour within the geometric graph according to the fitting curve and the geometric constraint conditions between each primitive within the geometric graph.
[0011] In some embodiments, contour completion of the geometric graph based on the recognition contribution degree of each primitive contour specifically includes: Determine a contour recognition threshold according to the recognition contribution degree of each primitive contour; Select a primitive from the geometric graph as the selected primitive; Judge the recognition contribution degree of the contour of the selected primitive; When the recognition contribution degree of the contour of the selected primitive is less than or equal to the contour recognition threshold, complete the contour of the selected primitive; When the recognition contribution degree of the contour of the selected primitive is greater than the contour recognition threshold, do not perform any operation; Continue to judge the recognition contribution degree of the contours of the remaining primitives within the geometric graph, and complete the contours of all primitives whose recognition contribution degrees are less than or equal to the contour recognition threshold.
[0012] In a second aspect, the present application provides a graphic recognition system, including: An acquisition module, configured to acquire a geometric graph drawn by a target user; A processing module, configured to extract a feature descriptor of the geometric graph during the graphic recognition process from each primitive within the geometric graph; The processing module is further configured to determine the contour confidence of each primitive within the geometric figure according to the position features of each primitive within the geometric figure and the connection relationship between the primitives, and determine the geometric constraint conditions between the primitives within the geometric figure through all the contour confidences and the feature descriptor; The processing module is further configured to obtain a plurality of example figures during the figure matching process, and determine the shape matching operator between each example figure and the geometric figure according to each matching feature point within each example figure and the shape similarity between each example figure and the geometric figure; The execution module is configured to determine the recognition contribution degree of each primitive contour within the geometric figure through all the shape matching operators and the geometric constraint conditions between the primitives within the geometric figure, and perform contour completion on the geometric figure based on the recognition contribution degree of each primitive contour.
[0013] In a third aspect, the present application provides a computer device, which includes a memory and a processor. The memory stores code, and the processor is configured to obtain the code and execute the above-mentioned figure recognition method.
[0014] In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned figure recognition method is implemented.
[0015] The technical solution provided by the embodiments disclosed in the present application has the following beneficial effects: In the figure recognition method and system provided by the present application, a geometric figure drawn by a target user is obtained; A feature descriptor of the geometric figure during the figure recognition process is extracted from each primitive within the geometric figure; the contour confidence of each primitive within the geometric figure is determined according to the position features of each primitive within the geometric figure and the connection relationship between the primitives, and the geometric constraint conditions between the primitives within the geometric figure are determined through all the contour confidences and the feature descriptor; a plurality of example figures during the figure matching process are obtained, and the shape matching operator between each example figure and the geometric figure is determined according to each matching feature point within each example figure and the shape similarity between each example figure and the geometric figure; the recognition contribution degree of each primitive contour within the geometric figure is determined through all the shape matching operators and the geometric constraint conditions between the primitives within the geometric figure, and contour completion is performed on the geometric figure based on the recognition contribution degree of each primitive contour.
[0016] It can be seen that in the present application, the recognition contribution degree of the contour of each primitive in the geometric figure can be determined through all shape matching operators and the geometric constraint conditions between each primitive in the geometric figure. Among them, first, feature descriptors of the geometric figure in the process of graphic recognition are extracted from each primitive in the geometric figure. The feature descriptors can accurately capture the geometric features of all non-linear contours in the geometric figure and help the system understand the overall structure of the geometric figure. Secondly, by analyzing the position features and connection relationships of the primitives, the contour credibility of each primitive in the geometric figure can be effectively evaluated. For the discontinuous or broken parts in the hand-drawn geometric figure, the contour confidence provides a dynamic evaluation mechanism to help identify which areas may be missing or incomplete. Furthermore, by combining the contour confidence and the feature descriptors, geometric constraint conditions between each primitive are established to clarify the mutual constraint conditions such as the position, angle, and connection method between the primitives. The geometric constraint conditions help the system understand the discontinuous and broken parts in the hand-drawn geometric figure. Then, the shape matching operator between each example figure and the geometric figure is determined. The shape matching operator can help the system judge which areas in the geometric figure are missing or irregular, so as to more accurately infer the missing contour parts and enhance the naturalness of the complement. Further, through all the shape matching operators combined with the geometric constraint conditions between each primitive in the geometric figure, the recognition contribution degree that measures the influence degree of the contour of each primitive on the recognition of the overall non-linear contour in the geometric figure is obtained. Finally, the geometric figure is contour-complemented based on the recognition contribution degree of the contour of each primitive. In summary, the solution of the present application can realize the adaptive complement of the non-linear contour of the hand-drawn figure in the process of graphic recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is an exemplary flowchart of a graphic recognition method according to some embodiments of the present application; Figure 2 is a schematic flowchart of determining a feature descriptor according to some embodiments of the present application; Figure 3 is a schematic flowchart of determining contour confidence according to some embodiments of the present application; Figure 4 is a schematic structural diagram of a graphic recognition system according to some embodiments of the present application; Figure 5 is a schematic structural diagram of a computer device for implementing the graphic recognition method according to some embodiments of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0018] In order to better understand the technical solution of the present application, the technical solution of the present application will be described in detail below in conjunction with the accompanying drawings of the specification and specific embodiments.
[0019] Reference Figure 1 , this figure is an exemplary flowchart of a graphic recognition method according to some embodiments of the present application. The graphic recognition method 100 mainly includes the following steps: In step 101, obtain the geometric figure drawn by the target user.
[0020] Specifically, the geometric figure drawn by the target user is obtained through an intelligent touch device (such as a touch drawing board).
[0021] In step 102, extract the feature descriptors of the geometric figure during the graphic recognition process from each primitive within the geometric figure.
[0022] In some embodiments, as shown in Figure 2 , this figure is a schematic flowchart for determining the feature descriptors in some embodiments of the present application. In this embodiment, extracting the feature descriptors of the geometric figure during the graphic recognition process from each primitive within the geometric figure can be implemented by the following steps: Perform convolution processing on the geometric figure to obtain the convolution feature map of the geometric figure; Classify all the primitives within the geometric figure to obtain different types of primitive sets; Extract weights for different types of primitive sets based on the self-attention mechanism to obtain the attention weights of each primitive set; Determine the feature descriptors of the geometric figure during the graphic recognition process according to the convolution feature map of the geometric figure and the attention weights of each primitive set.
[0023] Specifically, performing convolution processing on the geometric figure to obtain the convolution feature map of the geometric figure can be implemented in the following manner, that is: First, convert the geometric figure into a raster image using the pillow library in Python, and then input the raster image into a convolutional neural network (such as a ResNet-18 network). Through three convolutional layers, the geometric figure is gradually downsampled, and the feature map obtained from the last downsampling is used as the convolution feature map of the geometric figure. In other embodiments, other methods can also be used for implementation, which will not be elaborated here.
[0024] It should be noted that the convolution feature map in the present application represents the feature map extracted by the convolution operation on the raster image of the geometric figure.
[0025] In addition, it should also be noted that the primitive in the present application represents the smallest operable vector graphic object within the geometric figure, and each primitive within the geometric figure drawn by the target user can be obtained from the vector graphic file of the intelligent touch device.
[0026] In specific implementation, classifying all the primitive elements within the geometric figure to obtain primitive element sets of different types can be achieved in the following manner: using the svgpathtools library in Python to parse the path commands of each primitive element within the geometric figure, thereby identifying the types of each primitive element within the geometric figure, then classifying the primitive elements of the same type into the same category, and taking the set composed of the primitive elements of the same type as the primitive element set, so as to obtain primitive element sets of different types. In other embodiments, other methods can also be used for implementation, which are not limited herein.
[0027] In specific implementation, extracting weights for primitive element sets of different types based on the self-attention mechanism to obtain the attention weights of each primitive element set can be achieved in the following manner: selecting a type of primitive element set as the selected primitive element set, taking the vector composed of the geometric attributes (such as coordinates, length, angle, curvature) of each primitive element in the selected primitive element set as the feature vector of each primitive element in the selected primitive element set, and based on the attention mechanism, converting the feature vector of each primitive element in the selected primitive element set into a query vector and a key vector respectively, so as to obtain the query vector and key vector of each primitive element in the selected primitive element set. Then, performing dot product operations on the query vector and key vector of each primitive element in the selected primitive element set, normalizing all the values obtained after all dot product operations, finally taking the mean of all the normalized values, and taking the obtained mean as the attention weight of the selected primitive element set, and continuing to determine the attention weights of the remaining primitive element sets. In other embodiments, other methods can also be used for implementation, which will not be elaborated herein.
[0028] It should be noted that the attention weights in this application represent the relative contribution parameters of each primitive element in the primitive element set of the same type to the overall geometric figure representation.
[0029] In specific implementation, determining the feature descriptor of the geometric figure in the process of graphic recognition according to the convolutional feature map of the geometric figure and the attention weights of each primitive element set can be achieved in the following manner: using the Keras library in Python to perform max-pooling operations on the convolutional feature map of the geometric figure, thereby obtaining multiple values, and taking all the obtained values as the max-pooling values. Further, taking the mean of all the max-pooling values, then multiplying the obtained mean by the attention weights of each primitive element set, and then summing all the multiplied values, and taking the obtained sum value as the feature descriptor of the geometric figure in the process of graphic recognition. In other embodiments, other methods can also be used for implementation, which are not limited herein.
[0030] It should be noted that the feature descriptor in this application represents the feature value used to distinguish all non-linear contours within the geometric figure in the process of graphic recognition.
[0031] In step 103, the contour confidence of each primitive within the geometric figure is determined according to the position characteristics of each primitive within the geometric figure and the connection relationships between the primitives, and the geometric constraint conditions between the primitives within the geometric figure are determined through all the contour confidences and the feature descriptor.
[0032] In some embodiments, referring to Figure 3 as shown, this figure is a schematic flowchart of determining the contour confidence in some embodiments of the present application. In this embodiment, determining the contour confidence of each primitive within the geometric figure according to the position characteristics of each primitive within the geometric figure and the connection relationships between the primitives can be implemented by the following steps: First, in step 1031, the dependency relationships between the primitives within the geometric figure are determined according to the position characteristics of each primitive within the geometric figure. Second, in step 1032, the connection strengths of the primitives within the geometric figure are determined through the connection relationships between the primitives within the geometric figure. Then, in step 1033, the contour confidence of each primitive within the geometric figure is determined according to the connection strengths of the primitives within the geometric figure and the dependency relationships between the primitives within the geometric figure.
[0033] It should be noted that the position characteristics described in the present application represent the characteristic parameters describing the relative positions between the primitives and adjacent primitives. A primitive can be selected as the selected primitive, the distances between the center of the selected primitive and the centers of all the remaining primitives are calculated, and the shortest distance is used as the position characteristic of the selected primitive. Then, the position characteristics of the remaining primitives within the geometric figure are determined. In other embodiments, other methods can also be used to implement this, which is not limited here.
[0034] In specific implementation, the dependency relationship among the primitive elements within the geometric figure can be determined according to the position characteristics of each primitive element within the geometric figure in the following manner, that is: Based on graph theory, each primitive element within the geometric figure is regarded as a node, and the distance between the centers of the primitive elements corresponding to every two nodes is used as the weight of the edge between every two nodes, thereby constructing a topological structure. Then, a node is selected from the topological structure as the selected node, the position characteristic of the primitive element corresponding to the selected node is added to the position characteristic of the primitive element corresponding to the node farthest from the selected node, and then the value obtained by the addition is used to replace the weight of the edge between the selected node and the node farthest from the selected node. Continuing to replace the weights of the edges between the remaining nodes, and taking the topological structure after the replacement as the primitive element topological graph. Finally, the minimum spanning tree algorithm (such as Kruskal's algorithm) is used to obtain the minimum spanning tree of the primitive element topological graph, and the weights of all the edges in the minimum spanning tree are summed up, and the value obtained by the summation is used as the dependency relationship among the primitive elements within the geometric figure. In other embodiments, other methods may also be used for implementation, which are not limited herein.
[0035] It should be noted that the dependency relationship described in this application represents the topological characteristics of mutual dependence among the primitive elements within the geometric figure.
[0036] In addition, it should also be noted that the connection relationship described in this application represents the geometric characteristic parameters of the mutual connection between the center distances of the primitive elements within the geometric figure. It can be achieved by arbitrarily selecting a primitive element within the geometric figure as the first primitive element, taking the primitive element closest to the first primitive element as the second primitive element, and then taking the primitive element closest to the second primitive element as the third primitive element, and so on to obtain the order of all the remaining primitive elements. Thus, the sum of the distances between the centers of the obtained primitive elements in sequence is used as the connection relationship among the primitive elements. In other embodiments, other methods may also be used for implementation, which will not be elaborated herein.
[0037] In specific implementation, the connection strength among the primitive elements within the geometric figure can be determined according to the connection relationship among the primitive elements within the geometric figure in the following manner, that is: A node is selected from the primitive element topological graph as the selected node, the weights of the edges of all the nodes connected to the selected node are summed up, and the value obtained by the summation is multiplied by the connection relationship among the primitive elements within the geometric figure, and the value obtained by the multiplication is used as the connection strength of the primitive element within the geometric figure corresponding to the selected node. Continuing to determine the connection strength of the remaining primitive elements within the geometric figure. In other embodiments, other methods may also be used for implementation, which are not limited herein.
[0038] It should be noted that the connection strength described in this application represents the degree of tightness of each primitive element within the geometric figure.
[0039] When specifically implemented, determining the contour confidence of each primitive within the geometric figure based on the connection strength of each primitive within the geometric figure and the dependency relationship between each primitive within the geometric figure can be achieved in the following manner, that is: multiply the connection strength of each primitive within the geometric figure by the dependency relationship between each primitive within the geometric figure, and use all the obtained multiplied values as the contour confidence of each primitive within the geometric figure.
[0040] It should be noted that in this application, the contour confidence represents the credibility of the complete contour of the primitive within the geometric figure. The higher the contour confidence represents the credibility of the complete contour of the primitive within the geometric figure, and vice versa.
[0041] Determine the geometric constraint conditions between each primitive within the geometric figure based on all the contour confidences and the feature descriptor In some embodiments, determining the geometric constraint conditions between each primitive within the geometric figure based on all the contour confidences and the feature descriptor can be achieved through the following steps: Determine the contour recognition coefficient of each primitive within the geometric figure according to the topological constraint of each primitive within the geometric figure and all the contour confidences; Determine the geometric constraint conditions between each primitive within the geometric figure through the contour recognition coefficient of each primitive within the geometric figure and the feature descriptor.
[0042] When specifically implemented, determining the contour recognition coefficient of each primitive within the geometric figure according to the topological constraint of each primitive within the geometric figure and all the contour confidences can be achieved in the following manner, that is: obtain the primitive topology graph, select a node from the primitive topology graph as the selected node, sum the weights of the edges between all the nodes connected to the selected node, then divide the obtained sum value by the global connection value, and use the obtained division value as the topological constraint of the primitive corresponding to the selected node, and continue to determine the topological constraints of the primitives corresponding to the remaining nodes, where the topological constraint represents the parameter that restricts the connection form of the primitive in the geometric figure; then, divide the topological constraint of each primitive by the contour confidence of the corresponding primitive, and use all the obtained division values as the contour recognition coefficient of the corresponding primitive, so as to obtain the contour recognition coefficient of each primitive within the geometric figure. In other embodiments, other methods can also be used to achieve this, which is not limited here.
[0043] It should be noted that in this application, the contour recognition coefficient represents the parameter value for recognizing the existence of a non-linear contour of the primitive within the geometric figure.
[0044] In specific implementation, the geometric constraint conditions between the primitives within the geometric figure can be determined by the contour recognition coefficients of each primitive within the geometric figure and the feature descriptor in the following manner: divide the contour recognition coefficient of each primitive within the geometric figure by the feature descriptor, then sum all the obtained values after division, and use the sum value as the geometric constraint conditions between the primitives within the geometric figure. In other embodiments, other methods can also be used for implementation, which will not be elaborated here.
[0045] It should be noted that the geometric constraint conditions described in this application represent the parameters for constraining the contour features of each primitive within the geometric figure during shape matching.
[0046] In step 104, multiple example figures during the graphic matching process are obtained, and the shape matching operator between each example figure and the geometric figure is determined according to each matching feature point within each example figure and the shape similarity between each example figure and the geometric figure.
[0047] In specific implementation, multiple example figures during the graphic matching process are obtained from the database of the intelligent touch device.
[0048] It should be noted that the example figure represents a standard vector figure for graphic matching with the geometric figure.
[0049] In some embodiments, the shape matching operator between each example figure and the geometric figure can be determined according to each matching feature point within each example figure and the shape similarity between each example figure and the geometric figure by the following steps: Extract feature points for each example figure to obtain each matching feature point within each example figure; Cluster all the matching feature points to obtain multiple data clusters of the matching feature points; Determine the shape matching operator between each example figure and the geometric figure according to all the data clusters and the shape similarity between each example figure and the geometric figure.
[0050] In specific implementation, extracting feature points for each example figure to obtain each matching feature point within each example figure can be achieved in the following manner: use the Harris corner detection algorithm to extract key points within each example figure, and regard all the obtained key points as matching feature points, so as to obtain each matching feature point within each example figure. In other embodiments, other methods can also be used for implementation, which will not be elaborated here.
[0051] It should be noted that the matching feature points described in this application represent the key points for matching during the graphic matching process.
[0052] In specific implementation, clustering is performed on all the matching feature points, and multiple data clusters of the matching feature points can be obtained in the following manner: for each example graph, calculate the angles between the center of the example graph and each matching feature point within the example graph, and use all the obtained angles as the matching angles of each matching feature point within the example graph, thereby obtaining the matching angles of each matching feature point within all the example graphs; use a clustering algorithm (such as the hierarchical clustering algorithm) with the matching angles of each matching feature point as the clustering condition to cluster each matching feature point within all the example graphs, and use the clusters obtained by clustering as the data clusters of the matching feature points, so as to obtain multiple data clusters of the matching feature points. In other embodiments, other methods can also be used for implementation, which are not limited herein.
[0053] In specific implementation, determining the shape matching operator between each example graph and the geometric graph according to all the data clusters and the shape similarity between each example graph and the geometric graph can be implemented in the following manner: First, use an existing computational geometry library (such as CGAL, Computational Geometry Algorithms Library) to calculate the Hausdorff distance between each example graph and the geometric graph, and use the obtained Hausdorff distances as the shape similarities between each example graph and the geometric graph, where the shape similarity is a parameter representing the degree of shape similarity between the example graph and the geometric graph. Then, calculate the Euclidean distance between the cluster centers of every two data clusters, and sum all the obtained Euclidean distances. Further, multiply the sum value by the shape similarity between each example graph and the geometric graph, and use the multiplied values as the shape matching operators between each example graph and the geometric graph. In other embodiments, other methods can also be used for implementation, which will not be elaborated herein.
[0054] It should be noted that the shape matching operator in this application represents a characteristic value for evaluating the degree of shape matching between an example graph and a geometric graph.
[0055] In step 105, determine the recognition contribution degrees of the outlines of each primitive within the geometric graph through all the shape matching operators and the geometric constraint conditions between each primitive within the geometric graph, and complete the outline of the geometric graph based on the recognition contribution degrees of each primitive outline.
[0056] In some embodiments, determining the recognition contribution degrees of the outlines of each primitive within the geometric graph through all the shape matching operators and the geometric constraint conditions between each primitive within the geometric graph can be implemented in the following steps: Perform linear fitting on all the shape matching operators to obtain a fitting curve of the shape matching operators; Determine the recognition contribution degree of the contour of each primitive within the geometric figure according to the fitting curve and the geometric constraint conditions between the primitives within the geometric figure.
[0057] In specific implementation, linear fitting is performed on all shape matching operators to obtain the fitting curve of the shape matching operators, which can be implemented in the following manner: that is, use an existing linear fitting algorithm (such as the least squares support vector machine algorithm) to perform linear fitting on all shape matching operators, and use the obtained fitting curve as the fitting curve of the shape matching operators. Among them, each value on the fitting curve is used as the fitting value of the shape matching operator, and each fitting value of the shape matching operator corresponds to a shape matching operator. In other embodiments, other methods can also be used for implementation, which is not limited here.
[0058] In specific implementation, determining the recognition contribution degree of the contour of each primitive within the geometric figure according to the fitting curve and the geometric constraint conditions between the primitives within the geometric figure can be implemented in the following manner: First, subtract the corresponding shape matching operator from each fitting value of the shape matching operator on the fitting curve and take the absolute value, then sum all the obtained absolute values, and use the obtained sum value as the shape matching offset value of the geometric figure. Then, obtain the contour recognition coefficient of each primitive within the geometric figure, divide the shape matching offset value by the geometric constraint conditions between the primitives within the geometric figure, and then multiply the obtained division value by the contour recognition coefficient of each primitive within the geometric figure, and use the obtained multiplication values as the recognition contribution degrees of the contours of each primitive within the geometric figure. In other embodiments, other methods can also be used for implementation, which will not be elaborated here.
[0059] It should be noted that the recognition contribution degree described in this application represents the influence degree of the primitive contour on the recognition of the overall non-linear contour within the geometric figure. The greater the recognition contribution degree, the higher the influence degree of the primitive contour on the recognition of the overall non-linear contour within the geometric figure, and vice versa.
[0060] In some embodiments, contour completion of the geometric figure based on the recognition contribution degrees of the contours of each primitive can be implemented by the following steps: Determine the contour recognition threshold according to the recognition contribution degrees of the contours of each primitive; Select a primitive from the geometric figure as the selected primitive; Judge the recognition contribution degree of the contour of the selected primitive; When the recognition contribution degree of the contour of the selected primitive is less than or equal to the contour recognition threshold, complete the contour of the selected primitive; When the recognition contribution degree of the contour of the selected primitive is greater than the contour recognition threshold, do not perform any operation; Continue to determine the recognition contribution of the remaining primitive outlines within the geometric figure, and complete the outlines of all primitives whose recognition contributions are less than or equal to the outline recognition threshold.
[0061] In specific implementation, first, calculate the mean value of all recognition contributions, and use the obtained mean value as the outline recognition threshold; second, when the recognition contribution of a primitive outline is less than or equal to the outline recognition threshold, use the spline interpolation algorithm (such as the B-spline interpolation algorithm) in the SciPy library in Python to perform spline interpolation on the outline of the primitive, so as to complete the complement of the primitive outline.
[0062] In addition, on the other hand of this application, in some embodiments, this application provides a graphic recognition system. Refer to Figure 4 , this figure is a schematic structural diagram of the graphic recognition system shown in some embodiments of this application. The graphic recognition system 400 includes: an acquisition module 401, a processing module 402, and an execution module 403, which are described as follows: Acquisition module 401. In this application, the acquisition module 401 is mainly used to acquire the geometric figure drawn by the target user. Processing module 402. In this application, the processing module 402 is used to extract the feature descriptors of the geometric figure during the graphic recognition process from each primitive within the geometric figure. It should be noted that in this application, the processing module 402 is further used to determine the contour confidence of each primitive within the geometric figure according to the position characteristics of each primitive within the geometric figure and the connection relationship between each primitive, and determine the geometric constraint conditions between each primitive within the geometric figure through all the contour confidences and the feature descriptors. In addition, in this application, the processing module 402 is further used to acquire multiple example figures during the graphic matching process, and determine the shape matching operator between each example figure and the geometric figure according to each matching feature point within each example figure and the shape similarity between each example figure and the geometric figure. Execution module 403. In this application, the execution module 403 is mainly used to determine the recognition contribution of each primitive outline within the geometric figure through all the shape matching operators and the geometric constraint conditions between each primitive within the geometric figure, and complete the outline complement of the geometric figure based on the recognition contribution of each primitive outline.
[0063] In addition, this application also provides a computer device. The computer device includes a memory and a processor. The memory stores code, and the processor is configured to acquire the code and execute the above-mentioned graphic recognition method.
[0064] In some embodiments, refer to Figure 5, which is a schematic structural diagram of a computer device for implementing a graphic recognition method according to some embodiments of the present application. The graphic recognition method in the above embodiments can be implemented by Figure 5 the computer device shown. The computer device 500 includes at least one processor 501, a communication bus 502, a memory 503, and at least one communication interface 504.
[0065] The processor 501 can be a general-purpose central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more for controlling the execution of the graphic recognition method in the present application.
[0066] The communication bus 502 can be used to transfer information between the above components.
[0067] The memory 503 can be a read-only memory (ROM), or other types of static storage devices that can store static information and instructions, a random access memory (RAM), or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disks, or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 503 can exist independently and be connected to the processor 501 through the communication bus 502. The memory 503 can also be integrated with the processor 501.
[0068] Among them, the memory 503 is used to store the program code for executing the solution of the present application and is controlled by the processor 501 for execution. The processor 501 is used to execute the program code stored in the memory 503. The program code can include one or more software modules. The methods described in the above method embodiments can be implemented by one or more software modules in the program code in the processor 501 and the memory 503.
[0069] A communication interface 504, using any device such as a transceiver, is used to communicate with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.
[0070] In a specific implementation, as an example, a computer device may include multiple processors, and each of these processors may be a single-CPU processor or a multi-CPU processor. Here, the processor may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0071] The above computer device may be a general-purpose computer device or a special-purpose computer device. In a specific implementation, the computer device may be a desktop computer, a laptop computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device, or an embedded device. The embodiments of the present application do not limit the type of the computer device.
[0072] In addition, the present application also provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the above-described graphic recognition method is implemented.
[0073] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concept. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications falling within the scope of the present application.
[0074] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these changes and modifications.
Claims
1. A graphic recognition method, characterized in that, The steps are as follows: Obtain the geometric figure drawn by the target user; Extract the feature descriptors of the geometric figure during the figure recognition process from each primitive within the geometric figure; Determine the contour confidence of each primitive within the geometric figure according to the position features of each primitive within the geometric figure and the connection relationships between the primitives, and determine the geometric constraint conditions between each primitive within the geometric figure through all the contour confidences and the feature descriptors; Obtain multiple example figures during the figure matching process, and determine the shape matching operator between each example figure and the geometric figure according to each matching feature point within each example figure and the shape similarity between each example figure and the geometric figure; Determine the recognition contribution degrees of the contours of each primitive within the geometric figure through all the shape matching operators and the geometric constraint conditions between each primitive within the geometric figure, and complement the contours of the geometric figure based on the recognition contribution degrees of the contours of each primitive.
2. The method according to claim 1, wherein Specifically, extracting the feature descriptors of the geometric figure during the figure recognition process from each primitive within the geometric figure includes: Perform convolution processing on the geometric figure to obtain the convolution feature map of the geometric figure; Classify all the primitives within the geometric figure to obtain different types of primitive sets; Extract weights for different types of primitive sets based on the self-attention mechanism to obtain the attention weights of each primitive set; Determine the feature descriptors of the geometric figure during the figure recognition process according to the convolution feature map of the geometric figure and the attention weights of each primitive set.
3. The method according to claim 1, wherein Specifically, determining the contour confidence of each primitive within the geometric figure according to the position features of each primitive within the geometric figure and the connection relationships between the primitives includes: Determine the dependency relationships between each primitive within the geometric figure according to the position features of each primitive within the geometric figure; Determine the connection strength between each primitive within the geometric figure through the connection relationships between the primitives within the geometric figure; Determine the contour confidence of each primitive within the geometric figure according to the connection strength between each primitive within the geometric figure and the dependency relationships between the primitives within the geometric figure.
4. The method according to claim 1, wherein Specifically, determining the geometric constraint conditions between each primitive within the geometric figure through all the contour confidences and the feature descriptors includes: Determine the contour recognition coefficient of each primitive within the geometric figure according to the topological constraints of each primitive within the geometric figure and all the contour confidences; Determine the geometric constraint conditions between each primitive within the geometric figure through the contour recognition coefficient of each primitive within the geometric figure and the feature descriptors.
5. The method according to claim 1, characterized in that Specifically, determining the shape matching operator between each example figure and the geometric figure according to each matching feature point within each example figure and the shape similarity between each example figure and the geometric figure includes: Extract feature points from each example figure to obtain each matching feature point within each example figure; Cluster all the matching feature points to obtain multiple data clusters of the matching feature points; Determine the shape matching operator between each example graph and the geometric graph according to all data clusters and the shape similarity between each example graph and the geometric graph.
6. The method according to claim 1, characterized in that, Determining the recognition contribution degree of the contours of each primitive in the geometric graph through all the shape matching operators and the geometric constraint conditions between the primitives in the geometric graph specifically includes: Perform a linear fit on all the shape matching operators to obtain a fitting curve of the shape matching operators; Determine the recognition contribution degree of the contours of each primitive in the geometric graph according to the fitting curve and the geometric constraint conditions between the primitives in the geometric graph.
7. The method according to claim 1, characterized in that Performing contour completion on the geometric graph based on the recognition contribution degree of each primitive contour specifically includes: Determine a contour recognition threshold according to the recognition contribution degree of each primitive contour; Select a primitive from the geometric graph as the selected primitive; Judge the recognition contribution degree of the contour of the selected primitive; When the recognition contribution degree of the contour of the selected primitive is less than or equal to the contour recognition threshold, complete the contour of the selected primitive; When the recognition contribution degree of the contour of the selected primitive is greater than the contour recognition threshold, do nothing; Continue to judge the recognition contribution degree of the contours of the remaining primitives in the geometric graph, and complete the contours of all primitives whose recognition contribution degrees are less than or equal to the contour recognition threshold.
8. A graphic recognition system, characterized in that, Include: An acquisition module, configured to acquire a geometric graph drawn by a target user; A processing module, configured to extract a feature descriptor of the geometric graph in the process of graph recognition from each primitive in the geometric graph; The processing module is further configured to determine the contour confidence of each primitive in the geometric graph according to the position feature of each primitive in the geometric graph and the connection relationship between the primitives, and determine the geometric constraint conditions between the primitives in the geometric graph through all the contour confidences and the feature descriptor; The processing module is further configured to acquire multiple example graphs in the process of graph matching, and determine the shape matching operator between each example graph and the geometric graph according to each matching feature point in each example graph and the shape similarity between each example graph and the geometric graph; An execution module, configured to determine the recognition contribution degree of the contours of each primitive in the geometric graph through all the shape matching operators and the geometric constraint conditions between the primitives in the geometric graph, and perform contour completion on the geometric graph based on the recognition contribution degree of each primitive contour.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the graph recognition method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the graph recognition method according to any one of claims 1 to 7.