Capacitance test report table identification method and system based on mask attention

The deep learning method based on mask attention is used to perform feature extraction and multi-level decoding on the capacitance inspection report form, which solves the problems of poor recognition effect and slow response speed of traditional methods, and achieves efficient and accurate table recognition and data processing. .

CN118609147APending Publication Date: 2024-09-06XIAMEN UNIV OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410511895.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-26
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

The traditional table recognition method of capacitor inspection reports has poor recognition results under the influence of lighting such as tilt, distortion, shadows, etc., and manual recording results in low intelligence in information processing, and requires quick response. It is difficult for existing technology to effectively identify capacitor inspection reports. table contents.

Method used

Using a deep learning method based on mask attention, feature extraction, convolution and deconvolution are performed on the image of the capacitance inspection report form, and multi-level decoding is performed based on the mask image and feature matrix to output 14 pieces of information for each unit. attributes to achieve efficient identification of table structure and content.

Benefits of technology

It improves the accuracy and real-time performance of capacitor inspection report form identification, can effectively handle empty columns and single column cross-row situations, quickly detects table content, improves work efficiency and accuracy of data analysis, and adapts to various capacitor inspection report form formats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118609147A
    Figure CN118609147A
Patent Text Reader

Abstract

The invention provides a capacitance test report table identification method based on mask attention, which comprises the following steps: S1, inputting an image containing a capacitance test report table, and carrying out feature extraction on the input image; s2, carrying out convolution on the extracted image features to obtain image features of different sizes, fusing the image features of different sizes, and carrying out deconvolution on the fused image features to obtain feature maps suitable for three different sizes; and S3, performing n-level decoding on the feature map and outputting 14 attributes of each piece of unit information. According to the method, a coding and decoding feature learning mechanism of a mask attention mechanism is adopted, and the model can directly output table structure information of a table, so that complete table information of a capacitance test report can be constructed through post-processing, and an accurate and efficient application effect is achieved; and the analysis working efficiency of the capacitance test report and the accuracy of the analysis report are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of text recognition, and in particular to a method and system for recognizing a capacitive inspection report form based on masked attention. Background Art

[0002] The capacitor inspection report is a form containing key information such as product name, model specifications, inspection results, and inspection conclusions. However, since traditional capacitor inspection reports mainly rely on manual recording, the level of intelligent information processing is not high. Therefore, we need to use deep learning methods to perform table recognition on capacitor inspection reports in order to obtain the information content in the table.

[0003] Capacitor test reports may contain blank columns or single columns that span across lines. At the same time, due to the lighting effects such as tilt, distortion, and shadows that may occur during the shooting process, traditional table recognition methods have poor recognition effects in these situations. In addition, the capacitor test report needs to have a faster response time during processing. Therefore, we urgently need a method that can quickly and accurately recognize the capacitor test report table.

[0004] The method of the present invention utilizes a masked attention structure to achieve intelligent recognition of inspection report tables. By deeply analyzing the table structure and content, the method can efficiently identify each data in the table. Compared with traditional methods, the method of the present invention has higher accuracy and real-time performance, and can meet the scenarios with high requirements for data processing speed. In addition, the method realizes the decoupling of cell detection and table structure recognition. The application of this technology will greatly improve work efficiency, promote the development of information management and data analysis, and is of great significance to information management and data analysis in various industries. Summary of the invention

[0005] In order to achieve the above objectives, this application adopts the following technical solutions:

[0006] In a first aspect of the present application, a method for recognizing a capacitance inspection report form based on mask attention is provided, comprising:

[0007] S1. Input an image containing a capacitance inspection report form, and perform feature extraction on the input image;

[0008] S2, convolving the extracted image features to obtain image features of different sizes, fusing the image features of different sizes, and deconvolving the fused image features to obtain feature maps adapted to three different sizes;

[0009] S3, decode the feature map at n levels and output 14 attributes of each unit information.

[0010] The above technical solution provides a new, efficient, and automated ceramic capacitor detection and analysis report generation method and method to solve the problem that manual report generation in the prior art is time-consuming and error-prone. The method can automatically perform anomaly detection and analysis on the detection data of ceramic capacitors using a multi-dimensional time series anomaly detection interpretability method to generate a detailed and accurate analysis report. It can also display the generated ceramic capacitor detection and analysis report and provide user interaction functions, greatly improving work efficiency and the accuracy of the analysis report.

[0011] S1 specifically includes: extracting features from the input image to obtain features C2, C3, C4 and C5, wherein the feature sizes of features C2, C3, C4 and C5 are the original image size, 1 / 2 of the original image size, 1 / 4 of the original image size and 1 / 8 of the original image size, respectively.

[0012] S2 specifically includes: S201, use 1*1 convolution to adjust the channels of features C2, C3, C4 and C5 to obtain adjusted features F_1, F_2, F_3 and F_4, and then obtain the fused feature F; the fused feature F has a dimension of Bs*4Ch*H / 8*W / 8; S302, deconvolute the fused feature F to obtain the feature map Ex of the image; the feature map Ex includes E1, E2 and E3, and the sizes of the feature maps E1, E2 and E3 are 1 / 8, 1 / 4 and 1 / 2 of the original image size, respectively.

[0013] S3 is specifically as follows: S301, inputting the mask image Mc, the feature map Ex and the feature matrix Qa and performing first-level decoding to obtain a new feature matrix Don; specifically, inputting the mask image Mc, the feature map Ex and the feature matrix Qa: Among them, D on is the output of the nth layer block, δ is the activation function, and finally D on The dimension is R ^(C*N) ; S302, input and decode the mask image Mc, feature map Ex and feature matrix Don output by the previous level decoding to obtain the next level feature matrix Don; S303, repeat step S02 to the last level, and output 14 attributes of each cell information. The 14 attributes of the cell information are expressed as: Cell _attr=[CE, TS, x, y, cu, cd, cl, cr, tu, td, tl, tr, mu, md], where CE is whether the table exists, and the value is 0 / 1, 0 means no table cell, 1 means table cell, TS is whether text exists, and the value is 0 or 1, if the value is 0, it means the query table information has no text, 1 means text, attributes x and y represent the center point of the text in the table cell, cu, cd, cl, cr are the distance between the center point and the table cell line, the value is between [0, 1], indicating the ratio of the distance to the length and width, if a single cell spans across rows, the middle between the two text rows is the cell line, tu, td, tl, tr are the distance between the center point and the text frame line, the value is between [0, 1], indicating the ratio of the distance to the length and width, and mu, md indicate whether the query table cell information above and below can merge text rows, the value is 0 / 1, 0 means cannot merge, and 1 means can merge;

[0014] And, the size of the mask image Mc is R^ (N*H*W) ; The size of the feature map Ex is R^ (H*W*C) , the feature matrix Qa size is R^ (N*C) , N represents the number of table information that can be queried, and H and W represent the height and width of the image.

[0015] When S303 outputs the 14 attributes of each unit information, it outputs the CE and TS attributes through the classification loss function, and the remaining attributes are output through the regression loss function. The specific regression loss function is:

[0016]

[0017] in, and They represent the model predicted category and the true category of the i-th query of the b-th sample, respectively. and denote the continuous value predicted by the model and the true continuous value of the i-th query of the b-th sample, respectively. class is the classification loss, L reg is the regression loss and α is the parameter that weighs the two losses.

[0018] S4. Convert the attributes of each unit information output by S3 into table structure information through projection scanning of the horizontal and vertical axes.

[0019] Through the above technical solution, the influence of the recognition effect on the table recognition is avoided, and the recognition of the table structure can be completed by using only the layout information of the table, which has better generalization.

[0020] In a second aspect of the present application, a capacitive inspection report form recognition system based on mask attention is provided, comprising: an image input module, an image feature extraction encoding module, a mask attention decoding module and a post-processing module;

[0021] A picture input module, configured to input pictures to the picture feature extraction and encoding module;

[0022] The image feature extraction and encoding module is configured to detect whether the input image contains table information, extract features from the image containing table information, and encode the extracted features using a preset algorithm;

[0023] The masked attention decoding module consists of multiple levels of decoder units connected in series, and each level of decoder units includes three layers of decoder block units, which are configured to decode the encoded features through a preset model and output the results;

[0024] A post-processing module is configured to convert the table position information into table structure information.

[0025] Specifically, the image feature extraction encoding module performs feature extraction to obtain feature outputs C2, C3, C4 and C5, uses 1*1 convolution to adjust the channels of features C2, C3, C4 and C5 to obtain adjusted features F_1, F_2, F_3 and F_4, and then obtains the fused feature F; the fused feature F has a dimension of Bs*4Ch*H / 8*W / 8; S302, deconvolves the fused feature F to obtain a feature map Ex of the image; the feature map Ex includes E1, E2 and E3, and the sizes of feature maps E1, E2 and E3 are 1 / 8, 1 / 4 and 1 / 2 of the original image size, respectively.

[0026] Specifically, the number of mask attention decoding modules in series is L, and each level of series decoder has three layers of decoderblock units. The three layers of decoderblock constitute a first-level decoding unit. Each block unit input consists of three features. The first layer of block unit input is a mask image Mc, with a size of R^ (NxHxW) , the encoder encodes the image feature Ex, the size is R^ (HWxC) , and the query encoding feature matrix Qa, size R^ (NxC), the second and third layer block units input the mask image Mc, the encoder encodes the image features Ex and the previous level block outputs the new query matrix output Don, the feature dimension of Don is consistent with the query encoding feature matrix Qa, and is sent to the next level decoder, where N represents the number of table information that can be queried, generally representing a table unit, but if a table unit has multiple cross-line texts, then there are multiple query information values, N is a fixed value, that is, this method has a limit on the number of query table units, which is in line with the actual situation of the capacitor detection report, N is the maximum number of queried features, H and W represent the height and width of the image.

[0027] Specifically, the mask attention decoding module inputs the mask image Mc, the feature map Ex and the feature matrix Qa and performs the first-level decoding to obtain a new feature matrix Don; specifically, the mask image Mc, the feature map Ex and the feature matrix Qa are input: Among them, D on is the output of the nth layer block, δ is the activation function, and finally D on The dimension is R ^(C*N) ; Input and decode the mask image Mc, feature map Ex and feature matrix Don output by the previous level decoding, where the size of the mask image Mc is R ^(N*H*W) ; The size of the feature map Ex is R ^(H*W*C) , the feature matrix Qa is of size R ^(N*C) , N represents the number of table information that can be queried, H and W represent the height and width of the image; get the next level feature matrix Don; repeat to the last level, and output the 14 attributes of each cell information. The 14 attributes of the cell information are expressed as: Cell _attr =[CE, TS, x, y, cu, cd, cl, cr, tu, td, tl, tr, mu, md], where CE is whether the table exists, and the value is 0 / 1, 0 means no table cell, 1 means table cell, TS is whether text exists, and the value is 0 or 1, if the value is 0, it means the query table information has no text, 1 means text, attributes x and y represent the center point of the text in the table cell, cu, cd, cl, cr are the distance between the center point and the table cell line, the value is between [0, 1], indicating the ratio of the distance to the length and width, tu, td, tl, tr are the distance between the center point and the text frame line, the value is between [0, 1], indicating the ratio of the distance to the length and width, and mu, md represent whether the query table cell information above and below can merge text lines, the value is 0 / 1, 0 means cannot merge, and 1 means can merge;

[0028] And, when outputting the 14 attributes of each unit information, the CE and TS attributes are output through the classification loss function, and the remaining attributes are output through the regression loss function. The specific regression loss function is:

[0029]

[0030] in, and They represent the model predicted category and the true category of the i-th query of the b-th sample, respectively. and denote the continuous value predicted by the model and the true continuous value of the i-th query of the b-th sample, respectively. class is the classification loss, L reg is the regression loss and α is the parameter that weighs the two losses.

[0031] The beneficial effects of this application are as follows: 1. It is able to quickly detect the content of the capacitor inspection report form. By using the Transformer structure of masked attention, this method can quickly detect the content in the capacitor inspection report form. This is very useful for processing a large amount of capacitor inspection report form data, which can greatly improve the processing speed. This means that whether it is real-time detection on the production line or processing historical data in data analysis, this method can provide an efficient solution.

[0032] 2. It can effectively handle empty columns and single column cross-rows. The present method can well handle the situation of empty columns and single column cross-rows in the capacitance test report form. This is a common problem in the recognition of capacitance test report forms, and the present method can effectively solve this problem. This means that even if there are various complex formats and layouts in the capacitance test report form design, it can be accurately recognized and processed.

[0033] 3. The text detection and table structure recognition are performed simultaneously, but decoupled from the text recognition, which means that the recognition task can be performed independently without being affected by other tasks. This can improve the accuracy of each task and also make the whole system more flexible and scalable. This means that this method can be flexibly adjusted and optimized according to actual needs to meet different requirements for capacitor inspection report table recognition.

[0034] 4. This method is highly adaptable. Due to the use of the Transformer structure, this method is highly adaptable and can handle various types and formats of capacitance test report forms. Regardless of how the design of the capacitance test report form changes, this method can provide stable and accurate recognition results.

[0035] 5. The accuracy of this method is high: By using the masked attention mechanism, this method can more accurately identify the content in the capacitor inspection report form, thereby improving the accuracy of the entire system. It can provide high-quality capacitor inspection report form recognition results, thereby improving the accuracy and reliability of data analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings are included to provide a further understanding of the embodiments and are incorporated into and constitute a part of this specification. The accompanying drawings illustrate the embodiments and are used together with the description to explain the principles of the present application. It will be easy to recognize other embodiments and many expected advantages of the embodiments because they become better understood by reference to the following detailed description. The elements of the drawings are not necessarily to scale with each other. The same reference numerals refer to corresponding similar parts.

[0037] Figure 1 is a flow chart of a method for recognizing a capacitance inspection report form based on mask attention according to an embodiment of the present application;

[0038] Figure 2 It is a specific flow chart of S2 of a method for recognizing a capacitance inspection report form based on mask attention according to an embodiment of the present application;

[0039] Figure 3 is a specific flow chart of S3 of a method for recognizing a capacitance inspection report form based on masked attention according to an embodiment of the present application;

[0040] Figure 4 It is a masked attention-based table recognition model workflow of a method for recognizing a capacitance inspection report table based on masked attention according to an embodiment of the present application;

[0041] Figure 5 It is a coding layer block unit model structure of a capacitance inspection report form recognition system based on mask attention according to an embodiment of the present application;

[0042] Figure 6 It is a schematic diagram of converting cells into table structure information in a capacitance inspection report table recognition system based on masked attention according to an embodiment of the present application. DETAILED DESCRIPTION

[0043] In the following detailed description, reference is made to the accompanying drawings, which form a part of the detailed description and are shown by illustrative specific embodiments in which the present application can be practiced. To this end, directional terms, such as "top", "bottom", "left", "right", "up", "down", etc., are used with reference to the orientation of the figures described. Because the components of the embodiments can be positioned in several different orientations, directional terms are used for the purpose of illustration and are by no means limiting. It should be understood that other embodiments may be utilized or logical changes may be made without departing from the scope of the present application. Therefore, the following detailed description should not be adopted in a limiting sense, and the scope of the present application is defined by the appended claims.

[0044] Figure 1is a flowchart of a method for recognizing a capacitance inspection report form based on mask attention according to an embodiment of the present application, Figure 2 is a specific flow chart of S2 of a method for recognizing a capacitance inspection report form based on mask attention according to an embodiment of the present application, Figure 3 is a specific flow chart of S3 of a method for recognizing a capacitance inspection report form based on mask attention according to an embodiment of the present application, such as Figures 1 to 3 As shown, a method for recognizing a capacitance inspection report form based on mask attention includes:

[0045] S1. Input an image containing a capacitance inspection report form, and perform feature extraction on the input image;

[0046] S2, convolving the extracted image features to obtain image features of different sizes, fusing the image features of different sizes, and deconvolving the fused image features to obtain feature maps adapted to three different sizes;

[0047] S3, decode the feature map at n levels and output 14 attributes of each unit information.

[0048] The above technical solution provides a new, efficient, and automated ceramic capacitor detection and analysis report generation method and method to solve the problem that manual report generation in the prior art is time-consuming and error-prone. The method can automatically perform anomaly detection and analysis on the detection data of ceramic capacitors using a multi-dimensional time series anomaly detection interpretability method to generate a detailed and accurate analysis report. It can also display the generated ceramic capacitor detection and analysis report and provide user interaction functions, greatly improving work efficiency and the accuracy of the analysis report.

[0049] S1 specifically includes: extracting features from the input image to obtain features C2, C3, C4 and C5, wherein the feature sizes of features C2, C3, C4 and C5 are the original image size, 1 / 2 of the original image size, 1 / 4 of the original image size and 1 / 8 of the original image size, respectively.

[0050] S2 specifically includes: S201, use 1*1 convolution to adjust the channels of features C2, C3, C4 and C5 to obtain adjusted features F_1, F_2, F_3 and F_4, and then obtain the fused feature F; the fused feature F has a dimension of Bs*4Ch*H / 8*W / 8; S302, deconvolute the fused feature F to obtain the feature map Ex of the image; the feature map Ex includes E1, E2 and E3, and the sizes of the feature maps E1, E2 and E3 are 1 / 8, 1 / 4 and 1 / 2 of the original image size, respectively.

[0051] S3 is specifically as follows: S301, inputting the mask image Mc, the feature map Ex and the feature matrix Qa and performing first-level decoding to obtain a new feature matrix Don; specifically, inputting the mask image Mc, the feature map Ex and the feature matrix Qa: Among them, D on is the output of the nth layer block, δ is the activation function, and finally D on The dimension is R ^(C*N) ; S302, input and decode the mask image Mc, feature map Ex and feature matrix Don output by the previous level decoding to obtain the next level feature matrix Don; S303, repeat step S02 to the last level, and output 14 attributes of each cell information. The 14 attributes of the cell information are expressed as: Cell _attr =[CE, TS, x, y, cu, cd, cl, cr, tu, td, tl, tr, mu, md], where CE is whether the table exists, and the value is 0 / 1, 0 means no table cell, 1 means table cell, TS is whether text exists, and the value is 0 or 1, if the value is 0, it means the query table information has no text, 1 means text, attributes x and y represent the center point of the text in the table cell, cu, cd, cl, cr are the distance between the center point and the table cell line, the value is between [0, 1], indicating the ratio of the distance to the length and width, if a single cell spans across rows, the middle between the two text rows is the cell line, tu, td, tl, tr are the distance between the center point and the text frame line, the value is between [0, 1], indicating the ratio of the distance to the length and width, and mu, md indicate whether the query table cell information above and below can merge text rows, the value is 0 / 1, 0 means cannot merge, and 1 means can merge;

[0052] And, the size of the mask image Mc is R ^(N*H*W) ; The size of the feature map Ex is R ^(H*W*C) , the feature matrix Qa is of size R ^(N*C) , N represents the number of table information that can be queried, and H and W represent the height and width of the image.

[0053] When S303 outputs the 14 attributes of each unit information, it outputs the CE and TS attributes through the classification loss function, and the remaining attributes are output through the regression loss function. The specific regression loss function is:

[0054]

[0055] in, and They represent the model predicted category and the true category of the i-th query of the b-th sample, respectively. and denote the continuous value predicted by the model and the true continuous value of the i-th query of the b-th sample, respectively. class is the classification loss, L reg is the regression loss and α is the parameter that weighs the two losses.

[0056] S4. Convert the attributes of each unit information output by S3 into table structure information through projection scanning of the horizontal and vertical axes.

[0057] Through the above technical solution, the influence of the recognition effect on the table recognition is avoided, and the recognition of the table structure can be completed by using only the layout information of the table, which has better generalization.

[0058] Figure 4 The present invention is a masked attention-based table recognition model workflow of a method for recognizing a capacitance inspection report table based on masked attention according to an embodiment of the present application. Figure 5 is a coding layer block unit model structure of a capacitance inspection report form recognition system based on mask attention according to an embodiment of the present application, such as Figure 4 and Figure 5 As shown, combined Figures 1 to 3 It can be seen that in the decoder module, first, the decoder is composed of multiple levels of decoder units connected in series, the number of series connections is L, each level of series decoder has three layers of decoderblock units, and the three layers of decoderblock constitute a first-level decoding unit. Each block unit input consists of three features. The first layer of block unit input is a mask image Mc, the size is R^{NxHxW}, the encoder encoded image feature Ex, the size is R^{HWxC}, and the query encoding feature matrix Qa, the size is R^{NxC}, the second and third layers of block units input mask images Mc, encoder encoded image features Ex and the previous level block output new query matrix output Don, the feature dimension of Don is consistent with the query encoding feature matrix Qa, and is sent to the next level decoder. Where N represents the number of table information that can be queried, generally representing a table unit, but if a table unit has multiple cross-line texts, then there are multiple query information values, N is a fixed value, that is, this method has a limit on the number of query table units, which is in line with the actual situation of the capacitance detection report. N is the maximum number of features to be queried, and H and W represent the height and width of the image.

[0059] The working principle of the mask attention of each block unit in the decoder is to first send the three inputs of the mask image Mc, the encoder encoded image features Ex, and the query encoded feature matrix Qa to the mask attention module. The formula is as follows:

[0060]

[0061] Where Don is the output of the nth layer block, δ is the activation function, which is softmax in this invention, and finally D on The dimension is R^ (CxN) . Thus, after multiple levels of decoder blocks are connected, the final decoder output is L l , represents the output of the layer at level l, with a dimension of R^ (Cx14) . Where 14 represents the attribute of each query table cell to be output, which can be expressed as:

[0062] Cell_attr=[CE,TS,x,y,cu,cd,cl,cr,tu,td,tl,tr,mu,md]

[0063] Now let's introduce the meaning of each attribute. CE is whether the table exists. The value is 0 / 1. 0 means there is no table cell and 1 means there is a table cell. TS is whether there is text. The value is 0 / 1. If the value is 0, it means there is no text in the query table information, and 1 means there is text. The attributes x and y represent the center point of the text in the table cell. If there are multiple lines of text, there will be multiple center points. cu, cd, cl, cr are the distances between the center point and the table cell line. The values ​​are between [0, 1], indicating the ratio of the distance to the length and width. If a single cell spans across rows, the middle between the two text lines is the cell line. tu, td, tl, tr are the distances between the center point and the text frame line. The values ​​are between [0, 1], indicating the ratio of the distance to the length and width. mu and md indicate whether the query table cell information above and below can merge text lines. The values ​​are both 0 / 1. 0 means it cannot be merged, and 1 means it can be merged.

[0064] In the connection between the encoder and the decoder, the masked attention plays the role of connecting the encoder image features. In the present invention, the three layers of features of different scales are encoded and sent to the three blocks of the decoder, so that the decoder can learn the image features of different scales and directly obtain the table structure and text detection output of the table through the learning of the picture. This information is obtained by querying the table unit information matrix to obtain 14 attributes of each unit information. Through post-processing, text recognition and table typesetting, the complete table recognition information can be obtained.

[0065] In model training, the model loss includes two parts of loss functions: one part is classification loss, which is used to process the output of the first two dimensions; the other part is regression loss, which is used to process the output of the remaining dimensions. B represents the number of samples, and N represents the number of queries for each sample. For the classification part, the present invention uses binary cross entropy loss, and for the regression part, the present invention uses L1 loss. The loss expression is:

[0066]

[0067] in, and They represent the model predicted category and the true category of the i-th query of the b-th sample, respectively. and denote the continuous value predicted by the model and the true continuous value of the i-th query of the b-th sample, respectively. class is the classification loss, L reg is the regression loss and α is the parameter that weighs the two losses.

[0068] In addition, during the model training process, it is necessary to input the table mask image Mc, the size of Mc is R ^(NxHxW) . N is the maximum value of the queryable table cell information. In principle, each queryable table cell information is a text line of a cell, and if there is text across lines, then each text line occupies an independent query table cell information value. Each mask image Mc is expressed in the form of a binary mask, whose size is, N is the maximum queryable table cell information value, and is combined in Mc in order. The table cells are sorted from left to right and from top to bottom, so there is an order. And these table cells in the mask attention will be sent to the decoder input in the form of mask images. The mask image defines Mc as, for the mask image corresponding to the query value of the kth sequence, if the cell corresponding to the query information exists, then the position of the cell is 1, otherwise it is 0. The mask image is to help locate the table position and provide more table information. In the test mode, the mask image here is not sent in. At this time, the mask attention degenerates into ordinary cross attention, and the model can directly output the required 14 attribute information.

[0069] In the post-processing module, after the model outputs the table cell information, the complete table position information can be obtained, but it is not yet converted into table structure information, so the table position information needs to be converted into table structure information. Figure 6As shown, in the schematic diagram of converting the cells in the figure into table structure information, the projection scanning of the horizontal and vertical axes is used to find the most basic number of table cells before merging. For example, from the projection of the horizontal axis (looking from top to bottom), it can be obtained that the basic table cell structure is 2, and from the projection of the vertical axis (looking from left to right), it can be obtained that the basic table structure is 4, so that the basic table cells are calculated to be 2*4=8, which are marked with 0-7 in the figure respectively, and then the table structure matrix of the horizontal and vertical axes is obtained to indicate whether the cells are merged. For example, the vertical axis table structure merge matrix [[0,0], [0,1], [1,0]], wherein the first 0 in the first list [0,0] indicates that cell 2 and cell 0 are not merged vertically, the second 0 indicates that cell 3 is not merged with cell 1, and the first value 0 in the second list [0,1] indicates that cell 4 is not merged with cell 2.

[0070] The second value 1 means that cell 5 is merged with cell 3, and so on.

[0071] In addition, in the post-processing module, we need to perform text recognition on the detected text to obtain the required text information. Here, we decouple the detection and table structure information acquisition process from the text recognition process. This is to avoid the impact of the recognition effect on the table recognition, and to achieve the recognition of the table structure using only the table layout information, which has better generalization.

[0072] Obviously, those skilled in the art can make various modifications and changes to the embodiments of the present application without departing from the spirit and scope of the present application. In this way, if these modifications and changes are within the scope of the claims of the present application and their equivalents, the present application is also intended to cover these modifications and changes. The word "comprising" does not exclude the presence of other elements or steps not listed in the claims. The simple fact that certain measures are recorded in mutually different dependent claims does not indicate that the combination of these measures cannot be used to profit. Any figure mark in the claims should not be considered to limit the scope.

Claims

1. A method for recognizing a capacitance inspection report form based on masked attention, characterized in that: include: S1. Input an image containing a capacitance inspection report form, and perform feature extraction on the input image; S2, convolving the extracted image features to obtain image features of different sizes, fusing the image features of different sizes, and deconvolving the fused image features to obtain feature maps adapted to three different sizes; S3, decode the feature map at n levels and output 14 attributes of each unit information.

2. According to the method for recognizing a capacitance inspection report form based on masked attention in claim 1, the S1 specifically comprises: Feature extraction is performed on the input image to obtain features C2, C3, C4 and C5, wherein the feature sizes of the features C2, C3, C4 and C5 are the original image size, 1 / 2 of the original image size, 1 / 4 of the original image size and 1 / 8 of the original image size, respectively.

3. The method for recognizing a capacitance inspection report form based on masked attention according to claim 2, characterized in that: The S2 specifically includes: S201, using 1*1 convolution to adjust the channels of the features C2, C3, C4 and C5 to obtain adjusted features F_1, F_2, F_3 and F_4, and then obtaining a fused feature F; the fused feature F has a dimension of Bs*4Ch*H / 8*W / 8; S302, deconvolving the fused feature F to obtain a feature map Ex of the image; the feature map Ex includes E1, E2 and E3, and the sizes of the feature maps E1, E2 and E3 are 1 / 8, 1 / 4 and 1 / 2 of the original image size, respectively.

4. The method for recognizing a capacitance inspection report form based on masked attention according to claim 3, characterized in that: The S3 is specifically as follows: S301, inputting the mask image Mc, the feature map Ex and the feature matrix Qa and performing first-level decoding to obtain a new feature matrix Don; specifically, inputting the mask image Mc, the feature map Ex and the feature matrix Qa: Among them, D on is the output of the nth layer block, δ is the activation function, and finally D on The dimension is R^ (C*N) ; S302, input and decode the mask image Mc, feature map Ex and feature matrix Don output by the previous level decoding to obtain the next level feature matrix Don; S303, repeat step S02 to the last level, and output 14 attributes of each cell information, the 14 attributes of the cell information are expressed as: Cell _attr =[CE, TS, x, y, cu, cd, cl, cr, tu, td, tl, tr, mu, md], where CE is whether the table exists, and the value is 0 / 1, 0 means no table cell, 1 means table cell, TS is whether text exists, and the value is 0 or 1, if the value is 0, it means the query table information has no text, 1 means text, attributes x and y represent the center point of the text in the table cell, cu, cd, cl, cr are the distance between the center point and the table cell line, the value is between [0, 1], indicating the ratio of the distance to the length and width, if a single cell spans across rows, the middle between the two text rows is the cell line, tu, td, tl, tr are the distance between the center point and the text frame line, the value is between [0, 1], indicating the ratio of the distance to the length and width, and mu, md indicate whether the query table cell information above and below can merge text rows, the value is 0 / 1, 0 means cannot merge, and 1 means can merge; And, the size of the mask image Mc is R^ (N*H*W) ; The size of the feature map Ex is R^ (H*W*C) , the feature matrix Qa size is R^ (N*C) , N represents the number of table information that can be queried, and H and W represent the height and width of the image.

5. The method for recognizing a capacitance inspection report form based on masked attention according to claim 4, characterized in that: When outputting the 14 attributes of each unit information, S303 outputs the CE and TS attributes through the classification loss function, and outputs the remaining attributes through the regression loss function. The regression loss function is specifically: in, and They represent the model predicted category and the true category of the i-th query of the b-th sample, respectively. and denote the continuous value predicted by the model and the true continuous value of the i-th query of the b-th sample, respectively. class is the classification loss, L reg is the regression loss and α is the parameter that weighs the two losses.

6. The method for recognizing a capacitance inspection report form based on masked attention according to claim 1, characterized in that: Also includes: S4. Convert the attributes of each unit information output by S3 into table structure information through projection scanning of the horizontal and vertical axes.

7. A capacitance inspection report form recognition system based on masked attention, characterized in that: include: Image input module, image feature extraction encoding module, mask attention decoding module and post-processing module; The picture input module is configured to input pictures to the picture feature extraction and encoding module; The picture feature extraction and encoding module is configured to detect whether the input picture contains table information, extract features from the picture containing table information, and encode the extracted features using a preset algorithm; The masked attention decoding module is composed of multiple levels of decoder units connected in series, and each level of decoder units includes three layers of decoder block units, which are configured to decode the encoded features through a preset model and output the results; The post-processing module is configured to convert the table position information into table structure information.

8. The capacitance test report form recognition system based on masked attention according to claim 7, characterized in that: The image feature extraction encoding module performs feature extraction to obtain feature outputs C2, C3, C4 and C5, uses 1*1 convolution to adjust the channels of the features C2, C3, C4 and C5 to obtain adjusted features F_1, F_2, F_3 and F_4, and then obtains a fused feature F; the fused feature F has a dimension of Bs*4Ch*H / 8*W / 8; S302, deconvolves the fused feature F to obtain a feature map Ex of the image; the feature map Ex includes E1, E2 and E3, and the sizes of the feature maps E1, E2 and E3 are 1 / 8, 1 / 4 and 1 / 2 of the original image size, respectively.

9. The capacitive inspection report form recognition system based on masked attention according to claim 7, characterized in that: The number of series connections of the mask attention decoding module is L. Each level of series decoder has three layers of decoder block units. The three layers of decoder block constitute a first-level decoding unit. Each block unit input consists of three features. The first layer of block unit input is a mask image Mc, with a size of R. ^(NxHxW) , the encoder encodes the image feature Ex, the size is R ^(HWxC) , and the query encoding feature matrix Qa, size R ^(NxC) , the second and third layer block units input the mask image Mc, the encoder encodes the image features Ex and the previous level block outputs the new query matrix output Don, the feature dimension of Don is consistent with the query encoding feature matrix Qa, and is sent to the next level decoder, where N represents the number of table information that can be queried, generally representing a table unit, but if a table unit has multiple cross-line texts, then there are multiple query information values, N is a fixed value, that is, this method has a limit on the number of query table units, which is in line with the actual situation of the capacitor detection report, N is the maximum number of queried features, H and W represent the height and width of the image.

10. A capacitance inspection report form recognition system based on masked attention according to claim 9, characterized in that: The mask attention decoding module inputs the mask image Mc, the feature map Ex and the feature matrix Qa and performs the first-level decoding to obtain a new feature matrix Don; specifically, the mask image Mc, the feature map Ex and the feature matrix Qa are input: Among them, D on is the output of the nth layer block, δ is the activation function, and finally D on The dimension is R^ (C*N) ; Input and decode the mask image Mc, feature map Ex and feature matrix Don output by the previous level decoding, where the size of the mask image Mc is R^ (N*H*W) ; The size of the feature map Ex is R^ (H*W*C) , the feature matrix Qa size is R^ (N*C) , N represents the number of table information that can be queried, H and W represent the height and width of the image; get the next level feature matrix Don; repeat to the last level, and output the 14 attributes of each cell information, the 14 attributes of the cell information are expressed as: Cell _attr =[CE, TS, x, y, cu, cd, cl, cr, tu, td, tl, tr, mu, md], where CE is whether the table exists, and the value is 0 / 1, 0 means no table cell, 1 means table cell, TS is whether text exists, and the value is 0 or 1, if the value is 0, it means the query table information has no text, 1 means text, attributes x and y represent the center point of the text in the table cell, cu, cd, cl, cr are the distance between the center point and the table cell line, the value is between [0, 1], indicating the ratio of the distance to the length and width, tu, td, tl, tr are the distance between the center point and the text frame line, the value is between [0, 1], indicating the ratio of the distance to the length and width, and mu, md represent whether the query table cell information above and below can merge text lines, the value is 0 / 1, 0 means cannot merge, and 1 means can merge; And, when outputting the 14 attributes of each unit information, the CE and TS attributes are output through the classification loss function, and the remaining attributes are output through the regression loss function, and the regression loss function is specifically: in, and They represent the model predicted category and the true category of the i-th query of the b-th sample, respectively. and denote the continuous value predicted by the model and the true continuous value of the i-th query of the b-th sample, respectively. class is the classification loss, L reg is the regression loss and α is the parameter that weighs the two losses.