Methods, devices, electronic equipment, and readable storage media for recognizing hand-drawn graphics.

By calculating the probability that the coordinate set of a hand-drawn graphic lies on a quadratic curve, a classification model is used to identify whether the hand-drawn graphic is a quadratic curve, solving the problem of inaccurate recognition by conventional tools and achieving a higher recognition accuracy.

CN116883721BActive Publication Date: 2026-07-03SHENZHEN HONGHE INNOVATION INFORMATION TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN HONGHE INNOVATION INFORMATION TECH CO LTD
Filing Date
2023-06-15
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Conventional online drawing tools cannot accurately identify whether a hand-drawn graphic is a quadratic curve, resulting in inaccurate recognition results.

Method used

By obtaining the first set of coordinates of the hand-drawn graphic, the probability that the coordinates lie on a quadratic curve is calculated. This probability is used as a relevant feature of the quadratic curve to identify the hand-drawn graphic, and a classification model is used to determine whether the hand-drawn graphic is a quadratic curve.

Benefits of technology

It improves the accuracy of hand-drawn graphic recognition and ensures the accuracy of the recognition results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116883721B_ABST
    Figure CN116883721B_ABST
Patent Text Reader

Abstract

This application belongs to the field of computer graphics, and particularly relates to a method, apparatus, electronic device, and readable storage medium for recognizing hand-drawn graphics. The method can obtain the probability that the coordinates of the first coordinate set of the hand-drawn graphic lie on a quadratic curve based on this first coordinate set. The hand-drawn graphic is then recognized based on this probability, which reflects the degree of overlap between the hand-drawn graphic and the quadratic curve and is a relevant feature of the quadratic curve. Using this feature to recognize hand-drawn graphics can improve the accuracy of the recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image recognition, and in particular relates to a method, apparatus, electronic device and readable storage medium for recognizing hand-drawn images. Background Technology

[0002] The widespread use of touchscreens has led to the increasing use of online drawing tools such as hand-drawing software and whiteboard software.

[0003] In various scenarios, such as teaching and meetings, it's common to use online drawing tools to create quadratic curves. However, hand tremors can occur during the drawing process, resulting in shaky or jagged noise in the hand-drawn graph. Conventional online drawing tools will identify whether the hand-drawn graph is indeed a quadratic curve and correct it, so that the corrected graph can be used in teaching or meetings later.

[0004] However, conventional online drawing tools cannot accurately identify whether a hand-drawn graphic is a quadratic curve. Summary of the Invention

[0005] This application provides a method, apparatus, electronic device, and readable storage medium for recognizing hand-drawn graphics, which can improve the accuracy of recognizing hand-drawn graphics.

[0006] In a first aspect, a method for recognizing hand-drawn graphics is provided, the method comprising: obtaining a first coordinate set of the hand-drawn graphics; obtaining the probability that the coordinates of the first coordinate set lie on a quadratic curve based on the first coordinate set; and determining whether the hand-drawn graphics are a quadratic curve based on the probability that the coordinates of the first coordinate set lie on a quadratic curve.

[0007] In this embodiment, the probability that the coordinates of the first coordinate set lie on a quadratic curve can be obtained based on the first coordinate set of the hand-drawn graphic. The probability that the coordinates of the first coordinate set lie on a quadratic curve can reflect the degree of overlap between the hand-drawn graphic and the quadratic curve, and is a relevant feature of the quadratic curve. Determining whether the hand-drawn graphic is a quadratic curve based on the probability that the coordinates of the first coordinate set lie on a quadratic curve can improve the accuracy of hand-drawn graphic recognition.

[0008] Secondly, a hand-drawn graphic recognition device is provided. The recognition device includes a processing unit, which is used to: acquire a first coordinate set of the hand-drawn graphic; obtain the probability that the coordinates of the first coordinate set lie on a quadratic curve based on the first coordinate set; and determine whether the hand-drawn graphic is a quadratic curve based on the probability that the coordinates of the first coordinate set lie on a quadratic curve.

[0009] Thirdly, an electronic device is provided, comprising: one or more processors; one or more memories; wherein the one or more memories store one or more computer programs, the one or more computer programs including instructions that, when executed by the one or more processors, cause the electronic device to perform the method as described in any of the first aspects.

[0010] Fourthly, a computer-readable storage medium is provided, including computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of the first aspects.

[0011] Fifthly, a chip is provided, the chip comprising: a memory for storing instructions; and a processor for retrieving and executing the instructions from the memory, causing an electronic device having the chip mounted to perform the method as described in any one of the first aspects. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a schematic flowchart illustrating a method for recognizing hand-drawn graphics provided in an embodiment of this application.

[0014] Figure 2 This is a schematic flowchart illustrating the probability that the coordinates of the first coordinate set of a hand-drawn graphic lie on a quadratic curve, as provided in an embodiment of this application.

[0015] Figure 3 This is a schematic flowchart illustrating how to obtain multiple sets of first candidate sampling points, provided in an embodiment of this application.

[0016] Figure 4 This is a schematic flowchart illustrating how to obtain multiple sets of second candidate sampling points, provided in an embodiment of this application.

[0017] Figure 5 This is an example diagram of a capacitive sensing point provided in an embodiment of this application.

[0018] Figure 6 This is a schematic flowchart illustrating how to obtain multiple sets of target sampling points, provided in an embodiment of this application.

[0019] Figure 7 This is a schematic flowchart illustrating the determination of a set of target sampling points provided in an embodiment of this application.

[0020] Figure 8 This is a schematic flowchart provided in an embodiment of the present application for determining whether a hand-drawn graphic is a quadratic curve.

[0021] Figure 9 This is a schematic flowchart of the training method 300 for the classification model provided in the embodiments of this application.

[0022] Figure 10 This is an exemplary block diagram of the hand-drawn graphic recognition device 400 provided in the embodiments of this application.

[0023] Figure 11 This is a schematic structural diagram of the electronic device 500 provided in the embodiments of this application. Detailed Implementation

[0024] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application can also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of this application with unnecessary detail. In other instances, specific technical details in various embodiments can be referred to mutually, and specific systems not described in one embodiment can be referred to in other embodiments.

[0025] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0026] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0027] References to "embodiments of this application" or "some embodiments" in this specification mean that one or more embodiments of this application include specific features, structures, or characteristics described in connection with that embodiment. Therefore, phrases such as "in other embodiments," "an embodiment of this application," and "other embodiments of this application" appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0028] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "first class," "second class," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0029] The method provided in this application can be applied to electronic devices with touch functionality, such as mobile phones, tablets, laptops, netbooks, writing screens, and electronic whiteboards. This application does not impose any restrictions on the specific type of electronic device.

[0030] The following describes the inventive concept of this application.

[0031] Conventional online drawing tools cannot accurately identify whether a hand-drawn graphic is a quadratic curve. The reason is that when conventional online drawing tools extract features from the location of the hand-drawn graphic to identify whether it is a quadratic curve, the extracted features may not be relevant to quadratic curves, leading to inaccurate identification results.

[0032] To address the aforementioned deficiencies, the inventive concept of this application is as follows:

[0033] The embodiments of this application extract the feature of a hand-drawn graphic based on its position, namely the probability that the coordinates of the first coordinate set lie on a quadratic curve. This feature can reflect the degree of overlap between the hand-drawn graphic and the quadratic curve and is a related feature of the quadratic curve. Using this feature to identify the hand-drawn graphic can improve the accuracy of the hand-drawn graphic identification.

[0034] The internal implementation process of the embodiments of this application is described below with reference to the accompanying drawings.

[0035] Please refer to Figure 1 , Figure 1 This is a schematic flowchart illustrating a hand-drawn graphic recognition method 200 provided in one embodiment of this application. Method 200 can be executed by an electronic device, or by a processor or chip within the electronic device; this embodiment does not impose any limitations. For ease of description, method 200 is described in detail using an electronic device as an example.

[0036] S21. Obtain the first coordinate set of the hand-drawn graphic.

[0037] It should be understood that hand-drawn graphics refer to graphics created by a user that can be displayed on an electronic device. For example, hand-drawn graphics can be graphics drawn by a user in some application software on an electronic device (such as whiteboard software, drawing software, etc.), or graphics drawn by a user on a peripheral device of the electronic device (such as a graphics tablet) and displayed on the electronic device.

[0038] In this embodiment of the application, the first coordinate set can indicate the position of the hand-drawn graphic on the display screen of the electronic device.

[0039] In the embodiments of the present application, when the electronic device identifies whether a hand-drawn graph is a conic section, it can directly obtain the first coordinate set of the hand-drawn graph, or obtain the first coordinate set of the hand-drawn graph from the memory. The embodiments of the present application do not limit the manner in which the electronic device obtains the first coordinate set.

[0040] S22. Obtain the probability that the coordinates of the first coordinate set are located on the conic section according to the first coordinate set.

[0041] It should be understood that the conic section, also known as the conic curve, refers to the locus of points whose ratio of the distance r to a fixed point in the plane to the distance d to a fixed line is a constant e = r / d. When e>1, it is a hyperbola; when e = 1, it is a parabola; when 0<e<1, it is an ellipse. The conic section includes ellipses (circles are special cases of ellipses), parabolas, hyperbolas, etc. The embodiments of the present application do not limit the type of conic section.

[0042] It should be understood that the probability that the coordinates of the first coordinate set are located on the conic section refers to an attribute or feature of the conic section. Specifically, the probability that the coordinates of the first coordinate set are located on the conic section can be represented by a value between 0 and 1. For example, 0.6 indicates that the probability that the coordinates of the first coordinate set are located on the conic section is 0.6. The larger the value of this feature, the higher the coincidence degree of the hand-drawn graph and the conic section; the smaller the value of this feature, the lower the coincidence degree of the hand-drawn graph and the conic section.

[0043] It can also be understood that since the three pairs of opposite sides of the inscribed hexagon (including the degenerate hexagon) of the conic section intersect on a straight line. In other words, if the three pairs of opposite sides of a hexagon formed by six points intersect on a straight line, then these six points are points located on the conic section. Therefore, the implementation process of obtaining the probability that the coordinates of the first coordinate set are located on the conic section according to the first coordinate set can be:

[0044] Exemplarily, the electronic device can determine that the three pairs of opposite sides of the hexagon formed by any six points in the first coordinate set intersect on a straight line, and then obtain the number of points in the first coordinate set that are located on the conic section. By calculating the ratio of the number of points in the first coordinate set that are located on the conic section to the total number of coordinates in the first coordinate set, the probability that the coordinates of the first coordinate set are located on the conic section is obtained.

[0045] Of course, the embodiments of this application can also determine the number of points in the first coordinate set that lie on the quadratic curve through other implementation methods to obtain the probability that the coordinates of the first coordinate set lie on the quadratic curve. The embodiments of this application do not limit this. For example, an electronic device can fit a quadratic curve with the points in the first coordinate set to obtain the equation of the quadratic curve. Then, each coordinate of the first coordinate set is substituted into the equation to determine whether the equation is satisfied. If it is satisfied, it is determined that the coordinate lies on the quadratic curve. If it is not satisfied, it is determined that the coordinate does not lie on the quadratic curve. In this way, the number of points in the first coordinate set that lie on the quadratic curve is obtained. By calculating the number of points in the first coordinate set that lie on the quadratic curve and the total number of coordinates in the first coordinate set, the probability that the coordinates of the first coordinate set lie on the quadratic curve is obtained.

[0046] S23. The electronic device determines whether the hand-drawn graphic is a quadratic curve based on the probability that the coordinates of the first coordinate set lie on the quadratic curve.

[0047] In this embodiment of the application, the process by which the electronic device determines whether a hand-drawn graphic is a quadratic curve based on the probability that the coordinates of the first coordinate set lie on the quadratic curve can be as follows:

[0048] The electronic device can input the probability that the coordinates of the first coordinate set lie on a quadratic curve into a classification model, and determine whether the hand-drawn graphic is a quadratic curve based on the output of the classification model. The classification model may include logistic regression models, Naive Bayes models, decision tree models, support vector machine models, random forest models, gradient boosting tree models, etc., and the type of classification model is not limited in this application embodiment.

[0049] The process by which an electronic device determines whether a hand-drawn graphic is a quadratic curve based on the probability that the coordinates of the first coordinate set lie on the quadratic curve can also be as follows:

[0050] The electronic device determines whether the probability that the coordinates of the first coordinate set lie on a quadratic curve is greater than a preset threshold. If it is determined to be greater than the preset threshold, the hand-drawn graphic is determined to be a quadratic curve; if it is determined to be less than or equal to the preset threshold, the hand-drawn graphic is determined not to be a quadratic curve. For example, if the preset threshold is 0.8, if it is determined to be greater than 0.8, the hand-drawn graphic is determined to be a quadratic curve; if it is determined to be less than or equal to 0.8, the hand-drawn graphic is determined not to be a quadratic curve.

[0051] In this embodiment, the probability that the coordinates of the first coordinate set lie on a quadratic curve can be obtained based on the first coordinate set of the hand-drawn graphic. The probability that the coordinates of the first coordinate set lie on a quadratic curve can reflect the degree of overlap between the hand-drawn graphic and the quadratic curve, and is a relevant feature of the quadratic curve. Determining whether the hand-drawn graphic is a quadratic curve based on the probability that the coordinates of the first coordinate set lie on a quadratic curve can improve the accuracy of hand-drawn graphic recognition.

[0052] Figure 2 This is a schematic flowchart illustrating the probability that the coordinates of the first coordinate set of a hand-drawn graphic lie on a quadratic curve, as provided in an embodiment of this application.

[0053] S221. Sample the first coordinate set to obtain multiple sets of first candidate sampling points.

[0054] It should be understood that sampling processing of the first coordinate set can be performed once or multiple times.

[0055] When the amount of data in the first coordinate set is large, directly calculating the probability that the coordinates of the first coordinate set lie on the quadratic curve may increase the computational load on the electronic device. Therefore, the first coordinate set can be sampled once to reduce the amount of data required to calculate the probability that the coordinates of the first coordinate set lie on the quadratic curve. At the same time, to avoid the inaccuracy of the final calculated probability that the coordinates of the first coordinate set lie on the quadratic curve due to a single sampling process, the first coordinate set can be sampled multiple times (multiple times can be understood as more than one time) to improve the accuracy of the final calculated probability that the coordinates of the first coordinate set lie on the quadratic curve. The embodiments of this application do not limit the sampling process; for example, the sampling process can be uniform sampling.

[0056] For example, the first coordinate set includes the coordinates of 100 capacitive sensing points. Directly using the coordinates of these 100 points to calculate the probability that the coordinates of the first coordinate set lie on the quadratic curve might increase the computational load on the electronic device. To reduce the computational load and improve the accuracy of the final calculated probability that the coordinates of the first coordinate set lie on the quadratic curve, the first coordinate set undergoes two sampling processes. The first sampling process yields 10 sets of sampling points, and the second sampling process yields 15 sets of sampling points. Each set of first candidate sampling points includes 6 sampling points. In this embodiment, the 10 sets of sampling points, 15 sets of sampling points, etc., obtained through the sampling process are referred to as multiple sets of first candidate sampling points.

[0057] S222. Screening is performed on multiple groups of first candidate sampling points to obtain multiple groups of second candidate sampling points. Each group of second candidate sampling points can form multiple pairs of opposite edges, and the multiple pairs of opposite edges are multiple groups of non-parallel opposite edges.

[0058] It should be understood that each group of first candidate sampling points may include at least six sampling points, and the embodiments of this application do not limit the number of sampling points in each group of first candidate sampling points. The embodiments of this application illustrate that each group of first candidate sampling points may include six sampling points.

[0059] Each group of second candidate sampling points can form multiple pairs of opposite edges. Multiple pairs of opposite edges can be understood as multiple non-parallel opposite edges. For example, if each group of second candidate sampling points includes six sampling points, then these six sampling points can form six edges, and these six edges can form three pairs of opposite edges. These three pairs of opposite edges of the second candidate sampling points are three pairs of non-parallel opposite edges.

[0060] In some embodiments, after obtaining multiple sets of first candidate sampling points in S221, the probability that the coordinates of the first coordinate set lie on the quadratic curve can be determined by judging whether the intersection points of the three pairs of sides of the hexagon formed by the six sampling points in each set of first candidate sampling points are collinear. For example, after obtaining 10 sets of first candidate sampling points in the first sampling process of S221, if it is determined that the intersection points of the three pairs of sides of the hexagon formed by the six sampling points in 6 sets of first candidate sampling points are collinear, then the probability that the coordinates of the determined first coordinate set lie on the quadratic curve is 0.6.

[0061] First candidate sampling points can be filtered out if any one of the three sets of opposite edges obtained from six sampling points is parallel. Since first candidate sampling points have already been filtered out from multiple sets of first candidate sampling points if any one of the three sets of opposite edges obtained from six sampling points is parallel, the remaining first candidate sampling points will not have any one of the three sets of opposite edges obtained from six sampling points parallel. The three sets of opposite edges of the six sampling points of the remaining first candidate sampling points can form an intersection point. Using the remaining first candidate sampling points to determine whether the intersection point of the three sets of opposite edges of the six sampling points in each set of first candidate sampling points is collinear can improve the accuracy of determining the probability that the coordinates of the first coordinate set are located on the quadratic curve while reducing the computational load of electronic devices. In the embodiments of this application, the remaining first candidate sampling points are referred to as multiple sets of second candidate sampling points with multiple sets of opposite edges that are not parallel.

[0062] S223. Screening is performed on multiple sets of second candidate sampling points to obtain multiple sets of target sampling points, which are points located on the quadratic curve.

[0063] It should be understood that the purpose of screening multiple sets of second candidate sampling points is to select second candidate sampling points whose intersections of three pairs of sides obtained from six sampling points are collinear. In this embodiment, the second candidate sampling points whose intersections of three pairs of sides obtained from six sampling points are collinear are referred to as multiple sets of target sampling points.

[0064] The embodiments of this application do not limit the method for determining whether the intersection points of three pairs of sides obtained based on six sampling points are collinear.

[0065] S224. Based on multiple sets of second candidate sampling points and multiple sets of target sampling points, determine the probability that the coordinates of the first coordinate set lie on the quadratic curve.

[0066] In this embodiment of the application, when the sampling process is performed once, determining the probability that the coordinates of the first coordinate set lie on a quadratic curve includes:

[0067] The ratio of multiple sets of target sampling points to multiple sets of second candidate sampling points is determined as the probability that the coordinates of the first coordinate set lie on the quadratic curve.

[0068] In some embodiments, when the sampling process is performed multiple times, determining the probability that the coordinates of the first coordinate set lie on the quadratic curve includes:

[0069] Determine the ratio of multiple sets of target sampling points to multiple sets of second candidate sampling points; determine the ratio of the ratio of multiple sets of target sampling points to multiple sets of second candidate sampling points to the number of sampling processes i as the probability that the coordinates of the first coordinate set lie on the quadratic curve.

[0070] For example, the probability that the coordinates of the first coordinate set lie on the quadratic curve can be determined based on the following formula:

[0071]

[0072] Where P represents the ratio of the ratio of multiple sets of target sampling points to multiple sets of second candidate sampling points to the number of sampling processes i. X1, X2, ... X3 represent the ratios of multiple target sampling points to multiple second candidate sampling points, respectively. i Y1, Y2, ..., Y3 represent the number of target sampling points processed in each of the i-th sampling processes. i This represents the number of multiple sets of second candidate sampling points processed in each of the i sampling processes, where i represents the number of sampling processes and is an integer greater than or equal to 1.

[0073] In this embodiment of the application, when the amount of data in the first coordinate set is large, directly using the first coordinate set to calculate the probability that the coordinates of the first coordinate set are located on the quadratic curve may increase the computational load of the electronic device. Therefore, the first coordinate set can be sampled to reduce the amount of data required to calculate the probability that the coordinates of the first coordinate set are located on the quadratic curve.

[0074] Furthermore, the embodiments of this application can screen multiple sets of first candidate sampling points to obtain multiple sets of second candidate sampling points. The multiple pairs of opposite sides obtained by each set of second candidate sampling points are non-parallel opposite sides, which can improve the accuracy of determining multiple target sampling points, thereby improving the accuracy of determining the probability that the coordinates of the first coordinate set are located on the quadratic curve.

[0075] Moreover, the embodiments of this application can accurately determine the probability that the coordinates of the first coordinate set lie on the quadratic curve based on multiple sets of second candidate sampling points and multiple sets of target sampling points.

[0076] The embodiments of this application can also determine the probability that the coordinates of the first coordinate set lie on the quadratic curve based on multiple sets of second candidate sampling points, multiple sets of target sampling points and the number of sampling processes i, which is more accurate than the probability that the coordinates of the first coordinate set lie on the quadratic curve determined only based on multiple sets of second candidate sampling points and multiple sets of target sampling points.

[0077] In some embodiments, in S222, multiple sets of first candidate sampling points are filtered to obtain multiple sets of second candidate sampling points with non-parallel opposite edges, based on each set of second candidate sampling points, including:

[0078] Multiple sets of first candidate sampling points are filtered to obtain multiple sets of second candidate sampling points. The multiple pairs of opposite sides of each set of second candidate sampling points are non-parallel opposite sides, and the adjacent sampling points of each set of second candidate sampling points are spaced j coordinates apart in the first coordinate set.

[0079] It should be understood that if the values ​​of the adjacent coordinates of the six sampling points in some of the multiple sets of first candidate sampling points are similar, then the line connecting two sampling points with similar values ​​is prone to deviation, which will make the probability that the coordinates of the final calculated first coordinate set lie on the quadratic curve inaccurate.

[0080] To improve the accuracy of calculating the probability that the coordinates of the first coordinate set lie on the quadratic curve, the first candidate sampling points with an interval of j coordinates between adjacent sampling points in the first coordinate set can be filtered out from the six sampling points. In this way, the six sampling points of the remaining first candidate sampling points are not adjacent or have similar values ​​in the first coordinate set. This can reduce the computational load of the electronic device while ensuring that the electronic device can accurately identify the six sampling points, thereby improving the accuracy of calculating the probability that the coordinates of the first coordinate set lie on the quadratic curve.

[0081] It should be understood that when j is 0, filtering out the first candidate sample point in the first coordinate set that is j coordinates apart from the adjacent sample points in the six sample points is the same as filtering out the first candidate sample point in the first coordinate set that is also adjacent to the adjacent sample points in the six sample points.

[0082] When j is greater than 0, the first candidate sampling point in the first coordinate set that is j coordinates apart from adjacent sampling points among the six sampling points is the first candidate sampling point that is not adjacent but has similar values ​​among the six sampling points in the first coordinate set.

[0083] In this embodiment, multiple sets of first candidate sampling points are filtered out, and first candidate sampling points that are parallel to any one of the three sets of opposite edges obtained from six sampling points are filtered out. Also, first candidate sampling points in the six sampling points that are adjacent to each other and are separated by j coordinates in the first coordinate set are filtered out. The remaining first candidate sampling points are called multiple sets of second candidate sampling points.

[0084] Figure 3 This is a schematic flowchart illustrating how to obtain multiple sets of first candidate sampling points, provided in an embodiment of this application.

[0085] S2211. Perform preprocessing operations on the first coordinate set to obtain the second coordinate set. The preprocessing operations include deduplication.

[0086] It should be understood that the preprocessing operation on the first coordinate set mainly involves deleting irrelevant data, duplicate data, smoothing noisy data, outliers, etc. in the first coordinate set. The embodiments of this application do not limit the preprocessing operation.

[0087] S2212. Sample the second coordinate set to obtain multiple sets of first candidate sampling points.

[0088] It should be understood that sampling the second coordinate set can be performed once or multiple times.

[0089] The process for each sampling step is as follows:

[0090] Six sampling points are randomly selected from the second coordinate set as a group of first candidate sampling points to obtain multiple groups of first candidate sampling points.

[0091] It is understood that random sampling methods may include simple random sampling, stratified random sampling, cluster random sampling, etc., and the embodiments of this application do not limit the random sampling method.

[0092] In this embodiment, a preprocessing operation can be performed on the first coordinate set to obtain a second coordinate set. Redundant data in the first coordinate set can be deleted to reduce the computational load of the electronic device. Furthermore, the preprocessed second coordinate set can be sampled to reduce the amount of data required to calculate the probability that the coordinates of the first coordinate set lie on the quadratic curve, while improving the accuracy of the final calculated probability that the coordinates of the first coordinate set lie on the quadratic curve.

[0093] Figure 4 This is a schematic flowchart illustrating how to obtain multiple sets of second candidate sampling points, provided in an embodiment of this application.

[0094] S2221. Obtain the index set of the first coordinate set, and perform sampling processing on the index set to obtain multiple sets of first candidate sampling points.

[0095] It should be understood that each group of first candidate sampling points may include at least six indexes corresponding to the sampling points. This application embodiment does not limit the number of sampling points or the number of indexes corresponding to the sampling points in each group of first candidate sampling points. This application embodiment illustrates this by assuming that each group of first candidate sampling points may include six indexes corresponding to the sampling points. It should also be understood that sampling the index set can be performed once or multiple times.

[0096] When users draw hand-drawn graphics on a touchscreen, a large amount of coordinate data may be generated. In order to better process this large amount of coordinate data, an index can be added to each coordinate in the coordinate system in advance, so that the mapping relationship between coordinates and indexes can be obtained. When obtaining the first coordinate set, only the index set of the first coordinate set needs to be obtained. Processing the index set of the first coordinate set can improve the processing speed of electronic devices compared to directly processing the coordinate data of the first coordinate set.

[0097] In essence, an index is a separate, physical storage structure that sorts the values ​​of one or more columns in a database table. It's a collection of values ​​from one or more columns in a table and a list of logical pointers to the data pages in the table that physically identify those values. Simply put, an index is like a table of contents in a book; you can quickly find the content you need by referring to page numbers.

[0098] For example, an index can be added to each coordinate in the coordinate system to obtain the mapping relationship between coordinates and indices:

[0099] When the x-coordinate in the coordinate system is equal to the y-coordinate, the index is 0.

[0100] When the x-coordinate is greater than the y-coordinate, the index can be calculated using the following formula:

[0101] index = 4k 2 +1+(2k+x+y).

[0102] When the x-coordinate is less than or equal to the y-coordinate, the index can be calculated using the following formula:

[0103] index = 4k 2 +1-(2k+x+y).

[0104] Where k = max(|x|,|y|), x represents the x-coordinate and y represents the y-coordinate.

[0105] For example, the mapping relationship between coordinates and indices can be referenced. Figure 5 , Figure 5An example diagram of a capacitive touch point is shown. In this example, the capacitive touchscreen typically has 4 columns and 4 rows of capacitive touch sensors. These 4×4 interleaved capacitive touch sensors form a 4×4 capacitive touch point. The origin of the coordinate system is the capacitive touch point in the first row and first column. The positive direction of the X-axis is from the first column of capacitive touch points to the fourth column, and the positive direction of the Y-axis is from the first row of capacitive touch points to the fourth row.

[0106] The mapping relationships can be found in Table 1:

[0107] coordinate index (0,0) 0 (1,0) 8 (2,0) 23 (3,0) 46 (0,1) 2 (1,1) 1 (2,1) 24 (3,1) 47 (0,2) 11 (1,2) 10 (2,2) 9 (3,2) 48 (0,3) 28 (1,3) 27 (2,3) 26 (3,3) 25

[0108] Table 1

[0109] For example, the index set of the first coordinate set can be {0, 2, 11, 28, 27, 26, 25, 48, 47, 46, 23, 8}. The index set is sampled (e.g., twice). Each sampling process yields multiple sets of first candidate sampling points (e.g., the first sampling process yields 10 sets of first candidate sampling points, and the second sampling process yields 15 sets of first candidate sampling points). Each set of first candidate sampling points includes the indices corresponding to six sampling points. For example, the indices corresponding to one set of first candidate sampling points can be (0, 11, 27, 25, 47, 23), and the indices corresponding to another set of first candidate sampling points can be (0, 2, 27, 25, 47, 23).

[0110] S2222. Delete any first candidate sampling point that is parallel to any one of the three pairs of opposite edges obtained from the index of the six sampling points corresponding to the first candidate sampling points in each group of first candidate sampling points, to obtain multiple groups of second candidate sampling points.

[0111] It is understandable that, in multiple sets of first candidate sampling points, the first candidate sampling point parallel to any one of the three sets of opposite edges obtained from the indices corresponding to the six sampling points in each set of first candidate sampling points can be deleted.

[0112] For example, suppose that in a group of first candidate sampling points, one group of candidate sampling points has indices (0, 11, 27, 25, 47, 23). Then, the equation for edge 1 can be obtained based on the first index 0 and the second index 11. For example, based on the first index 0, the second index 11, and the mapping relationship between coordinates and indices, the coordinates corresponding to the first index and the second index can be obtained. Based on the coordinates corresponding to the first index and the second index, the equation for edge 1 can be calculated. Based on the above method, the equation for edge 2 can be obtained based on the second index 11 and the third index 27, the equation for edge 3 can be obtained based on the third index 27 and the fourth index 25, the equation for edge 4 can be obtained based on the fourth index 25 and the fifth index 47, the equation for edge 5 can be obtained based on the fifth index 47 and the sixth index 23, and the equation for edge 6 can be obtained based on the sixth index 23 and the first index 0.

[0113] Consider edges 1 and 4 as one pair of opposite edges, edges 2 and 5 as another pair of opposite edges, and edges 3 and 6 as yet another pair of opposite edges. Determine whether each of these three pairs of opposite edges is parallel. If at least one pair of opposite edges is found to be parallel, then delete the first candidate sampling point with index (0, 11, 27, 25, 47, 23) from the multiple first candidate sampling points.

[0114] The embodiments of this application do not limit the method for determining whether the three pairs of opposite sides are parallel. For example, the slope of side 1 can be calculated based on the equation of the side, and the slope of side 4 can be calculated based on the equation of side 4. If it is determined that the slope of side 1 is equal to the slope of side 4, then side 1 and side 4 are parallel; otherwise, side 1 and side 4 are not parallel.

[0115] In this embodiment, since multiple sets of second candidate sampling points are obtained by deleting any one of the three sets of opposite edges parallel to the index of the six sampling points corresponding to each set of first candidate sampling points, multiple sets of second candidate sampling points can be obtained. Therefore, each sampling point in multiple sets of second candidate sampling points can be accurately identified, which ultimately improves the accuracy of the probability that the coordinates of the determined first coordinate set are located on the quadratic curve.

[0116] In some embodiments, S2222 further includes deleting any one of the three sets of opposite edges parallel to the first candidate sampling points obtained from the indices corresponding to the six sampling points in each set of first candidate sampling points, to obtain multiple sets of second candidate sampling points:

[0117] In multiple sets of first candidate sampling points, delete the first candidate sampling points whose adjacent indices in the indexes corresponding to the six sampling points of each first candidate sampling point are separated by j indices in the index set, and delete the first candidate sampling points that are parallel to any one of the three sets of opposite edges obtained based on the indices corresponding to the six sampling points of each first candidate sampling point, to obtain multiple sets of second candidate sampling points.

[0118] It should be understood that when deleting the first candidate sampling points from multiple groups, the adjacent indices of the six sampling points corresponding to each group of first candidate sampling points are first candidate sampling points with an interval of j in the index set, where j is an integer greater than or equal to 0.

[0119] For example, when j equals 0, assuming the index set of the first coordinate set can be {0, 2, 11, 28, 27, 26, 25, 48, 47, 46, 23, 8}, if the index of one of the multiple sets of first candidate sampling points is (0, 2, 27, 25, 47, 23), since the adjacent index (0, 2) of this set of candidate sampling points is also adjacent in the index set of the first coordinate set (with a gap of 0 in the index set), it is necessary to delete this set of candidate sampling points from the multiple sets of first candidate sampling points.

[0120] In another example, when j is greater than 0, for example, j equals 1, assuming the index set of the first coordinate set can be {7, 8, 9, 28, 27, 26, 25, 48, 47, 46, 23, 8}, if the index of one of the multiple first candidate sampling points is (7, 9, 27, 25, 47, 23), since the adjacent indices (7, 9) of this group of candidate sampling points are close in the index set of the first coordinate set (separated by 1 index in the index set), it is necessary to delete this group of candidate sampling points from the multiple first candidate sampling points.

[0121] Figure 6 This is a schematic flowchart illustrating how to obtain multiple sets of target sampling points, provided in an embodiment of this application.

[0122] S2231. Based on the six sampling points of each group of second candidate sampling points in multiple groups of second candidate sampling points, determine three groups of opposite edges.

[0123] It should be understood that the method for determining the three sets of opposite edges has been described in other embodiments and will not be repeated here.

[0124] S2232. Based on the three sets of opposite edges, determine the three intersection points corresponding to the three sets of opposite edges.

[0125] In implementation, the three pairs of opposite edges can be determined in the following ways:

[0126] First, based on the six sampling points of each group of second candidate sampling points in multiple groups of second candidate sampling points, the first edge, the second edge, the third edge, the fourth edge, the fifth edge, and the sixth edge are determined. The first edge is obtained based on the first sampling point and the second sampling point, the second edge is obtained based on the second sampling point and the third sampling point, the third edge is obtained based on the third sampling point and the fourth sampling point, the fourth edge is obtained based on the fourth sampling point and the fifth sampling point, the fifth edge is obtained based on the fifth sampling point and the sixth sampling point, and the sixth edge is obtained based on the sixth sampling point and the first sampling point.

[0127] It should be understood that the six sampling points can include a first sampling point, a second sampling point, a third sampling point, a fourth sampling point, a fifth sampling point, and a sixth sampling point. These six sampling points are six sampling points arranged in the sampling order within each group of multiple groups of second candidate sampling points. For example, suppose a group of second candidate sampling points is ((0, 1), (11, 13), (27, 31), (38, 41), (47, 52), (60, 61)). Then, (0, 1) is the first sampling point when sampling this group of second candidate sampling points, called the first sampling point; (11, 13) is the second sampling point when sampling this group of second candidate sampling points, called the second sampling point; and so on, to obtain these six sampling points.

[0128] After obtaining the six sampling points and their arrangement, the first, second, third, fourth, fifth, and sixth edges can be determined using the following method:

[0129] The first edge is obtained from the second sampling point based on the first sampling point. For example, based on the coordinates of the first sampling point (0, 1) and the coordinates of the second sampling point (11, 13), the equation of the line 1 is calculated, which can represent the first edge.

[0130] The second edge is obtained based on the second and third sampling points. For example, based on the coordinates of the second sampling point (11, 13) and the coordinates of the third sampling point (27, 31), the equation of the line 2 is calculated, which can characterize the second edge.

[0131] The third edge is obtained based on the third and fourth sampling points. For example, based on the coordinates of the third sampling point (27, 31) and the coordinates of the fourth sampling point (38, 41), the equation of the line 3 is calculated, which can represent the third edge.

[0132] The fourth edge is obtained based on the fourth and fifth sampling points. For example, based on the coordinates of the fourth sampling point (38, 41) and the coordinates of the fifth sampling point (47, 52), the equation of the line 4 is calculated, which can characterize the fourth edge.

[0133] The fifth edge is obtained based on the fifth and sixth sampling points. For example, based on the coordinates of the fifth sampling point (47, 52) and the coordinates of the sixth sampling point (60, 61), the equation of the line 5 is calculated, which can characterize the fifth edge.

[0134] The sixth edge is obtained based on the sixth sampling point and the first sampling point. For example, based on the coordinates of the sixth sampling point (60, 61) and the coordinates of the first sampling point (0, 1), the equation of the line 6 is calculated. This equation of the line 6 can characterize the sixth edge.

[0135] Next, determine the first, second, and third pairs of opposite edges in the three pairs of opposite edges. The first pair of opposite edges is obtained based on the first and fourth edges, the second pair of opposite edges is obtained based on the second and fifth edges, and the sixth pair of opposite edges is obtained based on the third and sixth edges.

[0136] It should be understood that three pairs of opposite edges can be determined in the following way:

[0137] Let equation 1 (the first edge) and equation 4 (the fourth edge) be the first pair of opposite edges; let equation 2 (the first edge) and equation 5 (the fifth edge) be the second pair of opposite edges; and let equation 3 (the third edge) and equation 6 (the sixth edge) be the third pair of opposite edges.

[0138] S2233. If the three intersection points are collinear, then the six sampling points are determined as one set of target sampling points in the multiple sets of target sampling points, so as to determine the multiple sets of target sampling points.

[0139] The embodiments of this application do not limit the method of determining whether the three intersection points are collinear. For example, a straight line can be determined based on two of the three intersection points, and it can be determined whether the other intersection point is on this straight line. If the other intersection point is on this straight line, it is determined that the three intersection points are collinear. If the other intersection point is not on this straight line, it is determined that the three intersection points are not collinear.

[0140] For example, we can calculate the distance between each pair of these three intersection points to obtain three distances. If the ratio of the sum of the two smaller distances to the largest distance is 1, then the three intersection points are collinear. If the ratio of the sum of the two smaller distances to the largest distance is not 1, then the three intersection points are not collinear.

[0141] After determining that the three intersection points are collinear, the six sampling points corresponding to the three collinear intersection points are identified as a group of target sampling points. By repeating this method, multiple groups of target sampling points can be identified.

[0142] It should be understood that since the intersection points of the three opposite sides of the inscribed hexagon of a conic section are collinear, the target sampling point determined by the collinearity of the three intersection points is a point located on the conic section. Usually, determining whether a sampling point is located on a conic section requires knowing the coordinates of the sampling point and the equation of the conic section. Substituting the coordinates of the sampling point into the equation and judging whether the equation is satisfied requires explicit knowledge that a curve is a conic section and the ability to calculate the equation of the conic section. However, the embodiments of this application are based on the coordinates of a hand-drawn graphic to identify whether the hand-drawn graphic is a conic section. It is impossible to know whether the hand-drawn graphic is a conic section, and therefore it is impossible to know the precise equation of the conic section. Therefore, the usual method for determining whether a sampling point is located on a conic section is not applicable to the embodiments of this application.

[0143] In this embodiment, the target sampling point can be determined by whether the three intersection points are collinear. Compared with the usual method of determining whether the sampling point is located on a quadratic curve, multiple sets of target sampling points can be accurately determined even when it is unknown whether the hand-drawn graphic is a quadratic curve.

[0144] In some embodiments, even if some coordinates in a user-drawn graphic are not on a quadratic curve, but the error of these coordinates relative to the quadratic curve is small, the coordinates with the smaller error relative to the quadratic curve will also be judged as coordinates on the quadratic curve. The advantage of this processing is that it can increase the number of target sampling points to better identify whether the hand-drawn graphic is a quadratic curve.

[0145] Figure 7 This is a schematic flowchart illustrating the determination of a set of target sampling points provided in an embodiment of this application.

[0146] S22331. Based on the coordinates of the first intersection point, the second intersection point, and the third intersection point, determine the distances between the first and second intersection points, the distances between the second and third intersection points, and the distances between the first and third intersection points, and sort them to obtain the first distance, the second distance, and the third distance. The first distance is less than the second distance, and the second distance is less than the third distance.

[0147] It should be understood that after determining the three pairs of opposite sides in S2231, the equations for the three pairs of opposite sides can be obtained. Based on the equations for each pair of opposite sides, the first, second, and third intersection points corresponding to the three pairs of opposite sides can be determined. For example, solving equations 1 (the first side) and 4 (the fourth side) simultaneously yields the first intersection point; solving equations 2 (the first side) and 5 (the fifth side) simultaneously yields the second intersection point; and solving equations 3 (the third side) and 6 (the sixth side) simultaneously yields the third intersection point.

[0148] In this embodiment of the application, after determining the coordinates d1 of the first intersection point, d2 of the second intersection point, and d3 of the third intersection point, d1, d2, and d3 are sorted in ascending order of their values. The distance with the smallest value is called the first distance, the distance with the largest value is called the third distance, and the distance with the middle value is called the second distance. For example, if d1 < d2 < d3, then d1 is called the first distance, d2 is called the second distance, and d3 is called the third distance.

[0149] S22332. If the ratio of the sum of the first distance and the second distance to the third distance is less than the first threshold, then the six sampling points are determined as one set of target sampling points in a set of multiple target sampling points.

[0150] It should be understood that when all six coordinates of a set of target sampling points in a user-drawn hand-drawn graphic lie on a quadratic curve, the first distance, second distance, and third distance obtained based on these six coordinates satisfy the following condition: the ratio of the sum of the first distance and the second distance to the third distance is equal to 1.

[0151] In this embodiment, when the errors of six coordinates in a set of target sampling points relative to the quadratic curve are small, the first distance, second distance, and third distance obtained based on these six coordinates satisfy the following condition: the ratio of the sum of the first distance and the second distance to the third distance is less than a first threshold. The first threshold can be a number near the integer 1, such as 1+0.5, 1+0.6, etc., and this embodiment does not limit this value. The first threshold can be a value obtained in advance based on test data.

[0152] In this embodiment of the application, after determining the first distance, the second distance, and the third distance in multiple groups of second candidate sampling points, if the first distance, the second distance, and the third distance of one or more groups of second candidate sampling points satisfy the condition that the ratio of the sum of the first distance and the second distance to the third distance is less than a first threshold, then the one or more groups of second candidate sampling points are determined as target sampling points.

[0153] In this embodiment, the determination of six sampling points as one set of target sampling points among multiple sets is based on the fact that the ratio of the sum of the first distance and the second distance to the third distance is less than a first threshold, rather than based on the fact that the ratio of the sum of the first distance and the second distance to the third distance is equal to 1. This allows the second candidate sampling point with a smaller error relative to the quadratic curve among multiple sets of second candidate sampling points to be determined as the target sampling point, thereby increasing the number of target sampling points and better identifying whether the hand-drawn graphic is a quadratic curve.

[0154] Figure 8 This is a schematic flowchart provided in an embodiment of the present application for determining whether a hand-drawn graphic is a quadratic curve.

[0155] S231. Based on the probability that the coordinates of the first coordinate set lie on a quadratic curve, determine the probability that the hand-drawn graphic belongs to a quadratic curve.

[0156] In this embodiment, the probability that the coordinates of the first coordinate set lie on a quadratic curve can be used as a feature input into the classification model for processing. The classification model outputs a probability, which refers to the probability that the hand-drawn graphic belongs to the quadratic curve. For example, the classification model can be a binary classification model, such as a support vector machine.

[0157] S232. If the probability that a hand-drawn graphic belongs to a quadratic curve is greater than the second threshold, then the hand-drawn graphic is determined to be a quadratic curve.

[0158] It should be understood that the second threshold is a preset value. The larger the preset second threshold, the smaller the error between the recognized hand-drawn graphic and the quadratic curve. The smaller the preset second threshold, the larger the error between the recognized hand-drawn graphic and the quadratic curve.

[0159] For example, if the pre-set second threshold is 0.8, then if the probability of a hand-drawn graphic belonging to a quadratic curve is greater than 0.8 (e.g., 0.9), the hand-drawn graphic is determined to be a quadratic curve. If the pre-set second threshold is 0.7, then if the probability of a hand-drawn graphic belonging to a quadratic curve is greater than 0.7 (e.g., 0.8), the hand-drawn graphic is determined to be a quadratic curve. The error between a hand-drawn graphic with a probability of 0.9 belonging to a quadratic curve and a quadratic curve is less than the error between a hand-drawn graphic with a probability of 0.8 belonging to a quadratic curve and a quadratic curve.

[0160] S233. If the probability that a hand-drawn graphic belongs to a quadratic curve is less than or equal to the second threshold, then the hand-drawn graphic is determined not to be a quadratic curve.

[0161] For example, if the pre-set second threshold is 0.8, then if the probability that the hand-drawn graphic belongs to a quadratic curve is less than or equal to 0.8, the hand-drawn graphic is determined not to be a quadratic curve.

[0162] In this embodiment of the application, the probability of a hand-drawn graphic belonging to a quadratic curve is determined based on the probability that the coordinates of the first coordinate set lie on the quadratic curve. If the probability of the hand-drawn graphic belonging to a quadratic curve is greater than a second threshold, the hand-drawn graphic is determined to be a quadratic curve. If the probability of the hand-drawn graphic belonging to a quadratic curve is less than or equal to the second threshold, the hand-drawn graphic is determined not to be a quadratic curve. This method can accurately determine whether a hand-drawn graphic is a quadratic curve.

[0163] Figure 9This is a schematic flowchart of the training method 300 for the classification model provided in this application embodiment. This method 300 can be executed by an electronic device or server, by a processor in the electronic device or server, or by a chip in the electronic device or server; this application embodiment does not impose any limitations. For ease of description, an electronic device is used as an example to describe method 300 in detail.

[0164] S31. Select training data. The training data includes a first type of training data and a second type of training data. The first type of training data includes the probability that the coordinates obtained from the coordinate set of the hand-drawn graphic is a quadratic curve lie on the quadratic curve and a first label labeled with the probability that the coordinates obtained from the coordinate set of the hand-drawn graphic is a quadratic curve lie on the quadratic curve. The second type of training data includes the probability that the coordinates obtained from the coordinate set of the hand-drawn graphic is not a quadratic curve lie on the quadratic curve and a second label labeled with the probability that the coordinates obtained from the coordinate set of the hand-drawn graphic is not a quadratic curve lie on the quadratic curve.

[0165] It should be understood that before training the classification model, training data needs to be selected. The probability that the coordinates of the first type of training data lie on the quadratic curve is a feature obtained by processing the coordinate set of hand-drawn graphics that are quadratic curves. The probability that the coordinates of the second type of training data lie on the quadratic curve is a feature obtained by processing the coordinate set of hand-drawn graphics that are not quadratic curves.

[0166] This application embodiment can use commonly used annotation tools (such as labelimg, NLP annotation tool BRAT) to annotate the first type of training data and the second type of training data. For example, the first label can be "1" and the second label can be "-1".

[0167] S32. Train the classification model based on the training data until the classification model converges.

[0168] The classification models in this application embodiment may include logistic regression models, Naive Bayes models, decision tree models, support vector machine models, random forest models, gradient boosting tree models, etc. This application embodiment does not limit the type of classification model.

[0169] It should be understood that when training a classification model, the first and second types of training data are first input into the initial classification model to obtain the training analysis results of the initial classification model.

[0170] Since the classification model has not yet been fully trained initially, there will be some deviation and error between the output training analysis results and the standard analysis results. It can be understood that the labeled analysis results can be a first label and a second label.

[0171] Secondly, the global error of this round of training is calculated based on the training analysis results and the standard analysis results.

[0172] It should be understood that after obtaining the results of each training analysis, the global error of this round of training can be calculated based on the results of each training analysis and the corresponding standard analysis results. It can then be determined whether the global error meets a preset condition, such as whether the global error is less than 5%. Here, the preset condition can be determined during the training of the classification model. For example, the preset condition can be set as the global error being less than a specific threshold. This specific threshold can be a percentage value. The smaller the specific threshold, the more stable the classification model will be after training, and the higher the accuracy of the recognition results will be.

[0173] In this embodiment, global error refers to the loss function, which may include mean squared error loss, mean absolute error loss, cross-entropy loss function, etc. This embodiment does not limit the type of loss function.

[0174] Then, if the global error does not meet the preset conditions, the model parameters of the classification model are adjusted, and the classification model with the adjusted model parameters is determined as the initial classification model.

[0175] It should be understood that when the global error of this round of training does not meet the preset conditions, for example, when the global error of this round of training is 10%, the model parameters of the classification model can be adjusted, and the classification model with the adjusted model parameters can be determined as the initial classification model. Then, the model can be retrained with the training data to repeatedly adjust the model parameters of the classification model so that the global error calculated based on the training analysis results and the corresponding standard analysis results is minimized until the final global error meets the preset conditions.

[0176] Finally, if the global error meets the preset conditions, the classification model is determined to have converged.

[0177] It should be understood that when the global error of this round of training meets the preset conditions, for example, when the global error of this round of training is less than 5%, it can be determined that the classification model has converged.

[0178] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0179] Figure 10 This is an exemplary block diagram of a hand-drawn graphic recognition device 400 provided in this application embodiment. The hand-drawn graphic recognition device 400 includes a processing unit 41, which is configured to perform the following operations:

[0180] Obtain the first coordinate set of the hand-drawn graphic;

[0181] Based on the first coordinate set, obtain the probability that the coordinates of the first coordinate set lie on the quadratic curve;

[0182] Based on the probability that the coordinates of the first coordinate set lie on a quadratic curve, determine whether the hand-drawn graphic is a quadratic curve.

[0183] It should be understood that the processing unit 41 can be used to execute various steps performed by the electronic device in method 200. For a detailed description, please refer to the relevant description above, which will not be repeated here.

[0184] In addition, the processing unit 41 can also be used to execute various steps performed by the electronic device in method 300. For details, please refer to the relevant description above, which will not be repeated here.

[0185] It should be understood that the electronic device 400 here is embodied in the form of a functional unit. The term "unit" here may refer to application-specific integrated circuits (ASICs), electronic circuits, processors (e.g., shared processors, proprietary processors, or group processors) and memories for executing one or more software or firmware programs, combined logic circuits, and / or other suitable components that support the described functions.

[0186] Figure 11 This is a schematic structural diagram of the electronic device 500 provided in an embodiment of this application. The electronic device 500 is used to execute the corresponding steps and / or processes in the above method embodiments.

[0187] The electronic device 500 includes a processor 501 and a memory 502. The processor 501 and memory 502 communicate with each other via an internal connection. The processor 501 can implement the functions of the processing unit 41 in various possible implementations of the hand-drawn drawing recognition device 400. The memory 502 is used to store instructions, and the processor 501 is used to execute the instructions stored in the memory 502. In other words, the processor 501 can call these stored instructions to implement the functions of the processing unit 41 in the hand-drawn drawing recognition device 400.

[0188] Optionally, the memory 502 may include read-only memory and random access memory, and provide instructions and data to the processor. A portion of the memory may also include non-volatile random access memory. For example, the memory may also store device type information. The processor 501 may be used to execute instructions stored in the memory, and when the processor 501 executes instructions stored in the memory, the processor 501 is used to perform the various steps and / or processes of the method embodiments corresponding to the electronic device described above.

[0189] Processor 501 is used to perform the following steps:

[0190] Obtain the first coordinate set of the hand-drawn graphic;

[0191] The first coordinate set is fitted to obtain the first equation, which is used to characterize the fitted quadratic curve.

[0192] Based on the first coordinate set and the first equation, the similarity between the hand-drawn graphic and the quadratic curve is obtained;

[0193] Based on the similarity between the hand-drawn figure and the quadratic curve, determine whether the hand-drawn figure is a quadratic curve.

[0194] It should be understood that the specific process of each device performing the corresponding steps in the above methods has been described in detail in the above method embodiments, and will not be repeated here for the sake of brevity.

[0195] In addition, the processor 501 can also be used to execute various steps performed by the electronic device in method 200, as detailed in the relevant description above, and will not be repeated here.

[0196] In addition, the processor 501 can also be used to execute various steps performed by the electronic device in method 300, as detailed in the relevant description above, and will not be repeated here.

[0197] It should be understood that, in the embodiments of this application, the processor of the above-described device can be a central processing unit (CPU), which can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.

[0198] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or as a combination of hardware and software units within the processor. The software units can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor executes the instructions in the memory, combining them with its hardware to complete the steps of the above method. To avoid repetition, detailed descriptions are omitted here.

[0199] This application provides a computer program product that, when run on an electronic device, causes the electronic device to execute the technical solutions described in the above embodiments. Its implementation principle and technical effects are similar to those of the related embodiments described above, and will not be repeated here.

[0200] This application provides a readable storage medium containing computer instructions that, when executed by an electronic device, cause the electronic device to perform the technical solutions described in the above embodiments. The implementation principle and technical effects are similar and will not be repeated here.

[0201] This application provides a chip comprising: a memory for storing instructions; and a processor for retrieving and executing the instructions from the memory, causing an electronic device equipped with the chip to perform the technical solutions described in the above embodiments. Its implementation principle and technical effects are similar and will not be repeated here.

[0202] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., high-density digital video discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).

[0203] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0204] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be found in the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0205] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0206] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0207] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0208] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0209] The same or similar parts between the various embodiments in this application can be referred to mutually. In the various embodiments of this application, and in the various implementation methods / methods / implementations within each embodiment, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments and between the various implementation methods / methods / implementations within each embodiment are consistent and can be mutually referenced. The technical features in different embodiments and the various implementation methods / methods / implementations within each embodiment can be combined according to their inherent logical relationships to form new embodiments, implementation methods, methods, or implementation approaches. The above-described embodiments of this application do not constitute a limitation on the scope of protection of this application.

[0210] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of protection of the claims. In conclusion, the above description is merely a preferred embodiment of the technical solution of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for recognizing hand-drawn graphics, characterized in that, include: Obtain the first coordinate set of the hand-drawn graphic; The first coordinate set is sampled to obtain multiple sets of first candidate sampling points; The multiple sets of first candidate sampling points are filtered to obtain multiple sets of second candidate sampling points. Each set of second candidate sampling points can form multiple sets of opposite edges, and the multiple sets of opposite edges are multiple sets of non-parallel opposite edges. The multiple sets of second candidate sampling points are filtered to obtain multiple sets of target sampling points, which are points located on the quadratic curve. Based on the multiple sets of second candidate sampling points and the multiple sets of target sampling points, the probability that the coordinates of the first coordinate set lie on the quadratic curve is obtained; Based on the probability that the coordinates of the first coordinate set lie on the quadratic curve, determine whether the hand-drawn graphic is the quadratic curve.

2. The method according to claim 1, characterized in that, Each group of second candidate sampling points includes six sampling points. The process of filtering the multiple groups of second candidate sampling points to obtain multiple groups of target sampling points includes: Based on the six sampling points of each group of second candidate sampling points in the plurality of groups of second candidate sampling points, three groups of opposite edges are determined; Based on the three sets of opposite edges, determine the three intersection points corresponding to the three sets of opposite edges; If the three intersection points are collinear, then the six sampling points are determined as one set of target sampling points among the multiple sets of target sampling points, thereby determining the multiple sets of target sampling points.

3. The method according to claim 2, characterized in that, The determination of three pairs of opposite edges based on the six sampling points of each of the multiple sets of second candidate sampling points includes: Based on the six sampling points of each group of second candidate sampling points in the plurality of groups of second candidate sampling points, a first edge, a second edge, a third edge, a fourth edge, a fifth edge, and a sixth edge are determined. The first edge is obtained based on the first sampling point and the second sampling point, the second edge is obtained based on the second sampling point and the third sampling point, the third edge is obtained based on the third sampling point and the fourth sampling point, the fourth edge is obtained based on the fourth sampling point and the fifth sampling point, the fifth edge is obtained based on the fifth sampling point and the sixth sampling point, and the sixth edge is obtained based on the sixth sampling point and the first sampling point. The first set of opposite edges, the second set of opposite edges, and the third set of opposite edges are determined. The first set of opposite edges is obtained based on the first edge and the fourth edge, the second set of opposite edges is obtained based on the second edge and the fifth edge, and the third set of opposite edges is obtained based on the third edge and the sixth edge. The first sampling point, the second sampling point, the third sampling point, the fourth sampling point, the fifth sampling point, and the sixth sampling point are the six sampling points arranged in the sampling order within each group of the multiple groups of second candidate sampling points.

4. The method according to claim 2, characterized in that, The three intersection points include a first intersection point, a second intersection point, and a third intersection point. If the three intersection points are collinear, then the six sampling points are determined as one set of target sampling points among the multiple sets of target sampling points, including: Based on the coordinates of the first intersection point, the second intersection point, and the third intersection point, the distances between the first intersection point and the second intersection point, the distances between the second intersection point and the third intersection point, and the distances between the first intersection point and the third intersection point are determined and sorted to obtain a first distance, a second distance, and a third distance, wherein the first distance is less than the second distance, and the second distance is less than the third distance; If the ratio of the sum of the first distance and the second distance to the third distance is less than the first threshold, then the six sampling points are determined to be one set of target sampling points among the multiple sets of target sampling points.

5. The method according to claim 1, characterized in that, The sampling process of the first coordinate set yields multiple sets of first candidate sampling points, including: The first coordinate set is preprocessed to obtain the second coordinate set, and the preprocessing operation includes deduplication. The second coordinate set is sampled to obtain the multiple sets of first candidate sampling points.

6. The method according to any one of claims 1 to 5, characterized in that, Determining whether the hand-drawn graphic is the quadratic curve based on the probability that the coordinates of the first coordinate set lie on the quadratic curve includes: Based on the probability that the coordinates of the first coordinate set lie on the quadratic curve, determine the probability that the hand-drawn graphic belongs to the quadratic curve; If the probability that the hand-drawn graphic belongs to the quadratic curve is greater than the second threshold, the hand-drawn graphic is determined to be the quadratic curve. If the probability that the hand-drawn graphic belongs to the quadratic curve is less than or equal to the second threshold, then the hand-drawn graphic is determined not to be the quadratic curve.

7. A hand-drawn graphic recognition device, characterized in that, The identification device includes a processing unit, the processing unit being used for: Obtain the first coordinate set of the hand-drawn graphic; The first coordinate set is sampled to obtain multiple sets of first candidate sampling points; The multiple sets of first candidate sampling points are filtered to obtain multiple sets of second candidate sampling points. Each set of second candidate sampling points can form multiple sets of opposite edges, and the multiple sets of opposite edges are multiple sets of non-parallel opposite edges. The multiple sets of second candidate sampling points are filtered to obtain multiple sets of target sampling points, which are points located on the quadratic curve. Based on the multiple sets of second candidate sampling points and the multiple sets of target sampling points, the probability that the coordinates of the first coordinate set lie on the quadratic curve is obtained; Based on the probability that the coordinates of the first coordinate set lie on the quadratic curve, determine whether the hand-drawn graphic is the quadratic curve.

8. An electronic device, characterized in that, include: One or more processors; One or more memory units; The one or more memories store one or more computer programs, the one or more computer programs including instructions that, when executed by the one or more processors, cause the electronic device to perform the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, Includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1 to 6.