Test paper identification method, device and equipment, medium and product
By using the affine transformation algorithm to calculate the affine transformation matrix in test paper identification, the problem of low efficiency and accuracy of test paper identification caused by customized positioning information is solved, and efficient and accurate test paper identification without customized information is achieved.
Patent Information
- Application Number
- CN202410794355.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-20
AI Technical Summary
The existing technology requires customized positioning information in test paper identification, which results in additional time-consuming and reduced test paper utilization, and the identification deviation of customized positioning information will affect the accurate division of test question areas.
By obtaining the test paper image to be processed and the template test paper image, the first affine transformation algorithm and the second affine transformation algorithm are used to calculate the affine transformation matrix, respectively based on the positioning frame information and feature point matching relationship, to achieve test paper identification without customizing the positioning information. .
It improves the accuracy and efficiency of test paper identification, avoids the interference of customized positioning information, and ensures the accuracy and stability of automatic marking.
Smart Images

Figure CN118675175A
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition technology, and in particular to a test paper recognition method, device, equipment, medium and product. Background Art
[0002] Automatic marking is a process that uses computer technology and artificial intelligence algorithms to automate the scoring of test papers. Question segmentation is one of the key steps, which requires segmenting the scanned or digitized test paper image into separate question areas for easy identification and scoring.
[0003] At present, the division of test questions is usually based on the customized positioning information (such as calibrated points, lines, etc.) on the test paper, which is identified, and the coordinate transformation matrix is constructed according to the identification result of the customized positioning information, and the transformation matrix is used to achieve accurate division of the test question area. However, adding additional positioning information to the test paper will bring extra time consumption. And the customized positioning information will cause the effective area of the test paper to shrink, reducing the utilization rate of the test paper. Moreover, when the customized positioning information recognition is deviated, the cumulative error caused by the transformation matrix will be increased, affecting the accurate division of the test question area.
[0004] In summary, a method is urgently needed to accurately divide the test area without customized positioning information. Summary of the invention
[0005] This application provides test paper recognition methods, devices, equipment, media and products, aiming to effectively solve the above-mentioned technical problems.
[0006] In a first aspect of the present application, the present application provides a test paper recognition method, the method comprising:
[0007] Obtain the test paper image to be processed and the template test paper image;
[0008] Marking the test paper image to be processed and the template test paper image respectively, and obtaining a first marking result and a second marking result accordingly, wherein the first marking result includes first positioning frame information, and the second marking result includes second positioning frame information;
[0009] Determine a target affine transformation algorithm from a first affine transformation algorithm and a second affine transformation algorithm according to the first question marking result or the second question marking result, and use the target affine transformation algorithm to obtain an affine transformation matrix between the test paper image to be processed and the template test paper image, wherein the first affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the first positioning frame information and the second positioning frame information, and the second affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the feature points extracted from the test paper image to be processed and the template test paper image;
[0010] The first positioning frame information or the second positioning frame information is transformed using the affine transformation matrix, and text recognition is performed based on the transformed positioning frame information to obtain a test paper recognition result.
[0011] Preferably, the first positioning frame information includes first question block positioning frame information and first question number positioning frame information, and the second positioning frame information includes second question block positioning frame information and second question number positioning frame information;
[0012] The steps of the first affine transformation algorithm include:
[0013] According to a first degree of overlap between the first question block positioning frame information and the second question block positioning frame information, matching the first question block positioning frame with the second question block positioning frame to obtain a first positioning frame matching result;
[0014] Determine a second degree of overlap between the first question number positioning box information and the second question number positioning box information according to the first positioning box matching result, and match the first question number positioning box with the second question number positioning box based on the second degree of overlap to obtain a second positioning box matching result, wherein the second positioning box matching result includes the first question number positioning box information after matching and the second question number positioning box information after matching;
[0015] The position offset information and the region area information are determined according to the first question number positioning frame information after matching and the second question number positioning frame information after matching, and the first affine transformation matrix is calculated based on the position offset information and the region area information.
[0016] Preferably, the first question number positioning frame information after matching includes the first question number corner point position information, and the second question number positioning frame information after matching includes the second question number corner point position information, and the first question number corner point corresponds to the second question number corner point in position;
[0017] The step of determining the position offset information and the area information according to the matched first question number positioning frame information and the matched second question number positioning frame information comprises:
[0018] When the spacing between the first question horn corner points is greater than or equal to the preset spacing and the number of the first question horn corner points is greater than or equal to three, three third question horn corner points are determined from all the first question horn corner points, and the three third question horn corner points make the area enclosed by them the largest;
[0019] According to the third question horn point, the corresponding fourth question horn point is matched from the second question horn point, and the first affine transformation matrix is calculated according to the position offset and area ratio between the third question horn point and the fourth question horn point;
[0020] Alternatively, when the spacing between the second question horn corner points is greater than or equal to the preset spacing and the number of the second question horn corner points is greater than or equal to three, three fifth question horn corner points are determined from all the second question horn corner points, and the three fifth question horn corner points make the area enclosed by them the largest;
[0021] According to the fifth question horn point, the corresponding sixth question horn point is matched from the first question horn point, and the first affine transformation matrix is calculated according to the position offset and area ratio between the fifth question horn point and the sixth question horn point.
[0022] Preferably, the step of obtaining the first positioning frame matching result further includes:
[0023] According to the first overlap degree and the first character recognition information, the first question block positioning frame and the second question block positioning frame are matched to obtain a first positioning frame matching result; wherein the first character recognition information is a character recognition result in the first question block positioning frame and a character recognition result in the second question block positioning frame;
[0024] The step of matching the second positioning frame with the result further includes:
[0025] Based on the second overlap degree and the second text recognition information, the first question number positioning box and the second question number positioning box are matched to obtain a second positioning box matching result; wherein the second text recognition information is the text recognition result in the first question number positioning box and the text recognition result in the second question number positioning box in the first positioning box matching result.
[0026] Preferably, the first overlap degree is an area fit degree, and the step of obtaining the first positioning frame matching result includes:
[0027] The degree of area fit between the first question block positioning frame and the second question block positioning frame is calculated, and when the calculated degree of area fit is greater than a first overlap threshold and the first text recognition information matches, the matched first question block positioning frame and second question block positioning frame are obtained as the first positioning frame matching result.
[0028] Preferably, the first positioning frame information and the second positioning frame information both include topic block positioning frame information, sub-question block positioning frame information and answer area positioning frame information, and the first question block positioning frame information and the second question block positioning frame information are both the topic block positioning frame information;
[0029] The first question number positioning box information and the second question number positioning box information both include subject number positioning box information, sub-question number positioning box information and answer question number positioning box information.
[0030] Preferably, before obtaining the first positioning frame matching result, the method further includes:
[0031] The belonging relationship between the various elements is determined according to the subject block positioning box information, sub-question block positioning box information, answer area positioning box information, subject number positioning box information, sub-question number positioning box information and answer question number positioning box information, and the integrated positioning box information is obtained as the question block positioning box information according to the belonging relationship; wherein the elements include subject block, sub-question block, answer area, subject number, sub-question number and answer question number.
[0032] Preferably, the steps of the second affine transformation algorithm include:
[0033] Using the first model, feature extraction is performed on the test paper image to be processed and the template test paper image respectively, and first feature points and second feature points are obtained correspondingly;
[0034] Alternatively, the second model is used to perform feature extraction on the test paper image to be processed and the template test paper image respectively, and the third feature point and the fourth feature point are obtained correspondingly;
[0035] The first model is obtained based on machine learning training, and the second model is obtained based on deep learning training.
[0036] Preferably, the step of using the first model to extract features from the test paper image to be processed and the template test paper image respectively comprises:
[0037] Using the first model, respectively, the to-be-processed test paper image and the template test paper image are subjected to Gaussian convolution, Gaussian pyramid construction, and Gaussian difference pyramid construction, and first feature points and second feature points are detected based on the constructed Gaussian difference pyramid;
[0038] According to the similarity between the first feature point and the second feature point, matching is performed to obtain a feature matching result;
[0039] The position offset information and the area information between the matched first feature point and the second feature point are determined according to the feature matching result and the preset feature matching condition, and a second affine transformation matrix is obtained by calculation.
[0040] Preferably, the second model includes a convolutional neural network and a graph neural network;
[0041] The step of using the second model to extract features from the test paper image to be processed and the template test paper image respectively, and correspondingly obtaining the third feature point and the fourth feature point, comprises:
[0042] Using the convolutional neural network to extract features from the test paper image to be processed and the template test paper image respectively, and obtaining a third feature point and a fourth feature point accordingly;
[0043] Determine a first key point in the pixel points of the to-be-processed test paper image according to the third feature point, and determine a second key point in the pixel points of the template test paper image according to the fourth feature point;
[0044] Using the graph neural network to match the first key point with the second key point to obtain a key point matching result;
[0045] The position offset information and the area information between the matched first key point and the second key point are determined according to the key point matching result, and a third affine transformation matrix is calculated and obtained.
[0046] Preferably, the steps of the second affine transformation algorithm further include:
[0047] Perform handwriting recognition on the to-be-processed test paper image and the template test paper image respectively, and obtain a first handwriting recognition result and a second handwriting recognition result accordingly;
[0048] Erasing the handwriting of the test paper image to be processed according to the first handwriting recognition result to obtain the erased image to be processed; erasing the handwriting of the template test paper image according to the second handwriting recognition result to obtain the erased template image;
[0049] The steps of the second affine transformation algorithm include:
[0050] According to the matching relationship between the feature points extracted from the erased image to be processed and the erased template image.
[0051] Preferably, the step of marking the test paper image to be processed and the template test paper image respectively comprises:
[0052] The third model is used to mark the test paper image to be processed and the template test paper image respectively, wherein the third model is trained based on the training test paper images and corresponding label information.
[0053] In a second aspect of the present application, a test paper recognition device is also provided, comprising:
[0054] An image acquisition module is used to acquire the image of the test paper to be processed and the image of the template test paper;
[0055] a marking processing module, used for marking the test paper image to be processed and the template test paper image respectively, and obtaining a first marking result and a second marking result correspondingly, wherein the first marking result includes first positioning frame information, and the second marking result includes second positioning frame information;
[0056] A transformation matrix acquisition module, used to determine a target affine transformation algorithm from a first affine transformation algorithm and a second affine transformation algorithm according to the first question marking result or the second question marking result, and use the target affine transformation algorithm to obtain an affine transformation matrix between the test paper image to be processed and the template test paper image, wherein the first affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the first positioning frame information and the second positioning frame information, and the second affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the feature points extracted from the test paper image to be processed and the template test paper image;
[0057] The transformation and recognition module is used to transform the first positioning frame information or the second positioning frame information using the affine transformation matrix, and perform text recognition based on the transformed positioning frame information to obtain a test paper recognition result.
[0058] In a third aspect of the present application, the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the methods described above when executing the program.
[0059] In a fourth aspect of the present application, the present application further provides a storage medium, wherein a plurality of instructions are stored in the storage medium, and the instructions are suitable for being loaded by a processor to execute the steps of any of the methods described above.
[0060] In a fifth aspect of the present application, the present application further provides a computer program product, comprising a computer program, which implements the steps of any of the methods described above when executed by a processor.
[0061] Through one or more of the above embodiments in the present application, at least the following technical effects can be achieved: the affine transformation matrix is calculated by the first affine transformation algorithm or the second affine transformation algorithm, wherein the first affine transformation algorithm uses the matching relationship between the first positioning frame information and the second positioning frame information to calculate the affine transformation matrix, and the second affine transformation algorithm uses the matching relationship between the test paper image to be processed and the feature points extracted from the template test paper image to calculate the affine transformation matrix, neither of which uses customized positioning information, and only the original test questions on the test paper image to be processed and the template test paper image can be used to achieve test paper recognition, thereby avoiding the interference caused by customized positioning information. At the same time, the affine transformation matrix can be quickly calculated through rich positioning frame information, which improves the rate of the alignment process of the test paper image to be processed and the template test paper image, and can also improve the alignment accuracy, ensuring the accuracy of automatic marking. In addition, in order to ensure that the affine transformation matrix can still be accurately calculated when the positioning frame information is less, the feature points extracted from the test paper image to be processed and the template test paper image can also be used for matching calculation to ensure the stability of test paper recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] The technical solution and other beneficial effects of the present application will be made apparent by describing in detail the specific implementation methods of the present application in conjunction with the accompanying drawings.
[0063] Figure 1 A flowchart of the test paper recognition method provided in an embodiment of the present application;
[0064] Figure 2 A schematic diagram of a test paper to be processed provided in an embodiment of the present application;
[0065] Figure 3 A schematic diagram of positioning frame matching provided in an embodiment of the present application;
[0066] Figure 4 A schematic diagram of key point matching provided in an embodiment of the present application;
[0067] Figure 5 A schematic diagram of the structure of the test paper recognition device provided in the embodiment of the present application;
[0068] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0069] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0070] In the description of this application, it should be noted that, unless otherwise clearly specified and limited, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article, unless otherwise specified, generally indicates that the associated objects before and after are in an "or" relationship.
[0071] The following is an introduction to the test paper recognition method, device, equipment, medium and product provided by this application in conjunction with the accompanying drawings.
[0072] Figure 1 The flowchart of the test paper recognition method provided in the embodiment of the present application is as follows: Figure 1 As shown, a test paper recognition method comprises the following steps:
[0073] S101, obtaining a test paper image to be processed and a template test paper image.
[0074] Among them, the image of the test paper to be processed refers to an image that needs to be automatically marked, which can be formed by collecting the test paper that needs to be marked through a scanning device or a shooting device. The template test paper refers to a test paper that contains answers to questions, scoring standards, etc. for judging the test paper to be processed. The template test paper image can also be collected by a scanning device or a shooting device. This application does not limit the acquisition of the image of the test paper to be processed and the image of the template test paper. In the examination environment, the test paper to be processed can be a student test paper, and the template test paper can be a teacher test paper. The student test paper can have content after the student's answers, or it can be blank, and the teacher's test paper has information such as the answers to the test questions.
[0075] It should be noted that there is no need to draw additional points or lines on the test paper to be processed and the template test paper to assist in positioning. In addition, after obtaining the image of the test paper to be processed and the template test paper image, in order to improve the image quality, the image of the test paper to be processed and the template test paper image can be preprocessed, such as filtering, graying, etc., which is not limited in this application.
[0076] S102, marking the test paper image to be processed and the template test paper image respectively, and obtaining a first marking result and a second marking result accordingly, wherein the first marking result includes first positioning frame information, and the second marking result includes second positioning frame information.
[0077] In this step, the test paper image to be processed and the template test paper image can be divided into test question areas by machine learning or deep learning, so as to obtain the first question marking result of the test paper image to be processed and the second question marking result of the template test paper image. Schematically, the boundary of the test question can be obtained by edge detection in machine learning to determine the test question area; or the test question area can be determined by target detection in deep learning, or the test question area can be digitally recognized by a digital recognition model, and the test question area can be divided according to the digital recognition result. The test question can also be segmented by an image segmentation model, and this application does not limit this.
[0078] The result of marking the question in this embodiment at least includes the positioning frame information, and the positioning frame at least includes the question block positioning frame of the question, and may also include some sub-element positioning frames in the question area, such as the question number positioning frame, the answer area positioning frame, etc. The positioning frame information includes the size and position of the positioning frame, etc. In addition, the result of marking the question may also include the type information of each positioning frame, such as the question block, question number, etc.
[0079] In addition, the test paper image to be processed includes at least one first positioning frame, and the template test paper image includes at least one second positioning frame.
[0080] S103, determining a target affine transformation algorithm from a first affine transformation algorithm and a second affine transformation algorithm according to the first question marking result or the second question marking result, and using the target affine transformation algorithm to obtain an affine transformation matrix between the test paper image to be processed and the template test paper image.
[0081] Among them, the first affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the first positioning frame information and the second positioning frame information, and the second affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the feature points extracted from the test paper image to be processed and the template test paper image.
[0082] In this step, when the positioning frame information is rich, the sufficient positioning frame information can be used to match the test question area of the test paper image to be processed with the template test paper image, and then the position information in the matched positioning frame information is used to calculate the position offset and the area of the area, and the calculated position offset and area are used to further calculate the affine transformation matrix. Here, rich positioning frame information means that the amount of positioning frame information is greater than a preset threshold and the positioning frame information meets the preset quality requirements.
[0083] In the case of less positioning frame information, the feature points on the test paper image to be processed can be matched with the feature points on the template test paper image, so as to use the matched feature points to perform position offset and regional area calculation, and then use the calculated position offset and regional area calculation to obtain the affine transformation matrix. Here, the situation of less positioning frame information means that the number of positioning frame information is less than the preset value, or the quality of the positioning frame information does not meet the preset requirements. For example, when there is only one first positioning frame on the test paper image to be processed and only one second positioning frame on the template test paper image, the affine transformation matrix calculated by directly using this set of first positioning frame information and second positioning frame information is likely to have a large error. Alternatively, when the distance between the two first positioning frames (or the two second positioning frames) is less than the distance threshold, the inclination of the two first positioning frames (or the two second positioning frames) is not much different, and the affine transformation matrix obtained by calculating using the information of the two first positioning frames can only represent this small area, and may still have a large error for the entire image. Therefore, in order to ensure the accuracy of the transformation matrix, rich positioning frame information is required.
[0084] In the second affine transformation algorithm, the feature points in the test paper image to be processed and the template test paper image can be extracted by machine learning or deep learning, which is not limited in this embodiment.
[0085] It should be noted that since the position, quantity, content, etc. of the test questions on the test paper image to be processed and the template test paper image correspond to each other, the number of first positioning frames in the first marking result and the quality of the first positioning frame information are corresponding to the number of second positioning frames in the second marking result and the quality of the second positioning frame information. When the target affine transformation algorithm is determined, it can be determined whether to use the first affine transformation algorithm to calculate the affine transformation matrix or the second affine transformation algorithm to calculate the affine transformation matrix based on only one of the first marking result or the second marking result.
[0086] S104: transform the first positioning frame information or the second positioning frame information using the affine transformation matrix, and perform text recognition based on the transformed positioning frame information to obtain a test paper recognition result.
[0087] In this step, after obtaining the affine transformation matrix, the second positioning frame can be corrected according to the first positioning frame using the affine transformation matrix, or the first positioning frame can be corrected according to the second positioning frame using the affine transformation matrix. Preferably, the second positioning frame is corrected using the affine transformation matrix, and the corrected second positioning frame information obtained corresponds to the first positioning frame information.
[0088] Schematically, taking the correction of the first positioning frame as an example, after obtaining the first positioning frame after the correction transformation, the text content in the corrected first positioning frame and the second positioning frame can be recognized to obtain the test paper recognition result. The test paper recognition result includes the corrected first positioning frame information, corresponding text information and the second positioning frame information, corresponding text information, which is used for subsequent comparison, scoring, etc., so as to complete automatic marking.
[0089] The test paper recognition method provided in the embodiment of the present application calculates the affine transformation matrix through the first affine transformation algorithm or the second affine transformation algorithm, wherein the first affine transformation algorithm calculates the affine transformation matrix by using the matching relationship between the first positioning frame information and the second positioning frame information, and the second affine transformation algorithm calculates the affine transformation matrix by using the matching relationship between the test paper image to be processed and the feature points extracted from the template test paper image. Both do not use customized positioning information, and only the original test questions on the test paper image to be processed and the template test paper image can be used to realize test paper recognition, thereby avoiding the interference caused by customized positioning information. At the same time, the affine transformation matrix can be quickly calculated through rich positioning frame information, which improves the rate of the alignment process of the test paper image to be processed and the template test paper image, and can also improve the alignment accuracy, ensuring the accuracy of automatic marking. In addition, in order to ensure that the affine transformation matrix can still be accurately calculated when the positioning frame information is less, the feature points extracted from the test paper image to be processed and the template test paper image can also be used for matching calculation to ensure the stability of test paper recognition.
[0090] In some embodiments of the present application, the first positioning frame information includes first question block positioning frame information and first question number positioning frame information, and the second positioning frame information includes second question block positioning frame information and second question number positioning frame information.
[0091] It should be noted that a question block positioning frame corresponds to at least one question number positioning frame, that is, the area where each test question is located corresponds to at least one question number. The question block positioning frame here can cover all areas of a test question, including the answer area, text area, etc. The question number positioning frame of each question may be located in the question block positioning frame, or it may overlap with the question block positioning frame to a large extent. From the position point of view, the position information of some corner points of the question block positioning frame is similar to the position information of some corner points of the question number positioning frame.
[0092] The steps of the first affine transformation algorithm include:
[0093] According to a first degree of coincidence between the first question block positioning frame information and the second question block positioning frame information, the first question block positioning frame and the second question block positioning frame are matched to obtain a first positioning frame matching result.
[0094] In this step, the question block area is matched first, specifically, according to the overlap between the first question block positioning frame on the test paper image to be processed and the second question block positioning frame on the template test paper image, the corresponding first question block positioning frame and the second question block positioning frame are matched and bound, thereby obtaining a first positioning frame matching result. In other words, the first positioning frame matching result includes a group of first question block positioning frames and second question block positioning frames that correspond to each other.
[0095] A second degree of overlap between the first question number positioning box information and the second question number positioning box information is determined based on the first positioning box matching result, and the first question number positioning box and the second question number positioning box are matched based on the second degree of overlap to obtain a second positioning box matching result, wherein the second positioning box matching result includes the first question number positioning box information after matching and the second question number positioning box information after matching.
[0096] In this step, since the area corresponding to the question block positioning frame is large, the question mark regression of the question block positioning frame allows a high deviation, and the affine matrix transformation calculated using the question block positioning frame information will have a large deviation. Therefore, the element with the smallest area area, the question number, can be used to perform the affine matrix transformation calculation, thereby improving the accuracy of the affine matrix transformation calculation. In addition, first matching the question block positioning frame can improve the accuracy of the subsequent question number positioning frame matching. For example, the question block A in the test paper image to be processed includes the question number "1", and the question block B also includes the question number "1". In order to avoid the question number "1" of the B question block and the question number "1" in the A' question block in the template test paper image, the B question block and the B' question block are matched first, and then the question numbers corresponding to the B question block and the B' question block are matched, which improves the accuracy of the question number matching.
[0097] Specifically, after obtaining a group of mutually corresponding first question block positioning frames and second question block positioning frames through matching, the question number positioning frames corresponding to the first question block positioning frames and the second question block positioning frames of each group are matched, thereby obtaining a second positioning frame matching result, wherein the second positioning frame matching result includes a group of successfully matched first question number positioning frames and second question number positioning frames. Figure 3 Taking a set of matching question block positioning boxes in as an example, the question number "20" in the test paper image to be processed is matched with the question number "20" in the template test paper image.
[0098] The position offset information and the region area information are determined according to the first question number positioning frame information after matching and the second question number positioning frame information after matching, and the first affine transformation matrix is calculated based on the position offset information and the region area information.
[0099] In this step, the position information, area information of the first question number positioning frame and the position information, area information of the second question number positioning frame after matching can be used to calculate the position offset and the area ratio, and then the first affine transformation matrix can be calculated using the position offset and the area ratio. It should be noted that if multiple first affine transformation matrices are calculated based on multiple sets of matched first question number positioning frames and second question number positioning frames, the final first affine transformation matrix can be obtained by averaging, taking the median, and other data fusion methods. It is also possible to filter multiple sets of matched first question number positioning frames and second question number positioning frames according to preset filtering conditions, so as to obtain the matched first question number positioning frame and the matched second question number positioning frame with a large difference in inclination angle, and then calculate to obtain one or more first affine transformation matrices. In the case of multiple, the above-mentioned data fusion method can still be used to obtain the final first affine transformation matrix.
[0100] The test paper recognition method provided in the embodiment of the present application first matches and binds the question block positioning frame, and then matches the question number positioning frame based on the matching of the question block positioning frame, and uses the matched question number positioning frame information to calculate the first affine transformation matrix, thereby making full use of the positioning frame information, improving the accuracy and speed of the first affine transformation matrix calculation, and thus improving the accuracy and speed of image correction.
[0101] In order to further improve the accuracy of the calculation of the first affine transformation matrix, in some embodiments of the present application, the first affine transformation matrix is calculated using the corner point position information of the question number positioning frame.
[0102] Specifically, the first question number positioning frame information after matching includes the first question number corner point position information, and the second question number positioning frame information after matching includes the second question number corner point position information. The first question number corner point corresponds to the second question number corner point in position.
[0103] It should be noted that the question number positioning frame has four corner points, the first question number corner point and the second question number corner point are each one of the four corner points, and the first question number corner point corresponds to the second question number corner point in position. For example, if the first question number corner point is the corner point at the lower right corner of the first question number positioning frame, then the second question number corner point is also the corner point at the lower right corner of the second question number positioning frame. Preferably, the corner point at the upper left corner of the question number positioning frame can be selected as the question number corner point.
[0104] The step of determining the position offset information and the area information according to the matched first question number positioning frame information and the matched second question number positioning frame information comprises:
[0105] When the spacing between the first question horn corner points is greater than or equal to the preset spacing and the number of the first question horn corner points is greater than or equal to three, three third question horn corner points are determined from all the first question horn corner points, and the three third question horn corner points make the area enclosed by them the largest.
[0106] That is to say, when the number of first question number positioning frames is greater than or equal to 3 and the spacing between each first question number corner point is greater than or equal to the preset spacing, it is determined that the first question number positioning frame information is rich, and the current first question number positioning frame information can be used to calculate the first affine transformation matrix. In order to make the calculation more accurate, it is necessary to determine three third question number corner points from the first question number corner points that meet the above conditions. The area surrounded by these three third question number corner points is the largest compared to the area surrounded by the other three first question number corner points. It can be seen that the three third question number corner points are distributed far apart, so that the inclination of different areas can be reflected to the greatest extent.
[0107] According to the third question horn corner point, the corresponding fourth question horn corner point is matched from the second question horn corner point, and the first affine transformation matrix is calculated according to the position offset and area ratio between the third question horn corner point and the fourth question horn corner point; wherein the area ratio refers to the ratio between the area enclosed by the third question horn corner point and the area enclosed by the fourth question horn corner point.
[0108] That is to say, according to the matching relationship between the first question number positioning frame and the second question number positioning frame obtained by the previous matching, the fourth question number corner point corresponding to the three third question number corner points is obtained from the second question number corner points on the template test paper image.
[0109] The position offset is calculated using the position information of the three sets of corresponding horn points of the third question and the horn points of the fourth question, and the area ratio is calculated using the area enclosed by the three horn points of the third question and the area enclosed by the three horn points of the fourth question. Then, the first affine transformation matrix is calculated using the position offset and the area ratio.
[0110] Similarly, the second question horn corner points may be screened, and when the spacing between the second question horn corner points is greater than or equal to the preset spacing and the number of the second question horn corner points is greater than or equal to three, three fifth question horn corner points are determined from all the second question horn corner points, and the three fifth question horn corner points make the area enclosed by them the largest.
[0111] According to the fifth question horn point, the corresponding sixth question horn point is matched from the first question horn point, and the first affine transformation matrix is calculated according to the position offset and area ratio between the fifth question horn point and the sixth question horn point; wherein the area ratio refers to the ratio between the area enclosed by the fifth question horn point and the area enclosed by the sixth question horn point.
[0112] It should be noted that since there is a corresponding relationship between the corner points of the first question and the corner points of the second question, in order to improve the calculation speed, the corner points of the third question can be determined only based on the corner points of the first question, or the corner points of the fifth question can be determined only based on the corner points of the second question. The corner points finally obtained by both for calculating the first affine transformation matrix are essentially the same, that is, the corner points of the third question are the same as the corner points of the sixth question, and the corner points of the fourth question are the same as the corner points of the fifth question.
[0113] The test paper recognition method provided in the embodiment of the present application can improve the accuracy of the calculation of the first affine transformation matrix while also improving the calculation efficiency by determining three corner points of the third question from the corner points of the first question so that the area enclosed by them is the largest, or by determining three corner points of the fifth question from the corner points of the second question so that the area enclosed by them is the largest, and then using the corner points of the third question or the corner points of the fifth question to calculate the first affine transformation matrix.
[0114] In some embodiments of the present application, in order to improve the accuracy of the question block positioning box matching and the question number positioning box matching, the text information in the question block positioning box and the question number positioning box is also combined for matching, specifically:
[0115] The step of obtaining the first positioning frame matching result also includes:
[0116] According to the first overlap degree and the first text recognition information, the first question block positioning box and the second question block positioning box are matched to obtain a first positioning box matching result; wherein the first text recognition information is the text recognition result in the first question block positioning box and the text recognition result in the second question block positioning box.
[0117] In this step, the first question block positioning frame and the second question block positioning frame are matched according to the first overlap between the first question block positioning frame and the second question block positioning frame, and the text recognition result in the first question block positioning frame and the text recognition result in the second question block positioning frame. The text recognition result may be the recognition result of all characters, numbers and other contents in the question block positioning frame, or the recognition result of the first few characters or numbers, or the recognition result of characters or numbers in other specific positions, which is not limited in this application.
[0118] The step of matching the second positioning frame with the result further includes:
[0119] Based on the second overlap degree and the second text recognition information, the first question number positioning box and the second question number positioning box are matched to obtain a second positioning box matching result; wherein the second text recognition information is the text recognition result in the first question number positioning box and the text recognition result in the second question number positioning box in the first positioning box matching result.
[0120] That is to say, the question number information in the question number positioning box is recognized in text. The question number here may be Arabic numerals "1, 2, 3", or the text "one, two, three", or Roman letters "I, II, III", or other information used to represent the order of test questions. This application does not limit this. The question number information is generally located through the question number positioning box.
[0121] Since each question block positioning box corresponds to at least one question number positioning box, preferably, in order to further improve the calculation speed, the first text recognition information and the second text recognition information can both be question number information, that is, it is sufficient to perform text recognition on the content in the question number positioning box, thereby saving text recognition time and ensuring the accuracy of matching.
[0122] In addition, the first text recognition signal and the second text recognition information can be realized through optical character recognition technology, template matching method, text recognition based on deep learning, etc., which is not limited in this application.
[0123] The test paper recognition method provided in the embodiment of the present application improves the accuracy of matching the question block positioning box and the question number positioning box through the first character recognition information and the second character recognition information.
[0124] In some embodiments of the present application, in order to improve the accuracy of calculating the first affine transformation matrix, data screening is also performed in the process of obtaining the first positioning frame matching result and the second positioning frame matching result. Specifically:
[0125] The step of obtaining the first positioning frame matching result includes:
[0126] The degree of area fit between the first question block positioning frame and the second question block positioning frame is calculated, and when the calculated degree of area fit is greater than a first overlap threshold and the first text recognition information matches, the matched first question block positioning frame and second question block positioning frame are obtained as the first positioning frame matching result.
[0127] That is to say, when the overlap between the first question block positioning frame and the second question block positioning frame is high and the text recognition information in the two question block positioning frames also matches, the two question block positioning frames are determined to match, and the first positioning frame matching result is output. If the area fit between the first question block positioning frame and the second question block positioning frame is less than or equal to the first overlap threshold, or the text information in the two question block positioning frames does not match, it is determined that the two question block positioning frames do not match, and then the next question block positioning frame is matched. If the first question block positioning frame on the test paper to be processed does not match all the second question block positioning frames on the template test paper, the first question block positioning frame information does not participate in the subsequent calculation, thereby filtering out a portion of the question block positioning frame information with large differences, and improving the accuracy of the first affine transformation matrix calculation.
[0128] The step of obtaining the second positioning frame matching result includes:
[0129] The degree of area fit between the first question number positioning box and the second question number positioning box is calculated, and when the calculated degree of area fit is greater than the second overlap threshold and the second text recognition information matches, the matched first question number positioning box and the second question number positioning box are obtained as the second positioning box matching result.
[0130] Similarly, when the overlap between the first question number positioning frame and the second question number positioning frame is high and the text recognition information in the two question number positioning frames also matches, the two question number positioning frames are determined to match, and then the second positioning frame matching result is output. If the area fit between the first question number positioning frame and the second question number positioning frame is less than or equal to the second overlap threshold, or the text information in the two question number positioning frames does not match, then the two question number positioning frames are determined to be mismatched, and then the next question number positioning frame is matched under the premise of the same set of question block positioning frames. If the first question number positioning frame does not match all the second question number positioning frames in a question block positioning frame, then the first question number positioning frame information does not participate in subsequent calculations, thereby filtering out a portion of question number positioning frame information with large differences, thereby improving the accuracy of the first affine transformation matrix calculation.
[0131] It should be noted that the first overlap degree and the second overlap degree are both area fit degrees, and the area fit degree refers to the area matching degree between the regions corresponding to the two positioning frames.
[0132] In some embodiments of the present application, Figure 2 As shown, the first positioning box information and the second positioning box information both include subject block positioning box information, sub-question block positioning box information and answer area positioning box information, and the first question block positioning box information and the second question block positioning box information are both the subject block positioning box information.
[0133] The first question number positioning box information and the second question number positioning box information both include subject number positioning box information, sub-question number positioning box information and answer question number positioning box information.
[0134] That is to say, the elements of each test question may include a subject block, a sub-subject block, an answer area, a subject number, a sub-subject number, an answer question number, etc., wherein the subject block corresponds to the subject number, the sub-subject block corresponds to the sub-subject number, the answer area corresponds to the answer question number, and the answer area may or may not have an answer question number. Each test question has a subject block, and a subject block may or may not have at least two sub-subject blocks, and a subject block may have at least one answer area. Accordingly, a subject block corresponds to a subject number; a subject block may or may not have corresponding sub-subject numbers; a subject block may or may not have corresponding answer question numbers, and this application does not limit this.
[0135] It should be noted that the above-mentioned first question block positioning frame information and the second question block positioning frame information both refer to the subject block positioning frame information, while the first question number positioning frame and the second question number positioning frame include the subject number, sub-question number, and answer question number. Rich question number positioning frame information can help to accurately calculate the first affine transformation matrix, and representative subject block positioning frame information can improve the accuracy and speed of question number positioning frame matching.
[0136] In addition, in the process of determining the corner point of the third question or the corner point of the fifth question, what is involved are all types of question number positioning frames on the test paper image to be processed or all types of question number positioning frames on the template test paper image.
[0137] The test paper recognition method provided in the embodiment of the present application improves the richness of the positioning frame information and the accuracy of the calculation of the first affine transformation matrix by performing more detailed area division for each test question.
[0138] In some embodiments of the present application, in order to further improve the accuracy of question number positioning box matching, a nested structure based on the subject block positioning box will be constructed based on the positioning box information of all elements, so that the final question block positioning box of each question is a nested structure, avoiding errors caused by matching the question block positioning box based solely on the subject block positioning box.
[0139] Specifically, before obtaining the first positioning frame matching result, the method further includes:
[0140] The belonging relationship between the various elements is determined according to the subject block positioning box information, sub-question block positioning box information, answer area positioning box information, subject number positioning box information, sub-question number positioning box information and answer question number positioning box information, and the integrated positioning box information is obtained as the question block positioning box information according to the belonging relationship; wherein the elements include subject block, sub-question block, answer area, subject number, sub-question number and answer question number.
[0141] That is to say, after marking the test paper image to be processed and the template test paper image respectively, different types of positioning frame information in the test paper image to be processed and the template test paper image are correspondingly obtained.
[0142] The belonging relationship is determined according to the positional relationship between different types of positioning frames. For example, if the sub-question block positioning frame C is located in the theme block positioning frame D, then the sub-question block positioning frame C belongs to the theme block positioning frame D. If the overlapping area of the sub-question number positioning frame E and the sub-question block positioning frame C is large, then the sub-question number positioning frame E belongs to the sub-question block positioning frame C. All elements of each test question are integrated according to the belonging relationship to obtain the question block positioning frame information with a nested structure.
[0143] In one implementation of the present application, the above-mentioned affiliation can be determined based on the comparison result between the area intersection-and-union ratio between the positioning frames and the preset intersection-and-union ratio threshold value. For example, if the area intersection-and-union ratio between the positioning frames is greater than the preset intersection-and-union ratio threshold value, it is determined that there is an affiliation between the two positioning frames. If it is less than the preset intersection-and-union ratio threshold value, it is determined that there is no affiliation between the two positioning frames. The preset intersection-and-union ratio threshold values corresponding to different types of positioning frames can be the same or different, and are set according to actual conditions, and the present application does not limit this.
[0144] In addition, in order to avoid misjudgment of the belonging relationship or to compensate for the error in the result of the question marking process, the embodiment of the present application also provides a variety of methods for improving the integration of elements. For example, when the area intersection between the question number and the question block is lower than the threshold, it is necessary to supplement the distance threshold comparison between the coordinates of the corner point of the question number and the coordinates of the corner point of the question block. That is to say, although the area intersection between the question number and the question block is lower than the threshold, but the distance between the coordinates of the corner point of the question number and the coordinates of the corner point of the question block is less than the threshold, it can still be determined that there is a belonging relationship between the question number and the question block.
[0145] For example, when a question number is related to multiple question blocks, it is necessary to count the number of times the question number is judged and the minimum distance between the question block and the question number, and then determine which question block the question number best belongs to.
[0146] For another example, when question blocks include each other, it means that one of the positioning frames of the two question blocks may be wrong, and the coordinates of the wrong question block area need to be optimized to obtain accurate question block positioning frame information.
[0147] In some embodiments of the present application, the steps of the second affine transformation algorithm include:
[0148] The first model is used to extract features of the test paper image to be processed and the template test paper image, respectively, to obtain first feature points and second feature points accordingly.
[0149] Alternatively, the second model is used to perform feature extraction on the test paper image to be processed and the template test paper image respectively, and the third feature point and the fourth feature point are obtained correspondingly.
[0150] The first model is obtained based on machine learning training, and the second model is obtained based on deep learning training.
[0151] That is to say, in the embodiment of the present application, feature points on the test paper image to be processed and the template test paper image can be extracted by machine learning or deep learning. Specifically, the first model can extract feature points using a corner detection algorithm, an edge detection algorithm, a SIFT (Scale-Invariant Feature Transform) algorithm, etc., and the second model can perform feature extraction through a convolutional neural network (such as the R-CNN series, the YOLO series, etc.).
[0152] Among them, the second model obtained based on deep learning training can extract richer and more robust feature points, thereby improving the accuracy and stability of the second affine transformation matrix. However, the second model needs to be trained with a large amount of relevant data, while the first model requires less training data and the corresponding training time is also less. The complexity of the second model is higher than that of the first model, and the feature extraction time of the second model may be longer than that of the first model. The selection between the first model and the second model can be determined according to needs, and this application does not limit this.
[0153] It should be noted that the premise of selecting the first model or the second model is that the first question-marking result or the second question-marking result can provide insufficient information, and the first affine transformation matrix is calculated preferentially using the abundant positioning frame information.
[0154] The test paper recognition method provided in the embodiment of the present application provides a variety of feature point extraction methods.
[0155] In some embodiments of the present application, the step of extracting features from the to-be-processed test paper image and the template test paper image using the first model respectively includes:
[0156] The first model is used to perform Gaussian convolution, Gaussian pyramid construction and Gaussian difference pyramid construction on the test paper image to be processed and the template test paper image respectively, and the first feature point and the second feature point are detected correspondingly based on the constructed Gaussian difference pyramid.
[0157] According to the similarity between the first feature point and the second feature point, a feature matching result is obtained by matching.
[0158] The position offset information and the area information between the matched first feature point and the second feature point are determined according to the feature matching result and the preset feature matching condition, and a second affine transformation matrix is obtained by calculation.
[0159] That is to say, the embodiment of the present application uses the SIFT algorithm to detect feature points of the test paper image to be processed and the template test paper image, which specifically includes the following steps:
[0160] S201, perform Gaussian convolution on the input test paper image to be processed and the template test paper image respectively; on the basis of the respective Gaussian results, construct Gaussian pyramids of images of different scales, and obtain Gaussian difference pyramids by calculating the pixel point difference values on adjacent scale images; based on the Gaussian difference pyramid, detect the first feature point information in the test paper image to be processed and the second feature point information in the template test paper image by comparing the sizes of adjacent points, and use these feature point information as the feature description of the entire image.
[0161] S202, calculating the distance between the first feature point and the second feature point to determine the similarity, matching the first feature point to obtain the corresponding second feature point according to the similarity threshold, or matching the second feature point to obtain the corresponding first feature point, thereby obtaining a feature matching result.
[0162] S203, when the number of the first feature points and the second feature points that meet the conditions in the feature matching result is greater than or equal to 4, the position offset is calculated according to the position information of the first feature point and the position information of the second feature point, the area ratio is calculated according to the area of the area enclosed by the first feature point and the area of the area enclosed by the second feature point, and the second affine transformation matrix is calculated based on the position offset and the area ratio. Among them, the preset feature matching condition means that the number of feature points needs to be greater than a certain value, which is set to be greater than or equal to 4 in this embodiment, and the affine transformation matrix can be obtained with at least 4 coordinate points. In other embodiments of the present application, it can also be set to other values, which are not limited to this.
[0163] In some embodiments of the present application, Figure 4 As shown, the second model includes a convolutional neural network and a graph neural network.
[0164] The step of using the second model to extract features from the test paper image to be processed and the template test paper image respectively, and correspondingly obtaining the third feature point and the fourth feature point, comprises:
[0165] The convolutional neural network is used to extract features of the test paper image to be processed and the template test paper image respectively, and the third feature point of the test paper image to be processed and the fourth feature point of the template test paper image are correspondingly obtained.
[0166] The first key point is determined in the pixel points of the test paper image to be processed according to the third feature point, and the second key point is determined in the pixel points of the template test paper image according to the fourth feature point. In other words, the local maximum value can be selected as the key point according to the feature map range where the feature point is located, or the key point can be determined according to information such as energy threshold, local contrast, etc., or other key point determination methods, and the key point is a feature point with significant feature information.
[0167] The graph neural network is used to match the first key point with the second key point to obtain a key point matching result. That is, in order to improve the accuracy of matching between key points, the graph neural network is also used to match the first key point on the processed test paper image with the second key point on the template test paper image, specifically, the matching score between the first key point and the second key point is calculated, and the calculated matching score is compared with a preset score threshold. When the preset score threshold is met, the matched first key point and the second key point are obtained.
[0168] The position offset information and the area information between the matched first key point and the second key point are determined according to the key point matching result, and a third affine transformation matrix is calculated and obtained.
[0169] That is to say, the position offset is calculated using the position information of the matched first key point and the position information of the matched second key point, and then the area ratio is calculated using the area corresponding to the matched first key point and the area corresponding to the matched second key point, and then the third affine transformation matrix is calculated based on the position offset and the area ratio.
[0170] In some embodiments of the present application, the steps of the second affine transformation algorithm further include:
[0171] Handwriting recognition is performed on the test paper image to be processed and the template test paper image respectively, and a first handwriting recognition result and a second handwriting recognition result are obtained correspondingly.
[0172] Erasing the handwriting of the test paper image to be processed according to the first handwriting recognition result to obtain the erased image to be processed; erasing the handwriting of the template test paper image according to the second handwriting recognition result to obtain the erased template image;
[0173] The steps of the second affine transformation algorithm include:
[0174] According to the matching relationship between the feature points extracted from the erased image to be processed and the erased template image.
[0175] In this embodiment, in order to reduce the interference of handwriting on the test paper on the feature point extraction, the test paper image to be processed and the template test paper image will be cleared after the feature point extraction. Specifically, the test paper image to be processed and the template test paper image are firstly subjected to handwriting recognition to obtain the handwriting position information, and then the handwriting is erased according to the handwriting position information. Among them, handwriting recognition can also be achieved by deep learning or machine learning, which can be support vector machine SVM algorithm, hidden Markov model, convolutional neural network, recurrent neural network, etc., which is not limited in this application.
[0176] The test paper recognition method provided in the embodiment of the present application reduces human interference by erasing handwriting, improves the quality of feature points, and thereby improves the accuracy of the second affine transformation algorithm.
[0177] In some embodiments of the present application, the step of marking the test paper image to be processed and the template test paper image respectively includes:
[0178] The third model is used to mark the test paper image to be processed and the template test paper image respectively, wherein the third model is trained based on the training test paper images and corresponding label information.
[0179] Specifically, the third model is obtained based on deep learning training, and can be a target detection model, such as the YOLO series, the R-CNN series, etc., which is not limited to this. The third model is trained using training test paper images, label boxes of each element in the training test paper images, label types and other label information. The third model is used to divide the test paper images to be processed and the template test paper images into test questions, and obtain positioning box information.
[0180] Based on any of the above embodiments, another embodiment of the present application further provides a test paper recognition device, Figure 5 The schematic diagram of the structure of the test paper recognition device provided by this application is as follows: Figure 5 As shown, the test paper identification device comprises:
[0181] The image acquisition module 501 is used to acquire the test paper image to be processed and the template test paper image.
[0182] The question marking processing module 502 is used to perform question marking on the to-be-processed test paper image and the template test paper image respectively, and obtain a first question marking result and a second question marking result accordingly. The first question marking result includes first positioning frame information, and the second question marking result includes second positioning frame information.
[0183] The transformation matrix acquisition module 503 is used to determine the target affine transformation algorithm from the first affine transformation algorithm and the second affine transformation algorithm according to the first question marking result or the second question marking result, and use the target affine transformation algorithm to obtain the affine transformation matrix between the test paper image to be processed and the template test paper image, wherein the first affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the first positioning frame information and the second positioning frame information, and the second affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the feature points extracted from the test paper image to be processed and the template test paper image.
[0184] The transformation and recognition module 504 is used to transform the first positioning frame information or the second positioning frame information using the affine transformation matrix, and perform text recognition based on the transformed positioning frame information to obtain a test paper recognition result.
[0185] The test paper recognition device provided in the embodiment of the present application corresponds to the above-mentioned test paper recognition method, which will not be repeated here.
[0186] Based on any of the above embodiments, another embodiment of the present application further provides an electronic device, such as Figure 6 As shown, the electronic device may include: a processor 610 (Processor), a communication interface 620 (Communications Interface), a memory 630 (Memory) and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the above-mentioned test paper recognition method.
[0187] In addition, the logic instructions in the above-mentioned memory 630 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 this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable 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 application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0188] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable 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 application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0189] On the other hand, an embodiment of the present application further provides a storage medium on which a plurality of instructions are stored, and the instructions are suitable for being loaded by a processor to execute the test paper recognition method provided in the above embodiments to execute the above test paper recognition method.
[0190] On the other hand, an embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned test paper recognition method when executed by a processor.
[0191] 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. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0192] 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, it 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.
[0193] In summary, although the present application has been disclosed as above with preferred embodiments, the above preferred embodiments are not intended to limit the present application. Ordinary technicians in this field can make various changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be based on the scope defined in the claims.
Claims
1. A test paper recognition method, characterized in that: The method comprises: Obtain the test paper image to be processed and the template test paper image; Marking the test paper image to be processed and the template test paper image respectively, and obtaining a first marking result and a second marking result accordingly, wherein the first marking result includes first positioning frame information, and the second marking result includes second positioning frame information; Determine a target affine transformation algorithm from a first affine transformation algorithm and a second affine transformation algorithm according to the first question marking result or the second question marking result, and use the target affine transformation algorithm to obtain an affine transformation matrix between the test paper image to be processed and the template test paper image, wherein the first affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the first positioning frame information and the second positioning frame information, and the second affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the feature points extracted from the test paper image to be processed and the template test paper image; The first positioning frame information or the second positioning frame information is transformed using the affine transformation matrix, and text recognition is performed based on the transformed positioning frame information to obtain a test paper recognition result.
2. The method according to claim 1, characterized in that The first positioning frame information includes first question block positioning frame information and first question number positioning frame information, and the second positioning frame information includes second question block positioning frame information and second question number positioning frame information; The steps of the first affine transformation algorithm include: According to a first degree of overlap between the first question block positioning frame information and the second question block positioning frame information, matching the first question block positioning frame with the second question block positioning frame to obtain a first positioning frame matching result; Determine a second degree of overlap between the first question number positioning box information and the second question number positioning box information according to the first positioning box matching result, and match the first question number positioning box with the second question number positioning box based on the second degree of overlap to obtain a second positioning box matching result, wherein the second positioning box matching result includes the first question number positioning box information after matching and the second question number positioning box information after matching; The position offset information and the region area information are determined according to the first question number positioning frame information after matching and the second question number positioning frame information after matching, and the first affine transformation matrix is calculated based on the position offset information and the region area information.
3. The method according to claim 2, characterized in that The first question number positioning frame information after matching includes the first question number corner point position information, and the second question number positioning frame information after matching includes the second question number corner point position information, and the first question number corner point corresponds to the second question number corner point in position; The step of determining the position offset information and the area information according to the matched first question number positioning frame information and the matched second question number positioning frame information comprises: When the spacing between the first question horn corner points is greater than or equal to the preset spacing and the number of the first question horn corner points is greater than or equal to three, three third question horn corner points are determined from all the first question horn corner points, and the three third question horn corner points make the area enclosed by them the largest; According to the third question horn point, the corresponding fourth question horn point is matched from the second question horn point, and the first affine transformation matrix is calculated according to the position offset and area ratio between the third question horn point and the fourth question horn point; Alternatively, when the spacing between the second question horn corner points is greater than or equal to the preset spacing and the number of the second question horn corner points is greater than or equal to three, three fifth question horn corner points are determined from all the second question horn corner points, and the three fifth question horn corner points make the area enclosed by them the largest; According to the fifth question horn point, the corresponding sixth question horn point is matched from the first question horn point, and the first affine transformation matrix is calculated according to the position offset and area ratio between the fifth question horn point and the sixth question horn point.
4. The method according to claim 2, characterized in that The step of obtaining the first positioning frame matching result also includes: According to the first overlap degree and the first character recognition information, the first question block positioning frame and the second question block positioning frame are matched to obtain a first positioning frame matching result; wherein the first character recognition information is a character recognition result in the first question block positioning frame and a character recognition result in the second question block positioning frame; The step of matching the second positioning frame with the result further includes: Based on the second overlap degree and the second text recognition information, the first question number positioning box and the second question number positioning box are matched to obtain a second positioning box matching result; wherein the second text recognition information is the text recognition result in the first question number positioning box and the text recognition result in the second question number positioning box in the first positioning box matching result.
5. The method according to claim 4, characterized in that The first overlap degree is the area fit degree, and the step of obtaining the first positioning frame matching result includes: The degree of area fit between the first question block positioning frame and the second question block positioning frame is calculated, and when the calculated degree of area fit is greater than a first overlap threshold and the first text recognition information matches, the matched first question block positioning frame and second question block positioning frame are obtained as the first positioning frame matching result.
6. The method according to claim 2, characterized in that The first positioning frame information and the second positioning frame information both include topic block positioning frame information, sub-question block positioning frame information and answer area positioning frame information, and the first question block positioning frame information and the second question block positioning frame information are both the topic block positioning frame information; The first question number positioning box information and the second question number positioning box information both include subject number positioning box information, sub-question number positioning box information and answer question number positioning box information.
7. The method according to claim 6, characterized in that Before obtaining the first positioning frame matching result, the method further includes: The belonging relationship between the various elements is determined according to the subject block positioning box information, sub-question block positioning box information, answer area positioning box information, subject number positioning box information, sub-question number positioning box information and answer question number positioning box information, and the integrated positioning box information is obtained as the question block positioning box information according to the belonging relationship; wherein the elements include subject block, sub-question block, answer area, subject number, sub-question number and answer question number.
8. The method according to claim 1, characterized in that The steps of the second affine transformation algorithm include: Using the first model, feature extraction is performed on the test paper image to be processed and the template test paper image respectively, and first feature points and second feature points are obtained correspondingly; Alternatively, the second model is used to perform feature extraction on the test paper image to be processed and the template test paper image respectively, and the third feature point and the fourth feature point are obtained correspondingly; The first model is obtained based on machine learning training, and the second model is obtained based on deep learning training.
9. The method according to claim 8, characterized in that The step of using the first model to extract features from the test paper image to be processed and the template test paper image respectively comprises: Using the first model, respectively, the to-be-processed test paper image and the template test paper image are subjected to Gaussian convolution, Gaussian pyramid construction, and Gaussian difference pyramid construction, and first feature points and second feature points are detected based on the constructed Gaussian difference pyramid; According to the similarity between the first feature point and the second feature point, matching is performed to obtain a feature matching result; The position offset information and the area information between the matched first feature point and the second feature point are determined according to the feature matching result and the preset feature matching condition, and a second affine transformation matrix is obtained by calculation.
10. The method according to claim 8, characterized in that The second model includes a convolutional neural network and a graph neural network; The step of using the second model to extract features from the test paper image to be processed and the template test paper image respectively, and correspondingly obtaining the third feature point and the fourth feature point, comprises: Using the convolutional neural network to extract features from the test paper image to be processed and the template test paper image respectively, and obtaining a third feature point and a fourth feature point accordingly; Determine a first key point in the pixel points of the to-be-processed test paper image according to the third feature point, and determine a second key point in the pixel points of the template test paper image according to the fourth feature point; Using the graph neural network to match the first key point with the second key point to obtain a key point matching result; The position offset information and the area information between the matched first key point and the second key point are determined according to the key point matching result, and a third affine transformation matrix is calculated and obtained.
11. The method according to claim 8, characterized in that The steps of the second affine transformation algorithm also include: Perform handwriting recognition on the to-be-processed test paper image and the template test paper image respectively, and obtain a first handwriting recognition result and a second handwriting recognition result accordingly; Erasing the handwriting of the test paper image to be processed according to the first handwriting recognition result to obtain the erased image to be processed; erasing the handwriting of the template test paper image according to the second handwriting recognition result to obtain the erased template image; The steps of the second affine transformation algorithm include: According to the matching relationship between the feature points extracted from the erased image to be processed and the erased template image.
12. The method according to claim 1, characterized in that The step of marking the test paper image to be processed and the template test paper image respectively comprises: The third model is used to mark the test paper image to be processed and the template test paper image respectively, wherein the third model is trained based on the training test paper images and corresponding label information.
13. A test paper recognition device, characterized in that: include: An image acquisition module is used to acquire the image of the test paper to be processed and the image of the template test paper; a marking processing module, used for marking the test paper image to be processed and the template test paper image respectively, and obtaining a first marking result and a second marking result correspondingly, wherein the first marking result includes first positioning frame information, and the second marking result includes second positioning frame information; A transformation matrix acquisition module, used to determine a target affine transformation algorithm from a first affine transformation algorithm and a second affine transformation algorithm according to the first question marking result or the second question marking result, and use the target affine transformation algorithm to obtain an affine transformation matrix between the test paper image to be processed and the template test paper image, wherein the first affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the first positioning frame information and the second positioning frame information, and the second affine transformation algorithm calculates the affine transformation matrix using the matching relationship between the feature points extracted from the test paper image to be processed and the template test paper image; The transformation and recognition module is used to transform the first positioning frame information or the second positioning frame information using the affine transformation matrix, and perform text recognition based on the transformed positioning frame information to obtain a test paper recognition result.
14. 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 program, the steps of the method according to any one of claims 1 to 12 are implemented.
15. A storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps of the method according to any one of claims 1 to 12.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
