An intelligent test paper reading method and device based on an OCR algorithm
By using an intelligent test paper recognition method based on OCR algorithm, combined with denoising, segmentation, page alignment and semantic analysis, the problems of noise and question type alignment in test papers are solved, and efficient and accurate test paper recognition and scoring are achieved.
Patent Information
- Application Number
- CN202410950978.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2044-07-16
AI Technical Summary
Existing OCR test paper interpretation methods cannot effectively handle noise in the test paper, alignment of different question types, and multiple question types, resulting in inaccurate recognition results.
An intelligent test paper interpretation method based on OCR algorithm is adopted, including noise reduction, segmentation processing, page alignment, string comparison of objective questions and semantic analysis of subjective questions. The method uses Siamese network to calculate semantic similarity to achieve accurate recognition of various question types.
It improves the accuracy and efficiency of test paper interpretation, reduces labor costs, is compatible with various question types and can handle questions spread across multiple pages, and avoids the subjective influence of human grading.
Smart Images

Figure CN118942099B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and in particular to a method and apparatus for intelligent interpretation of test papers based on OCR algorithms. Background Technology
[0002] The Optical Character Recognition (OCR) exam paper intelligent interpretation method includes OCR algorithms and image analysis algorithms. However, OCR algorithms cannot analyze the entire exam paper layout to obtain answers to all questions. Specifically, current exam paper interpretation methods face the following problems: 1. Exam papers often contain noise, such as Gaussian noise, large black block noise, and rectangular box noise, which can affect the recognition results. 2. The order and number of different question types vary within the exam paper; aligning the recognized questions with their corresponding question types is a challenge. 3. Exam papers contain various question types, including multiple choice, true / false, fill-in-the-blank, and short answer questions. Each question type has different answering methods; processing all question types is also a challenge.
[0003] Based on the above problems, there is an urgent need for a new intelligent test paper reading method to improve the accuracy of test paper reading results. Summary of the Invention
[0004] The purpose of this invention is to provide a method and device for intelligent test paper interpretation based on OCR algorithm, which can improve the accuracy and efficiency of test paper interpretation.
[0005] To achieve the above objectives, this invention provides a method for intelligent interpretation of test papers based on an OCR algorithm, comprising:
[0006] Obtain a scanned image of the answer sheet of the test paper to be graded and a standard answer template of the test paper to be graded; the standard answer template includes multiple arrays, each array corresponding to a question, and each array includes the question number, the type of question to which the question belongs, the answer to the question, the number of options for the question, the score of the question, and the question number of the question.
[0007] The scanned image of the answer sheet is sequentially subjected to noise reduction and segmentation processing to obtain multiple answer rectangles;
[0008] The question types and order of multiple answer rectangles are aligned with the standard answer template, and an OCR algorithm is used to identify the question type corresponding to each answer rectangle; the question types include objective questions and subjective questions.
[0009] For objective questions, the candidate's objective answer for each question is determined based on the gray value of each option in the answer rectangle of each question. The candidate's objective answer is then compared with the corresponding answer in the standard answer template to determine the score for each question in the objective questions.
[0010] For subjective questions, an OCR algorithm is used to identify the candidate's subjective answers for each sub-question within the answer rectangle of the subjective question.
[0011] For any sub-question in the subjective questions, a pre-trained Siamese network is used to determine the semantic similarity between the candidate's subjective answer to the sub-question and the corresponding sub-question answer in the standard answer template, so as to obtain the score for the corresponding sub-question;
[0012] The total score of the scanned answer sheet image is determined based on the scores of each sub-question.
[0013] To achieve the above objectives, the present invention also provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above method.
[0014] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects: The present invention first performs noise reduction and segmentation processing on the scanned image of the answer sheet to better recognize characters. Then, it aligns the layout of the scanned image of the answer sheet with the standard answer template. Finally, it identifies each question in the scanned image of the answer sheet. For the recognition results, objective questions are scored directly using string comparison, while subjective questions are scored using semantic analysis and semantic similarity calculation. This greatly reduces manual costs and is not affected by human subjective grading. It can also be compatible with various question types and can handle objective questions with different numbers of options and questions distributed across multiple pages, thus improving the accuracy and efficiency of grading. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 The flowchart shows the intelligent test paper interpretation method based on OCR algorithm provided by this invention.
[0017] Figure 2 This is a flowchart of the noise reduction and segmentation process for scanned images of answer sheets.
[0018] Figure 3This is a schematic diagram of a scanned image of an answer sheet.
[0019] Figure 4 This is a flowchart for aligning the answer rectangle with the standard answer template.
[0020] Figure 5 This is a diagram showing the arrangement of the answer rectangles.
[0021] Figure 6 This is a diagram of the candidate information area.
[0022] Figure 7 This is a schematic diagram of the answer rectangle before correction.
[0023] Figure 8 This is a schematic diagram of the corrected answer rectangle.
[0024] Figure 9 This is a schematic diagram of the basic structure of a twin network.
[0025] Figure 10 This is a diagram of the internal structure of a computer device. Detailed Implementation
[0026] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0027] The purpose of this invention is to provide a test paper intelligent interpretation method and device based on OCR algorithm. Based on OCR algorithm, image analysis algorithm and semantic analysis algorithm, it fully considers various test paper formats and question types, and performs customized analysis for each question type. It can align all recognition results with question numbers and finally accurately obtain the answer and score of each question.
[0028] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0029] like Figure 1 As shown, the intelligent test paper interpretation method based on OCR algorithm provided by this invention includes:
[0030] S1: Obtain the scanned image of the answer sheet of the exam paper to be graded and the standard answer template of the exam paper to be graded. A PDF document is obtained by scanning the answer sheet, and then the PDF document is converted into multiple RGB color images, i.e., the scanned images of the answer sheet.
[0031] Specifically, the standard answer template includes multiple arrays, each corresponding to a sub-question. Each array includes the sub-question number, the type of the main question to which the sub-question belongs, the sub-question answer, the number of sub-question options, the sub-question score, and the main question number. The standard answer template is a JSON file. The order of the sub-questions in the standard answer template is consistent with the order of the sub-questions on the answer sheet.
[0032] Taking a major question as an example where each major question includes one sub-question, the JSON format of the standard answer template is as follows:
[0033] {"sort": 1, "questionType": "single choice question", "answer": ["C"], "optionNumber": 4, "questionScore": 2.0, "questionTypeSort": 1};
[0034] {"sort": 1, "questionType": "multiple choice question", "answer": ["A", "B", "C", "D"], "optionNumber": 4, "questionScore": 2.0, "questionTypeSort": 2};
[0035] {"sort": 1, "questionType": "True or False", "answer": ["0"], "optionNumber": 2, "questionScore": 1.0, "questionTypeSort": 3};
[0036] {"sort":1","questionType":"fill-in-the-blank","answer":["five years","ten years"]","optionNumber":2","questionScore":1.0","questionTypeSort":4};
[0037] {"sort":1","questionType":"Question and Answer","answer":["Wireless communication devices can become secondary transmission devices"]","optionNumber":1","questionScore":4.0","questionTypeSort":5}.
[0038] Among them, the field "sort" represents the sequence number of each sub-question, the field "questionType" represents the type of major question to which the sub-question belongs, the field "answer" represents the answer to the sub-question, the field "optionNumber" represents the number of options for the sub-question (if it is a fill-in-the-blank question, it represents the number of blanks to fill in, and if it is a short answer question, this value is always 1), the field "questionScore" represents the score of the sub-question, and the field "questionTypeSort" represents the question number of the major question.
[0039] S2: The scanned image of the answer sheet is sequentially denoised and segmented to obtain multiple answer rectangles.
[0040] Specifically, this step involves denoising the exam paper layout. Before intelligently interpreting the exam paper, the scanned answer sheet image needs to be denoised. Because each candidate's answers are different, the angle at which the answer sheet is placed during scanning may vary slightly, and the scanning effect of different scanners can all generate noise in the scanned image of the answer sheet. This noise includes Gaussian noise, large black block noise, and rectangular frame noise. This invention performs a series of operations on the answer sheet, including grayscale conversion, Gaussian filtering, edge detection, rectangular frame extraction, and rectangular frame filtering, to remove noise. Figure 2 As shown, S2 specifically includes the following steps:
[0041] S21: Convert the scanned image of the answer sheet into a grayscale image.
[0042] S22: Perform Gaussian filtering on the grayscale image to obtain the filtered image. Specifically, a 7×7 filter kernel is used to perform a convolution operation on the grayscale image. The filter kernel is used as the weight, multiplied by the corresponding pixel, and then added together. The result is the filtered image, which can effectively remove edge noise from the grayscale image.
[0043] S23: Perform edge detection on the filtered image to determine the edge information of the answer box, and use a double threshold algorithm to convert the edge information into a binary image.
[0044] In this embodiment, Canny edge detection is performed on the filtered image. The edges of the large bounding box are determined by calculating the magnitude and direction of the gradient of the filtered image. The final edge information is determined by a double threshold algorithm and stored in a binary image.
[0045] S24: The closed contours in the binary graph are extracted using the connected component algorithm to obtain multiple closed contours.
[0046] S25: Determine the minimum bounding rectangle of each closed contour to obtain multiple minimum bounding rectangles. Specifically, for any closed contour, calculate the convex hull of the contour point set of the closed contour. Use a rotating caliper algorithm to determine the minimum bounding rectangle of the convex hull to obtain the minimum bounding rectangle of the closed contour.
[0047] S26: Based on the area, length, and width of each minimum bounding rectangle, filter the multiple minimum bounding rectangles to obtain the answer rectangle. Specifically, filter the minimum bounding rectangles whose area is less than a set area threshold and whose length and width are both less than set length and width thresholds to obtain multiple candidate rectangles. Select the non-overlapping candidate rectangles and the candidate rectangle with the largest area among the overlapping candidate rectangles as the answer rectangle.
[0048] In this embodiment, by traversing all the minimum bounding rectangles, the minimum bounding rectangles with an area less than 5000 and a length and width of less than 40 pixels are identified as noise rectangles, and the area method is used to filter them. Then, the remaining candidate rectangles are traversed, and overlapping candidate rectangles are filtered out using the intersection area method, retaining the candidate rectangles with larger areas as the answer rectangles.
[0049] S3: Align the question types and order of multiple answer rectangles with the standard answer template, and use an OCR algorithm to identify the question type corresponding to each answer rectangle. The question types include objective questions and subjective questions. Objective questions include single-choice, multiple-answer, and multiple-selection questions. Subjective questions include fill-in-the-blank and short-answer questions.
[0050] Specifically, after obtaining all the answer rectangles, since the question types are in different orders on different answer sheets and the number of sub-questions in each major question is also different, and each major question may be distributed on different pages of the answer sheet, aligning the answer rectangles with the question types is also a challenge. This invention first designed a standard answer template and used the question types on the standard answer template to align with the answer rectangles.
[0051] like Figure 3The image shown is an example of an actual answer sheet. This answer sheet consists of a candidate information area and a question area. All candidate information and questions are represented by black hollow rectangles. The candidate information area is located at the top of the first page of the answer sheet and consists of three rectangles of the same height arranged side-by-side, displaying the candidate's name, candidate number, and instructions. The remaining area is the question area, which contains five sections: multiple choice, true / false, fill-in-the-blank, and short answer. Each section contains several sub-questions. Multiple choice, true / false, and fill-in-the-blank questions are represented by small rectangles that need to be filled in, indicating that the candidate has selected the correct option. Fill-in-the-blank and short answer questions require candidates to fill in their answers on the lines within the rectangles. Each sub-question in the short answer section is represented by a rectangle. The question type for each section is indicated in the upper left corner of the rectangle. For short answer questions, only the upper left corner of the first rectangle displays the question type; the upper left corners of the other rectangles do not. The short answer section is the last section.
[0052] like Figure 4 As shown, S3 specifically includes the following steps:
[0053] S31: Group the array in the standard answer template according to the question type to which the sub-question belongs, so that the question type and question order of multiple answer rectangles are aligned with the question type and question order in the standard answer template.
[0054] Specifically, sub-questions belonging to the same major question are grouped together. Since the order of sub-questions in the standard answer template is consistent with the order of sub-questions in the answer rectangle, the order of the answer rectangle can be aligned with the order of major questions in the standard answer template in the order of multiple choice, true / false, fill-in-the-blank, and short answer.
[0055] Furthermore, since the answer sheet has multiple pages, and the divided answer rectangles are arranged from top to bottom on the original answer sheet page, such as... Figure 5 As shown, the answer rectangles are arranged in order from 1 to 5, which corresponds to the order of the major questions in the standard answer template. Next, retrieve the answer rectangle located in the candidate information area and sort it according to the horizontal axis of the answer sheet. The second rectangle is the candidate number box, as shown below. Figure 6 As shown. Take all the answer rectangles from the fourth to the last, and sort them according to the vertical axis.
[0056] S32: Use the four-point correction method to correct each answer rectangle.
[0057] like Figure 7 As shown, since the answer sheets are placed and scanned manually, each answer sheet will be slightly tilted, resulting in a certain angle between the answer rectangle and the horizontal direction. In order to ensure the accuracy of OCR recognition, it is necessary to correct it.
[0058] (1) As shown in Figure 7 , edge detection is performed on the answer sheet to obtain the four vertex coordinates of the answer rectangle: top-left, bottom-left, top-right and bottom-right.
[0059] (2) The maximum value of the horizontal coordinate distance between the top-left vertex and the top-right vertex and the horizontal coordinate distance between the bottom-left vertex and the bottom-right vertex is selected as the width maxWidth of the corrected image, and the maximum value of the vertical coordinate distance between the top-left vertex and the bottom-left vertex and the vertical coordinate distance between the top-right vertex and the bottom-right vertex is selected as the height maxHeight of the corrected image.
[0060] (3) The four coordinate points of the image are constructed using the height and width of the corrected image, which are (0,0), (maxWidth-1,0), (maxWidth-1,maxHeight-1), and (0,maxHeight-1) in clockwise order from top-left, top-right, bottom-right, and bottom-left.
[0061] (4) A reflection transformation matrix is calculated according to the above two sets of coordinates.
[0062] (5) The reflection transformation matrix is used to perform reflection transformation on the original answer box image to obtain the corrected image, as shown in Figure 8 .
[0063] S33: Extend the top-left corner of each corrected answer rectangle respectively to obtain a plurality of extended answer rectangles; the extended answer rectangles include a question type text area and an answer area.
[0064] S34: An OCR algorithm is used to recognize the text in the question type text area in each extended answer rectangle, so as to determine the major question type corresponding to each answer rectangle.
[0065] Further, in order to prevent some characters that are relatively difficult to judge from not being recognized, separate rules are set up here according to different question types to judge whether it is the corresponding question type: as long as the character "single" is recognized, it is determined as a single-choice question; when the character "multiple" is recognized, it is determined as a multiple-choice question; when the character "judge" or "judgment" is recognized, it is determined as a true / false question; when the character "fill" or "blank" is recognized, it is determined as a fill-in-the-blank question; when the character "question" or "answer" is recognized, it is determined as a question-and-answer question; if none of the characters is recognized, it means that the question type of the current answer rectangle is the same as that of the previous answer rectangle, and it can be directly merged with the previous answer rectangle.
[0066] S4: For objective questions, the examinee's objective answers corresponding to each sub-question are determined according to the gray value at each option of each sub-question in the answer rectangle of the objective question, and the examinee's objective answers are compared with the corresponding sub-question answers in the standard answer template to determine the score of each sub-question in the objective question.
[0067] Specifically, for any sub-question within the answer rectangle of the objective questions, the option with a grayscale value less than the empirical value is taken as the candidate's objective answer for that sub-question. First, the position of each option is marked, and the average grayscale value of all option boxes is obtained. Then, it is compared with the empirical value; the smaller the grayscale value, the more likely the option is to be highlighted. If the grayscale value is less than the empirical value, the candidate has selected that option; otherwise, no option has been selected. For single-choice and true / false questions, candidates are only allowed to select one option.
[0068] Since the answer sheet contains various types of questions, and the answering methods for each type of question are different, for multiple choice, true / false, and other questions, candidates need to blacken the answer options on the answer sheet. However, there are some difficulties. For example, the number of options for each multiple choice question is not the same, and there are multiple candidate answers. For fill-in-the-blank questions, it is necessary to determine the range of blanks for each question. In order to improve the accuracy of OCR recognition, this invention recognizes each blank separately.
[0069] S5: For subjective questions, an OCR algorithm is used to identify the candidate's subjective answers for each sub-question in the answer rectangle of the subjective question.
[0070] For fill-in-the-blank questions, the blank area within the answer rectangle is first segmented according to the number of questions in the standard answer template. OCR recognition is then performed on each segmented blank area, and the recognition result represents the answer entered by the test-taker. For open-ended questions, the entire answer rectangle is directly subjected to OCR recognition, and the recognition result represents the answer entered by the test-taker.
[0071] S6: For any sub-question in the subjective questions, a pre-trained Siamese network is used to determine the semantic similarity between the candidate's subjective answer to the sub-question and the corresponding sub-question answer in the standard answer template, so as to obtain the score of the corresponding sub-question.
[0072] Specifically, the answers identified for fill-in-the-blank and open-ended questions undergo semantic vectorization: character text data is converted into numerical data vectors that machines can understand, called sentence vectors. Semantic vectors are generated using Siamese networks; sentences with similar semantics also produce similar vectors. The basic structure of a Siamese network is as follows: Figure 9 As shown, Siamese Network is a network framework used to measure the similarity between two inputs. It uses the BERT model as the backbone network. During training, each input consists of two sentences. If the two sentences are semantically similar, their label is 1; otherwise, it is 0. The BERT model is then used to calculate the sentence vectors, and the cosine distance is used to calculate the similarity between the two sentence vectors. The similarity is then compared with the label to calculate the loss for training.
[0073] In this embodiment, the candidate's subjective answer and the corresponding answer in the standard answer template are input into the BERT model, respectively. The candidate's subjective answer and the corresponding answer in the standard answer template share the same BERT model parameters, resulting in sentence vectors for both the candidate's answer and the standard answer. Then, the cosine distance between the sentence vectors of the candidate's answer and the standard answer is calculated as the semantic similarity between the candidate's subjective answer and the corresponding answer in the standard answer template, thereby obtaining the score for that question. The calculation formula is as follows:
[0074]
[0075] Where s1 is the sentence vector of the candidate's answer, s2 is the sentence vector of the standard answer, n is the number of words in the sentence vector, and s 1i Let s be the i-th word in the vector of the candidate's answer sentence. 2i Let i be the i-th word in the standard answer sentence vector.
[0076] S7: Determine the total score of the scanned image of the answer sheet based on the scores of each question.
[0077] This invention employs a step-by-step pipeline approach to process answer sheets. First, the answer sheet layout is denoised to improve character recognition. Then, the answer sheet layout is aligned. Finally, each question on the answer sheet is identified. For the recognition results, objective questions are scored using string comparison, while subjective questions are scored using semantic analysis and semantic similarity calculation. It can receive PDF scans of candidate answer sheets in real time, processing each PDF document in less than 2 seconds, and can process multiple documents in parallel, significantly reducing manual costs and being unaffected by human subjective grading. It is also compatible with various question types, including multiple choice, true / false, fill-in-the-blank, and short answer questions, and can handle objective questions with varying numbers of options, as well as questions spread across multiple pages. Through intelligent test paper interpretation, it provides users with an efficient and fast fully automated method for grading test papers, helping to improve the accuracy and efficiency of grading.
[0078] In one embodiment, a computer device is provided, which may be a database, and its internal structure diagram may be as follows: Figure 10As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores pending transactions. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network. When executed by the processor, the computer program implements an intelligent test paper interpretation method based on an OCR algorithm.
[0079] In one embodiment, a computer device is also provided, including a memory and a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in the above-described intelligent test paper interpretation method based on the OCR algorithm.
[0080] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-described intelligent test paper interpretation method based on the OCR algorithm.
[0081] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described intelligent test paper interpretation method based on the OCR algorithm.
[0082] It should be noted that the object information (including but not limited to object device information, object personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the object or fully authorized by all parties, and the collection, use and processing of related data must comply with relevant laws, regulations and standards.
[0083] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0084] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0085] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for intelligent interpretation of test papers based on OCR algorithm, characterized in that, The intelligent test paper interpretation method based on OCR algorithm includes: Obtain a scanned image of the answer sheet of the test paper to be graded and a standard answer template of the test paper to be graded; the standard answer template includes multiple arrays, each array corresponding to a question, and each array includes the question number, the type of question to which the question belongs, the answer to the question, the number of options for the question, the score of the question, and the question number of the question. The scanned image of the answer sheet is sequentially subjected to noise reduction and segmentation processing to obtain multiple answer rectangles; Aligning the question types and order of multiple answer rectangles with the standard answer template, and using an OCR algorithm to identify the question type corresponding to each answer rectangle, specifically includes: grouping the array in the standard answer template according to the question type of each sub-question, so that the question types and order of the multiple answer rectangles are aligned with the question types and order in the standard answer template; correcting each answer rectangle using a four-point correction method; expanding the upper left corner of each corrected answer rectangle to obtain multiple expanded answer rectangles; each expanded answer rectangle includes a question type text area and an answer area; using an OCR algorithm to identify the text in the question type text area of each expanded answer rectangle to determine the question type corresponding to each answer rectangle; the question types include objective questions and subjective questions; For objective questions, the candidate's objective answer for each question is determined based on the gray value of each option in the answer rectangle of each question. The candidate's objective answer is then compared with the corresponding answer in the standard answer template to determine the score for each question in the objective questions. For subjective questions, an OCR algorithm is used to identify the candidate's subjective answers for each sub-question within the answer rectangle of the subjective question. For any sub-question in the subjective questions, a pre-trained Siamese network is used to determine the semantic similarity between the candidate's subjective answer to the sub-question and the corresponding sub-question answer in the standard answer template, so as to obtain the score for the corresponding sub-question; The total score of the scanned answer sheet image is determined based on the scores of each sub-question.
2. The intelligent test paper interpretation method based on OCR algorithm according to claim 1, characterized in that, The standard answer template is a JSON file.
3. The intelligent test paper interpretation method based on OCR algorithm according to claim 1, characterized in that, The scanned image of the answer sheet is sequentially subjected to denoising and segmentation processing to obtain multiple answer rectangles, specifically including: Convert the scanned image of the answer sheet to a grayscale image; The grayscale image is subjected to Gaussian filtering to obtain the filtered image; Edge detection is performed on the filtered image to determine the edge information of the answer box, and the edge information is converted into a binary image using a double threshold algorithm; The closed contours in the binary graph are extracted using a connected component algorithm, resulting in multiple closed contours. Determine the minimum bounding rectangle for each closed contour to obtain multiple minimum bounding rectangles; Based on the area, length, and width of each minimum bounding rectangle, multiple minimum bounding rectangles are filtered to obtain the answer rectangle.
4. The intelligent test paper interpretation method based on OCR algorithm according to claim 3, characterized in that, Determine the minimum bounding rectangle for each closed contour, specifically including: For any closed contour, calculate the convex hull of the contour point set of the closed contour; The minimum bounding rectangle of the convex hull is determined by a rotating caliper algorithm, so as to obtain the minimum bounding rectangle of the closed contour.
5. The intelligent test paper interpretation method based on OCR algorithm according to claim 3, characterized in that, Based on the area, length, and width of each minimum bounding rectangle, multiple minimum bounding rectangles are filtered to obtain the answer rectangle, specifically including: The smallest bounding rectangle whose area is smaller than the set area threshold and whose length and width are both smaller than the set length and width thresholds is used to obtain multiple candidate rectangles. The non-overlapping candidate rectangles and the candidate rectangle with the largest area among the overlapping candidate rectangles are used as the answer rectangles.
6. The intelligent test paper interpretation method based on OCR algorithm according to claim 1, characterized in that, Based on the grayscale value of each option in the answer rectangle for each objective question, determine the candidate's objective answer for each question, specifically including: For any sub-question in the answer rectangle of the objective questions, the option with a gray value less than the empirical value is taken as the candidate's objective answer for the corresponding sub-question.
7. The intelligent test paper interpretation method based on OCR algorithm according to claim 1, characterized in that, The twin network is a BERT model.
8. The intelligent test paper interpretation method based on OCR algorithm according to claim 1, characterized in that, The objective questions include single-choice, multiple-choice, and multiple-response questions; the subjective questions include fill-in-the-blank and short-answer questions.
9. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the method according to any one of claims 1-8.
Citation Information
Patent Citations
Method and system for calculating scores of test paper
CN101901338A
A designer and a design method for a test question and a test paper structure
CN109241508A
