Connection result acquisition method and device, electronic equipment and storage medium

By directly detecting the endpoint positions of the connection using a neural network model, the problem of error accumulation in obtaining connection results in existing technologies is solved, thus improving the accuracy of connection detection.

CN118887159APending Publication Date: 2024-11-01HANVON CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410797596.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-19
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

In existing technologies, the methods for obtaining the connection results of elements in mathematical matching problems suffer from error accumulation, resulting in low accuracy, especially when the connection is a curve.

Method used

By using a pre-set neural network model to detect question elements and connections in the question image, the location information of the bounding box and the location information of the pixel region are obtained, the endpoint positions of the connections are directly determined, and the connection results are judged based on the endpoint and bounding box position information, reducing the error of intermediate steps.

Benefits of technology

It improves the accuracy of connection detection, especially when the connection is a curve, and can accurately judge the connection result.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118887159A_ABST
    Figure CN118887159A_ABST
Patent Text Reader

Abstract

The invention discloses a connection result obtaining method and device and electronic equipment, and belongs to the technical field of computers. The method comprises the steps of performing question element detection and connection line detection on a target question picture through a preset neural network model, and obtaining positioning frame position information of question elements and pixel region position information of each connection line; according to the pixel area position information, respectively determining end point position information of each connecting line; according to the end point position information and the positioning frame position information, question element pairs connected with each connecting line are determined; according to the preset positioning frame position information of the answer element pair and the positioning frame position information of the question element pair connected with each connection line, a connection line result is obtained, and the connection line result is used for indicating whether the question elements are correctly paired or not. According to the method, connection modeling is used as an instance segmentation task, topic element region detection and connection detection are completed at the same time through the neural network model, accumulated errors of intermediate steps are reduced, and the accuracy of connection detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a connection result acquisition method, device, electronic device, and computer-readable storage medium. Background Art

[0002] With the rapid development of AI technologies such as image recognition, intelligent judgment has played an increasingly important role in helping education. For example, by presetting questions and answers, and automatically identifying the students' answers, pattern recognition and other technologies are used to compare the answers with the preset answers, and automatically determine whether the answers are correct. Intelligent judgment can not only improve the efficiency of judgment, but also help promote the promotion of applications such as online answering. However, the intelligent judgment technology in the prior art cannot handle some special question types well. For example, for math connection questions, because the question elements are very rich, there are not only texts, but also various boundary rules and irregular graphics, pictures, etc., and the question element styles cannot be enumerated. In the prior art, for such questions that are answered by connecting lines, the method usually adopted is: first, the slope of each line segment is obtained by image recognition technology to obtain the straight line equation, and then, each line segment is combined by the straight line equation to obtain the question elements connected by the line. Alternatively, the connection line and the question elements connected by each line are determined by detecting the angle and direction of the straight line.

[0003] In the prior art, the method for obtaining the connection results of question elements needs to first obtain the connection information and then determine the connection results based on the connection information. The connection result determination process goes through multiple stages, which will lead to error accumulation, thereby reducing the accuracy of the obtained connection results.

[0004] It can be seen that the connection result acquisition method in the prior art still needs to be improved. Summary of the invention

[0005] The embodiments of the present application provide a method and device for obtaining connection results, which directly detect connection instances to determine connection results, thereby helping to improve the accuracy of obtaining connection results.

[0006] In a first aspect, an embodiment of the present application provides a method for obtaining a connection result, comprising:

[0007] The target topic image is subjected to topic element detection and line detection through a preset neural network model to obtain the positioning frame position information of the topic element and the pixel area position information of each line;

[0008] According to the pixel area position information, respectively determine the endpoint position information of each of the connecting lines;

[0009] Determine the topic element pairs connected to each of the connecting lines according to the endpoint position information and the positioning frame position information;

[0010] According to the preset positioning frame position information of the answer element pair and the positioning frame position information of the question element pair respectively connected by each connection line, a connection result is obtained, and the connection result is used to indicate whether the question elements are correctly paired.

[0011] In a second aspect, an embodiment of the present application provides a connection result acquisition device, including:

[0012] A detection module is used to perform title element detection and line detection on the target title image through a preset neural network model to obtain the positioning frame position information of the title element and the pixel area position information of each line;

[0013] An endpoint position information determination module, used to determine the endpoint position information of each of the connecting lines according to the pixel area position information;

[0014] A topic element pair determination module, used to determine the topic element pair connected to each of the connecting lines according to the endpoint position information and the positioning frame position information;

[0015] The connection result acquisition module is used to obtain the connection result based on the positioning frame position information of the preset answer element pair and the positioning frame position information of the question element pair connected by each connection line, and the connection result is used to indicate whether the question elements are correctly paired.

[0016] In a fourth aspect, an embodiment of the present application further discloses an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the connection result acquisition method described in the embodiment of the present application when executing the computer program.

[0017] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the method for obtaining connection results disclosed in the embodiment of the present application are implemented.

[0018] The connection result acquisition method disclosed in the embodiment of the present application performs title element detection and connection line detection on the target title image through a preset neural network model, obtains the positioning frame position information of the title element and the pixel area position information of each connection line; then, according to the pixel area position information, respectively determines the endpoint position information of each connection line; according to the endpoint position information and the positioning frame position information, determines the question element pair connected by each connection line; according to the positioning frame position information of the preset answer element pair, and the positioning frame position information of the question element pair connected by each connection line, obtains the connection result, and the connection result is used to indicate whether the question element is correctly paired. This method models the connection line as an instance segmentation task, and simultaneously completes the question element area detection and connection line detection through the neural network model, reduces the cumulative error of the intermediate steps, and improves the accuracy of the connection line detection. Furthermore, the two question elements connected by each connection line are directly obtained through the endpoints of the connection line, and are matched with the preset answer, thereby improving the accuracy of the connection result judgment.

[0019] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0021] Figure 1 is a flow chart of a connection result obtaining method disclosed in an embodiment of the present application;

[0022] Figure 2 It is a structural diagram of a preset neural network model in the connection result acquisition method disclosed in the embodiment of the present application;

[0023] Figure 3 It is a schematic diagram of an original question picture in the connection result acquisition method disclosed in the embodiment of the present application;

[0024] Figure 4 yes Figure 3 Schematic diagram of the target question picture after answering the original question picture shown in ;

[0025] Figure 5 Yes Figure 4 Schematic diagram of title element detection results of the target title image shown in ;

[0026] Figure 6 Yes Figure 4 Schematic diagram of the line detection result of the target question picture shown in ;

[0027] Figure 7 It is a schematic diagram of the connection result judgment scenario;

[0028] Figure 8 This is one of the structural schematic diagrams of the connection result acquisition device disclosed in the embodiment of the present application;

[0029] Fig. 9 A block diagram schematically shows an electronic device for executing the method according to the present application; and

[0030] Fig.10 A storage unit for holding or carrying a program code for implementing the method according to the present application is schematically shown. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0032] Reference Figure 1 A method for obtaining connection results disclosed in an embodiment of the present application includes: steps 110 to 140.

[0033] Step 110, performing title element detection and line detection on the target title image through a preset neural network model to obtain the positioning frame position information of the title element and the pixel area position information of each line.

[0034] Optionally, the preset neural network model is a pre-trained multi-task neural network model. In some optional embodiments, such as Figure 2As shown, the preset neural network model includes: a backbone network 210, a first branch network 220, a second branch network 230, a third branch network 240 and a clustering module 250. Among them, the backbone network 210 is used to extract features of the target title image input into the preset neural network model. In some optional embodiments, the backbone network 210 can be constructed based on the structure of a residual network cascade feature pyramid network. The first branch network 220, the second branch network 230 and the third branch network 240 share the image features extracted by the backbone network 210, and perform different feature processing tasks respectively. The clustering module 250 is used to cluster the output results of the second branch network 230 and the third branch network 240.

[0035] Among them, the first branch network 220 is used to predict the position of the topic elements included in the target topic image, and output the positioning box information of each topic element; the second branch network 230 is used to perform embedded representation of pixels; the third branch network 240 is used to predict the mask of the connection; the clustering module 250 is used to cluster the predicted mask and the embedded representation of the pixel to obtain the pixel area of ​​different connections.

[0036] The first branch network 220 may be constructed based on a target detection network, the second branch network 230 may be constructed based on a coding network, and the third branch network 240 may be constructed based on a classification network.

[0037] The training process of the preset neural network model is described below and will not be repeated here.

[0038] In some optional embodiments, the method of performing title element detection and line detection on the target title image through a preset neural network model to obtain the positioning box position information of the title elements and the pixel area position information of each line includes: performing feature extraction on the target title image through the backbone network to obtain image features; using the first branch network to perform title element detection based on the image features to obtain the positioning box position information of each title element in the target title image; using the second branch network to perform feature encoding based on the image features to obtain an embedded vector representation; using the third branch network to perform line prediction based on the image features to obtain a line mask feature map; and using the clustering module to perform clustering processing on the embedded vector representation and the mask feature map to obtain the pixel area position information of each line in the target title image.

[0039] Combine the following Figure 2 , Figure 3 , Figure 4 and Figure 5 The following is an example of how to obtain connection results.

[0040] by Figure 3 Take the original question picture shown in as an example, where the first row of the original question picture contains two original shapes, and the second row contains the folded shape. The question requires connecting the two identical shapes with a line segment. Figure 4 For Figure 3 A schematic diagram of the target question image obtained by connecting the original question images in Figure 4 After the target title picture shown is input into the preset neural network model, first, the backbone network 210 performs feature extraction on the target title picture to obtain the image features of the target title picture.

[0041] Afterwards, the first branch network 220, the second branch network 230 and the third branch network 240 respectively perform corresponding tasks to further process the image features output by the backbone network 210. The tasks performed by each network branch are described below.

[0042] In some optional embodiments, the first branch network 220 can be constructed based on the target detection network, and the specific network structure of the first branch network 220 is not limited in the embodiment of the present application. The first branch network 220 performs further encoding and decoding processing based on the image features output by the trunk network 210, and finally obtains the title element detection result of the target title image. Among them, the title element detection result includes: the positioning frame position information of each title element detected from the target title image. In some optional embodiments, the positioning frame position information includes: the position coordinates of the positioning frame of the title element; or, the positioning frame position information includes: the position coordinates and confidence of the positioning frame of the title element. Among them, the position coordinates of the positioning frame can be the center position coordinates of the positioning frame and the width and height of the positioning frame, and the confidence is represented by the confidence score. For the convenience of calculation, in the embodiment of the present application, the positioning frame position information represented by the center position coordinates and the width and height of the positioning frame is further converted into the upper left corner coordinates and the lower right corner coordinates of the positioning frame, or, converted into the lower left corner coordinates and the upper right corner coordinates of the positioning frame. In the embodiment of the present application, the positioning frame position information is taken as: the upper left corner coordinates and lower right corner coordinates of the positioning frame of the title element as an example to illustrate the scheme for obtaining the connection result.

[0043] The first branch network 220 performs further encoding and decoding processing based on the image features output by the main network 210, and finally obtains Figure 4 The title element detection results of the target title image shown in Figure 5In the embodiment of the present application, the upper left corner coordinates and the lower right corner coordinates of the positioning box can be used to represent the positioning box position information of each topic element. For example, the positioning box position information of positioning boxes 1 to 4 can be represented as: (lf1, rg1), (lf2, rg2), (lf3, rg3) and (lf4, rg4), lf i Indicates the coordinates of the upper left corner of the positioning box i, rg i Indicates the coordinates of the lower right corner of positioning box i.

[0044] In some other optional embodiments, the positioning frame position information includes: the center coordinates and the horizontal and vertical dimensions of the title element.

[0045] On the other hand, the second branch network 230 performs further instance segmentation processing based on the image features output by the backbone network 210 to obtain an embedded vector representation for expressing the pixel points in the target title image. In specific implementation, the second branch network 230 maps each pixel in the target title image to a vector in a high-dimensional space based on the image features, thereby obtaining an embedded vector representation of the target title image. The embedded vector representation is intended to capture and express the feature information of the pixel, so that the pixels on the same line are closer in the embedded space, while the pixels on different lines are farther in the embedded space.

[0046] On the other hand, the third branch network 240 performs further semantic segmentation processing based on the image features output by the backbone network 210 to obtain a mask feature map for expressing the connected pixels and non-connected pixels in the target title image. In specific implementation, in the semantic segmentation task, the third branch network 240 uses the connected pixels as the foreground, performs semantic segmentation processing on the target title image, and obtains a mask feature map of the same size as the target title image. The mask feature map is a two-dimensional array for representing an image, which is used to indicate which pixels in the target title image belong to the connected lines and which pixels belong to the background.

[0047] Taking the pixel size of the target title image as H×W as an example, the embedded vector representation output by the second branch network 230 can be a vector of size H×W×N, where N represents the feature length of each pixel, and the size of the mask feature map output by the third branch network 240 is H×W. Next, based on the embedded vector representation of each pixel in the target title image and the features in the mask feature map, the pixels in the target title image are clustered to cluster the pixels on the same line in the same cluster, thereby achieving segmentation of the line instance.

[0048] In some optional embodiments, the clustering module is used to perform clustering processing on the embedded vector representation and the mask feature map to obtain each connecting line in the target title image, including: using a mean shift algorithm to cluster the pixel points in the target title image based on the embedded vector representation and the mask feature map to obtain a clustering result; and according to the pixel points in each cluster in the clustering result, respectively determining the pixel area position information of the connecting lines corresponding to the corresponding cluster in the target title image.

[0049] The mean shift algorithm (i.e., Mean-Shift clustering algorithm) is a non-parametric clustering algorithm used to find density estimates and cluster centers in a data set. In an embodiment of the present application, the Mean-Shift clustering algorithm can be used to group points (i.e., pixels) in the embedded space into clusters, each cluster corresponding to a line instance in the target title image. Optionally, the mean shift algorithm is used to cluster the pixels in the target title image based on the embedded vector representation and the mask feature map to obtain a clustering result, including: for the target pixel points in the mask feature map indicating that they belong to the line, based on the embedded vector representation of the pixel points output by the second branch network 230, the mean shift algorithm is used to cluster the target pixel points to obtain a clustering result. Among them, the clustering result is to cluster the pixels in the embedded space to obtain the line instance segmentation result. The Mean-Shift algorithm can divide the pixels into multiple clusters according to the density of the embedded vector, without pre-specifying the number of clusters, and is very suitable for situations where the number of instances is unknown, such as line detection.

[0050] In some optional embodiments, according to the pixel points in each cluster in the clustering result, the pixel area position information of the connection line corresponding to the corresponding cluster in the target title image is determined respectively, and it also includes: performing denoising processing on the pixel points in each cluster in the clustering result to obtain the denoised pixel point set corresponding to each cluster; performing straight line fitting on the pixel points in the denoised pixel point set to obtain the line segment corresponding to each denoised pixel point set, and then taking the pixel area covered by the line segment as the pixel area of ​​the connection line to obtain the pixel area position information of each connection line in the target title image. Among them, the denoising processing of the pixel points in each cluster can remove the pixel points that do not belong to any connection instance, thereby improving the accuracy and robustness of line segment detection.

[0051] In other optional embodiments, the image area covered by each pixel point in the denoised pixel point set can be used as the pixel area of ​​a connecting line, and the position coordinates of the pixel points in the denoised pixel point set can be used as the pixel area position information of the corresponding connecting line.

[0052] by Figure 5Taking the target topic picture shown in as an example, after clustering, we can get the following Figure 6 The pixel area of ​​each line shown.

[0053] Step 120: Determine the endpoint position information of each of the connecting lines according to the pixel region position information.

[0054] As mentioned above, the pixel region position information of each connecting line is expressed by the position information of a number of pixel points. Next, the two endpoints of the corresponding line segment are determined according to the pixel region position information corresponding to each connecting line.

[0055] Optionally, the determining the endpoint position information of each of the lines according to the pixel area position information includes: obtaining the horizontal projection length and the vertical projection length of each of the lines according to the pixel area position information; for each of the lines, determining the endpoint position information of the lines according to the size relationship between the horizontal projection length and the vertical projection length span. For example, for a group of the pixel area position information, the horizontal coordinate span and the vertical coordinate span of each pixel point in the group of the pixel area position information can be first calculated as the horizontal projection length and the vertical projection length of the lines corresponding to the group of the pixel area position information. The horizontal coordinate span is the difference between the minimum horizontal coordinate value and the maximum horizontal coordinate value of the pixel point in the group of the pixel area position information, and the vertical coordinate span is the difference between the minimum vertical coordinate value and the maximum vertical coordinate value of the pixel point in the group of the pixel area position information.

[0056] In some optional embodiments, the endpoint position information of the connecting line is determined based on the size relationship between the horizontal projection length and the vertical projection length span, including: when the horizontal projection length is greater than or equal to the vertical projection length span, determining the first pixel point corresponding to the minimum horizontal coordinate and the second pixel point corresponding to the maximum coordinate in the pixel area of ​​the connecting line as the two endpoints of the connecting line; when the horizontal projection length is less than the vertical projection length span, determining the first pixel point corresponding to the minimum vertical coordinate and the second pixel point corresponding to the maximum coordinate in the pixel area of ​​the connecting line as the two endpoints of the connecting line.

[0057] If the horizontal projection length is greater than or equal to the vertical projection length, the corresponding line is considered to be horizontal; if the horizontal projection length is less than the vertical projection length, the corresponding line is considered to be vertical. For a horizontal line, the leftmost pixel and the rightmost pixel in the pixel area can be used as the two endpoints of the line. For a vertical line, the topmost pixel and the bottommost pixel in the pixel area can be used as the two endpoints of the line.

[0058] Step 130: Determine the topic element pairs connected by each of the connecting lines according to the endpoint position information and the positioning frame position information.

[0059] In some optional embodiments, determining the pair of topic elements connected to each of the connecting lines according to the endpoint position information and the positioning frame position information includes: determining the topic element closest to each of the endpoints according to the endpoint position information and the positioning frame position information; and for each of the connecting lines, taking the topic element closest to each of the endpoints of the connecting line as the pair of topic elements connected by the connecting line.

[0060] Optionally, determining the topic element closest to each of the endpoints according to the endpoint position information and the positioning frame position information includes: determining the positioning frame center position of each topic element according to the positioning frame position information; calculating the distance between each of the endpoints and each of the positioning frame center positions; determining the positioning frame center position with the smallest distance from each of the endpoints as the adjacent positioning frame center position of the endpoint; and using the topic element to which the adjacent positioning frame center position belongs as the topic element closest to the endpoint corresponding to the adjacent positioning frame center position. For example, for each positioning frame, the coordinates of the upper left corner and the lower right corner of the positioning frame can be used to calculate the coordinates of the positioning frame center position of the positioning frame by using the method of calculating the midpoint of the line connecting two points.

[0061] The two endpoints of the jth line are represented by A j and B j For example, calculate endpoint A respectively j and B j The distance between the center position of each positioning frame and the endpoint A is obtained. j The closest positioning frame R1, and the endpoint B j The nearest positioning box R2. Further, the topic element corresponding to the positioning box R1 and the topic element corresponding to the positioning box R2 are taken as the topic element pair (R1, R2) connected by the jth line. According to this method, the topic element pair corresponding to each detected line is determined respectively.

[0062] Step 140, obtaining a connection result based on the preset positioning frame position information of the answer element pair and the positioning frame position information of the question element pair respectively connected by each connection line, wherein the connection result is used to indicate whether the question elements are correctly paired.

[0063] In an embodiment of the present application, for a question in a target question image, a pair of answer elements is pre-set, and is represented in the form of the positioning frame position information of the answer element pair. For example, the positioning frame position information of the preset answer element pair is represented by the position coordinate pair of the positioning frames of the two answer elements in the answer element pair in the question image. The positioning frame of the answer element can be a boundary frame of the answer element.

[0064] For example, Figure 5 In the question element 1 and question element 4 are the same figure, and question element 2 and question element 3 are the same figure, then the preset answer element pair is represented by the following method: the upper left corner coordinate lf'1 and the lower right corner coordinate rg'1 of the bounding box of question element 1, and the upper left corner coordinate lf'4 and the lower right corner coordinate rg'4 of the bounding box of question element 4 form a pair of coordinates, recorded as "[(lf'1, rg'1), (lf'4, rg'4)]"; the upper left corner coordinate lf'2 and the lower right corner coordinate rg'2 of the bounding box of question element 2, and the upper left corner coordinate lf'3 and the lower right corner coordinate rg'3 of the bounding box of question element 3 form a pair of coordinates, recorded as "[(lf'2, rg'2), (lf'3, rg'3)]"; the above two pairs of coordinates are used as Figure 5 The original title image corresponding to the target title image (such as Figure 3 ) of the preset answer elements.

[0065] In the above steps, the positioning frame position information (lf1, rg1), (lf2, rg2), (lf3, rg3) and (lf4, rg4) of each question element has been obtained through the preset neural network model. Further, according to the question element pairs connected by each line and the positioning frame position information of the question elements, the position information of the two positioning frames connected by each line can be determined, thereby further obtaining the positioning frame position information of the answer element pair. For example, Figure 5The position information of the positioning boxes connected by the two lines are respectively expressed as: the positioning box position information of the answer element pair composed of the upper left corner coordinates and lower right corner coordinates of the positioning box of question element 1 (lf1, rg1) and the upper left corner coordinates and lower right corner coordinates of the positioning box of question element 4 (lf4, rg4), recorded as "[(lf1, rg1), (lf4, rg4)]"; the positioning box position information of the answer element composed of the upper left corner coordinates and lower right corner coordinates of the positioning box of question element 2 (lf2, rg2) and the upper left corner coordinates and lower right corner coordinates of the positioning box of question element 3 (lf3, rg3), recorded as "[(lf2, rg2), (lf3, rg3)]".

[0066] Next, based on the detected positioning frame position information of the question element pair and the positioning frame position information of the answer element pair, the degree of overlap of the positioning frames of the question element pair and the answer element pair is further determined, and based on the degree of overlap, whether the question element pair connected by the line matches the answer is determined.

[0067] In some optional embodiments, the obtaining of connection results based on the preset positioning box position information of the answer element pair and the positioning box position information of the question element pair respectively connected by each of the connection lines includes: for each of the connection lines, based on the preset positioning box position information of the answer element pair and the positioning box position information of the question element pair connected by the connection line, obtaining the answer element pair that satisfies the preset positioning box overlap condition between the question element pair connected by the connection line as a matching answer element pair; in response to obtaining the matching answer element pair, obtaining a connection result indicating that the connection is correct; in response to not obtaining the matching answer element pair, obtaining a connection result indicating that the connection is incorrect.

[0068] Still Figure 5 Taking the detection result shown in the figure as an example, for the line connecting topic element 1 and topic element 4, the positioning frame position information of the topic element pair connected by the line is: [(lf1, rg1), (lf4, rg4)], where (lf1, rg1) represents the upper left corner coordinates and lower right corner coordinates of the positioning frame of topic element 1, and (lf4, rg4) represents the upper left corner coordinates and lower right corner coordinates of the positioning frame of topic element 4. Therefore, the positioning frame position information of the topic element pair connected by the line can determine two positioning frames as the positioning frames to be matched. On the other hand, for Figure 3 The original question image shown in the figure determines two positioning frames as reference positioning frames according to the position coordinates of the positioning frames of each question element in each answer element pair.

[0069] Then, the overlap between the two positioning frames to be matched and each pair of reference positioning frames is determined respectively. That is, it is determined whether the two positioning frames to be matched have overlapping areas with each pair of reference positioning frames, and the reference positioning frames with overlapping areas with the two positioning frames to be matched are found. Then, the area of ​​each positioning frame and the overlapping area of ​​each two overlapping positioning frames are calculated. After that, it is determined whether the overlapping area of ​​the positioning frame to be matched and each pair of reference positioning frames meets the preset positioning frame overlap condition. If it does, it is considered that the positioning frame to be matched matches the pair of reference positioning frames, otherwise, it is considered that the positioning frame to be matched does not match the pair of reference positioning frames. If the positioning frame to be matched matches a pair of reference positioning frames, it means that the connection line is correctly connected; if the positioning frame to be matched matches any pair of reference positioning frames, it means that the connection line is wrong. In specific implementation, the existing technology can be used to determine whether the two positioning frames overlap, and to calculate the overlapping area of ​​the two positioning frames, which will not be repeated here.

[0070] Optionally, the preset positioning frame overlap condition includes: the positioning frame to be matched overlaps with the reference positioning frame, and the overlapping area of ​​the positioning frame to be matched and the reference positioning frame satisfies the following formula: S 12 / (S1+S2-S 12 )>TH, where S 12 represents the area of ​​the overlapping area, S1 represents the area of ​​the positioning frame to be matched, S2 represents the area of ​​the reference positioning frame, and TH represents the preset ratio threshold; the positioning frame to be matched is: the positioning frame of the question element in the question element pair connected to the line; the reference positioning frame is: the positioning frame of the answer element in any of the answer element pairs. The preset ratio threshold can be determined according to the specific scenario. For example, the value of the preset ratio threshold TH can be set to 0.5.

[0071] Combine the following Figure 7 Describe the process of determining the connection result. Figure 7 As shown, 730 and 740 are a pair of reference positioning frames, 770 and 780 are a pair of reference positioning frames, line L1 connects the positioning frames to be matched 710 and 720, and line L2 connects the positioning frames to be matched 720 and 760. Among them, the positioning frame to be matched 710 overlaps with the reference positioning frame 730, the positioning frame to be matched 720 overlaps with the reference positioning frame 740, and the positioning frame to be matched 760 overlaps with the reference positioning frame 780.

[0072] The overlapping area of ​​the to-be-matched positioning frame 710 and the reference positioning frame 730 is represented as S 12 , the area of ​​the to-be-matched positioning frame 710 is represented as S1, and the area of ​​the reference positioning frame 730 is represented as S2, and the overlapping area S can be obtained. 12 Satisfy S 12 / (S1+S2-S12 )>0.5, it is considered that the to-be-matched positioning frame 710 matches the reference positioning frame 730. Similarly, the overlapping area of ​​the to-be-matched positioning frame 720 and the reference positioning frame 740 is represented as S 12 , the area of ​​the to-be-matched positioning frame 720 is represented as S1, and the area of ​​the reference positioning frame 740 is represented as S2, and the overlapping area S can be obtained. 12 Satisfy S 12 / (S1+S2-S 12 )>0.5, it can also be considered that the to-be-matched positioning frame 720 matches the reference positioning frame 740. In summary, the overlapping area of ​​the to-be-matched positioning frames 710 and 720 and the reference positioning frames 730 and 740 meets the preset positioning frame overlap condition, and it can be concluded that the to-be-matched positioning frames 710 and 720 match the pair of reference positioning frames 730 and 740, that is, the connection line L1 is correctly connected.

[0073] Depend on Figure 7 The above calculation method can be used to conclude that the overlapping area of ​​the to-be-matched positioning frames 720 and 760 and the reference positioning frames 730 and 740 does not satisfy the preset positioning frame overlapping condition, and the overlapping area of ​​the to-be-matched positioning frames 720 and 760 and the reference positioning frames 770 and 780 does not satisfy the preset positioning frame overlapping condition, that is, the to-be-matched positioning frames 720 and 760 do not match any pair of reference positioning frames, and the judgment result that the connection of the line L2 is incorrect can be obtained.

[0074] In order to make the connection result acquisition method disclosed in the embodiment of the present application clearer, the training process of the preset neural network model is explained below.

[0075] First, obtain sample question images including several answered connection questions and construct a sample data set. The sample data set includes: a training set, a test set and a validation set. The sample ratio in the training set, the test set and the validation set can be 4:1:1. The annotation information of each sample question image includes: the bounding box of each question element and the pixel-level annotation information of each connection line. The pixel-level annotation information includes, for example, whether each pixel point is a connection line or background, and the pixel points belonging to the connection line are also annotated with the connection line number.

[0076] Next, the sample title images in the sample data set are preprocessed, for example, scaling, cropping, normalization, and possible data augmentation operations (such as rotation, translation, color adjustment, etc.) are performed on the sample title images to improve the generalization ability of the model.

[0077] Then, the preset neural network model is trained based on the training set. The loss function of the preset neural network model is configured as: loss = l Det +λl Instseg , where lDet represents the loss of the first branch network 220, λl Instseg represents the combined loss of the second branch network 230 and the third branch network 240, and λ is a hyperparameter used to weight the losses of different tasks to optimize the overall performance.

[0078] In some optional embodiments, Det A composite loss function is selected, including: a positioning box loss function (such as a CIoU (Complete Intersection over Union) loss function) and a positioning box confidence loss function (such as a binary cross entropy loss function). Among them, the positioning box loss function is used to evaluate the geometric consistency between the predicted box of the title element and the real box, and the positioning box confidence loss function is used to evaluate the difference between the confidence of the model predicting the existence of the object and whether the object actually exists. The loss calculation method of the first branch network 220 refers to the loss calculation method of the target detection task in the prior art, which will not be repeated here.

[0079] In some optional embodiments, λl Instseg The representation includes: instance segmentation loss and semantic segmentation loss. Among them, semantic segmentation loss is used to classify each pixel in the sample title image to determine whether it is a line or background. The goal of semantic segmentation loss is to accurately classify at the pixel level. Instance segmentation loss is used to evaluate the model's ability to distinguish different line instances, and is calculated using the distance metric between pixel-level embedded vectors. When calculating instance segmentation loss, pixels at the intersection of multiple lines do not participate in the loss calculation.

[0080] During the model training process, the model loss value calculated based on the loss function is used to calculate the gradient through the back propagation algorithm, and the model weights are updated to complete the iterative training of the model.

[0081] The trained model can be tested based on the test set and verified based on the validation set.

[0082] In summary, the connection result acquisition method disclosed in the embodiment of the present application first performs title element detection and connection line detection on the target title image through a preset neural network model to obtain the positioning frame position information of the title element and the pixel area position information of each connection line; then, according to the pixel area position information, the endpoint position information of each connection line is determined respectively; according to the endpoint position information and the positioning frame position information, the question element pair connected by each connection line is determined; according to the positioning frame position information of the preset answer element pair, and the positioning frame position information of the question element pair connected by each connection line, the connection result is obtained, and the connection result is used to indicate whether the question element is correctly paired. This method models the connection line as an instance segmentation task, and simultaneously completes the question element area detection and connection line detection through the neural network model, reduces the cumulative error of the intermediate steps, and improves the accuracy of the connection line detection. Furthermore, the two question elements connected by each connection line are directly obtained through the endpoints of the connection line, and are matched with the preset answer, thereby improving the accuracy of the connection result judgment.

[0083] In the prior art, when the connection line is a curve, the accuracy of the connection result judgment will decrease. However, the present application uses a preset neural network model to detect the title elements and connection lines of the target title image, and directly obtains the two title elements connected by each connection line according to the endpoints of the connection line, so that the connection result can be accurately obtained when the connection line is a curve.

[0084] Reference Figure 8 The embodiment of the present application also discloses a connection result acquisition device, the device comprising:

[0085] The detection module 810 is used to perform title element detection and line detection on the target title image through a preset neural network model to obtain the positioning frame position information of the title element and the pixel area position information of each line;

[0086] The endpoint position information determination module 820 is used to determine the endpoint position information of each of the connecting lines according to the pixel area position information;

[0087] A topic element pair determination module 830, configured to determine the topic element pair connected to each of the connection lines according to the endpoint position information and the positioning frame position information;

[0088] The connection result acquisition module 840 is used to obtain the connection result based on the positioning frame position information of the preset answer element pair and the positioning frame position information of the question element pair connected by each connection line, and the connection result is used to indicate whether the question elements are correctly paired.

[0089] Optionally, the preset neural network model includes: a backbone network, a first branch network, a second branch network, a third branch network and a clustering module, and the detection module 810 is further used to:

[0090] Extracting features of the target topic image through the backbone network to obtain image features;

[0091] Using the first branch network to detect title elements based on the image features, and obtaining the positioning frame position information of each title element in the target title image;

[0092] Using the second branch network to perform feature encoding based on the image features to obtain an embedded vector representation;

[0093] Using the third branch network to perform line prediction based on the image features to obtain a line mask feature map;

[0094] The clustering module is used to perform clustering processing on the embedded vector representation and the mask feature map to obtain pixel area position information of each connecting line in the target title image.

[0095] Optionally, the clustering module is used to perform clustering processing on the embedded vector representation and the mask feature map to obtain pixel area position information of each connecting line in the target title image, including:

[0096] Using a mean shift algorithm, clustering pixels in the target question image based on the embedded vector representation and the mask feature map to obtain a clustering result;

[0097] According to the pixel points in each cluster in the clustering result, the pixel area position information of the connecting line corresponding to the corresponding cluster in the target topic image is determined respectively.

[0098] Optionally, the endpoint location information determination module 820 is further configured to:

[0099] According to the pixel area position information, obtaining the horizontal projection length and the vertical projection length of each of the connecting lines;

[0100] For each of the connecting lines, the endpoint position information of the connecting line is determined according to the size relationship between the horizontal projection length and the vertical projection length span.

[0101] Optionally, the topic element pair determination module 830 is further configured to:

[0102] Determine the topic element closest to each of the endpoints according to the endpoint position information and the positioning frame position information;

[0103] For each of the connecting lines, the topic element that is closest to each of the endpoints of the connecting line is used as a topic element pair connected by the connecting line.

[0104] Optionally, the connection result acquisition module 840 is further used to:

[0105] For each of the connecting lines, according to the preset positioning frame position information of the answer element pair and the positioning frame position information of the question element pair connected by the connecting line, the answer element pair that satisfies the preset positioning frame overlap condition with the question element pair connected by the connecting line is obtained as a matching answer element pair;

[0106] In response to obtaining the matching answer element pair, obtaining a connection result indicating that the connection is correct;

[0107] In response to not obtaining the matching answer element pair, a connection result indicating the connection error is obtained.

[0108] Optionally, the preset positioning frame overlap condition includes: the positioning frame to be matched overlaps with the reference positioning frame, and the overlapping area of ​​the positioning frame to be matched and the reference positioning frame satisfies the following formula: S 12 / (S1+S2-S 12 )>TH, where S 12 Represents the area of ​​the overlapping area, S1 represents the area of ​​the positioning box to be matched, S2 represents the area of ​​the reference positioning box, and TH represents the preset ratio threshold; the positioning box to be matched is: the positioning box of the question element in the pair of question elements connected to the connecting line; the reference positioning box is: the positioning box of the answer element in any pair of answer elements.

[0109] The connection result acquisition device disclosed in the embodiment of the present application is used to implement the connection result acquisition method described in the embodiment of the present application. The specific implementation methods of each module of the device will not be repeated here. Please refer to the specific implementation methods of the corresponding steps in the method embodiment.

[0110] The connection result acquisition device disclosed in the embodiment of the present application first performs title element detection and connection detection on the target title image through a preset neural network model, and obtains the positioning frame position information of the title element and the pixel area position information of each connection line; then, according to the pixel area position information, the endpoint position information of each connection line is determined respectively; according to the endpoint position information and the positioning frame position information, the question element pair connected by each connection line is determined; according to the positioning frame position information of the preset answer element pair, and the positioning frame position information of the question element pair connected by each connection line, the connection result is obtained, and the connection result is used to indicate whether the question element is correctly paired. The device models the connection line as an instance segmentation task, and completes the title element area detection and connection line detection at the same time through the neural network model, reduces the cumulative error of the intermediate steps, and improves the accuracy of the connection line detection. Furthermore, the two question elements connected by each connection line are directly obtained through the endpoints of the connection line, and matched with the preset answer, thereby improving the accuracy of the connection result judgment.

[0111] In the prior art, when the connection line is a curve, the accuracy of the connection result judgment will decrease. However, the present application uses a preset neural network model to detect the title elements and connection lines of the target title image, and directly obtains the two title elements connected by each connection line according to the endpoints of the connection line, so that the connection result can be accurately obtained when the connection line is a curve.

[0112] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0113] The above is a detailed introduction to a connection result acquisition method and device, and a connection result acquisition system provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and a core idea. At the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

[0114] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0115] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in the electronic device according to the embodiment of the present application. The present application can also be implemented as a device or apparatus program (e.g., computer program and computer program product) for executing part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0116] For example, Fig. 9 An electronic device that can implement the method according to the present application is shown. The electronic device can be a PC, a mobile terminal, a personal digital assistant, a tablet computer, etc. The electronic device traditionally includes a processor 910 and a memory 920 and a program code 930 stored on the memory 920 and can be run on the processor 910, and the processor 910 implements the method described in the above embodiment when executing the program code 930. The memory 920 can be a computer program product or a computer-readable medium. The memory 920 can be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. The memory 920 has a storage space 9201 for the program code 930 of a computer program for executing any method step in the above method. For example, the storage space 9201 for the program code 930 can include various computer programs for implementing various steps in the above method respectively. The program code 930 is a computer-readable code. These computer programs can be read from one or more computer program products or written into the one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. The computer program includes a computer readable code, and when the computer readable code is executed on an electronic device, the electronic device is caused to execute the method according to the above embodiment.

[0117] The embodiment of the present application further discloses a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the method for obtaining connection results as described in the embodiment of the present application are implemented.

[0118] Such a computer program product may be a computer-readable storage medium, which may have a computer-readable storage medium having a Fig. 9 The memory 920 in the electronic device shown in the figure is similar to the storage segment, storage space, etc. The program code can be compressed and stored in the computer-readable storage medium in an appropriate form. The computer-readable storage medium is generally as shown in the reference Fig.10 The portable or fixed storage unit. Generally, the storage unit includes computer readable code 930', which is a code read by a processor. When the code is executed by the processor, each step in the method described above is implemented.

[0119] The term "one embodiment", "embodiment" or "one or more embodiments" herein means that a particular feature, structure or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present application. In addition, please note that the examples of the term "in one embodiment" here do not necessarily all refer to the same embodiment.

[0120] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0121] In the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

[0122] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for obtaining connection results, characterized in that: The method comprises: The target topic image is subjected to topic element detection and line detection through a preset neural network model to obtain the positioning frame position information of the topic element and the pixel area position information of each line; According to the pixel area position information, respectively determine the endpoint position information of each of the connecting lines; Determine the topic element pairs connected to each of the connecting lines according to the endpoint position information and the positioning frame position information; According to the preset positioning frame position information of the answer element pair and the positioning frame position information of the question element pair respectively connected by each connection line, a connection result is obtained, and the connection result is used to indicate whether the question elements are correctly paired.

2. The method according to claim 1, characterized in that The preset neural network model includes: a backbone network, a first branch network, a second branch network, a third branch network and a clustering module. The preset neural network model is used to perform title element detection and line detection on the target title image to obtain the positioning frame position information of the title element and the pixel area position information of each line, including: Extracting features of the target topic image through the backbone network to obtain image features; Using the first branch network to detect title elements based on the image features, and obtaining the positioning frame position information of each title element in the target title image; Using the second branch network to perform feature encoding based on the image features to obtain an embedded vector representation; Using the third branch network to perform line prediction based on the image features to obtain a line mask feature map; The clustering module is used to perform clustering processing on the embedded vector representation and the mask feature map to obtain pixel area position information of each connecting line in the target title image.

3. The method according to claim 2, characterized in that The clustering module is used to perform clustering processing on the embedded vector representation and the mask feature map to obtain pixel area position information of each connecting line in the target title picture, including: Using a mean shift algorithm, clustering pixels in the target question image based on the embedded vector representation and the mask feature map to obtain a clustering result; According to the pixel points in each cluster in the clustering result, the pixel area position information of the connecting line corresponding to the corresponding cluster in the target topic image is determined respectively.

4. The method according to claim 1, characterized in that: The step of determining the endpoint position information of each of the connecting lines according to the pixel area position information comprises: According to the pixel area position information, obtaining the horizontal projection length and the vertical projection length of each of the connecting lines; For each of the connecting lines, the endpoint position information of the connecting line is determined according to the size relationship between the horizontal projection length and the vertical projection length span.

5. The method according to claim 1, characterized in that The determining, according to the endpoint position information and the positioning frame position information, the topic element pairs connected by each of the connecting lines respectively comprises: Determine the topic element closest to each of the endpoints according to the endpoint position information and the positioning frame position information; For each of the connecting lines, the topic element that is closest to each of the endpoints of the connecting line is used as a topic element pair connected by the connecting line.

6. The method according to claim 1, characterized in that The obtaining of the connection result according to the preset positioning frame position information of the answer element pair and the positioning frame position information of the question element pair respectively connected by each connection line comprises: For each of the connecting lines, according to the preset positioning frame position information of the answer element pair and the positioning frame position information of the question element pair connected by the connecting line, the answer element pair that satisfies the preset positioning frame overlap condition with the question element pair connected by the connecting line is obtained as a matching answer element pair; In response to obtaining the matching answer element pair, obtaining a connection result indicating that the connection is correct; In response to not obtaining the matching answer element pair, a connection result indicating the connection error is obtained.

7. The method according to claim 6, characterized in that The preset positioning frame overlap condition includes: the positioning frame to be matched overlaps with the reference positioning frame, and the overlapping area of ​​the positioning frame to be matched and the reference positioning frame satisfies the following formula: S 12 / (S1+S2-S 12 )>TH, where S 12 Represents the area of ​​the overlapping area, S1 represents the area of ​​the positioning box to be matched, S2 represents the area of ​​the reference positioning box, and TH represents the preset ratio threshold; the positioning box to be matched is: the positioning box of the question element in the pair of question elements connected to the connecting line; the reference positioning box is: the positioning box of the answer element in any pair of answer elements.

8. A connection result acquisition device, characterized in that: The device comprises: A detection module is used to perform title element detection and line detection on the target title image through a preset neural network model to obtain the positioning frame position information of the title element and the pixel area position information of each line; An endpoint position information determination module, used to determine the endpoint position information of each of the connecting lines according to the pixel area position information; A topic element pair determination module, used to determine the topic element pair connected to each of the connecting lines according to the endpoint position information and the positioning frame position information; The connection result acquisition module is used to obtain the connection result based on the positioning frame position information of the preset answer element pair and the positioning frame position information of the question element pair connected by each connection line, and the connection result is used to indicate whether the question elements are correctly paired.

9. An electronic device comprising a memory, a processor, and a program code stored in the memory and executable on the processor, wherein: When the processor executes the program code, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a program code stored thereon, characterized in that: When the program code is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Automatic correction method and device for online test questions and storage medium

    CN114332898A

  • Intelligent paper marking method for connection questions

    CN116310411A