Test question correction method and device, equipment and storage medium
By calculating the overlap between the handwritten text lines and the answer area in the test question correction, determining the target answer area and correcting it, the problem of low accuracy of the test question correction in the existing technology is solved, and the accuracy and reliability of the correction are improved.
Patent Information
- Application Number
- CN202411801181.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-04-15
AI Technical Summary
The accuracy of correcting test questions in the prior art is not high, resulting in the possible loss of handwritten text lines or errors in attribution.
By obtaining the text image of the test questions to be corrected, traverse each answer area, calculate the overlap between the handwritten text line and the answer area, determine the most matching target answer area, and correct it based on the standard answers of the answer area.
It improves the accuracy of the target answer area, avoids the loss or misallocation of handwritten text lines, and improves the accuracy of the test questions.
Smart Images

Figure CN119832571A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a test question marking method, device, equipment and storage medium. Background Art
[0002] In the field of education, the automatic grading function for test papers and homework will be the inevitable direction of intelligent education. It will not only relieve teachers and parents of a lot of repetitive work, but also serve as an important data analysis basis for intelligent guidance and precise teaching in future education.
[0003] At present, when marking test questions, the test paper or homework will be photographed first, and then the photographed photo will be subjected to image recognition to detect the handwritten text lines and printed text lines, and establish the mapping relationship between the answer area and the standard answer, as well as the answer area and the handwritten text lines. Afterwards, the handwritten text line belonging to a certain answer area will be identified, and the recognition result will be compared with the standard answer corresponding to the answer area to give a scoring result. In the above-mentioned test question marking process, it is very important to correctly establish the mapping relationship between the answer area and the handwritten text line. In the prior art, the corresponding area will be directly cut according to the size of the answer area to obtain the handwritten text in the answer area.
[0004] However, in the actual homework process, there are often situations where answers are given beyond the answer area. Directly cropping the area corresponding to the answer area will result in excess handwritten text or loss of the handwritten text in the answer area, resulting in low accuracy in test grading. Summary of the invention
[0005] The present invention provides a test question marking method, device, equipment and storage medium, which are used to solve the defect of low accuracy of test question marking in the prior art and achieve the purpose of improving the accuracy of test question marking.
[0006] The present invention provides a test question correction method, comprising: Get the text image of the test paper to be corrected; For each handwritten text line in all the test questions to be corrected, traverse each answer area in the text image to determine a first overlap between the handwritten text line and the first answer area currently traversed; Determine at least one target answering area corresponding to the handwritten text line based on each of the first overlap degrees; The handwritten text lines are corrected based on the standard answers corresponding to the target answer areas.
[0007] According to a test question marking method provided by the present invention, the step of determining at least one target answering area corresponding to the handwritten text line based on each of the first overlap degrees includes: When the maximum first overlap degree among all the first overlap degrees is greater than a first preset threshold and the difference between the maximum first overlap degree and the second largest first overlap degree is greater than a first target value, the answer area corresponding to the maximum first overlap degree is determined as the target answer area of the handwritten text line, and the first target value is related to the maximum first overlap degree.
[0008] According to a test question marking method provided by the present invention, the method further comprises: For the first handwritten text line that is not matched to the target answer area among all handwritten text lines, traverse the first overlap degrees corresponding to the first handwritten text line, and determine the answer areas corresponding to all first overlap degrees greater than a second preset threshold as the target answer area for the first handwritten text line, and the second preset threshold is less than the first preset threshold.
[0009] According to a test question marking method provided by the present invention, the method further comprises: For all second handwritten text lines in the first handwritten text lines that are not matched to the target answer area, if the second answer area currently traversed does not include handwritten text, determine a first distance between the second handwritten text line and the second answer area currently traversed; When the first distance is less than a second target value, the currently traversed second answer area is determined as the target answer area for the second handwritten text line, and the second target value is determined based on the line heights of all handwritten text lines in the text image.
[0010] According to a test question marking method provided by the present invention, the method further comprises: In a case where the second answer area currently traversed includes handwritten text and the handwritten text is smeared text, determining a second distance between the second handwritten text line and a text line corresponding to the smeared text; When the second distance is smaller than the second target value, the currently traversed second answer area is determined as the target answer area of the second handwritten text line.
[0011] According to a test question marking method provided by the present invention, the method further comprises: For all second handwritten text lines in the first handwritten text lines that are not matched to the target answer area, traverse each question frame area in the text image to determine a third distance between the second handwritten text line and the currently traversed question frame area; When the third distance is less than the preset distance and the answer area within the question frame area does not include handwritten text or the handwritten text included in the answer area within the question frame area is smudged text, the answer area within the question frame area is determined to be the target answer area corresponding to the second handwritten text row.
[0012] According to a test question marking method provided by the present invention, the method further comprises: Determining a third handwritten text line that does not belong to the question frame area of the non-answer question based on the second handwritten text line that is not matched to the target answer area in all the first handwritten text lines; For each of the third handwritten text lines, determining a second overlap between the third handwritten text line and an answer area of an answer question adjacent to the non-answer question; When the second overlap degree is greater than a third preset threshold, determining the answer area of the answer question as the target answer area corresponding to the third handwritten text line; When the second overlap degree is less than or equal to the third preset threshold, the answer area of the answer question is expanded based on the question frame area and answer area of other test questions adjacent to the answer question to obtain the expanded answer area, and the third overlap degree between the third handwritten text line and the expanded answer area is determined. When the third overlap degree is greater than the fourth preset threshold, the answer area of the answer question is determined as the target answer area corresponding to the third handwritten text line, and the fourth preset threshold is less than the third preset threshold.
[0013] According to a test question grading method provided by the present invention, the determining of a third handwritten text line that does not belong to a question frame area of a non-answer question based on a second handwritten text line that does not match a target answer area in all the first handwritten text lines comprises: For each second handwritten text line that is not matched to the target answer area in all the first handwritten text lines, determining a fourth degree of overlap between the second handwritten text line and the question frame area of the non-answer question; When the fourth overlap degree is greater than a fifth preset threshold, determining that the second handwritten text line belongs to the title frame area; Determine a fourth distance between other second handwritten text lines and the second handwritten text lines belonging to the title frame area, wherein the other second handwritten text lines include all the second handwritten text lines that do not belong to the title frame area; In the case where the fourth distance is less than a third target value, the other second handwritten text lines are attributed to the title frame area; the third target value is determined based on the line spacing of all handwritten text lines in the text image; The handwritten text lines among all the second handwritten text lines except the target handwritten text line belonging to the title frame area are determined as the third handwritten text lines.
[0014] According to a test question marking method provided by the present invention, the method further comprises: For each target handwritten text line belonging to the question frame area, determining a fifth degree of overlap between the target handwritten text line and the answer area of all answer questions; When the number of the fifth overlap degrees greater than the sixth preset threshold is greater than the preset number, the target handwritten text line is updated to a third handwritten text line that does not belong to the title frame area.
[0015] According to a test question marking method provided by the present invention, marking the handwritten text line based on the standard answer corresponding to each target answer area includes: When the number of the target answer areas is at least two, the standard answers corresponding to all the target answer areas are concatenated to obtain a concatenated answer; The handwritten text line is corrected based on the concatenated answer.
[0016] The present invention also provides a test question correction device, comprising: An acquisition module, used for acquiring text images of test questions to be marked; A determination module, for traversing each answer area in the text image for each handwritten text line in all the test questions to be corrected, and determining a first overlap between the handwritten text line and the first answer area currently traversed; The determination module is further configured to determine at least one target answering area corresponding to the handwritten text line based on each of the first overlap degrees; The correction module is used to correct the handwritten text lines based on the standard answers corresponding to each target answer area.
[0017] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any one of the above-mentioned test question grading methods is implemented.
[0018] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the test question grading method as described above is implemented.
[0019] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned test question marking methods.
[0020] The test question grading method, device, equipment and storage medium provided by the present invention obtain the text image of the test questions to be graded, and for each handwritten text line in all the test questions to be graded, traverse each answer area in the text image, determine the first overlap between the handwritten text line and the first answer area currently traversed, determine at least one target answer area corresponding to the handwritten text line based on each first overlap, and grading the handwritten text line based on the standard answer corresponding to each target answer area. Since the matching degree between the handwritten text line and each answer area can be quantified by the first overlap, at least one target answer area that best matches the handwritten text line can be accurately determined. This method can avoid the loss of handwritten text lines or confusion in the attribution of handwritten text lines caused by directly cutting the answer area, improve the accuracy of the determined target answer area, and when grading the handwritten text lines based on the standard answer corresponding to each target answer area, the grading accuracy can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0022] Figure 1 This is one of the diagrams for answering questions outside the answer area.
[0023] Figure 2 This is the second diagram of answering questions outside the answer area.
[0024] Figure 3 A schematic diagram of the flow chart of the test question grading method provided in an embodiment of the present invention.
[0025] Figure 4 This is the third diagram for answering questions outside the answer area.
[0026] Figure 5 This is the fourth diagram of answering questions outside the answer area.
[0027] Figure 6 This is the fifth diagram of answering questions outside the answer area.
[0028] Figure 7 This is the sixth diagram for answering questions outside the answer area.
[0029] Figure 8 This is the seventh diagram for answering questions outside the answer area.
[0030] Fig. 9 A schematic diagram of the structure of a test question grading device provided in an embodiment of the present invention.
[0031] Fig.10 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] In the process of automatic test grading, whether the mapping relationship between the answer area and the handwritten text line is established correctly directly affects the accuracy of test grading. In the prior art, the answer area is cut according to the size of the answer area marked in advance on the test paper, and the text in the cut answer area is used as the handwritten text line corresponding to the answer area. However, when students are doing the test, they often write the answers outside the answer area. Figure 1 This is one of the schematic diagrams for answering questions outside the answer area, such as Figure 1 As shown, for question 1, part of the answer exceeds the answer area 11. If the answer area 11 is directly cropped and the content of the cropped answer area 11 is used as the answer to question 1, the content exceeding the answer area 11 will be lost, which may cause errors in the grading result of question 1. Figure 2 This is the second diagram of answering questions outside the answer area. Figure 2 As shown, for question 3, part of the answer exceeds the answer area 21. If the answer area 21 is directly cut and the cut content of the answer area 21 is used as the answer to question 3, the content exceeding the answer area 21 will be lost. For question 4, the corresponding answer area 22 contains part of the content that does not belong to the answer area. If the answer area 22 is directly cut and the cut content of the answer area 22 is used as the answer to question 4, it will contain content that is not related to the question. When correcting the test questions, it may cause errors in the correction results of both questions 3 and 4.
[0034] In response to the above problems, an embodiment of the present invention provides a method for marking test questions. In the method, considering that when answering questions, the answers are usually written at a position relatively close to the answer area, therefore, for each handwritten text line in the test question to be marked, all answer areas in the text image are traversed to determine the overlap between the handwritten text line and each traversed answer area, so as to determine at least one target answer area corresponding to the handwritten text line based on the overlap, and the matching degree between the handwritten text line and each answer area is quantified by the overlap, so as to accurately determine at least one target answer area that best matches the handwritten text line. This method can avoid the loss of handwritten text lines or confusion in the attribution of handwritten text lines caused by directly cropping the answer area, thereby improving the accuracy of the determined target answer areas, and when marking the handwritten text lines based on the standard answers corresponding to the target answer areas, the accuracy of the marking can be improved.
[0035] Combine the following Figures 3 to 8 The test question grading method provided by an embodiment of the present invention is described. The execution subject of the method can be an electronic device such as a terminal device, a computer or a server, or a smart device specially designed for educational image and text recognition, or a test question grading device set in the electronic device or smart device, and the test question grading device can be implemented by software, hardware or a combination of the two. The method can be applied to student test paper or homework grading, online education platform, training and assessment scenarios or any other educational tutoring scenarios that require automatic test question grading.
[0036] Figure 3 A flow chart of a method for correcting test questions provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the method includes: Step 301: Obtain the text image of the test question to be corrected.
[0037] In this step, the homework or test paper is scanned by using an image acquisition device such as a camera or a scanning device such as a scanning pen to obtain a text image, wherein the test questions to be corrected contained in the text image may be multiple test questions.
[0038] In order to avoid the situation where test question marking errors are caused by the poor quality of the text image, after obtaining the text image, the text image can also be subjected to operations such as denoising, binarization or tilt correction, so as to improve the image quality of the text image.
[0039] Step 302: for each handwritten text line in all the test questions to be corrected, traverse each answer area in the text image to determine a first overlap between the handwritten text line and the first answer area currently traversed.
[0040] In this step, after the text image is acquired, a handwritten text detection algorithm is used to identify all the handwritten text lines in all the test questions to be corrected in the text image. The handwritten text contained in the handwritten text line is the answer written by the student.
[0041] When preparing the test paper, the answer area corresponding to each test question to be corrected can be marked in advance. Of course, the answer area corresponding to each test question to be corrected can also be marked manually in the test paper. The answer area can be understood as a specific area where answers should be given.
[0042] For each handwritten text line identified, each answer area in the text image is traversed to determine the first overlap between the handwritten text line and the first answer area currently traversed. In one possible implementation, the first overlap can be determined by the ratio between the area of the intersection between the handwritten text line and the first answer area currently traversed, and the area of the handwritten text line. In another possible implementation, the first overlap can also be determined by the ratio between the area of the intersection between the handwritten text line and the first answer area currently traversed, and the area of the first answer area.
[0043] Step 303: Determine at least one target answering area corresponding to the handwritten text line based on each first overlap degree.
[0044] In this step, after determining the first overlap between the handwritten text line and each answer area, the answer area corresponding to the maximum first overlap can be used as the target answer area corresponding to the handwritten text line. In addition, considering that in actual homework scenarios, there may be a situation where the answers in multiple answer areas are stuck together, therefore, all answer areas with a first overlap greater than a preset threshold can also be used as the target answer area corresponding to the handwritten text line. Step 304: Correct the handwritten text lines based on the standard answers corresponding to each target answer area.
[0045] In this step, after determining the target answer area, the standard answer corresponding to each target answer area can be obtained through the pre-established correspondence between each answer area and the standard answer, so as to compare the standard answer with the handwritten text line. If they are consistent, the handwritten text line is considered correct; if they are inconsistent, the handwritten text line is considered incorrect.
[0046] It should be understood that when the number of target answer areas is at least two, it means that the handwritten text line is a multi-line glued text, that is, the text combination of at least two target answer areas forms a handwritten text line. Therefore, when correcting, the standard answers of at least two target answer areas can be spliced, and the handwritten text line can be corrected based on the spliced answers. For example, the handwritten text line and the spliced answers are compared. If they are consistent, it is considered that the answers of at least two target answer areas are correct. If they are inconsistent, it is considered that the answers of at least two target answer areas are wrong, so as to correct the handwritten text line. In the above manner, the glued handwritten text lines can be corrected, which improves the adaptability of test question correction and improves the accuracy of correction.
[0047] The test question grading method provided by the embodiment of the present invention obtains the text image of the test questions to be graded, traverses each answer area in the text image for each handwritten text line in all the test questions to be graded, determines the first overlap between the handwritten text line and the first answer area currently traversed, determines at least one target answer area corresponding to the handwritten text line based on each first overlap, and corrects the handwritten text line based on the standard answer corresponding to each target answer area. Since the matching degree between the handwritten text line and each answer area can be quantified by the first overlap, at least one target answer area that best matches the handwritten text line can be accurately determined. This method can avoid the loss of handwritten text lines or confusion in the attribution of handwritten text lines caused by directly cutting the answer area, improves the accuracy of the determined target answer area, and can improve the accuracy of the correction when correcting the handwritten text line based on the standard answer corresponding to each target answer area.
[0048] Exemplarily, on the basis of the above embodiments, when determining at least one target answer area corresponding to a handwritten text line based on each first overlap degree, it may be that when the maximum first overlap degree among all the first overlap degrees is greater than a first preset threshold and the difference between the maximum first overlap degree and the second largest first overlap degree is greater than a first target value, the answer area corresponding to the maximum first overlap degree is determined as the target answer area of the handwritten text line, wherein the first target value is related to the maximum first overlap degree.
[0049] Specifically, for non-answer questions such as multiple-choice questions or fill-in-the-blank questions, in order to adapt to various situations, a greedy search method can be used to optimally match the handwritten text line and the answer area. The first overlap iou_1 can be calculated as follows: iou_1 = the area of the intersection of the i-th handwritten text line and the j-th answer area / the area of the i-th handwritten text line. According to the above method, after traversing each handwritten text line and each answer area, the first overlap as shown in Table 1 can be obtained: Table 1
[0050] As shown in Table 1, the first overlap between the 0th handwritten text line and the 0th answer area is 0.1, the first overlap between the 0th handwritten text line and the 1st answer area is also 0.1, and so on.
[0051] Figure 4 This is the third diagram of answering questions outside the answer area. Figure 4 As shown, answer C is very close to the answer area of question 2 and the answer area of question 3. If the corresponding target answer area is determined only based on the maximum overlap between the handwritten text line and the answer area, the accuracy of the determined target answer area will not be high. In response to this problem, in this embodiment, after all the first overlaps are determined, the maximum first overlap iout_1 (i_max, j_max) among the first overlaps can be determined, and it is judged whether the maximum first overlap iout_1 (i_max, j_max) is greater than the first preset threshold. If the maximum first overlap is greater than the first preset threshold, in order to further improve the accuracy, it is also necessary to determine whether the difference between the maximum first overlap iout_1 (i_max, j_max) and the second largest first overlap iou_1 (i_max, j_second) is greater than the first target value. When the difference is greater than the first target value, the answer area corresponding to the maximum first overlap is determined as the target answer area of the handwritten text line.
[0052] The first preset threshold value may be set according to actual conditions or experience, for example, it may be set to 0.8. The first target value is related to the maximum first overlap, for example, it may be set to half of the maximum first overlap.
[0053] Continue to refer to Figure 4 As shown, after considering the maximum first overlap and the second largest first overlap at the same time, since answer C is very close to the answer area of question 2 and the answer area of question 3, the difference between the maximum first overlap between answer C and the answer area of question 2 and the second largest first overlap between answer C and the answer area of question 3 cannot be greater than the first target value. Therefore, the situation of attributing answer C to the answer area of question 2 or the answer area of question 3 will be excluded.
[0054] It should be noted that the above iout_1 can be applied to the case where the handwritten text line does not exceed the answer area. For the case where the handwritten text line has more content and exceeds the answer area, the first overlap iou_2 can be calculated in the following way: iou_2 = the area of the intersection of the i-th handwritten text line and the j-th answer area / the area of the j-th answer area. For this case, it is only necessary to determine whether the maximum first overlap iou_2 is greater than the first preset threshold. When the maximum first overlap iou_2 is greater than the first preset threshold, the answer area corresponding to the maximum first overlap iou_2 is determined as the target answer area of the handwritten text line.
[0055] In this way, the target answer area uniquely corresponding to the handwritten text line can be found. In addition, in order to reduce the amount of calculation and avoid subsequent repeated searches, the first overlaps in the rows and columns where the handwritten text line and the target answer area are located in Table 1 can all be set to 0.
[0056] If the maximum first overlap is not greater than the first preset threshold, or the difference between the maximum first overlap and the second largest first overlap is not greater than the first target value, the first overlaps in the rows and columns where the handwritten text row and the target answer area are located in Table 1 can all be set to 0, and the maximum first overlap can be re-determined from the first overlaps between the remaining other handwritten text rows and answer areas to determine whether there is a target answer area uniquely corresponding to other handwritten text rows, until the iteration is completed without any results that meet the above conditions.
[0057] Furthermore, the first preset threshold value may be adjusted, such as reducing the first preset threshold value by 0.2, searching for a new maximum first overlap, and repeating the above steps of determining the target answer area until there is no result that meets the above conditions again. At this time, the first preset threshold value may be lowered again, such as reducing it by 0.2, searching for a new maximum first overlap, and repeating the above steps of determining the target answer area until there is no result that meets the above conditions.
[0058] In this way, the target answer area uniquely corresponding to each handwritten text line can be found. For such handwritten text lines, a normal label can be set, and when correcting the test questions, the handwritten text line is compared with the standard answer corresponding to the target answer area.
[0059] In this embodiment, not only the maximum first overlap is considered, but also the difference between the maximum first overlap and the second largest first overlap is considered. This method can avoid the situation where a handwritten text line is close to both answer areas and the handwritten text line is attributed to one of the answer areas. Through the above scheme, the target answer area that completely matches each handwritten text line can be determined, thereby improving the accuracy of the target answer area.
[0060] Exemplarily, on the basis of the above embodiments, for the first handwritten text line that is not matched to the target answer area among all handwritten text lines, the first overlap degrees corresponding to the first handwritten text line are traversed, and the answer areas corresponding to all first overlap degrees greater than a second preset threshold are determined as the target answer areas for the first handwritten text line, and the second preset threshold is less than the first preset threshold.
[0061] Specifically, after multiple loop traversals are performed in the manner in the aforementioned embodiment, a handwritten text line that completely matches a target answer area can be screened out. For the first handwritten text line that does not match the target answer area, that is, multiple first handwritten text lines that do not belong to any answer area, the first overlaps corresponding to each first handwritten text line will be traversed. If iou_1(i, j) is greater than the second preset threshold, it is confirmed that the i-th first handwritten text line belongs to the j-th answer area. In this way, for the i-th first handwritten text line, it may be attributed to multiple answer areas, and these multiple answer areas can all be used as the target answer area corresponding to the i-th first handwritten text line. Among them, the second preset threshold is less than the first preset threshold, and the specific value can also be set according to actual conditions or experience, for example, it can be set to 0.3.
[0062] For example, Figure 5 This is the fourth diagram of answering questions outside the answer area. Figure 5 As shown, for the first handwritten text line 53, it will be attributed to both the answer area 51 and the answer area 52. Therefore, both the answer area 51 and the answer area 52 will be determined as the target answer area of the first handwritten text line 53. In addition, the first handwritten text line 53 will be marked with a glue label. When correcting the test questions, the standard answers of the answer area 51 and the answer area 52 are combined, and the first handwritten text line 53 and the combined standard answers are compared. If the two are consistent, it is considered that the answers of the answer area 51 and the answer area 52 are both correct, otherwise, it is considered that the answers of the two answer areas are both wrong.
[0063] In this embodiment, for the first handwritten text line that is not matched to the target answer area, a smaller second preset threshold is set, and the answer areas corresponding to all first overlaps greater than the second preset threshold are determined as the target answer areas for the first handwritten text line. Based on the above method, when text adhesion occurs, the target answer area corresponding to the adhered text can also be correctly determined.
[0064] Exemplarily, on the basis of the above embodiment, for the second handwritten text line that is not matched to the target answer area in all first handwritten text lines, when the currently traversed second answer area does not include handwritten text, the first distance between the second handwritten text line and the currently traversed second answer area is determined. When the first distance is less than the second target value, the currently traversed second answer area is determined as the target answer area for the second handwritten text line. The second target value is determined based on the line height of all handwritten text lines in the text image.
[0065] Specifically, for all second handwritten text lines in the first handwritten text lines that are not matched to the target answer area, it is possible to further determine whether these second handwritten text lines are candidate answer lines. For each second handwritten text line, all answer areas will be traversed, and when the second answer area currently traversed does not contain handwritten text, that is, when the second answer area is blank, the first distance between the second handwritten text line and the second answer area currently traversed will be determined. Among them, the distance between the center point of the second handwritten text line and the center point of the second answer area currently traversed can be determined, or a reference point can be set to determine the distance between the reference point in the second handwritten text line and the reference point in the second answer area currently traversed.
[0066] When the first distance is less than the second target value, it means that the second handwritten text line is close to the second answer area currently traversed. At this time, the second answer area currently traversed can be determined as the target answer area of the second handwritten text line. It can also be understood that the second handwritten text line is used as a candidate text line of the second answer area currently traversed, and a candidate text label is set for the second handwritten text line. The second target value is determined based on the line height of all handwritten text lines in the text image. For example, the average line height of all handwritten text lines in the text image can be used as the second target value, or the maximum line height of all handwritten text lines can be used as the second target value.
[0067] When correcting test questions, the standard answer in the target answer area can be obtained, and the second handwritten text line can be compared with the standard answer in the target answer area.
[0068] For example, Figure 6 This is the fifth diagram of answering questions outside the answer area. Figure 6 As shown, for the second handwritten text line 62, after traversing each answer area, it is determined that the distance between the second answer area 61 and the second handwritten text line 62 is less than the second target value, indicating that the second handwritten text line 62 is a candidate text line for the second answer area 61, and the second answer area 61 is determined as the target answer area for the second handwritten text line 62.
[0069] In this embodiment, when the currently traversed second answer area does not include handwritten text, the first distance between the second handwritten text line and the traversed second answer area is determined to determine whether the second handwritten text line is a candidate text line for the second answer area. This avoids the situation where the answer is written outside the answer area and causes the answer to be incorrectly attributed, thereby improving the accuracy of the established mapping relationship between the handwritten text line and the answer area.
[0070] Exemplarily, when the second answer area currently traversed includes handwritten text and the handwritten text is smeared text, the second distance between the second handwritten text row and the text row corresponding to the smeared text is determined. When the second distance is less than the second target value, the second answer area currently traversed is determined as the target answer area for the second handwritten text row.
[0071] Specifically, the determination of candidate answer rows is mainly to solve the scenario where the answer is rewritten after being erased. Usually, according to writing habits, the text that is rewritten after being erased is generally written near the original content. Based on this, when the second answer area currently traversed contains handwritten text and the handwritten text is erased text, it means that the student may have re-answered near the erased content after erasing. Therefore, the erased text will be used to replace the second answer area currently traversed, and the second distance between the second handwritten text row and the text row corresponding to the erased text will be determined. Among them, the distance between the center point of the second handwritten text row and the center point of the text row corresponding to the erased text can be determined, or a reference point can be set to determine the distance between the reference point in the second handwritten text row and the reference point in the text row corresponding to the erased text.
[0072] When the second distance is less than the second target value, it means that the distance between the second handwritten text line and the smeared text is relatively close. At this time, the currently traversed second answer area can be determined as the target answer area of the second handwritten text line. It can also be understood that the second handwritten text line is used as a candidate text line for the currently traversed second answer area, and a candidate text label is set for the second handwritten text line.
[0073] When correcting test questions, the standard answer in the target answer area can be obtained, and the second handwritten text line can be compared with the standard answer in the target answer area.
[0074] For example, Figure 7 This is the sixth diagram of answering questions outside the answer area. Figure 7 As shown, for the second handwritten text line 72, after traversing each answer area, it is determined that there is smudged text 73 in the second answer area 71, and the second distance between the second handwritten text line 72 and the smudged text 73 is less than the second target value, indicating that the second handwritten text line 72 is a candidate text line for the second answer area 71, and the second answer area 71 is determined as the target answer area for the second handwritten text line 72.
[0075] It should be noted that, for the handwritten text lines marked as candidate text lines, these handwritten text lines will not be marked as belonging to a certain answer area, and these text lines will continue to be processed later.
[0076] In this embodiment, when the second answer area currently traversed includes handwritten text and the handwritten text is smudged text, the second distance between the second handwritten text line and the smudged text is determined to determine whether the second handwritten text line is a candidate text line for the second answer area. This avoids the situation where the answer is incorrectly attributed after smudged and re-answered outside the answer area, and improves the accuracy of the established mapping relationship between the handwritten text line and the answer area.
[0077] Exemplarily, on the basis of the above embodiments, for the second handwritten text line in all first handwritten text lines that is not matched to the target answer area, traverse each question frame area in the text image to determine the third distance between the second handwritten text line and the currently traversed question frame area. When the third distance is less than the preset distance, and the answer area within the question frame area does not include handwritten text or the handwritten text included in the answer area within the question frame area is smudged text, determine that the answer area within the question frame area is the target answer area corresponding to the second handwritten text line.
[0078] Specifically, in actual answering scenarios, students often give non-standard answers, such as filling in answers near the question number. In this case, for the second handwritten text line that is not matched to the target answer area, the distance between the second handwritten text line and each question frame area can be determined. When the third distance between the second handwritten text line and the currently traversed question frame area is less than the preset distance, it means that the distance between the second handwritten text line and the currently traversed question frame area is very close. At this time, if the answer area in the question frame area does not include handwritten text, or the handwritten text included in the answer area in the question frame area is smeared text, it means that the student may have filled in the answer to the test question corresponding to the question frame area near the test question, such as the area around the question number, etc. At this time, the answer area in the question frame area can be determined as the target answer area corresponding to the second handwritten text line, that is, the second handwritten text line is used as the answer to the test question in the question frame area for correction.
[0079] In this embodiment, the target answer area corresponding to the second written text line can be determined based on the third distance between the second written text line and each question box area. This method can still determine the answer area corresponding to the second written text line even in a scenario where students' writing is not standard, thereby avoiding the situation where the answer text corresponding to the answer area is missed.
[0080] For example, the above methods are all for non-answer questions such as multiple-choice questions or fill-in-the-blank questions. For answer questions, they usually contain a larger answer area and generally require writing multiple lines of answer results. Based on this feature, the following methods can be used to determine whether the handwritten text line belongs to the target answer area corresponding to the answer question: Based on the second handwritten text lines that are not matched to the target answer area in all the first handwritten text lines, determine the third handwritten text lines that do not belong to the question frame area of the non-answer question, and for each third handwritten text line, determine the second overlap between the third handwritten text line and the answer area of the answer question adjacent to the non-answer question; when the second overlap is greater than a third preset threshold, determine the answer area of the answer question as the target answer area corresponding to the third handwritten text line; when the second overlap is less than or equal to the third preset threshold, expand the answer area of the answer question based on the question frame area and answer area of other questions adjacent to the answer question to obtain the expanded answer area, determine the third overlap between the third handwritten text line and the expanded answer area, and when the third overlap is greater than a fourth preset threshold, determine the answer area of the answer question as the target answer area corresponding to the third handwritten text line, and the fourth preset threshold is less than the third preset threshold.
[0081] Specifically, after all the answer areas are organized, they are guaranteed to be in order from top to bottom and from left to right, because the writing order is from top to bottom and from left to right. Even if there are multiple lines of handwritten text in the answer questions, it is usually the case that the writing on the left side of the question exceeds the answer area and is written to the right, while it is rare that the writing on the right side exceeds the writing on the left.
[0082] In actual answering scenarios, students may make drafts on their homework or test papers. To prevent interference from the drafts, for all second handwritten text lines in the first handwritten text line that are not matched to the target answer area, it is also necessary to determine whether the second handwritten text line belongs to the question frame area of the non-answer question, that is, whether it is a draft of a non-answer question adjacent to the answer question. If the second handwritten text line belongs to the question frame area of the non-answer question, it means that the second handwritten text line may be a draft of the non-answer question.
[0083] For the third handwritten text line that does not belong to the question frame area of the non-answer question, it is necessary to further determine whether the third handwritten text line belongs to the handwritten text of the answer question adjacent to the non-answer question. For each third handwritten text line, the second overlap between the third handwritten text line and the answer area of the answer question can be determined, wherein the second overlap can be determined in the following manner: the ratio of the intersection area of the third handwritten text line and the answer area of the answer question to the area of the third handwritten text line.
[0084] The answer area of the above-mentioned answer question is the original answer area. When the second overlap is greater than the third preset threshold, it means that the third handwritten text line belongs to the original answer area of the answer question, that is, the answer area of the answer question is determined as the target answer area corresponding to the third handwritten text line, and the third handwritten text line is marked as belonging. The third preset threshold can be set according to actual conditions or experience, for example, it can be set to 0.8.
[0085] In addition, there are usually cases where students answer outside the answer area. Therefore, the answer area of the answer question can also be expanded to the right and bottom until it is blocked by the question frame area and the answer area of other test questions, thereby obtaining the expanded answer area. By determining the third overlap between the third handwritten text line and the expanded answer area, when the third overlap is greater than the fourth preset threshold, it means that the third handwritten text line belongs to the answer question, that is, the answer area of the answer question is determined as the target answer area corresponding to the third handwritten text line. Among them, the fourth preset threshold is less than the third preset threshold, and the fourth preset threshold can be, for example, 0.5.
[0086] For example, Figure 8 This is the seventh diagram of answering questions outside the answer area. Figure 8 As shown, for the third handwritten text lines inside the answer area 81, the second overlap between them and the original answer area 81 is greater than the third preset threshold, so it can be determined that these third handwritten text lines belong to the answer area 81. For the third handwritten text lines outside the original answer area 81 whose second overlap with the original answer area 81 is less than or equal to the third preset threshold, the original answer area 81 can be expanded to the expanded answer area 82, and the third overlap between these third handwritten text lines and the expanded answer area 82 can be re-determined. When the third overlap is greater than the fourth preset threshold, it means that these third handwritten text lines outside the original answer area 81 also belong to the answer area 81.
[0087] It should be noted that all the handwritten text lines in the answer area that belong to the answer question need to be merged, and the attributed handwritten text lines must be expanded outward, and the distance between other handwritten text lines and the attributed handwritten text lines must be calculated. When the distance in the x-direction is less than 0.2 times the line spacing of the handwritten text lines, and the distance in the y-direction is less than 0.5 times the line spacing of the handwritten text lines, it means that the other handwritten text lines and the attributed handwritten text lines are continuous text lines, and the other handwritten text lines are also attributed to the answer question. By repeating the above process, all the handwritten text lines that belong to the answer question can be determined.
[0088] In this embodiment, the answer area of the answer question is expanded to obtain the expanded answer area, and then the third degree of overlap between the third handwritten text line and the expanded answer area is determined. When the third degree of overlap is greater than a fourth preset threshold, it is determined that these third handwritten text lines also belong to the answer area of the answer question, thereby preventing the omission of content written outside the answer area of the answer question, improving the accuracy of handwritten text line attribution, and making the established mapping relationship between handwritten text lines and the answer area more accurate.
[0089] Exemplarily, based on the above embodiment, when determining the third handwritten text line that does not belong to the question frame area of the non-answer question based on the second handwritten text line that does not match the target answer area in all the first handwritten text lines, it can be performed in the following manner: For each second handwritten text line that is not matched to a target answer area among all first handwritten text lines, a fourth degree of overlap between the second handwritten text line and a question frame area of a non-answer question is determined; when the fourth degree of overlap is greater than a fifth preset threshold, it is determined that the second handwritten text line belongs to the question frame area; a fourth distance between other second handwritten text lines and the second handwritten text lines belonging to the question frame area is determined, where the other second handwritten text lines include the handwritten text lines that are not matched to the question frame area among all second handwritten text lines; and when the fourth distance is less than a third target value, the other second handwritten text lines are attributed to the question frame area; and all second handwritten text lines except the target handwritten text line belonging to the question frame area are determined as third handwritten text lines; the third target value is determined based on the line spacing of all handwritten text lines in the text image.
[0090] Specifically, in order to prevent the interference of the draft, for each second handwritten text line in all first handwritten text lines that are not matched to the target answer area, it is necessary to determine the fourth overlap between the second handwritten text line and the question frame area of the non-answer question, wherein the question frame area includes the entire question stem, which is pre-marked when making the test paper or pre-set by the user. The fourth overlap is the ratio between the intersection area of the second handwritten text line and the question frame area of the non-answer question and the area of the second handwritten text line.
[0091] When the fourth overlap is greater than the fifth preset threshold, it means that the second handwritten text line is very close to the content of the non-answer question. Therefore, it can be determined that the second handwritten text line is likely to be a draft of the non-answer question, and the second handwritten text line is determined to belong to the question frame area of the non-answer question, and the second handwritten text line is marked as attributed to prevent it from being attributed to the answer area of the answer question adjacent to the non-answer question. Among them, the fifth preset threshold can be set according to actual conditions or experience, for example, it can be set to 0.7.
[0092] Furthermore, students may write multiple steps to solve the problem in succession, so it is necessary to determine other contents of the continuous writing. After determining the second handwritten text line belonging to the question frame area, the second handwritten text line is taken as line_1, and line_1 is expanded outwardly as a basis to determine other handwritten text lines that do not belong to the question frame area among all the second handwritten text lines, and the fourth distance between the other second handwritten text lines and the second handwritten text line line_1 belonging to the question frame area is calculated. When the fourth distance is less than the third target value, it means that the other second handwritten text line line_2 is the continuous writing content of the second handwritten text line line_1, then the other second handwritten text line line_2 is added to the second handwritten text line line_1, that is, the other second handwritten text line line_2 is also attributed to the question frame area. By repeating the above steps until the determined fourth distance is greater than or equal to the third target value, at this time, all target handwritten text lines belonging to the question frame area will be determined. Among them, the third target value is determined based on the line spacing of all handwritten text lines in the text image. For example, the fourth distance in the x direction and the fourth distance in the y direction between the other second handwritten text lines and the second handwritten text lines belonging to the title frame area can be determined. When the fourth distance in the x direction is less than 0.2 times the average line spacing of all handwritten text lines, and the fourth distance in the y direction is less than 0.5 times the average line spacing of all handwritten text lines, the other second handwritten text lines are attributed to the title frame area.
[0093] After all target handwritten text lines belonging to the question frame area are determined, after removing the target handwritten text lines from all second handwritten text lines, the remaining handwritten text lines are third handwritten text lines that do not belong to the question frame area of non-answer questions.
[0094] In this embodiment, by determining the fourth degree of overlap between the second handwritten text line and the question frame area of the non-answer question, invalid draft content can be excluded based on the fourth degree of overlap, thereby avoiding the situation where the invalid draft is assigned to the answer area of the answer question adjacent to the non-answer question, thereby improving the accuracy of the mapping relationship between the determined handwritten text line and the answer area.
[0095] Furthermore, based on the above embodiment, in order to prevent the valid content of the answer question from being mistaken as invalid content, each target handwritten text line belonging to the question frame area can also be checked again. Exemplarily, for each target handwritten text line belonging to the question frame area, the fifth overlap between the target handwritten text line and the answer area of all answer questions is determined, and when the number of fifth overlaps greater than the sixth preset threshold is greater than the preset number, the target handwritten text line is updated to the third handwritten text line that does not belong to the question frame area.
[0096] Specifically, for each target handwritten text line belonging to the question frame area, it is also possible to traverse the answer areas of all the answer questions and determine the fifth degree of overlap between the target handwritten text line and the answer area of the currently traversed answer question, wherein the fifth degree of overlap is the ratio of the intersection area of the target handwritten text line and the answer area of the currently traversed answer question to the area of the target handwritten text line.
[0097] If the fifth overlap is greater than the sixth preset threshold, the count is increased by 1. After traversing the answer areas of all the answer questions, if the final count value is greater than the preset number, that is, the number of fifth overlaps greater than the sixth preset threshold is greater than the preset number, it is considered that a misjudgment has occurred, and the target handwritten text line is updated to the third handwritten text line that does not belong to the question frame area. Among them, the sixth preset threshold and the preset number can be set according to actual conditions or experience. For example, the sixth preset threshold can be set to 0.6, and the preset number can be set to 3.
[0098] In this embodiment, for each target handwritten text line belonging to the question frame area, the fifth degree of overlap between the target handwritten text line and the answer area of all the answer questions can be further determined. When the number of fifth degrees of overlap greater than the sixth preset threshold is greater than the preset number, the target handwritten text line is updated to the third handwritten text line that does not belong to the question frame area. In this way, the handwritten text line that is mistakenly judged as an invalid draft can be updated to an unattributed handwritten text line, thereby avoiding the omission of content that was originally the answer to the answer question and improving the accuracy of handwritten text line attribution.
[0099] The following is a description of the test question grading device provided by the present invention. The test question grading device described below and the test question grading method described above can be referenced to each other.
[0100] Fig. 9 The schematic diagram of the structure of the test question correction device provided by the embodiment of the present invention is shown in FIG. Fig. 9 As shown, the test question correction device 900 includes: The acquisition module 901 is used to acquire the text image of the test questions to be corrected; A determination module 902 is used for traversing each answer area in the text image for each handwritten text line in all the test questions to be corrected, and determining a first overlap between the handwritten text line and the first answer area currently traversed; The determination module 902 is further configured to determine at least one target answering area corresponding to the handwritten text line based on each of the first overlap degrees; The correction module 903 is used to correct the handwritten text line based on the standard answer corresponding to each target answer area.
[0101] In an exemplary embodiment, the determining module 902 is specifically configured to: When the maximum first overlap degree among all the first overlap degrees is greater than a first preset threshold and the difference between the maximum first overlap degree and the second largest first overlap degree is greater than a first target value, the answer area corresponding to the maximum first overlap degree is determined as the target answer area of the handwritten text line, and the first target value is related to the maximum first overlap degree.
[0102] In an exemplary embodiment, the determining module 902 is further configured to: For the first handwritten text line that is not matched to the target answer area among all handwritten text lines, traverse the first overlap degrees corresponding to the first handwritten text line, and determine the answer areas corresponding to all first overlap degrees greater than a second preset threshold as the target answer area for the first handwritten text line, and the second preset threshold is less than the first preset threshold.
[0103] In an exemplary embodiment, the determining module 902 is further configured to: For all second handwritten text lines in the first handwritten text lines that are not matched to the target answer area, if the second answer area currently traversed does not include handwritten text, determine a first distance between the second handwritten text line and the second answer area currently traversed; When the first distance is less than a second target value, the currently traversed second answer area is determined as the target answer area for the second handwritten text line, and the second target value is determined based on the line heights of all handwritten text lines in the text image.
[0104] In an exemplary embodiment, the determining module 902 is further configured to: In a case where the second answer area currently traversed includes handwritten text and the handwritten text is smeared text, determining a second distance between the second handwritten text line and a text line corresponding to the smeared text; When the second distance is smaller than the second target value, the currently traversed second answer area is determined as the target answer area of the second handwritten text line.
[0105] In an exemplary embodiment, the determining module 902 is further configured to: For all second handwritten text lines in the first handwritten text lines that are not matched to the target answer area, traverse each question frame area in the text image to determine a third distance between the second handwritten text line and the currently traversed question frame area; When the third distance is less than the preset distance and the answer area within the question frame area does not include handwritten text or the handwritten text included in the answer area within the question frame area is smudged text, the answer area within the question frame area is determined to be the target answer area corresponding to the second handwritten text row.
[0106] In an exemplary embodiment, the determining module 902 is further configured to: Determining a third handwritten text line that does not belong to the question frame area of the non-answer question based on the second handwritten text line that is not matched to the target answer area in all the first handwritten text lines; For each of the third handwritten text lines, determining a second overlap between the third handwritten text line and an answer area of an answer question adjacent to the non-answer question; When the second overlap degree is greater than a third preset threshold, determining the answer area of the answer question as the target answer area corresponding to the third handwritten text line; When the second overlap degree is less than or equal to the third preset threshold, the answer area of the answer question is expanded based on the question frame area and answer area of other test questions adjacent to the answer question to obtain the expanded answer area, and the third overlap degree between the third handwritten text line and the expanded answer area is determined. When the third overlap degree is greater than the fourth preset threshold, the answer area of the answer question is determined as the target answer area corresponding to the third handwritten text line, and the fourth preset threshold is less than the third preset threshold.
[0107] In an exemplary embodiment, the determining module 902 is specifically configured to: For each second handwritten text line that is not matched to the target answer area in all the first handwritten text lines, determining a fourth degree of overlap between the second handwritten text line and the question frame area of the non-answer question; When the fourth overlap degree is greater than a fifth preset threshold, determining that the second handwritten text line belongs to the title frame area; Determine a fourth distance between other second handwritten text lines and the second handwritten text lines belonging to the title frame area, wherein the other second handwritten text lines include all the second handwritten text lines that do not belong to the title frame area; In the case where the fourth distance is less than a third target value, the other second handwritten text lines are attributed to the title frame area; the third target value is determined based on the line spacing of all handwritten text lines in the text image; The handwritten text lines among all the second handwritten text lines except the target handwritten text line belonging to the title frame area are determined as the third handwritten text lines.
[0108] In an exemplary embodiment, the apparatus further comprises an updating module, wherein: The determination module 902 is further configured to determine, for each target handwritten text line belonging to the question frame area, a fifth degree of overlap between the target handwritten text line and the answer area of all answer questions; An updating module is used to update the target handwritten text line to a third handwritten text line that does not belong to the title frame area when the number of fifth overlaps that are greater than a sixth preset threshold is greater than a preset number.
[0109] In an exemplary embodiment, the correction module 903 is specifically used to: When the number of the target answer areas is at least two, the standard answers corresponding to all the target answer areas are concatenated to obtain a concatenated answer; The handwritten text line is corrected based on the concatenated answer.
[0110] The device of this embodiment can be used to execute the method of any one of the embodiments in the test question correction method side embodiments. Its specific implementation process and technical effects are similar to those in the test question correction method side embodiments. For details, please refer to the detailed introduction in the test question correction method side embodiments, which will not be repeated here.
[0111] Fig.10 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention, such as Fig.10 As shown, the electronic device may include: a processor 1010, a communication interface 1020, a memory 1030 and a communication bus 1040, wherein the processor 1010, the communication interface 1020 and the memory 1030 communicate with each other through the communication bus 1040. The processor 1010 may call the logic instructions in the memory 1030 to execute the test question correction method, which includes: obtaining a text image of the test question to be corrected; for each handwritten text line in all the test questions to be corrected, traversing each answer area in the text image, determining a first overlap between the handwritten text line and the first answer area currently traversed; determining at least one target answer area corresponding to the handwritten text line based on each of the first overlaps; and correcting the handwritten text line based on the standard answer corresponding to each of the target answer areas.
[0112] In addition, the logic instructions in the above-mentioned memory 1030 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0113] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the test question grading method provided by the above-mentioned methods, which includes: obtaining a text image of the test questions to be graded; for each handwritten text line in all the test questions to be graded, traversing each answer area in the text image, and determining a first overlap between the handwritten text line and the first answer area currently traversed; determining at least one target answer area corresponding to the handwritten text line based on each first overlap; and correcting the handwritten text line based on the standard answer corresponding to each target answer area.
[0114] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the test question grading method provided by the above-mentioned methods, the method comprising: obtaining a text image of the test questions to be graded; for each handwritten text line in all the test questions to be graded, traversing each answer area in the text image, and determining a first degree of overlap between the handwritten text line and the first answer area currently traversed; determining at least one target answer area corresponding to the handwritten text line based on each of the first degrees of overlap; and correcting the handwritten text line based on the standard answer corresponding to each of the target answer areas.
[0115] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for correcting test questions, characterized in that: include: Get the text image of the test paper to be corrected; For each handwritten text line in all the test questions to be corrected, traverse each answer area in the text image to determine a first overlap between the handwritten text line and the first answer area currently traversed; Determine at least one target answering area corresponding to the handwritten text line based on each of the first overlap degrees; The handwritten text lines are corrected based on the standard answers corresponding to the target answer areas.
2. The test question marking method according to claim 1, characterized in that: The determining, based on each of the first overlap degrees, at least one target answering area corresponding to the handwritten text line comprises: When the maximum first overlap degree among all the first overlap degrees is greater than a first preset threshold and the difference between the maximum first overlap degree and the second largest first overlap degree is greater than a first target value, the answer area corresponding to the maximum first overlap degree is determined as the target answer area of the handwritten text line, and the first target value is related to the maximum first overlap degree.
3. The test question marking method according to claim 2, characterized in that: The method further comprises: For the first handwritten text line that is not matched to the target answer area among all handwritten text lines, traverse the first overlap degrees corresponding to the first handwritten text line, and determine the answer areas corresponding to all first overlap degrees greater than a second preset threshold as the target answer area for the first handwritten text line, and the second preset threshold is less than the first preset threshold.
4. The test question marking method according to claim 3, characterized in that: The method further comprises: For all second handwritten text lines in the first handwritten text lines that are not matched to the target answer area, if the second answer area currently traversed does not include handwritten text, determine a first distance between the second handwritten text line and the second answer area currently traversed; When the first distance is less than a second target value, the currently traversed second answer area is determined as the target answer area for the second handwritten text line, and the second target value is determined based on the line heights of all handwritten text lines in the text image.
5. The test question marking method according to claim 4, characterized in that: The method further comprises: In a case where the second answer area currently traversed includes handwritten text and the handwritten text is smeared text, determining a second distance between the second handwritten text line and a text line corresponding to the smeared text; When the second distance is smaller than the second target value, the currently traversed second answer area is determined as the target answer area of the second handwritten text line.
6. The test question marking method according to claim 3, characterized in that: The method further comprises: For all second handwritten text lines in the first handwritten text lines that are not matched to the target answer area, traverse each question frame area in the text image to determine a third distance between the second handwritten text line and the currently traversed question frame area; When the third distance is less than the preset distance and the answer area within the question frame area does not include handwritten text or the handwritten text included in the answer area within the question frame area is smudged text, the answer area within the question frame area is determined to be the target answer area corresponding to the second handwritten text row.
7. The test question marking method according to claim 3, characterized in that: The method further comprises: Determining a third handwritten text line that does not belong to the question frame area of the non-answer question based on the second handwritten text line that is not matched to the target answer area in all the first handwritten text lines; For each of the third handwritten text lines, determining a second overlap between the third handwritten text line and an answer area of an answer question adjacent to the non-answer question; When the second overlap degree is greater than a third preset threshold, determining the answer area of the answer question as the target answer area corresponding to the third handwritten text line; When the second overlap degree is less than or equal to the third preset threshold, the answer area of the answer question is expanded based on the question frame area and answer area of other test questions adjacent to the answer question to obtain the expanded answer area, and the third overlap degree between the third handwritten text line and the expanded answer area is determined. When the third overlap degree is greater than the fourth preset threshold, the answer area of the answer question is determined as the target answer area corresponding to the third handwritten text line, and the fourth preset threshold is less than the third preset threshold.
8. The test question marking method according to claim 7, characterized in that: The determining, based on the second handwritten text line that is not matched to the target answer area among all the first handwritten text lines, a third handwritten text line that does not belong to the question frame area of the non-answer question includes: For each second handwritten text line that is not matched to the target answer area in all the first handwritten text lines, determining a fourth degree of overlap between the second handwritten text line and the question frame area of the non-answer question; When the fourth overlap degree is greater than a fifth preset threshold, determining that the second handwritten text line belongs to the title frame area; Determine a fourth distance between other second handwritten text lines and the second handwritten text lines belonging to the title frame area, wherein the other second handwritten text lines include all the second handwritten text lines that do not belong to the title frame area; In the case where the fourth distance is less than a third target value, the other second handwritten text lines are attributed to the title frame area; the third target value is determined based on the line spacing of all handwritten text lines in the text image; The handwritten text lines among all the second handwritten text lines except the target handwritten text line belonging to the title frame area are determined as the third handwritten text lines.
9. The test question marking method according to claim 8, characterized in that: The method further comprises: For each target handwritten text line belonging to the question frame area, determining a fifth degree of overlap between the target handwritten text line and the answer area of all answer questions; When the number of the fifth overlap degrees greater than the sixth preset threshold is greater than the preset number, the target handwritten text line is updated to a third handwritten text line that does not belong to the title frame area.
10. The test question marking method according to claim 1, characterized in that: The correcting the handwritten text line based on the standard answer corresponding to each target answer area includes: When the number of the target answer areas is at least two, the standard answers corresponding to all the target answer areas are concatenated to obtain a concatenated answer; The handwritten text line is corrected based on the concatenated answer.
11. A test question grading device, characterized in that: include: An acquisition module, used for acquiring text images of test questions to be marked; A determination module, for traversing each answer area in the text image for each handwritten text line in all the test questions to be corrected, and determining a first overlap between the handwritten text line and the first answer area currently traversed; The determination module is further configured to determine at least one target answering area corresponding to the handwritten text line based on each of the first overlap degrees; The correction module is used to correct the handwritten text lines based on the standard answers corresponding to each target answer area.
12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the test question marking method according to any one of claims 1 to 10 is implemented.
13. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the test question marking method according to any one of claims 1 to 10 is implemented.