Methods, apparatus, storage media and electronic devices for detecting neatness of handwritten text

By performing contour detection on handwritten text to determine the boundary information of text lines, the problem of the inability to detect neatness in handwritten text in online education is solved, and efficient and accurate neatness assessment is achieved.

CN114818866BActive Publication Date: 2026-05-26BEIJING DINGSHIXINGJIAOYU CONSULTATION CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING DINGSHIXINGJIAOYU CONSULTATION CO LTD
Filing Date
2022-03-28
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In online education scenarios, handwritten text cannot be photographed and uploaded for neatness testing because the writing trajectory points cannot be recorded.

Method used

By acquiring the handwritten text to be detected, contour detection is performed to determine the boundary information of the text lines, and the neatness information is calculated based on the boundary information to finally determine the neatness detection result.

Benefits of technology

It improves the accuracy and flexibility of neatness detection, enabling the detection of handwritten text in image format, thus improving detection efficiency and providing a unified standard for neatness assessment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114818866B_ABST
    Figure CN114818866B_ABST
Patent Text Reader

Abstract

This disclosure relates to a method, apparatus, storage medium, and electronic device for detecting the neatness of handwritten text. The method includes: performing contour detection on lines of text in the acquired handwritten text to be detected, obtaining a line contour map of each line; determining target sampling points for each line from the line contour map, and determining the boundary information of the line based on the target sampling points; determining the neatness information of the handwritten text to be detected based on the boundary information of each line; and determining the neatness detection result for the text based on the neatness information. Obtaining line contour maps of each line through contour detection and determining the boundary information of each line based on the target sampling points, thereby determining the neatness information of the handwritten text to be detected, can improve the accuracy of neatness detection. Furthermore, even for handwritten text in image format, contour detection can obtain line contour maps, thus enabling neatness detection and improving the flexibility of neatness detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of character recognition technology, specifically to a method, apparatus, storage medium, and electronic device for detecting the neatness of handwritten text. Background Technology

[0002] When teachers grade students' assignments or check class notes, they not only check for accuracy but also for neatness. This is especially true in online education scenarios, where students are required to upload assignments or class notes; however, with such a large volume of work, it is difficult for teachers to check them promptly.

[0003] In relevant scenarios, writing trajectory points are recorded during the writing process, and text writing features are extracted based on these points. The neatness detection result is then determined based on the matching degree between the extracted text writing features and the writing features of a preset template. However, if handwritten text is written on paper and then a photo is taken and uploaded, the writing trajectory points cannot be recorded, making it impossible to detect neatness. Summary of the Invention

[0004] The purpose of this disclosure is to provide a method, apparatus, storage medium, and electronic device for detecting the neatness of handwritten text, so as to at least partially solve the above-mentioned technical problems.

[0005] To achieve the above objectives, the first aspect of this disclosure provides a method for detecting the neatness of handwritten text, the method comprising:

[0006] Obtain the handwritten text to be detected, and perform contour detection on the text lines in the handwritten text to be detected to obtain the line contour map of each text line;

[0007] The target sampling point corresponding to the text line is determined from the line contour map, and the boundary information of the text line is determined based on the target sampling point;

[0008] The neatness information of the handwritten text to be detected is determined based on the boundary information of each line of text.

[0009] The neatness detection result for the text to be detected is determined based on the neatness information.

[0010] Optionally, the neatness information is parallel similarity, the boundary information includes the boundary length of each text line and the width of the handwritten text to be detected, and determining the neatness information of the handwritten text to be detected based on the boundary information of each text line includes:

[0011] The line weight of each text line is determined based on the boundary length of each text line in the line contour map and the width of the handwritten text to be detected.

[0012] Determine the number of text lines in the line outline diagram and the slope of the boundary line corresponding to each text line;

[0013] The parallel similarity is determined based on the number of lines, the line weight, and the difference between the slope of each line of text and the average slope of the lines of text.

[0014] Optionally, determining the parallel similarity based on the number of lines, the line weight, and the difference between the slope of each text line and the average slope includes:

[0015] Determine the absolute value of the difference between the slope corresponding to each of the text lines and the average slope;

[0016] Based on the line weight of each text line and the absolute value corresponding to that text line, calculate the first line parameter value of each text line, and sum the first line parameter values ​​to obtain the second line parameter value;

[0017] The parallel similarity is determined based on the number of rows and the parameter value of the second row.

[0018] Optionally, the neatness information is line height fluctuation information, and determining the neatness information of the handwritten text to be detected based on the boundary information of each of the text lines includes:

[0019] Based on the boundary information of each text line, determine the line height of each text line and the average line height of each text line;

[0020] Based on the number of text lines in the line contour map, the difference between the line height of each text line and the average line height, and the average line height, the line height fluctuation information of the handwritten text to be detected is determined.

[0021] Optionally, determining the line height of each text line and the average line height of the text lines based on the boundary information of each text line includes:

[0022] The text lines are sorted according to the length of their boundary lines, and the boundary information includes the length of the boundary lines.

[0023] Select the target text line from the sorted text lines according to the selected percentage;

[0024] Based on the boundary line coordinates of each target text line, the line height of each target text line and the average line height of the target text lines are determined, and the boundary information also includes the boundary line coordinates;

[0025] The step of determining the line height fluctuation information of the handwritten text to be detected based on the number of text lines in the line contour map, the difference between the line height of each text line and the average line height, and the average line height includes:

[0026] Based on the number of target text lines in the line contour map, the difference between the line height of each target text line and the average line height, and the average line height of each target text line, the line height fluctuation information of the handwritten text to be detected is determined.

[0027] Optionally, determining the neatness detection result for the text to be detected based on the neatness information includes:

[0028] Based on the preset parameter factors and the neatness information, a neatness score is obtained for the neatness of the text to be detected.

[0029] The neatness score is mapped to a preset system detection range to obtain the neatness detection result for the text to be detected.

[0030] Optionally, determining the target sampling point corresponding to the text line from the line contour map includes:

[0031] The number of target sampling points is determined based on the length information in the row contour map;

[0032] Select the target number of sampling points from the row contour map as the target sampling points;

[0033] Determining the boundary information of the text line based on the target sampling point includes:

[0034] Based on the least squares method, the boundary line of the text line is obtained by fitting the coordinates of the target sampling point;

[0035] The boundary information of the text line is determined based on the minimum and maximum coordinates of the sampling points in each text line, as well as the boundary line.

[0036] A second aspect of this disclosure provides a handwritten text neatness detection device, the device comprising:

[0037] The acquisition module is configured to acquire the handwritten text to be detected and perform contour detection on the text lines in the handwritten text to be detected to obtain the line contour map of each text line.

[0038] The first determining module is configured to determine target sampling points corresponding to the text line from the line contour map, and determine the boundary information of the text line based on the target sampling points;

[0039] The second determining module is configured to determine the neatness information of the handwritten text to be detected based on the boundary information of each of the text lines;

[0040] The third determining module is configured to determine the detection result of the neatness of the text to be detected based on the neatness information.

[0041] Optionally, the neatness information is parallel similarity, the boundary information includes the boundary length of each text line and the width of the handwritten text to be detected, and the second determining module includes:

[0042] The first determining submodule is configured to determine the line weight of each text line based on the boundary length of each text line in the line contour map and the width of the handwritten text to be detected.

[0043] The second determining submodule is configured to determine the number of text lines in the line outline diagram and the slope of the boundary line corresponding to each text line;

[0044] The third determining submodule is configured to determine the parallel similarity based on the number of lines, the line weight, and the difference between the slope of each text line and the average slope of the text lines.

[0045] Optionally, the third determining submodule includes:

[0046] The first determining unit is configured to determine the absolute value of the difference between the slope corresponding to each of the text lines and the average slope;

[0047] The calculation unit is configured to calculate a first line parameter value for each of the text lines based on the line weight of each text line and the absolute value corresponding to the text line, and to sum the first line parameter values ​​to obtain a second line parameter value.

[0048] The second determining unit is configured to determine the parallel similarity based on the number of rows and the second row parameter value.

[0049] Optionally, the neatness information is row height fluctuation information, and the second determining module includes:

[0050] The fourth determining submodule is configured to determine the line height of each text line and the average line height of each text line based on the boundary information of each text line.

[0051] The fifth determining submodule is configured to determine the line height fluctuation information of the handwritten text to be detected based on the number of text lines in the line outline diagram, the difference between the line height of each text line and the average line height, and the average line height.

[0052] Optionally, the fourth determining submodule is configured to sort each of the text lines according to the length of the text line boundary, the boundary information including the boundary line length; and select target text lines from the sorted text lines according to the selected percentage; and determine the line height of each target text line and the average line height of the target text lines according to the boundary line coordinates of each target text line, the boundary information also including the boundary line coordinates;

[0053] The fifth determining submodule is configured to determine the line height fluctuation information of the handwritten text to be detected based on the number of target text lines in the line contour map, the difference between the line height of each target text line and the average line height, and the average line height of each target text line.

[0054] Optionally, the third determining module is configured to obtain a neatness score for the neatness of the text to be detected based on preset parameter factors and the neatness information; and map the neatness score to a preset system detection range to obtain a detection result for the neatness of the text to be detected.

[0055] Optionally, the first determining module is configured to:

[0056] The number of target sampling points is determined based on the length information in the row contour map;

[0057] Select the target number of sampling points from the row contour map as target sampling points; and

[0058] Based on the least squares method, the boundary line of the text line is obtained by fitting the coordinates of the target sampling point;

[0059] The boundary information of the text line is determined based on the minimum and maximum coordinates of the sampling points in each text line, as well as the boundary line.

[0060] A third aspect of this disclosure provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of the method described in any of the first aspects.

[0061] A fourth aspect of this disclosure provides an electronic device, comprising:

[0062] A memory on which computer programs are stored;

[0063] A processor for executing the computer program in the memory to implement the steps of the method of any one of the first aspects.

[0064] The above technical solution can achieve at least the following technical effects:

[0065] By performing contour detection on the lines of the acquired handwritten text to be detected, line contour maps of each line are obtained. Target sampling points for each line are determined from the line contour maps, and the boundary information of that line is determined based on these target sampling points. The neatness information of the handwritten text to be detected is then determined based on the boundary information of each line. Finally, the neatness detection result for the text to be detected is determined based on the neatness information. Obtaining line contour maps of each line through contour detection and determining the boundary information of each line based on the target sampling points, thereby determining the neatness information of the handwritten text to be detected, can improve the accuracy of neatness detection. Furthermore, even for handwritten text in image format, line contour maps can be obtained through contour detection, thus enabling neatness detection and increasing the flexibility of neatness detection.

[0066] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description

[0067] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the following detailed description to explain the present disclosure, but do not constitute a limitation thereof. In the drawings:

[0068] Figure 1 A flowchart illustrating a method for detecting the neatness of handwritten text is shown according to an exemplary embodiment.

[0069] Figure 2 A network structure diagram of a text detection model is shown according to an exemplary embodiment.

[0070] Figure 3 This is a schematic diagram illustrating the generation of a row outline map according to an exemplary embodiment.

[0071] Figure 4 This is a schematic diagram of a row outline diagram according to an exemplary embodiment.

[0072] Figure 5 This is a schematic diagram of another row outline diagram according to an exemplary embodiment.

[0073] Figure 6 An implementation is illustrated according to an exemplary embodiment. Figure 1 The flowchart for step S13.

[0074] Figure 7 Another implementation illustrated according to an exemplary embodiment Figure 1 The flowchart for step S13.

[0075] Figure 8 Another implementation illustrated according to an exemplary embodiment Figure 1The flowchart for step S13.

[0076] Figure 9 A schematic diagram of a logistic regression function is shown according to an exemplary embodiment.

[0077] Figure 10 This is a schematic diagram illustrating a normalized detection result according to an exemplary embodiment.

[0078] Figure 11 This is a block diagram illustrating a handwritten text neatness detection device according to an exemplary embodiment.

[0079] Figure 12 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation

[0080] The specific embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit this disclosure.

[0081] Figure 1 A flowchart illustrating a handwritten text neatness detection method according to an exemplary embodiment is shown below. Figure 1 As shown, the method includes the following steps.

[0082] In step S11, the handwritten text to be detected is obtained, and the outline of the text lines in the handwritten text to be detected is detected to obtain the outline of each text line.

[0083] Optionally, the handwritten text to be detected can be a photograph obtained by means of taking a picture of the handwritten content, an image obtained by means of taking a screenshot, or handwritten text formed online by an electronic device.

[0084] Specifically, a text detection model is used to perform contour detection on the text lines in the handwritten text to be detected, resulting in a line contour map for each text line. See [link to relevant documentation]. Figure 2 As shown, during the training process of the text detection model, sample handwritten text (such as...) is used... Figure 2 As shown in the lower left corner, after inputting the text into the network (for example, an image of handwritten text or text handwritten on an electronic device), it undergoes feature extraction, upsampling, fusion, and concat operations. This extracts convolutional features of different depths to simultaneously obtain both high-resolution location information and high-level semantic information, resulting in... Figure 2The image feature map F is used to predict the probability map P and the threshold map T. Finally, an approximate binary map is calculated using the probability map P and the threshold map T. The output result of the sample handwritten text is obtained based on the approximate binary map.

[0085] In the application process, the handwritten text to be detected is input into the text detection model. Similarly, convolutional features of different depths are extracted to simultaneously obtain both high-resolution positional information and high-level semantic information. Features such as tilt and distortion in the handwritten text to be detected are extracted. Figure 3 As shown, the first step is to obtain a polygon feature map of the handwritten text to be detected. Then, based on the polygon feature map, the corresponding probability map and threshold map are obtained. Finally, based on the probability map and threshold map, the line contour map of each text line is obtained.

[0086] It should be noted that the line outline diagram can be understood as the outline diagram along the direction of text writing. For example, if the text is written horizontally, the line outline diagram can be a horizontal outline diagram; if the text is written vertically, the line outline diagram can be a vertical outline diagram; if the text is written at an angle, the line outline diagram can be an angled outline diagram.

[0087] In step S12, target sampling points corresponding to the text line are determined from the line contour map, and the boundary information of the text line is determined based on the target sampling points.

[0088] Specifically, by using a mask of a preset size, sampling points are determined for the boundary lines in both the length and width directions of each text line. Then, target sampling points are selected from each boundary line according to a preset number of target sampling points.

[0089] For example, for a horizontally written line outline diagram, nine sampling points are selected as target sampling points on both the upper and lower boundary lines. Among these, the nine sampling points with the furthest coordinates on each boundary line are selected based on their coordinates. For instance, the nine sampling points with the largest ordinates are selected as target sampling points for the upper boundary line, and the nine sampling points with the smallest ordinates are selected as target sampling points for the lower boundary line.

[0090] Furthermore, based on the least squares method, the straight line closest to the nine sampling points is obtained, and this line is used as the boundary in that direction. Then, the boundary information of each text line in the line contour map is obtained using this method. See also... Figure 4 as well as Figure 5 The boundary information of the row outline diagram shown.

[0091] Determining the target sampling points for a text line according to a preset number may result in an inaccurate boundary line if the number of target sampling points is too small. Optionally, determining the target sampling points corresponding to the text line from the line contour map includes:

[0092] The number of target sampling points is determined based on the length information in the row contour map.

[0093] The number of target sampling points can be determined based on the average length of the text lines in the line contour map, or based on the length of each text line.

[0094] Select the target number of sampling points from the row contour map as target sampling points.

[0095] Similarly, based on the coordinates of the sampling points, select the number of target sampling points with the furthest coordinates on the boundary line as the target sampling points.

[0096] Determining the boundary information of the text line based on the target sampling point includes:

[0097] Based on the least squares method, the boundary line of the text line is obtained by fitting the coordinates of the target sampling point;

[0098] The boundary information of the text line is determined based on the minimum and maximum coordinates of the sampling points in each text line, as well as the boundary line.

[0099] Specifically, the boundary line in the writing direction (length direction) is determined based on the minimum and maximum coordinates in the writing direction; the boundary line in the vertical writing direction (width direction) is determined based on the minimum and maximum coordinates in the vertical writing direction. Then, the boundary information of the text line is determined based on the boundary lines in the length and width directions.

[0100] In step S13, the neatness information of the handwritten text to be detected is determined based on the boundary information of each text line.

[0101] In this embodiment, the neatness information is parallel similarity, and the boundary information includes the boundary length of each text line and the width of the handwritten text to be detected. Figure 6 An implementation is illustrated according to an exemplary embodiment. Figure 1 The flowchart of step S13 shows that in step S13, determining the neatness information of the handwritten text to be detected based on the boundary information of each text line includes:

[0102] In step S1301, the line weight of each text line is determined based on the boundary length of each text line in the line contour map and the width of the handwritten text to be detected.

[0103] The width of the handwritten text to be detected can be either the width of the text in the vertical writing direction or the width of the text in the vertical direction. For example, in the case of slanted writing, the text width can be determined in the initial writing direction or in the vertical direction by the difference between the maximum and minimum ordinates.

[0104] For example, the line weight lambda of a text line can be calculated using the following formula. i :

[0105]

[0106] Among them, Slengths i Let w be the boundary length of the i-th text line, where the boundary length can be the average value of the boundary lines in the same direction, and w is the width of the handwritten text to be detected.

[0107] In step S1302, the number of text lines in the line contour map and the slope of the boundary line corresponding to each text line are determined.

[0108] The number of text lines can be determined by the number of boundary lines in the same direction. For example, half the number of boundary lines in the writing direction can be used as the number of text lines. However, this method is less accurate when there are parts horizontal writing, parts slanted writing, and parts continuous writing. Therefore, one-quarter of the number of boundary lines in a text line can be used as the number of text lines.

[0109] The slope of the boundary line refers to the slope of the boundary line in the writing direction.

[0110] In step S1303, the parallel similarity is determined based on the number of lines, the line weight, and the difference between the slope of each text line and the average slope of the text lines.

[0111] Based on the above embodiments, in step S133, determining the parallel similarity according to the number of lines, the line weight, and the difference between the slope and the average slope of each text line includes:

[0112] Determine the absolute value of the difference between the slope corresponding to each of the text lines and the average slope.

[0113] Based on the line weight of each text line and the absolute value corresponding to that text line, calculate the first line parameter value for each text line, and sum the first line parameter values ​​to obtain the second line parameter value.

[0114] The parallel similarity is determined based on the number of rows and the parameter value of the second row.

[0115] In one implementation, the quotient of the row number and the second row parameter value can be used as the parallel similarity, i.e., the parallel similarity score1 is determined by the following formula:

[0116]

[0117] Where N is the number of text lines in the line outline diagram, and k i Let be the slope of the boundary line of the i-th text line, k_mean be the average slope of the text lines, and lambda be the slope of the boundary line of the i-th text line. i Let be the line weight of the i-th text line.

[0118] Where, k i It can be the slope of the upper boundary line and / or the slope of the lower boundary line of the text line, or it can be the average of the slopes of the upper and lower boundary lines. Usually, the slopes of the upper and lower boundary lines of the text line are different, so they can be used separately in the calculation of the average slope and separately in the calculation of the first line parameter.

[0119] In the above technical solution, the larger the score1 is, the higher the parallel similarity of the straight lines. The square root of the text line width and then the line weight can be calculated by using an exponential function to smooth the sensitivity of the boundary line to parallel similarity, reduce the jitter of changes, and thus reduce the impact of the width of the handwritten text to be detected on the final neatness detection. Furthermore, the neatness detection does not fluctuate significantly due to changes in the number of text lines.

[0120] In this embodiment, the neatness information is row height fluctuation information. Figure 7 Another implementation illustrated according to an exemplary embodiment Figure 1 The flowchart of step S13 shows that in step S13, determining the neatness information of the handwritten text to be detected based on the boundary information of each text line includes:

[0121] In step S131, the line height of each text line and the average line height of each text line are determined based on the boundary information of each text line.

[0122] In step S132, the line height fluctuation information of the handwritten text to be detected is determined based on the number of text lines in the line outline diagram, the difference between the line height of each text line and the average line height, and the average line height.

[0123] The line height fluctuation information can include the first line height fluctuation value, for example, the first line height fluctuation value score2 of the handwritten text to be detected can be determined by the following formula:

[0124]

[0125] Where H is the average line height of the text lines, N is the number of lines in the text lines, and h i Let h be the line height of the i-th text line, where h is the line height of the i-th text line. i It can be the average of the line heights at both ends of the text line.

[0126] In one possible implementation, h i Taking the average line height at both ends of the text line ignores the impact of variations in line height within the text line on neatness detection. Therefore, we can first determine the difference in line height between the two ends. If the difference in line height is less than a preset threshold, h i Take the average of the line heights at both ends of the text line. If the difference in line heights is greater than or equal to a preset threshold, the line heights at both ends of the text line can be used to calculate the first line height fluctuation value, score2.

[0127] Based on the above embodiments, Figure 8 Another implementation illustrated according to an exemplary embodiment Figure 1 The flowchart for step S13 shows that in step S131, determining the line height of each text line and the average line height of the text lines based on the boundary information of each text line includes:

[0128] In step S1311, the text lines are sorted according to the length of the boundary lines of the text lines, and the boundary information includes the length of the boundary lines;

[0129] In step S1312, the target text line is selected from the sorted text lines according to the selection percentage.

[0130] Optionally, the selection percentage can be a preset selection percentage, such as 80%, which selects the 80% of the longest text lines as the target text lines. Alternatively, it can be a selection percentage determined based on the number of text lines, for example, establishing a correspondence between the number of text lines and the selection percentage.

[0131] In step S1313, the line height of each target text line and the average line height of the target text lines are determined based on the boundary line coordinates of each target text line. The boundary information also includes the boundary line coordinates.

[0132] In step S132, determining the line height fluctuation information of the handwritten text to be detected based on the number of text lines in the line contour map, the difference between the line height of each text line and the average line height, and the average line height, includes:

[0133] In step S1321, the line height fluctuation information of the handwritten text to be detected is determined based on the number of target text lines in the line contour map, the difference between the line height of each target text line and the average line height, and the average line height of each target text line.

[0134] Among them, through Figure 8 The line height fluctuation information calculated in this way is the second line height fluctuation value. For example, the second line height fluctuation value score3 of the handwritten text to be detected is determined by the following formula:

[0135]

[0136] Where W is the average line height of the target text lines, M is the number of lines in the target text lines, and w i w is the line height of the i-th target text line. Similarly, when the difference between the line heights at both ends of the target text line is less than a preset threshold, w i Take the average of the line heights at both ends of the target text line. If the difference between the line heights at both ends of the target text line is greater than or equal to a preset threshold, the line heights at both ends of the target text line can be used to calculate the second line height fluctuation value score3.

[0137] In step S14, the neatness detection result for the text to be detected is determined based on the neatness information.

[0138] In one implementation, the neatness information may include parallel similarity, first row high volatility information, and second row high volatility information, wherein the first row high volatility information is based on... Figure 7 The method shown indicates that the second row of high volatility information is determined based on... Figure 8 The method shown is used to determine this.

[0139] The neatness detection score for the text to be detected is determined by the following formula:

[0140] score=score1+λ1score2+λ2score3

[0141] Wherein, score1 is the parallel similarity, score2 is the high fluctuation information of the first row, score3 is the high fluctuation information of the second row, and λ1 and λ2 are preset balance weight coefficients. Optionally, the preset values ​​of λ1 and λ2 are both 0.1.

[0142] In the above embodiments, since the score is not normalized to the score range of 0 to 100, and each person's perception of the sensitive area of ​​neatness is different, the lack of normalization may lead to inconsistent detection results. Therefore, the detection result score can be normalized and mapped and adjusted. Thus, in step S14, determining the detection result of neatness for the text to be detected based on the neatness information may include:

[0143] Based on the preset parameter factors and the neatness information, a neatness score is obtained for the neatness of the text to be detected.

[0144] The preset parameter factor can be the expected neatness of manually annotated sample handwritten text. For example, it can be annotated by three people, and the average value can be taken as the expected neatness of the sample handwritten text. Using the BP algorithm, the sample handwritten text is input into the model. During forward propagation, the sample handwritten text enters the network from the input layer, passes through the hidden layers, and is passed to the output layer. If the actual output of the output layer differs from the expected neatness, the process switches to error backpropagation; if the actual output of the output layer is the same as the expected neatness, the learning algorithm ends.

[0145] During backpropagation, the output error (the difference between the expected output and the actual output) is calculated by propagating back along the original path, through the hidden layers, and down to the input layer. During backpropagation, the error is distributed to each unit in each layer, obtaining the error signal for each unit, which is then used to adjust the weights of each unit. This calculation process uses gradient descent, continuously adjusting the weights and thresholds of neurons in each layer to minimize the error signal.

[0146] In this way, through forward propagation of the signal and backward propagation of the error, the adjustment of weights and thresholds is repeated until a predetermined number of training iterations are completed, or the output error is reduced to an acceptable level, thus obtaining the preset parameter factors. For example, minimizing the error between the actual output and the sample yields the preset parameter factors.

[0147] The preset parameter factors may include a preset scaling factor and a preset translation factor. The scaling factor is used to adjust the change amplitude of each neatness score segment, and the translation factor is used to adjust the mean of the neatness score. The larger the translation factor value, the steeper the change of the score in the middle segment.

[0148] The neatness score is mapped to a preset system detection range to obtain the neatness detection result for the text to be detected.

[0149] like Figure 9 As shown, the detection result score is mapped to the interval between 0 and 1 using a logistic regression function, as illustrated in the following formula. Figure 10As shown, based on different scaling factors c1 and translation factors c2, the detection result score is adjusted using a logistic regression function to bring the detection result into the system's detection range of 0 to 1. Then, multiplying by 100 yields the final detection result S, which falls within the 0-100 range.

[0150]

[0151] Where c1 is the preset scaling factor and c2 is the preset translation factor.

[0152] The above technical solution performs contour detection on the lines of the acquired handwritten text to be detected, obtaining a line contour map for each line. Target sampling points for each line are determined from the line contour map, and the boundary information of that line is determined based on these target sampling points. The neatness information of the handwritten text to be detected is determined based on the boundary information of each line. Finally, the neatness detection result for the text to be detected is determined based on the neatness information. Obtaining line contour maps for each line through contour detection and determining the boundary information of each line based on the target sampling points improves the accuracy of neatness detection. Even for handwritten text in image format, line contour maps can be obtained through contour detection, enabling neatness detection and increasing the flexibility of neatness detection. Furthermore, it allows for rapid and standardized neatness detection of various types of handwritten text, such as handwritten assignments and notes, improving the efficiency of neatness detection.

[0153] Based on the same concept, this disclosure also provides a handwritten text neatness detection device for performing the steps of the handwritten text neatness detection method provided in the above embodiments. The device can implement the handwritten text neatness detection method in software, hardware or a combination of both. Figure 11 This is a block diagram illustrating a handwritten text neatness detection device 1100 according to an exemplary embodiment, such as... Figure 11 As shown, the device 1100 includes: an acquisition module 1110, a first determination module 1120, a second determination module 1130, and a third determination module 1140.

[0154] The acquisition module 1110 is configured to acquire the handwritten text to be detected and perform contour detection on the text lines in the handwritten text to be detected to obtain the line contour map of each text line.

[0155] The first determining module 1120 is configured to determine target sampling points corresponding to the text line from the line contour map, and determine the boundary information of the text line based on the target sampling points;

[0156] The second determining module 1130 is configured to determine the neatness information of the handwritten text to be detected based on the boundary information of each of the text lines.

[0157] The third determining module 1140 is configured to determine the detection result of the neatness of the text to be detected based on the neatness information.

[0158] The aforementioned device obtains the line contour map of each text line through contour detection, and determines the boundary information of the text line based on the target sampling points of each line, thereby determining the neatness information of the handwritten text to be detected. This can improve the accuracy of neatness detection. Furthermore, even for handwritten text in image form, the line contour map can be obtained through contour detection, thus enabling neatness detection and improving the flexibility of neatness detection.

[0159] Optionally, the neatness information is parallel similarity, the boundary information includes the boundary length of each text line and the width of the handwritten text to be detected, and the second determining module 1130 includes:

[0160] The first determining submodule is configured to determine the line weight of each text line based on the boundary length of each text line in the line contour map and the width of the handwritten text to be detected.

[0161] The second determining submodule is configured to determine the number of text lines in the line outline diagram and the slope of the boundary line corresponding to each text line;

[0162] The third determining submodule is configured to determine the parallel similarity based on the number of lines, the line weight, and the difference between the slope of each text line and the average slope of the text lines.

[0163] Optionally, the third determining submodule includes:

[0164] The first determining unit is configured to determine the absolute value of the difference between the slope corresponding to each of the text lines and the average slope;

[0165] The calculation unit is configured to calculate a first line parameter value for each of the text lines based on the line weight of each text line and the absolute value corresponding to the text line, and to sum the first line parameter values ​​to obtain a second line parameter value.

[0166] The second determining unit is configured to determine the parallel similarity based on the number of rows and the second row parameter value.

[0167] Optionally, the neatness information is row height fluctuation information, and the second determining module 1130 includes:

[0168] The fourth determining submodule is configured to determine the line height of each text line and the average line height of each text line based on the boundary information of each text line.

[0169] The fifth determining submodule is configured to determine the line height fluctuation information of the handwritten text to be detected based on the number of text lines in the line outline diagram, the difference between the line height of each text line and the average line height, and the average line height.

[0170] Optionally, the fourth determining submodule is configured to sort each of the text lines according to the length of the text line boundary, the boundary information including the boundary line length; and select target text lines from the sorted text lines according to the selected percentage; and determine the line height of each target text line and the average line height of the target text lines according to the boundary line coordinates of each target text line, the boundary information also including the boundary line coordinates;

[0171] The fifth determining submodule is configured to determine the line height fluctuation information of the handwritten text to be detected based on the number of target text lines in the line contour map, the difference between the line height of each target text line and the average line height, and the average line height of each target text line.

[0172] Optionally, the third determining module is configured to obtain a neatness score for the neatness of the text to be detected based on preset parameter factors and the neatness information; and map the neatness score to a preset system detection range to obtain a detection result for the neatness of the text to be detected.

[0173] Optionally, the first determining module is configured to:

[0174] The number of target sampling points is determined based on the length information in the row contour map;

[0175] Select the target number of sampling points from the row contour map as target sampling points; and

[0176] Based on the least squares method, the boundary line of the text line is obtained by fitting the coordinates of the target sampling point;

[0177] The boundary information of the text line is determined based on the minimum and maximum coordinates of the sampling points in each text line, as well as the boundary line.

[0178] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0179] Furthermore, it is worth noting that, for the sake of convenience and brevity, the embodiments described in the specification are all preferred embodiments, and the parts involved are not necessarily essential to the present invention. For example, the second determining module 1130 and the third determining module 1140 can be independent devices or the same device in specific implementations, and this disclosure does not limit them in this regard.

[0180] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the handwritten text neatness detection methods.

[0181] This disclosure also provides an electronic device, including:

[0182] A memory on which computer programs are stored;

[0183] A processor for executing the computer program in the memory to implement the steps of any of the handwritten text neatness detection methods.

[0184] Figure 12 This is a block diagram illustrating an electronic device 1200 according to an exemplary embodiment. The electronic device 1200 can be configured as a teaching terminal, smartphone, tablet computer, desktop computer, etc., to perform the aforementioned handwritten text neatness detection method. Figure 11 As shown, the electronic device 1200 may include a processor 1201 and a memory 1202. The electronic device 1200 may also include one or more of a multimedia component 1203, an input / output (I / O) interface 1204, and a communication component 1205.

[0185] The processor 1201 controls the overall operation of the electronic device 1200 to complete all or part of the steps in the handwritten text neatness detection method described above. The memory 1202 stores various types of data to support the operation of the electronic device 1200. This data may include, for example, instructions for any application or method operating on the electronic device 1200, and application-related data, such as school data, course data, class data, teacher and classroom data, etc. The memory 1202 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. Multimedia component 1203 may include a screen and an audio component. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 1202 or transmitted via communication component 1205. The audio component also includes at least one speaker for outputting audio signals. I / O interface 1204 provides an interface between processor 1201 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 1205 is used for wired or wireless communication between the electronic device 1200 and other devices. Wireless communication includes, for example, Wi-Fi, Bluetooth, etc. Therefore, the corresponding communication component 1205 may include a Wi-Fi module, a Bluetooth module, etc.

[0186] In an exemplary embodiment, the electronic device 1200 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the handwritten text neatness detection method described above.

[0187] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, which, when executed by a processor, implement the steps of the handwritten text neatness detection method described above. For example, the computer-readable storage medium may be the memory 1202 including the program instructions described above, which may be executed by the processor 1201 of the electronic device 1200 to complete the handwritten text neatness detection method described above.

[0188] The preferred embodiments of this disclosure have been described in detail above with reference to the accompanying drawings. However, this disclosure is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this disclosure, various simple modifications can be made to the technical solutions of this disclosure, and these simple modifications all fall within the protection scope of this disclosure.

[0189] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, this disclosure will not describe the various possible combinations separately.

[0190] Furthermore, various different embodiments of this disclosure can be combined in any way, as long as they do not violate the spirit of this disclosure, they should also be regarded as the content disclosed in this disclosure.

Claims

1. A method of detecting the neatness of handwritten text, characterized by, include: The handwritten text to be detected is obtained, and the outline of the text lines in the handwritten text to be detected is detected to obtain the outline map of each text line. The outline map is the outline map in the writing direction of the text. When the text is written horizontally, the outline map is horizontal; when the text is written vertically, the outline map is vertical; when the text is written slanted, the outline map is slanted. Determining the target sampling point corresponding to the text line from the line contour map includes: determining the number of target sampling points based on the length information in the line contour map, selecting the number of target sampling points from the line contour map as target sampling points, and determining the boundary information of the text line based on the target sampling points; The neatness information of the handwritten text to be detected is determined based on the boundary information of each line of text. The neatness detection result for the handwritten text to be detected is determined based on the neatness information; Wherein, the neatness information is parallel similarity, the boundary information includes the boundary length of each text line and the width of the handwritten text to be detected, and the step of determining the neatness information of the handwritten text to be detected based on the boundary information of each text line includes: The line weight of each text line is determined based on the boundary length of each text line in the line contour map and the width of the handwritten text to be detected. Determine the number of text lines in the line outline diagram and the slope of the boundary line corresponding to each text line; The parallel similarity is determined based on the number of lines, the line weight, and the difference between the slope of each line of text and the average slope of the lines of text.

2. The method of claim 1, wherein, Determining the parallel similarity based on the number of lines, the line weight, and the difference between the slope of each text line and the average slope includes: Determine the absolute value of the difference between the slope corresponding to each of the text lines and the average slope; Based on the line weight of each text line and the absolute value corresponding to that text line, calculate the first line parameter value of each text line, and sum the first line parameter values ​​to obtain the second line parameter value; The parallel similarity is determined based on the number of rows and the parameter value of the second row.

3. The method according to any one of claims 1-2, characterized in that, The step of determining the neatness detection result for the handwritten text to be detected based on the neatness information includes: Based on the preset parameter factors and the neatness information, a neatness score is obtained for the neatness of the handwritten text to be detected. The neatness score is mapped to a preset system detection range to obtain the neatness detection result for the handwritten text to be detected.

4. The method according to any one of claims 1-2, characterized in that, Determining the boundary information of the text line based on the target sampling point includes: Based on the least squares method, the boundary line of the text line is obtained by fitting the coordinates of the target sampling point; The boundary information of the text line is determined based on the minimum and maximum coordinates of the sampling points in each text line, as well as the boundary line.

5. A handwriting neatness detection apparatus, characterized by comprising: The device includes: The acquisition module is configured to acquire the handwritten text to be detected and perform contour detection on the text lines in the handwritten text to be detected to obtain the line contour map of each text line. The line contour map is a contour map in the direction of text writing. When the text is written horizontally, the line contour map is a horizontal contour map; when the text is written vertically, the line contour map is a vertical contour map; when the text is written at an angle, the line contour map is an angled contour map. The first determining module is configured to determine target sampling points corresponding to the text line from the line contour map, including: determining the number of target sampling points according to the length information in the line contour map, selecting the number of target sampling points from the line contour map as target sampling points, and determining the boundary information of the text line according to the target sampling points; The second determining module is configured to determine the neatness information of the handwritten text to be detected based on the boundary information of each of the text lines; The third determining module is configured to determine the detection result of the neatness of the handwritten text to be detected based on the neatness information; Wherein, the neatness information is parallel similarity, the boundary information includes the boundary length of each text line and the width of the handwritten text to be detected, and the second determining module includes: The first determining submodule is configured to determine the line weight of each text line based on the boundary length of each text line in the line contour map and the width of the handwritten text to be detected. The second determining submodule is configured to determine the number of text lines in the line outline diagram and the slope of the boundary line corresponding to each text line; The third determining submodule is configured to determine the parallel similarity based on the number of lines, the line weight, and the difference between the slope of each text line and the average slope of the text lines.

6. A computer-readable storage medium having stored thereon a computer program, characterized in that, When executed by a processor, the program implements the steps of the method described in any one of claims 1-4.

7. An electronic device, characterized in that, include: A memory on which computer programs are stored; A processor for executing the computer program in the memory to implement the steps of the method according to any one of claims 1-4.