Test paper analysis method, device, storage medium and electronic equipment
Through the pre-trained question number level classification detection model and image recognition model, question number recognition and level detection are performed on the test paper images, which solves the problem that the existing technology cannot handle multiple formats of test papers, realizes a more general test paper analysis method, and improves Improve the efficiency of test paper correction in electronic teaching.
Patent Information
- Application Number
- CN202110351442.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-31
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-03-31
AI Technical Summary
Existing optical character recognition technology can only handle fixed templates or fixed format test papers in test paper analysis, and cannot adapt to test papers in multiple formats, resulting in analysis errors or inability to analyze.
Through the pre-trained question number level classification detection model and image recognition model, the question number recognition, level detection and segmentation of the test paper image are performed, the test paper layout content is generated, and the analysis of various formats of test papers is realized.
It does not rely on fixed templates or fixed formats, improves the efficiency of test paper correction in electronic teaching, and is suitable for multi-disciplinary and multi-format photo test paper layout analysis.
Smart Images

Figure CN113177435B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of electronic teaching, and in particular, to a test paper analysis method, device, storage medium and electronic equipment. Background Art
[0002] With the development of computer and Internet technology, more and more people use electronic devices to mark students' test papers. In related technologies, test paper analysis usually uses ORC (Optical Character Recognition) to recognize and analyze test paper characters. This solution can usually only analyze test papers with fixed templates or fixed formats, that is, it can only match the test paper with the preset templates stored in the system, and use the matched template for analysis. However, in actual applications, due to the variety of test paper formats, using OCR for test paper analysis will result in analysis errors or failure to analyze. Summary of the invention
[0003] In order to solve the above problems, the present disclosure provides a test paper analysis method, device, storage medium and electronic device.
[0004] In a first aspect, the present disclosure provides a test paper analysis method, the method comprising:
[0005] Perform question number recognition on the test paper image of the target test paper, obtain one or more question numbers in the test paper image, and obtain the question number text, question number image and question number position of each question number;
[0006] Input the question number text, the question number image and the question number position into a pre-trained question number level classification detection model to obtain the question number level of each question number;
[0007] Segment the test paper image according to the question number level and the question number position to obtain a target question area for each question number;
[0008] Input the target question area of each question number into the pre-trained first image recognition model to obtain question information of the question number;
[0009] The test paper layout content of the target test paper is generated according to the question number, the question number level and the question information.
[0010] Optionally, the question number level classification detection model includes an encoding network and a decoding network, the encoding network includes a text encoding network and a first residual network ResNet; the question number text, the question number image and the question number position are input into the question number level classification detection model to obtain the question number level of each question number, including:
[0011] Inputting the question number text into the text encoding network to obtain a question number text vector;
[0012] Inputting the question number image into the first residual network ResNet to obtain a question number image vector;
[0013] Performing position encoding on the question number position to obtain a question number position vector;
[0014] The question number text vector, the question number image vector and the question number position vector are input into the decoding network to obtain the question number level of each question number.
[0015] Optionally, the convolution layer of the first residual network ResNet is a depth-separable convolution, and the network depth of the first residual network ResNet is 18.
[0016] Optionally, the text encoding network includes a Transformer network or a Word2vec network.
[0017] Optionally, before obtaining the test paper layout content according to the question number, the question number level and the question information, the method further includes:
[0018] Encode the question number according to the question number level to obtain a digital code for the question number;
[0019] sorting the question numbers according to their positions;
[0020] For each question number after sorting, confirm whether the digital code of the question number is continuous with the digital code of the adjacent question number; if it is confirmed that the digital code of the question number is not continuous with the digital code of the adjacent question number, correct the question number according to the adjacent question number to obtain a corrected question number;
[0021] Generating the test paper layout content of the target test paper according to the question number, the question number level and the question information includes:
[0022] The test paper layout content of the target test paper is generated according to the corrected question number, the question number level and the question information.
[0023] Optionally, before inputting the target question area of each question number into the pre-trained first image recognition model to obtain the question information of the question number, the method further includes:
[0024] Inputting the target test paper image into a pre-trained second image recognition model to obtain one or more candidate question areas;
[0025] For each question number, among the one or more candidate question regions, obtain the first candidate question region with the highest degree of position overlap with the target question region of the question number;
[0026] When the position overlap is less than or equal to a preset overlap threshold, modifying the target topic area according to the first candidate topic area;
[0027] The step of inputting the target topic area of each topic number into the pre-trained first image recognition model to obtain topic information of the topic number includes:
[0028] The corrected target question area is input into the pre-trained first image recognition model to obtain the question information of the question number.
[0029] Optionally, the question information includes one or more of graphics, text, tables, formulas, answer areas and question scores.
[0030] Optionally, before the question number recognition is performed on the test paper image of the target test paper, the method further includes:
[0031] Acquire an original image of the target test paper, wherein the original image includes a background area image and a test paper area image;
[0032] Performing edge detection on the original image through an edge detection model to obtain edge information of the target test paper;
[0033] Determine the test paper area image from the original image according to the edge information;
[0034] The test paper image is acquired according to the test paper area image.
[0035] Optionally, performing edge detection on the original image by using an edge detection model to obtain edge information of the target test paper includes:
[0036] Inputting the original image into a pre-trained edge detection model to obtain an edge feature image of the target test paper;
[0037] The edge information of the target test paper is obtained from the edge feature image.
[0038] Optionally, acquiring the test paper image according to the test paper area image includes:
[0039] Performing perspective transformation on the test paper area image to obtain the test paper image.
[0040] Optionally, before performing edge detection on the original image by using an edge detection model, the method further includes:
[0041] Inputting the original image into a second residual network ResNet to obtain the text direction of the original image, wherein the second residual network ResNet model is pre-trained according to sample original image data;
[0042] In the case where the text direction is not a preset direction, rotating the original image according to the text direction so that the text direction of the rotated original image is the preset direction;
[0043] The performing edge detection on the original image by using an edge detection model comprises:
[0044] The edge detection model is used to perform edge detection on the rotated original image.
[0045] Optionally, the second residual network ResNet includes a convolutional block attention module.
[0046] In a second aspect, the present disclosure provides a test paper analysis device, the device comprising:
[0047] The question number recognition module is used to recognize the question number of the test paper image of the target test paper, obtain one or more question numbers in the test paper image, and obtain the question number text, question number image and question number position of each question number;
[0048] A question number level detection module, used to input the question number text, the question number image and the question number position into a pre-trained question number level classification detection model to obtain the question number level of each question number;
[0049] A question area acquisition module, used to segment the test paper image according to the question number level and the question number position, and obtain a target question area for each question number;
[0050] A question information acquisition module, used for inputting a target question area of each question number into a pre-trained first image recognition model to obtain question information of the question number;
[0051] The test paper layout content generating module is used to generate the test paper layout content of the target test paper according to the question number, the question number level and the question information.
[0052] In a third aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in the first aspect of the present disclosure.
[0053] In a fourth aspect, the present disclosure provides an electronic device, comprising: a memory on which a computer program is stored; and a processor for executing the computer program in the memory to implement the steps of the method described in the first aspect of the present disclosure.
[0054] By adopting the above technical scheme, the test paper image of the target test paper is subjected to question number recognition, one or more question numbers in the test paper image are obtained, and the question number text, question number image and question number position of each question number are obtained; the question number text, the question number image and the question number position are input into the pre-trained question number level classification detection model to obtain the question number level of each question number; the test paper image is segmented according to the question number level and the question number position to obtain the target question area of each question number; the target question area of each question number is input into the pre-trained first image recognition model to obtain the question information of the question number; the test paper layout content of the target test paper is generated according to the question number, the question number level and the question information. In this way, there is no need to rely on fixed templates or fixed formats, and test papers of various formats can be analyzed, thereby improving the efficiency of test paper grading in electronic teaching.
[0055] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:
[0057] Figure 1 is a flow chart of a test paper analysis method provided by an embodiment of the present disclosure;
[0058] Figure 2 is a flow chart of another test paper analysis method provided by an embodiment of the present disclosure;
[0059] Figure 3 is a flow chart of another test paper analysis method provided by an embodiment of the present disclosure;
[0060] Figure 4 is a structural schematic diagram of a test paper analysis device provided by an embodiment of the present disclosure;
[0061] Figure 5 is a structural schematic diagram of another test paper analysis device provided by an embodiment of the present disclosure;
[0062] Figure 6 is a structural schematic diagram of another test paper analysis device provided by an embodiment of the present disclosure;
[0063] Figure 7 is a structural schematic diagram of another test paper analysis device provided by an embodiment of the present disclosure;
[0064] Figure 8 is a block diagram of an electronic device provided by an embodiment of the present disclosure;
[0065] Fig. 9is a block diagram of another electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0066] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.
[0067] It should be noted that, in the present disclosure, words such as "first" and "second" are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order; terms such as "S101", "S102", "S201", "S202", etc. are used to distinguish steps, and do not have to be understood as performing method steps in a specific order or sequential order; when the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements.
[0068] First, the application scenario of the present disclosure is described. The present disclosure can be applied to the field of electronic teaching, especially the analysis application of electronic image test papers obtained by taking photos or scanning in electronic teaching. However, in actual applications, the formats of test papers are various, and the use of conventional OCR to analyze test papers according to fixed templates or fixed formats will result in analysis errors or failure to analyze. For example, when analyzing test papers in related technologies, the question number level is generally determined according to the preset question number format level correspondence relationship, for example, the question number in Chinese character number format is level one; the question number in Arabic number format is level two; the question number in bracketed Arabic number format is level three. However, the actual test paper is not necessarily set according to this preset question number format level correspondence relationship. For example, the actual test paper can also have question numbers in Roman numeral format. At this time, the use of the preset question number format level correspondence relationship cannot determine the question number level of this type of test paper, which will cause the test paper analysis to be wrong or unable to analyze.
[0069] In order to solve the above problems, the present disclosure provides a test paper analysis method, device, storage medium and electronic device, which obtains the question number level of each question number through a pre-trained question number level classification detection model, and segments the test paper image according to the question number level and the question number position to obtain the target question area of each question number; inputs the target question area of each question number into the pre-trained first image recognition model to obtain the question information of the question number; and generates the test paper layout content of the target test paper according to the question number, the question number level and the question information. Thus, it no longer relies on fixed templates or fixed formats, and realizes a more universal comprehensive solution for test paper layout analysis, which can adapt to the layout analysis of multi-disciplinary and multi-format photographed test papers in primary and secondary schools, and improves the efficiency of test paper correction in electronic teaching.
[0070] The specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0071] Figure 1 A test paper analysis method provided by the embodiment of the present disclosure is as follows: Figure 1 As shown, the method may include:
[0072] S101. Perform question number recognition on the test paper image of the target test paper, obtain one or more question numbers in the test paper image, and obtain the question number text, question number image and question number position of each question number.
[0073] The test paper image may be an image obtained by a user taking a photo or scanning the test paper, and the test paper image includes one or more questions. For example, the test paper image is obtained by a user taking a photo with a mobile phone.
[0074] There are many ways to identify the question number of the test paper image, for example:
[0075] Method 1: The text in the test paper image can be recognized through OCR recognition technology to obtain multiple text lines; a candidate text line starting with a preset question number format text is obtained from the multiple text lines, and the preset question number format text is used as the question number text; the position vector of the preset question number format text in the two-dimensional plane space of the test paper image is used as the question number position; the image of the area corresponding to the preset question number format document is used as the question number image.
[0076] The preset question number format text may include one or more of Arabic numeral format, Chinese numeral format, Roman numeral format, Arabic numeral format with brackets, and Chinese numeral format with brackets.
[0077] Method 2: The test paper image can be input into a pre-trained question number detection model, and question numbers can be recognized through the question number detection model to obtain one or more question numbers in the test paper image, and obtain the question number text, question number image and question number position of each question number.
[0078] Among them, the question number detection model can be a model trained by question number detection sample data, which is used for question number recognition.
[0079] S102, input the question number text, the question number image and the question number position into a pre-trained question number level classification detection model to obtain the question number level of each question number.
[0080] Among them, the question level classification detection model can be a convolutional neural network (CNN), which can be pre-trained through visual features based on sample data.
[0081] S103, segmenting the test paper image according to the question number level and the question number position, and obtaining a target question area for each question number.
[0082] In this step, the questions can be grouped according to their levels, and each group of questions can be sorted according to their positions before being segmented. The specific steps are as follows:
[0083] First of all, the questions can be divided into first-level, second-level and third-level questions according to their levels.
[0084] Secondly, all the first-level question numbers are taken as the target question numbers, and after the test paper image is segmented according to the preset segmentation method, the target question area of each target question number is obtained. The preset segmentation method may include: sorting the target question numbers according to the question number position; traversing all the target question numbers in order from top to bottom and obtaining the target question area of the question number, for example, according to the question number position of the first target question number, the text line where the first target question number is located is obtained as the first starting line; according to the question number position of the second target question number adjacent to the first target question number and located below, the previous line of the text line where the second target question number is located is obtained as the first ending line, so that the test paper image area from the first starting line to the first ending line can be used as the first target question area corresponding to the first target question number; according to the same method, the second target question area of the second target question number can be obtained until the last target question number. It should be noted that the target question area corresponding to the last target question number of the test paper can use the end line of the test paper as the ending line.
[0085] Again, according to the position of the second-level question number, obtain one or more subordinate second-level question numbers in the target question area of each first-level question number; similarly, use the subordinate second-level question number as the target question number, segment the test paper image according to the above-mentioned preset segmentation method, and obtain the target question area for each target question number.
[0086] Finally, according to the position of the third-level question number, one or more subordinate third-level question numbers in the target question area of each second-level question number are obtained. The subordinate third-level question number is also used as the target question number. After the test paper image is segmented according to the above-mentioned preset segmentation method, the target question area for each target question number is obtained.
[0087] It should be noted that this embodiment uses level one to level three question numbers as examples, but the present disclosure does not limit the number of question number levels. If the test paper includes more question number levels such as level four and level five, the test paper image can be segmented in the same way to obtain the target question area for each question number.
[0088] In this way, the test paper image can be segmented according to the question number level and question number position, and the target question area of each question number can be accurately obtained.
[0089] S104, inputting the target question area of each question number into the pre-trained first image recognition model to obtain question information of the question number.
[0090] The first image recognition model can be R-CNN (Region Convolutional Neural Networks). The R-CNN follows the idea of traditional target detection and also uses four steps of extracting frames, extracting features for each frame, image classification, and non-maximum suppression to perform target detection. However, in the step of extracting features, traditional feature extraction, such as SIFT (Scale-Invariant Feature Transform) and HOG (Histogram of Oriented Gradient), is replaced by feature extraction using a deep convolutional network, which improves the accuracy of target recognition.
[0091] Furthermore, the first image recognition model may include one or more of MaskR-CNN, CascadeR-CNN and FasterR-CNN.
[0092] Optionally, if the first image recognition model includes the above-mentioned multiple models, the multiple models can be detected in parallel to improve the efficiency of image recognition.
[0093] The question information detected by the first image recognition model may include one or more of the following: graphics, text, tables, formulas, answer areas (the answer areas can be divided into underline, brackets, handwriting + brackets, handwriting + underline, handwriting, etc.), question types (can be divided into multiple-choice questions, fill-in-the-blank questions, true-or-false questions, subjective questions, etc.), question options (divided into ABCDEF, etc.), handwritten correct or incorrect numbers (specifically two categories of handwritten correct or incorrect numbers), question scores, page numbers, student classes and student names, etc.
[0094] S105. Generate the test paper layout content of the target test paper according to the question number, the question number level and the question information.
[0095] The test paper layout content can store each question number, the question level corresponding to the question number, and the question information corresponding to the question number in the form of a database. Furthermore, the test paper layout content can be clearly displayed to teachers and students in a visual form, so that teachers can easily correct the test papers and students can review and review the correction results of the test papers.
[0096] By adopting the above method, the test paper image of the target test paper is subjected to question number recognition, one or more question numbers in the test paper image are obtained, and the question number text, question number image and question number position of each question number are obtained; the question number text, the question number image and the question number position are input into the pre-trained question number level classification detection model to obtain the question number level of each question number; the test paper image is segmented according to the question number level and the question number position to obtain the target question area of each question number; the target question area of each question number is input into the pre-trained first image recognition model to obtain the question information of the question number; the test paper layout content of the target test paper is generated according to the question number, the question number level and the question information. In this way, there is no need to rely on a fixed template or a fixed format, and test papers of various formats can be analyzed, thereby improving the efficiency of test paper grading in electronic teaching.
[0097] Figure 2 Another test paper analysis method provided by the embodiment of the present disclosure is as follows: Figure 2 As shown in the figure, due to the variety of test paper styles, the presentation of question numbers is not fixed. Figure 2 In the illustrated embodiment, the question level classification detection model may include an encoding network and a decoding network, wherein the encoding network includes a text encoding network and a first residual network ResNet; thus, the above step S102 may be implemented in the following manner:
[0098] S1021. Input the question number text into the text encoding network to obtain a question number text vector.
[0099] The text encoding network may include a Transformer network or a Word2vec network.
[0100] When the text encoding network is a Transformer network, only the encoding (Encoder) part of the Transformer network can be selected. Since the question number text is short and the correlation between text sequences is not important, the number of multi-head attention modules in the Encoder can be set to 2. Compared with the use of 8 multi-head attention modules in the related technology, it can reduce the amount of calculation and improve the operation efficiency.
[0101] Furthermore, in order to more fully extract text features, after the question number text is embedded through embedding to obtain the first text vector, one or more multi-head attention modules can be added to the channel dimension of the first text vector. For example, two multi-head attention modules can be added. In this way, the accuracy of text feature extraction can be improved and a more accurate question number text vector can be obtained. In addition, the question number text vector output by the Transformer network can be 512-dimensional.
[0102] When the text encoding network is a Word2vec network, the Word2vec network can be established in the following way:
[0103] First, a vocabulary including a preset question number format text can be established in the Word2vec model, and the preset question number format text can include one or more of Arabic numeral format, Chinese numeral format, Roman numeral format, Arabic numeral format with brackets, and Chinese numeral format with brackets. The vocabulary can include the digital codes corresponding to the above preset question number format text from the preset minimum number to the preset maximum number. For example, the vocabulary can include Chinese numerals from one to fifty, Roman numerals from one to fifty, Arabic numerals from one to one thousand, Arabic numerals from one to five hundred with brackets, etc.
[0104] Then, the Word2vec model can be trained based on the sample question number text data to obtain a Word2vec network. The input of the Word2vec network is the question number text, and the output is the question number text vector, which can be 512 dimensions.
[0105] S1022. Input the question number image into the first residual network ResNet to obtain a question number image vector.
[0106] Among them, the convolution layer of the first residual network ResNet is a depth-separable convolution, and the network depth of the first residual network ResNet is 18.
[0107] It should be noted that the network depth of ResNet generally has several typical depths of 18, 34, 50, 101 and 152. Here, a ResNet network with a depth of 18 is selected to meet the requirements of this relatively simple question number image feature extraction. In addition, the convolution layer in the related technology can also be replaced with a depthwise separable convolution. The depthwise separable convolution operation can be decomposed into two processes: depthwise convolution and pointwise convolution. That is, first, each channel of the question number image is convolved with a convolution kernel of size K×K, and the number of feature maps obtained is the same as the number of channels of the input question number image; then the above feature map is convolved through n 1×1×M (M is the number of channels of the previous layer, and n is the number of output channels) convolution kernels to obtain a new feature map of the question number, and finally a global average pooling layer is added to obtain a 1×n-dimensional feature vector. In this way, by replacing the traditional convolution method with a depthwise separable convolution, the size and amount of calculation of the model can be reduced while maintaining the effect of feature vector extraction, thereby improving the model operation efficiency.
[0108] For example, the depth convolution kernel size of the depthwise separable convolution may be 3×3, and the number of output channels N of the feature map of the question number image may be 512, so that a 512-dimensional question number image vector may be obtained through the residual network ResNet.
[0109] S1023. Perform position encoding on the question number position to obtain a question number position vector.
[0110] In this step, the question number position can be encoded using trigonometric functions to obtain a question number position vector. For example, the question number position can be encoded using sine and cosine functions, respectively, and the formula is as follows:
[0111] PE (pos,2i) =sin(pos / 10000 2i / d );
[0112] PE (pos,2i+1) =cos(pos / 10000 2i / d );
[0113] Among them, pos is the position of the question number, PE (pos,2i) and PE (pos,2i+1) Together they constitute the question number position vector after position encoding, i is each dimension of the question number position encoding, and d is the output dimension after position encoding, that is, the dimension of the output question number position vector.
[0114] For example, if pos is 3 and d is 512, the question number position vector obtained after position encoding according to the above formula can be [sin(3 / 10000 0 / 512 ), cos(3 / 10000 1 / 512 ), sin(3 / 10000 2 / 512 ), cos(3 / 10000 3 / 512 ), ..., sin(3 / 10000 510 / 512 ), cos(3 / 10000 511 / 512 )].
[0115] S1024. Input the question number text vector, the question number image vector and the question number position vector into the above decoding network to obtain the question number level of each question number.
[0116] It should be noted that the above-mentioned question number text vector, question number image vector and question number position vector can all be 512-dimensional vectors, and the above-mentioned decoding network can include a convolutional layer and a fully connected layer, so that a more accurate question number level can be obtained.
[0117] Through the above method, by combining text features, image visual features, and spatial position features, and using multimodal fusion to train deep learning models, the question level categories can be obtained more accurately; and through the application of the above network structure, while maintaining the accuracy of question level recognition, the size and amount of calculation of the model can be reduced, thereby improving the model's computing efficiency.
[0118] Figure 3 is another test paper analysis method provided by the embodiment of the present disclosure, such as Figure 3 As shown, the method may include:
[0119] S301, obtaining the original image of the target test paper.
[0120] The original image may include a background area image and a test paper area image. The original image may be an image uploaded by a user through a photo, or an image uploaded by a user through a scan.
[0121] S302: Perform image preprocessing on the original image.
[0122] It should be noted that, since the original images uploaded by users are in various forms and of varying quality, there will be some interference factors that affect the analysis of the test paper. For example, there may be redundant and complex background area images; the text content of the test paper in the original image is tilted or deformed, etc. In order to minimize the impact of the above-mentioned interference factors on the analysis of the test paper layout, in this step, the original image can be preprocessed, and then the preprocessed test paper image can be subjected to test paper analysis processes such as question number recognition, thereby improving the effect of the test paper analysis. Among them, the image preprocessing can include text direction processing and / or background removal processing, which are explained separately below:
[0123] Since the text directions in the original images uploaded by users are various, such as 0 degrees, 90 degrees, 180 degrees, 270 degrees, etc., 0 degrees represents that the text is upright, which can be used as a preset direction. Under this preset direction, the effect of test paper analysis is the best. Therefore, in this embodiment, the text direction processing method may include the following steps:
[0124] First, the original image is input into the second residual network ResNet to obtain the text direction of the original image.
[0125] Among them, the second residual network ResNet model is pre-trained according to the sample original image data and can be a four-category classification model.
[0126] Optionally, the second residual network ResNet may include a convolutional block attention module. For example, the second residual network may be based on ResNet18 (where 18 represents the depth of the network). In order to further improve the classification accuracy of the above four text directions, a convolutional block attention module (Convolutional Block Attention Module) may be added to each convolutional layer in the second residual network, and the attention mechanism may be introduced into the second residual network, so that the classification accuracy is effectively improved. After training with labeled sample original image data, the classification accuracy can reach more than 99%.
[0127] Secondly, when the text direction is not the preset direction, the original image is rotated according to the text direction so that the text direction of the rotated original image is the preset direction.
[0128] For example, if the text direction of the original image obtained by the second residual network is 270 degrees, and the preset direction is 0 degrees, the original image can be rotated 270 degrees to obtain an image with a text direction of 0 degrees, so as to improve the accuracy of the test paper analysis.
[0129] Furthermore, complex and diverse background images may appear in the original test paper image obtained by the user, which may cause serious interference to the subsequent analysis of the test paper content. Therefore, it is necessary to remove the redundant background outside the test paper area. Traditional image processing methods have limited applicability and it is difficult to solve the complex and changing background in a unified way. Therefore, in this embodiment, the background removal processing method may include the following steps:
[0130] Firstly, edge detection is performed on the original image through an edge detection model to obtain edge information of the target test paper, and the test paper area image is determined from the original image based on the edge information.
[0131] In this step, the original image may be input into a pre-trained edge detection model to obtain an edge feature image of the target test paper; and edge information of the target test paper may be obtained from the edge feature image.
[0132] The edge detection model can be a HED (Holistically-Nested Edge Detection) edge detection network. The HED edge detection network is a deep learning edge detection algorithm that can make full use of the natural advantages of neural network feature processing, use a fully convolutional network to automatically learn rich hierarchical representations, and fully capture the edge hierarchical features of the test paper through training. And HED can add a side output layer after each convolutional layer, apply deep supervision to each side output layer, so as to guide the side output to become an edge prediction, and further use weighted fusion to automatically combine the outputs of multiple scales on these side output layers, so that the network can automatically learn to obtain the hierarchical features of the edge of the test paper.
[0133] Finally, the test paper image is obtained according to the test paper area image.
[0134] In this step, the test paper area image can be directly used as the test paper image; or the test paper area image can be perspective transformed to obtain the test paper image. In this way, the rectangular correction of the test paper image can be achieved through perspective transformation, so that the corrected test paper image becomes a regular rectangle.
[0135] S303, performing question number recognition on the preprocessed test paper image, obtaining one or more question numbers in the test paper image, and obtaining the question number text, question number image and question number position of each question number.
[0136] S304, input the question number text, the question number image and the question number position into a pre-trained question number level classification detection model to obtain the question number level of each question number.
[0137] S305. Correct the question number according to the question number level and question number position.
[0138] It should be noted that if the photographed image is blurry, the result of the above question number recognition may be disturbed. Therefore, in this step, the question number can be corrected in the following way:
[0139] First, the question number is encoded according to its level to obtain a digital code for the question number.
[0140] Secondly, sort the question numbers according to their positions.
[0141] Finally, for each question number after sorting, confirm whether the digital code of the question number is continuous with the digital code of the adjacent question number; if it is confirmed that the digital code of the question number is not continuous with the digital code of the adjacent question number, correct the question number according to the adjacent question number to obtain the corrected question number.
[0142] For example, if the question number recognition results after sorting according to the question number position are 1, 22, 3, 4, 5, then 22 is not related to the digital codes of the adjacent question numbers. In this way, the question number can be corrected to 2 based on the adjacent question numbers 1 and 2. The corrected question number recognition results are 1, 2, 3, 4, 5.
[0143] In this way, by correcting the question number, the accuracy of question number recognition is further improved.
[0144] S306: Segment the test paper image according to the corrected question number, question number level and question number position to obtain a target question area for each question number.
[0145] S307: Correct the target question area.
[0146] In this step, in order to further increase the accuracy of obtaining the target topic area, the target topic area can be corrected in the following ways:
[0147] First, the target test paper image is input into a pre-trained second image recognition model to obtain one or more candidate question areas.
[0148] The second image recognition model can be a pre-trained model for obtaining the candidate question area corresponding to each question number in the test paper image. Similarly, the second image recognition model can also be an R-CNN network. Through the second image recognition model, the target test paper image can be segmented and the candidate question area corresponding to each question number can be obtained.
[0149] Secondly, for each question number, among the one or more candidate question regions, a first candidate question region with the highest degree of position overlap with the target question region of the question number is obtained.
[0150] Finally, when the position overlap is less than or equal to a preset overlap threshold, the target question area is modified according to the first candidate question area.
[0151] It should be noted that the above position overlap can be IOU (Intersection-over-Union), that is, the ratio of the intersection and union of the first candidate question area and the target question area. The above preset overlap threshold can be set to any value between 60% and 90%, for example, 80%.
[0152] According to the way in which the first candidate topic area modifies the target topic area, the union of the first candidate topic area and the target topic area can be used as a new target topic area, so as to avoid missing topic areas and improve the completeness of target topic area recognition.
[0153] S308. Input the corrected target question area into the pre-trained first image recognition model to obtain question information of the question number.
[0154] S309: Generate the test paper layout content of the target test paper according to the question number, the question number level and the question information.
[0155] In this way, by preprocessing the original image of the target test paper uploaded by the user, and performing question number detection, question number correction, question area acquisition and correction, and question information acquisition, the test paper layout content of the target test paper can be generated, so there is no need to rely on fixed templates or fixed formats, that is, test papers in various formats can be analyzed, thereby improving the efficiency of test paper grading in electronic teaching.
[0156] Figure 4 is a schematic diagram of the structure of a test paper analysis device provided by an embodiment of the present disclosure, such as Figure 4 As shown, the device comprises:
[0157] The question number recognition module 401 is used to recognize the question number of the test paper image of the target test paper, obtain one or more question numbers in the test paper image, and obtain the question number text, question number image and question number position of each question number;
[0158] The question level detection module 402 is used to input the question text, the question image and the question position into a pre-trained question level classification detection model to obtain the question level of each question;
[0159] The question area acquisition module 403 is used to segment the test paper image according to the question number level and the question number position to obtain the target question area for each question number;
[0160] The topic information acquisition module 404 is used to input the target topic area of each topic number into the pre-trained first image recognition model to obtain the topic information of the topic number;
[0161] The test paper layout content generating module 405 is used to generate the test paper layout content of the target test paper according to the question number, the question number level and the question information.
[0162] Optionally, the question level classification detection model includes an encoding network and a decoding network, and the encoding network includes a text encoding network and a first residual network ResNet; wherein:
[0163] The question number level detection module 402 is used to input the question number text into the text encoding network to obtain a question number text vector; input the question number image into the first residual network ResNet to obtain a question number image vector; perform position encoding on the question number position to obtain a question number position vector; input the question number text vector, the question number image vector and the question number position vector into the decoding network to obtain the question number level of each question number.
[0164] Optionally, the convolution layer of the first residual network ResNet is a depth-separable convolution, and the network depth of the first residual network ResNet is 18.
[0165] Optionally, the text encoding network includes a Transformer network or a Word2vec network.
[0166] Optionally, Figure 5 is a schematic diagram of the structure of another test paper analysis device provided by an embodiment of the present disclosure, such as Figure 5 As shown, the device also includes a question number correction module 501, wherein:
[0167] The question number correction module 501 is used to encode the question number according to the question number level to obtain the digital code of the question number; sort the question numbers according to the question number positions; for each sorted question number, confirm whether the digital code of the question number is continuous with the digital code of the adjacent question number; if it is confirmed that the digital code of the question number is not continuous with the digital code of the adjacent question number, correct the question number according to the adjacent question number to obtain a corrected question number;
[0168] The question area acquisition module 403 is used to generate the test paper layout content of the target test paper according to the corrected question number, the question number level and the question information.
[0169] Optionally, Figure 6 is a structural schematic diagram of another test paper analysis device provided by an embodiment of the present disclosure, such as Figure 6 As shown, the device also includes a topic area correction module 601, wherein:
[0170] The question area correction module 601 is used to input the target test paper image into the pre-trained second image recognition model to obtain one or more candidate question areas; for each question number, obtain the first candidate question area with the highest position overlap with the target question area of the question number from the one or more candidate question areas; and correct the target question area according to the first candidate question area when the position overlap is less than or equal to a preset overlap threshold;
[0171] The topic information acquisition module 404 is used to input the corrected target topic area into the pre-trained first image recognition model to obtain the topic information of the topic number.
[0172] Optionally, the question information includes one or more of graphics, text, tables, formulas, answer areas and question scores.
[0173] Optionally, Figure 7 is a structural schematic diagram of another test paper analysis device provided by an embodiment of the present disclosure, such as Figure 7 As shown, the device also includes an image preprocessing module 701, wherein:
[0174] The image preprocessing module 701 is used to obtain the original image of the target test paper, which original image includes a background area image and a test paper area image; perform edge detection on the original image through an edge detection model to obtain edge information of the target test paper; determine the test paper area image from the original image based on the edge information; and obtain the test paper image based on the test paper area image.
[0175] Optionally, the image preprocessing module 701 is used to input the original image into a pre-trained edge detection model to obtain an edge feature image of the target test paper; and obtain edge information of the target test paper from the edge feature image.
[0176] Optionally, the image preprocessing module 701 is used to perform perspective transformation on the test paper area image to obtain the test paper image.
[0177] Optionally, the image preprocessing module 701 is also used to input the original image into a second residual network ResNet to obtain the text direction of the original image, wherein the second residual network ResNet model is pre-trained based on the sample original image data; when the text direction is not a preset direction, the original image is rotated according to the text direction so that the text direction of the rotated original image is the preset direction; and edge detection is performed on the rotated original image through an edge detection model.
[0178] Optionally, the second residual network ResNet includes a convolutional block attention module.
[0179] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0180] Figure 8 FIG. 8 is a block diagram of an electronic device 800 according to an exemplary embodiment. Figure 8As shown, the electronic device 800 may include: a processor 801 and a memory 802. The electronic device 800 may also include one or more of a multimedia component 803, an input / output (I / O) interface 804, and a communication component 805.
[0181] The processor 801 is used to control the overall operation of the electronic device 800 to complete all or part of the steps in the above-mentioned test paper analysis method. The memory 802 is used to store various types of data to support the operation of the electronic device 800, and these data may include, for example, instructions for any application or method used to operate on the electronic device 800, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 803 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 802 or sent through the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above-mentioned other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the electronic device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 805 may include: Wi-Fi module, Bluetooth module, NFC module, etc.
[0182] In an exemplary embodiment, the electronic device 800 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned test paper analysis method.
[0183] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned test paper analysis method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 802 including program instructions, and the above-mentioned program instructions can be executed by the processor 801 of the electronic device 800 to complete the above-mentioned test paper analysis method.
[0184] Fig. 9 is a block diagram of an electronic device 900 according to an exemplary embodiment. For example, the electronic device 900 may be provided as a server. Fig. 9 The electronic device 900 includes a processor 922, which may be one or more, and a memory 932 for storing a computer program executable by the processor 922. The computer program stored in the memory 932 may include one or more modules, each corresponding to a set of instructions. In addition, the processor 922 may be configured to execute the computer program to perform the above-mentioned test paper analysis method.
[0185] In addition, the electronic device 900 may further include a power supply component 926 and a communication component 950, wherein the power supply component 926 may be configured to perform power management of the electronic device 900, and the communication component 950 may be configured to implement communication of the electronic device 900, for example, wired or wireless communication. In addition, the electronic device 900 may further include an input / output (I / O) interface 958. The electronic device 900 may operate based on an operating system stored in the memory 932, such as Windows Server, Mac OS, Unix, Linux, etc.
[0186] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned test paper analysis method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 932 including program instructions, and the above-mentioned program instructions can be executed by the processor 922 of the electronic device 900 to complete the above-mentioned test paper analysis method.
[0187] In another exemplary embodiment, a computer program product is also provided. The computer program product includes a computer program that can be executed by a programmable device. The computer program has a code portion for executing the above-mentioned test paper analysis method when executed by the programmable device.
[0188] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.
[0189] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0190] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.
Claims
1. A test paper analysis method, characterized in that: The method comprises: Perform question number recognition on the test paper image of the target test paper, obtain one or more question numbers in the test paper image, and obtain the question number text, question number image and question number position of each question number; Input the question number text, the question number image and the question number position into a pre-trained question number level classification detection model to obtain the question number level of each question number; The question number level classification detection model includes an encoding network and a decoding network, and the encoding network includes a text encoding network and a first residual network ResNet; the question number text, the question number image and the question number position are input into the question number level classification detection model to obtain the question number level of each question number, including: Input the question number text into the text encoding network to obtain a question number text vector; input the question number image into the first residual network ResNet to obtain a question number image vector; perform position encoding on the question number position to obtain a question number position vector; input the question number text vector, the question number image vector and the question number position vector into the decoding network to obtain the question number level of each question number; Segment the test paper image according to the question number level and the question number position to obtain a target question area for each question number; Input the target question area of each question number into the pre-trained first image recognition model to obtain question information of the question number; The test paper layout content of the target test paper is generated according to the question number, the question number level and the question information.
2. The method according to claim 1, characterized in that The convolution layer of the first residual network ResNet is a depth-separable convolution, and the network depth of the first residual network ResNet is 18.
3. The method according to claim 1, characterized in that The text encoding network includes a Transformer network or a Word2vec network.
4. The method according to claim 1, characterized in that: Before obtaining the test paper layout content according to the question number, the question number level and the question information, the method further includes: Encode the question number according to the question number level to obtain a digital code for the question number; sorting the question numbers according to their positions; For each question number after sorting, confirm whether the digital code of the question number is continuous with the digital code of the adjacent question number; if it is confirmed that the digital code of the question number is not continuous with the digital code of the adjacent question number, correct the question number according to the adjacent question number to obtain a corrected question number; Generating the test paper layout content of the target test paper according to the question number, the question number level and the question information includes: The test paper layout content of the target test paper is generated according to the corrected question number, the question number level and the question information.
5. The method according to claim 1, characterized in that Before inputting the target question area of each question number into the pre-trained first image recognition model to obtain the question information of the question number, the method further includes: Inputting the target test paper image into a pre-trained second image recognition model to obtain one or more candidate question areas; For each question number, among the one or more candidate question regions, obtain a first candidate question region with the highest degree of position overlap with the target question region of the question number; When the position overlap is less than or equal to a preset overlap threshold, modifying the target topic area according to the first candidate topic area; The step of inputting the target question area of each question number into the pre-trained first image recognition model to obtain the question information of the question number includes: The corrected target question area is input into the pre-trained first image recognition model to obtain the question information of the question number.
6. The method according to claim 1, characterized in that The question information includes one or more of graphics, text, tables, formulas, answer areas and question scores.
7. The method according to any one of claims 1 to 6, characterized in that Before the question number recognition is performed on the test paper image of the target test paper, the method further includes: Acquire an original image of the target test paper, wherein the original image includes a background area image and a test paper area image; Performing edge detection on the original image using an edge detection model to obtain edge information of the target test paper; Determine the test paper area image from the original image according to the edge information; The test paper image is acquired according to the test paper area image.
8. The method according to claim 7, characterized in that The edge detection of the original image by using an edge detection model to obtain edge information of the target test paper includes: Inputting the original image into a pre-trained edge detection model to obtain an edge feature image of the target test paper; The edge information of the target test paper is obtained from the edge feature image.
9. The method according to claim 7, characterized in that: The acquiring the test paper image according to the test paper area image comprises: Performing perspective transformation on the test paper area image to obtain the test paper image.
10. The method according to claim 7, characterized in that Before performing edge detection on the original image by using the edge detection model, the method further includes: Inputting the original image into a second residual network ResNet to obtain the text direction of the original image, wherein the second residual network ResNet model is pre-trained according to sample original image data; In the case where the text direction is not a preset direction, rotating the original image according to the text direction so that the text direction of the rotated original image is the preset direction; The performing edge detection on the original image by using an edge detection model comprises: The edge detection model is used to perform edge detection on the rotated original image.
11. The method according to claim 10, characterized in that The second residual network ResNet includes a convolutional block attention module.
12. A test paper analysis device, characterized in that: The device comprises: The question number recognition module is used to recognize the question number of the test paper image of the target test paper, obtain one or more question numbers in the test paper image, and obtain the question number text, question number image and question number position of each question number; A question number level detection module is used to input the question number text, the question number image and the question number position into a pre-trained question number level classification detection model to obtain the question number level of each question number; the question number level classification detection model includes an encoding network and a decoding network, and the encoding network includes a text encoding network and a first residual network ResNet; the inputting the question number text, the question number image and the question number position into the question number level classification detection model to obtain the question number level of each question number includes: inputting the question number text into the text encoding network to obtain a question number text vector; inputting the question number image into the first residual network ResNet to obtain a question number image vector; position encoding the question number position to obtain a question number position vector; inputting the question number text vector, the question number image vector and the question number position vector into the decoding network to obtain the question number level of each question number; A question area acquisition module, used to segment the test paper image according to the question number level and the question number position, and obtain a target question area for each question number; A question information acquisition module, used for inputting a target question area of each question number into a pre-trained first image recognition model to obtain question information of the question number; The test paper layout content generating module is used to generate the test paper layout content of the target test paper according to the question number, the question number level and the question information.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
14. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 11.
