A table structure recognition method

Through the method of initial row and row generation and row and row generation stages, combined with graph neural network and undirected graph model, it solves the problem that existing technology cannot effectively restore the table structure, and achieves efficient and generalized table structure extraction and computational complexity reduction. .

CN113627318BActive Publication Date: 2024-09-06BEIJING INST OF TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110904049.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-06
Publication Date
2024-09-06
Estimated Expiration
2041-08-06

AI Technical Summary

Technical Problem

Existing table structure recognition methods cannot effectively restore the table structure, have high computational complexity, and cannot adapt to different styles of tables.

Method used

Using the methods of the initial row and row generation stage and the row and row generation stage, the row and row relationship between cells is predicted through the graph neural network, the initial rows and columns are generated by combining the cell position information and height/width information, and the units are judged through the undirected graph model The relationship between grids and rows reduces computational complexity.

Benefits of technology

It achieves efficient structure extraction of tables of different styles, reduces computational complexity, can completely restore the table structure, has strong applicability, and can adapt to cell position offsets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113627318B
    Figure CN113627318B
Patent Text Reader

Abstract

The present invention relates to a table structure recognition method, belonging to the field of pattern recognition technology. It includes two processes: an initial row and column generation stage and a row and column generation stage. In the initial row and column generation stage, cells with overlapping areas are organized into initial rows and initial columns through a heuristic algorithm; since cells without overlapping relationships may also have row / column relationships, in the row and column generation stage, a graph neural network is used to mainly predict the row and column relationships between cells without overlapping areas as a supplement to the missing relationships; in order to reduce the computational complexity of the prediction, the relationship between cells is actually obtained by predicting the relationship between the cells and the initial rows / initial columns. Compared with the prior art, the present invention reduces the number of cells that the model needs to judge the relationship, and provides prior knowledge for the construction of subsequent graph models and feature extraction based on the initial rows and initial columns; finally, the rows and columns of the table can be generated, which can completely restore the structure of the table.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to table recognition technology, in particular to a table structure recognition method, and belongs to the fields of computer technology, pattern recognition and artificial intelligence technology. Background Art

[0002] Tables contain rich structured data and are therefore an important data source for data mining applications. However, in widely used document formats such as PDF or images, the structured information of tables cannot be directly used. In order to extract the structure of tables from documents in these formats, the general practice is to manually set rules, such as detecting the borders of the table, and then perform subsequent processing based on whether the document matches the rules. However, due to the variety of table styles, such as the absence of borders in the table, the manually set rules cannot be applied to a variety of tables. In order to process tables of different styles, a better way is to use a data-driven approach to enable the machine to automatically learn features that are not related to the style, and use the learned features to extract the table structure.

[0003] At present, a table structure recognition method based on graph attention network has been proposed. This method obtains the spatial position of cells through tools, and then sets a series of initial features according to the spatial distribution of cells. The initial features are used to obtain deep features through graph attention network. The deep features are finally used to determine whether there is a row or column relationship between each cell in the table and its k nearest cells. This method has the characteristics of strong applicability, but because this method does not determine the relationship between all cells, the relationship it detects is not enough to restore the table structure; at the same time, because the row and column relationships between some cells can be determined by rules, using graph attention network to determine these relationships results in high computational complexity.

[0004] The present invention proposes an improved table structure recognition method based on the advantages and disadvantages of the above methods. The improved method has strong applicability, can directly restore the structure of the table, and further reduces the calculation complexity. Summary of the invention

[0005] The purpose of the present invention is to address the deficiencies of the prior art and to solve the problem of extracting table structures from documents, thereby providing a table structure recognition method to achieve efficient and highly generalized table structure extraction for document tables.

[0006] In order to achieve the above-mentioned object, the present invention provides a table structure recognition method, including an initial row and column generation phase and a row and column generation phase;

[0007] In the initial row and column generation stage, cells with overlapping areas are organized into initial rows and initial columns;

[0008] In the row and column generation stage, a graph neural network is used to predict the row and column relationships between cells without overlapping areas, as a supplement to the omitted relationships in the initial row and column generation stage.

[0009] According to a specific implementation method of an embodiment of the present invention, in the initial row and column generation stage, document features are used to extract cell position information from the document, and the cell position information is used to determine whether there is an overlapping area in the vertical / horizontal direction between different cells, so as to preliminarily determine whether there is a row / column relationship between different cells, and then organize the cells with a row / column relationship into initial rows / initial columns according to the height / width information of the cells.

[0010] According to a specific implementation method of an embodiment of the present invention, in the row and column generation stage, based on the initial row and the initial column, two graphs are constructed for matching cells to the initial row and the initial column respectively, and the graphs are used to determine the relationship between the cells and the initial row or the initial column. The row finally generated is the union of the initial row and all cells matching the initial row, and the column finally generated is the union of the initial column and all cells matching the initial column.

[0011] According to a specific implementation of an embodiment of the present invention, in the initial row and column generation stage:

[0012] ① Extract the cell information corresponding to the table from the input document, where the position of the cell is defined by the text actually contained in the cell;

[0013] ②According to the cell information, the overlapping area between different cells in the horizontal / vertical direction is obtained, so as to obtain the same column / row relationship between different cells, and record the same row relationship in D r In the example, record the same column relationship in D c middle;

[0014] ③ Initialize the initial row set PR = {} and the initial column set PC = {};

[0015] ④Add elements to the set PR:

[0016] If there are unmarked cells, select the unmarked cells from all cells and select them from D r Find all cells that have a peer relationship with it, merge the selected cell and all cells that have a peer relationship with it into the initial row pr i , the generated pr i Add to PR and mark all existing in PR i If the cell is not found, return to ④; otherwise, save PR and exit ④;

[0017] ⑤Add elements to the set PC:

[0018] If there are unmarked cells, select the unmarked cells from all cells and select them from D c Find all cells that are in the same column as the selected cell, and merge the selected cell and all cells that are in the same column as the selected cell into the initial column pc i , the generated pc i Add to PC and mark all existing i If the cell is not found, return to ⑤; otherwise, save the PC and exit ⑤.

[0019] According to a specific implementation of an embodiment of the present invention, in the row and column generation stage:

[0020] Column generation:

[0021] ① Calculate the ranking: For each initial column in the PC, calculate its average horizontal boundary, and rank the initial columns according to the average boundary. Since there are two boundary values ​​in the horizontal direction for each cell, each initial column also has two ranking values.

[0022] ② Initialize the undirected graph G;

[0023] ③Construct the nodes in graph G:

[0024] There are two types of nodes in the graph: initial column nodes and cell nodes; the i-th initial column node Using three-dimensional vector It represents that the first and second dimensions are the two ranking values ​​of the initial columns, and the third dimension is the number of initial columns in the PC; the i-th cell exists in a number of initial columns {pc p1 , pc p2 ,…,pc pn} and several initial lines {pr q1 ,pr q2 ,…,pr qn}, which corresponds to the cell node in graph G , using a four-dimensional vector Represents, where the first and second dimensions are the ranking values ​​of the initial columns with the smallest average left boundary and the largest average right boundary in the initial column set where the cell is located, the third dimension is the number of cells in the first initial row where the cell is located, and the fourth dimension is the index value of the first initial row where the cell is located;

[0025] ④Construct the edges in graph G:

[0026] There are two kinds of edges in the graph: the edge between cell nodes, denoted by c2c; the edge between the cell node and the initial column node, denoted by c2g;

[0027] If two cells exist in the same initial row and are adjacent in the horizontal direction, a c2c edge is added between the corresponding cell nodes, and the corresponding cell nodes are called neighboring cell nodes;

[0028] Add c2g edges between each cell node and all initial column nodes. There are two types of added edges: if the cell exists in the corresponding initial column, the type of the c2g edge is 1; otherwise, it is 0;

[0029] ⑤ According to the type of c2g edge, initialize the vector representation of the edge by looking up the dictionary. The dictionary includes four types: the dictionary used for edge type mapping Dictionary used for ranking value mapping Dictionary used for node number mapping Dictionary used to map absolute values ​​of ranking differences

[0030] ⑥ Feature extraction of node number difference:

[0031] Calculate the number of cells contained in all initial rows and construct the number into a sequence L. For PR = {pr1, pr2, ..., pr i ,…pr k′}, the constructed sequence is L = (l1,l2,…,l i ,…l k′ ), where l i =(|pr i |), where |pr i | represents the number of cells contained in the i-th initial row;

[0032] Process the sequence L through the bidirectional GRU to obtain the same length sequence L′, the i-th element h in L′ i It reflects the characteristics of the difference in the number of cells contained in the i-th initial row and other initial rows;

[0033] ⑦ Dynamically update the vector representation corresponding to the c2g edge: The vector representation of the c2g edge is finally represented by Z rounds of updates, where Z is the number of hops of the graph neural network; in the zth round of updates, three aspects of information are mainly considered, where z = 1, 2, ..., Z:

[0034] (1) Differences between cell nodes and initial column nodes

[0035] (2) Information provided by the cell node's neighboring cell nodes

[0036] (3) Difference characteristics of the number of nodes in the initial row to which the cell belongs

[0037] Update formula: Where α is the weight, the weight vector Among them, softmax normalizes the vector, F3 is a two-layer feedforward neural network with ReLU as the activation function, and α=w2.

[0038] ⑧ Based on the vector representation of the final c2g edge, a multi-layer perceptron is used to classify the c2g edge into two categories: belonging to and not belonging to;

[0039] ⑨Analyze the edge types between all cell nodes and the initial column nodes. If the edge type is belongs to, merge the corresponding cell to the corresponding initial column to obtain the corresponding generated column;

[0040] ⑩Output all generated columns;

[0041] Generation of rows:

[0042] Rotate the cell position coordinates 90 degrees clockwise, let PR′=PC, PC′=PR, use PR′ as the initial row set, PC′ as the initial column set, generate columns by generating the columns, the corresponding generated columns are the actual rows of the table, and output all generated rows.

[0043] Beneficial effects:

[0044] Because of the data-driven approach, the present invention has strong applicability. In particular, because the cell position is not directly used as input in the row and column generation stage, but the generated initial row / column is used as input, the method is still applicable when the positions of all cells in the table are offset as a whole; after obtaining the position information of all cells in the table, the row and column relationships of some cells are determined through a pre-operation step, and they are organized into initial rows and initial columns, thereby (1) reducing the number of cell relationships that need to be judged by the model later, thereby reducing the computational complexity (2) providing prior knowledge for the construction of subsequent graph models and feature extraction; the present invention can finally generate the rows and columns of the table, so it can completely restore the structure of the table. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 is the original table to be identified in the embodiment of the present invention;

[0046] Figure 2 is the position recognition result of the original table in the embodiment of the present invention;

[0047] Figure 3 The initial row and column generation result in the embodiment of the present invention;

[0048] Figure 4 A graph model constructed in an embodiment of the present invention;

[0049] Figure 5 is a c2g edge between a cell node and an initial column node in an embodiment of the present invention;

[0050] Figure 6 This is an illustration of the first part of information in an embodiment of the present invention;

[0051] Figure 7 This is a schematic diagram of the second part of information in an embodiment of the present invention;

[0052] Figure 8 This is a schematic diagram of the third part of information in an embodiment of the present invention;

[0053] Fig. 9 It is an overall flow chart of an embodiment of the present invention. DETAILED DESCRIPTION

[0054] The implementation of the method of the present invention is described in detail below with reference to the accompanying drawings.

[0055] The present invention provides a table structure recognition method, which includes two processes: an initial row and column generation stage and a row and column generation stage. In the initial row and column stage, the present invention organizes cells with overlapping areas into initial rows and initial columns through a heuristic algorithm; since cells without overlapping relationships may also have row / column relationships (such as cells across rows / columns), in the row and column generation stage, the present invention uses a graph neural network to predict the row and column relationships between cells without overlapping areas as a supplement to the missing relationships in the initial row and column stage. In order to reduce the computational complexity of the prediction, the relationship between cells is actually obtained by predicting the relationship between the cells and the initial rows / initial columns. The implementation process of the entire invention method is as follows: Fig. 9 shown.

[0056] Better:

[0057] In the initial row and column generation stage, the document features are used to extract the cell position information from the document. The cell position information is used to determine whether there is an overlapping area between different cells in the vertical / horizontal direction, so as to preliminarily determine whether there is a row / column relationship between different cells. Then, the cells with a row / column relationship are organized into initial rows / initial columns according to the cell height / width information.

[0058] Of course, the acquisition of the initial row / initial column is not limited to the above method, and those skilled in the art may use other methods to implement it, such as the method mentioned in the background art.

[0059] Better:

[0060] In the row and column generation stage, based on the initial row and initial column, two graphs are constructed for matching cells to the initial row and initial column respectively. The graphs are used to determine the relationship between the cell and the initial row or initial column. The row / column finally generated is the union of the initial row / initial column and all cells matching the corresponding initial row / column.

[0061] Preferably, a specific embodiment of the above method is given below.

[0062] Before introducing this example, the symbols involved are agreed upon as shown in Table 1.

[0063] Table 1 Symbol conventions

[0064]

[0065] 1) Generation of initial rows / columns:

[0066] ①: Extract the cell information corresponding to the table from the input document.

[0067] Utilize the relevant features of the document to extract the two-dimensional spatial position of the cell corresponding to the table from the document. Specifically, Tabby (Alexey O.Shigarov, Andrey A.Mikhailov, Andrey Altaev: Configurable Table Structure Recognition in Untagged PDF documents. DocEng 2016: 119-122) and Cascadetabnet (Devashish Prasad, Ayan Gadpal, Kshitij Kapadni, Manish Visave, Kavita Sultanpure: CascadeTabNet: An approach for end to end table detection and structure recognition from image-based documents. CVPR Workshops 2020: 2439-2447) can be used to extract the cell position from the PDF document and image respectively, where the cell position is defined by the text actually contained in the cell. For example, if the table of the structure to be extracted is such as Figure 1 As shown, the extracted cell positions are as follows Figure 2 The positions of all extracted cells constitute a set C = {c1, c2, ..., c i ,…c n}, the position of the i-th cell is vector c i =(xi1 ,x i2 ,y i1 ,y i2 ), where x i1 ,x i2 Represents the values ​​of the left and right boundaries in the horizontal direction, y i1 ,y i2 Represents the values ​​of its upper and lower boundaries in the vertical direction; n represents the total number of cells; the width / height of a cell is defined as the absolute value of the difference in the boundary values ​​in the horizontal / vertical direction.

[0068] ②: Obtain the overlapping area between different cells in the horizontal / vertical direction according to the cell information, so as to obtain the same column / row relationship between different cells.

[0069] According to our findings, when different cells overlap horizontally or vertically, the cells often have a same column or row relationship. Therefore, we will calculate whether there is an overlap between two cells in C in the horizontal direction, so as to make a preliminary judgment on whether there is a same column relationship between the cells, and record the same column relationship in D. c For example, in Figure 2 There is a horizontal overlap between the "Dev" cell and the "EM" cell in the table, so these two cells are judged to have a column relationship, and the correlation relationship is stored in D c Similarly, we will make a preliminary judgment on the peer relationship of cells in C based on the vertical overlap relationship, and record the peer relationship in D r For example, in Figure 2 In the example, the "System" cell and the "Dev" cell overlap vertically, so the two cells are judged to have a row relationship, and the related relationship is stored in D r middle.

[0070] ③: Initialize the initial row set PR = {} and the initial column set PC = {}, and add elements to PR and PC respectively through step 4;

[0071] ④: Add elements to the sets PR and PC:

[0072] Add elements to PR: If there are unmarked cells, select the unmarked cells from all cells (preferably, select the unmarked cells with the smallest height, the smallest horizontal left border, and the smallest vertical border), and add them from D r Merge the selected cell and all cells in the same row as the initial row pr i , then, the generated pr i Add to PR and mark all existing in PRi If there are no cells that have not been marked, return to step 4; otherwise, that is, there are no unmarked cells, save PR and exit. Figure 2 The initial row set generated by all cells of Figure 3 As shown, pr1 includes "#1Single-MIR-MRC(F-Net)", "74.8", "78.0" cells, pr2 includes "#2Single-nlnet", "74.2", "77.1" cells, and the same applies to the cells included in pr3 to pr6. Those skilled in the art know that when adding elements to PR, i is set to 0. Each time the loop "if there are unlabeled cells, select unlabeled cells from all cells", i is incremented, and the result is as follows Figure 3 As shown, pr1 to pr6 are acquired in sequence.

[0073] Add elements to PC: If there are unmarked cells, select the unmarked cells from all cells (preferably, select the unmarked cells with the smallest width, the smallest vertical border, and the smallest horizontal left border), and add them from D c Find all cells in the same column as the selected cell. Merge the selected cell and all cells in the same column as the initial column pc i , then, the generated pc i Add to PC and mark all existing i If there are no cells in the list, return to step 5; otherwise, that is, there are no unmarked cells, save PC and exit. Figure 2 The initial column set generated by all cells of Figure 3 As shown, pc1 includes "F1", "Top LeaderboardSystems(Dec 10th,2018)", and "89.0"; pc2 includes "F1", "89.5", "78.0", and "77.1", and the same applies to the cells contained in pc3 to pc5. It can be found that based on step 5, cells with overlapping areas with multiple columns can be divided into multiple initial columns. For example, the cell "Top Leaderboard Systems(Dec 10th,2018)" exists in the four initial columns pc1 to pc4. As before, those skilled in the art know that when adding elements to PC initially, i is set to 0. Each time the loop "if there are unmarked cells, select unmarked cells from all cells", i is incremented, and the result is as follows. Figure 3 As shown, pc1 to pc5 are acquired in sequence.

[0074] Through the above steps, cells with obvious row / column relationships can be organized into rows and columns with high accuracy. However, if the rows and columns of the table are generated completely according to the overlapping rules, the row and column relationships of some cells that cross rows and columns may be omitted, such as Figure 3 As shown in the figure, the cell "Dev" is a cross-column cell, and it should have a column relationship with the cells "EM" and "F1". However, since there is no horizontal overlapping relationship between the cells "Dev" and "F1", the column relationship between the cells "Dev" and "F1" will be omitted. In order to find out the possible omitted relationships, we subsequently proposed a deep learning-based model to predict the omitted relationships. The model takes the generated initial rows and initial columns as input and the table structure as output. In summary, preprocessing the cell relationships based on the overlapping rules can not only reduce the number of relationships that the subsequent model needs to predict and thus reduce the computational complexity of the model, but also provide prior knowledge for the construction of the subsequent graph model and feature extraction.

[0075] 2) Generation of rows / columns:

[0076] Column generation:

[0077] ①: Calculate the ranking. For each initial column in PC, calculate its average horizontal boundary and rank the initial columns according to the average boundary. Because there are two boundary values ​​in the horizontal direction for each cell, each initial column also has two ranking values. That is, for PC = {pc1, pc2, ..., pc i ,…,pc k Each initial column pc in i (i∈{1,2,…,k}; k represents the number of initial columns), calculate the average boundary value in the horizontal direction where |pc i | indicates pc i The number of cells contained in c j For PC i The cells in the , including the two elements of the horizontal left and right border positions. In PC, the ranking is performed according to the first two dimensions of the initial column average border value, that is, the average value of the left and right borders, and {(r 11 ,r 12 ),(r 21 ,r 22 ),…,(r k1 ,r k2 )}.

[0078] ②: Initialize the undirected graph G;

[0079] ②: Construct nodes in graph G.

[0080] There are two types of nodes in the graph: initial column nodes and cell nodes, which represent the initial columns and cells in the table constructed above, respectively. The i-th initial column node corresponds to the node in graph G Using three-dimensional vector Indicates that the first and second dimensions are the two ranking values ​​of the initial columns, and the third dimension is the number of initial columns. The i-th cell exists in several initial columns {pc p1 ,pc p2 ,…,pc pn}(pn represents the number of initial columns containing the i-th cell), several initial rows {pr q1 ,pr q2 ,…,pr qn} (qn represents the number of initial rows containing the i-th cell), which corresponds to the node in graph G Using four-dimensional vector Indicates that the first and second dimensions are the ranking values ​​of the initial columns with the smallest average left boundary and the largest average right boundary in the initial column set where the cell is located, the third dimension is the number of cells in the first initial row where the cell is located, and the fourth dimension is the index value of the first initial row where the cell is located. Compare The definitions of the two nodes are similar except for the addition of one dimension. If all the initial column nodes are combined into a new initial row but It also reflects the number of nodes in the initial row where the initial column node is located. Figure 4 The cell nodes and initial column nodes are represented by circles and rectangles respectively. Figure 2 The cells in the figure correspond one to one, and the initial column nodes correspond one to one with the initial columns. The constituent nodes of each initial column in the figure are marked by the shaded part (the cells spanning 4 columns are not marked with shades). Figure 4 All rectangular nodes in are organized into the 7th initial row. There are 5 nodes in the initial row, so the value of the third dimension of all initial column nodes is 5.

[0081] ④: Construct the edges in graph G.

[0082] There are two types of edges in the graph: the edge between cell nodes (denoted by c2c) and the edge between cell nodes and the initial column nodes (denoted by c2g). If two cells exist in the same initial row and are adjacent to each other in the horizontal direction, a c2c edge is added between the corresponding cell nodes, and the corresponding cell nodes are called neighboring cell nodes. Figure 4As shown in the figure, c2c edges are constructed between neighboring cells. In the figure, cell nodes 1 and 2 are neighboring cell nodes, but cell nodes 1 and 3 (not adjacent) and cell nodes 1 and 4 (not in the same initial column) are not neighboring cell nodes. c2g edges are added between each cell node and all initial column nodes. There are two types of added edges: if the cell exists in the corresponding initial column, the type of c2g edge is 1; otherwise, it is 0. Note that in Figure 4 In the figure, the c2g edges are omitted, and the c2g edges of the cell nodes in the dashed box are Figure 5 In the figure, it is represented by a dotted line. If the type of the c2g edge is 1, the color of the dotted line is gray, otherwise it is black.

[0083] ⑤: According to the type of c2g edge, initialize the vector representation of the edge by looking up the dictionary.

[0084] For the edge between the i-th cell node and the j-th initial column node, its initial vector is expressed as in Dictionary representing edge type mapping, e ij ∈{0,1} represents the type of c2g edge. The dictionary randomly initializes the mapping method and continuously changes the mapping method through model training. By converting to a high-dimensional vector, the corresponding data can be more distinguished. Similarly, except In addition, there are three other dictionaries for the ranking value, the number of nodes, and the absolute value of the ranking value difference, which are recorded as These three dictionaries can also map numerical values ​​with specific meanings to high-dimensional vectors, allowing the model to learn deep features.

[0085] ⑥: Feature extraction based on node number difference.

[0086] We found that the change in the number of nodes in all rows of the table is suggestive of the prediction of cell relationships. For example, for a table with 4 rows, the number of nodes in each row forms the set {2,4,4,4}. It is very likely that the first row contains 2 cross-column cells, and each cell spans 2 columns, while the cells in the 2nd, 3rd, and 4th rows do not span columns. In order to extract this feature, we first calculate the number of cells in all initial rows and construct the number into a sequence L. For PR = {pr1,pr2,…,pr i ,…pr k′}(i∈{1,2,…,k′}, k′ represents the number of initial rows), the constructed sequence is L=(l1,l2,…,l i ,…l k′ ), where l i =(|pr i |), where |pr i| represents the number of cells contained in the i-th initial row; then the sequence L is processed by the bidirectional GRU to obtain a sequence L′ of equal length. Since the bidirectional GRU can effectively capture the features of sequence data and convert them into higher-dimensional features, the i-th element h in L′ i reflects the difference in the number of nodes in the i-th initial row. Figure 8 For example, the vectors in L are l1=(3),l2=(4),l3=(1),…,l6=(3). The bidirectional GRU (Bi-GRU) transforms l i One-to-one mapping is h i .

[0087] ⑦: Dynamically update the vector representation E corresponding to the c2g edge z (i,j).

[0088] The vector representation of the c2g edge is finally represented by Z rounds of updates, where Z is the number of hops of the graph neural network, which is a preset hyperparameter and should not be set too large. In our embodiment, it is 3. During the zth round of updates, three aspects of information are mainly considered:

[0089] (1) The difference between the cell node and the initial column node;

[0090] (2) Information provided by the neighboring cell nodes of the cell node;

[0091] (3) Characteristics of the difference in the number of nodes in the initial row to which the cell belongs.

[0092] Specifically, take the i-th cell node With the jth initial column node ( Figure 6 Take the circular nodes and rectangular nodes connected by dotted lines in Figure 1 as an example to illustrate how to obtain the above three parts of information:

[0093] Part I Information It can be obtained by the following formula: Among them, F1 is a two-layer feedforward neural network with ReLU as the activation function. Indicates the concatenation operation of vectors, and the subscripts 1, 2, and 3 represent the first, second, and third dimensional data of the node respectively. and The difference between the ranking value of and the number of nodes in the initial row to which it belongs is Figure 6In the figure, for the c2g edge represented by the dotted line, there is a difference in the ranking values ​​of the nodes on both sides of the edge, and there is an approximate multiple relationship between the number of nodes in the initial row, and the multiple is equivalent to the absolute value of the ranking value difference, so the corresponding cell node is likely to be a cross-column cell node. Specifically, the absolute value of the ranking value difference of the nodes on both sides of the edge is 1, and the multiple of the initial row node number difference is approximately 2, so the true type of the c2g edge is more likely to be 1;

[0094] For the second part of the information First, define the aggregation information between the two nodes Where abs represents the absolute value function, E z-1 (i,j) represents the current vector representation of the edge between the two nodes. in express F2 is a set of neighboring cell nodes, and F2 is a two-layer feedforward neural network with ReLU as the activation function. Because two neighboring cells cannot exist in the same column, the type of the c2g edge between the two and a certain initial column should not be 1 at the same time. Therefore, when updating the c2g vector representation, it is necessary to consider the vector representation of the edge between the neighboring cell node and the corresponding initial column node; and when considering the above vector representation, we will also consider the ranking difference between the neighboring cell node and the corresponding initial column node. Figure 7 As shown, when updating the vector representation of the c2g edge between the cell node 2 and the initial column node, the aggregation information of the cell node 2 and its neighboring cell nodes 1 and 3 and the target initial column node will be considered, and then the relevant aggregation information will be nonlinearly mapped through the feedforward neural network to obtain the processed aggregation information related to the neighboring cell nodes 1 and 3, and then these two parts of information will be added to obtain the final information.

[0095] Since the difference features have been obtained in step 6, the third part of the information For example, Figure 8 As shown in , if the cell is in the first initial row from top to bottom (the initial row with three cell nodes), the third part of its information is h1. Figure 8 The c2g edge is black to highlight the current cell node and the initial column node, rather than indicating that the c2g type of the edge is 0. In order to represent the prediction process of the model, Figure 8 Type 1 c2g edges are ignored.

[0096] The acquisition of the above three parts of information is only a preferred implementation of the present invention and is not limited thereto, as long as the above features can be acquired.

[0097] Considering the above three pieces of information, the specific update method of the vector representation is Where α is the weight, which is obtained by learning by considering the current vector representation of the edge and the third part of information. Specifically, the weight vector Among them, softmax normalizes the vector, and F3 is a two-layer feedforward neural network with ReLU as the activation function. After obtaining w, α takes the second dimension value of w, that is, α = w2.

[0098] ⑧: Based on the vector representation of the final c2g edge, a multi-layer perceptron is used to classify the c2g edge into two categories: belonging to and not belonging to;

[0099] ⑨: Analyze the edge types between all cell nodes and the initial column nodes. If the edge type is belongs to, merge the corresponding cell to the corresponding initial column to obtain the corresponding generated column;

[0100] ⑩: Output all generated columns and end;

[0101] The process of generating a row:

[0102] Rotate the cell position coordinates 90 degrees clockwise (i.e. swap the row and column relationship of the cell), let PR′=PC, PC′=PR, use PR′ as the initial row set and PC′ as the initial column set, generate columns through the aforementioned "column generation process", the corresponding generated columns are the actual rows of the table, and output all generated rows.

[0103] It should be noted that in the process of "column generation", the steps represented by the various numbers do not need to be executed strictly in the order of the numbers, as long as the contents described by the above numbers are completed.

[0104] Experimental Results

[0105] (1) Experimental setup

[0106] We used the ICDAR-2013, SciTSR and SciTSR-COMP datasets to verify the effectiveness of our model.

[0107] ICDAR-2013 is a public dataset for the ICDAR 2013 table recognition competition. ICDAR-2013 contains a total of 156 tables saved in PDF files, and the structural information of each table and the location of the cells in the table are manually annotated. Since the dataset is manually annotated, the dataset is small in size and is only used as a test set in the experiment.

[0108] SciTSR is a dataset automatically constructed by an algorithm. SciTSR contains a total of 15,000 tables saved in PDF and image formats, of which 12,000 tables are divided into training sets and 3,000 tables are divided into test sets. In addition, in order to evaluate the recognition accuracy of the model for cross-row and cross-column table structures, a sub-test set SciTSR-COMP containing 716 tables is defined in the test set.

[0109] Since ICDAR-2013 does not provide a training set, all models are trained on the SciTSR training set and tested on the ICDAR-2013, SciTSR-COMP, and SciTSR test sets.

[0110] We compare the proposed method with the following baseline models:

[0111] GraphTSR (Zewen Chi, Heyan Huang, Heng-Da Xu, Houjin Yu, Wanxuan Yin, Xianling Mao: Complicated Table Structure Recognition. CoRR abs / 1908.04729 (2019)): GraphTSR is a model based on graph attention network, which mainly restores the table structure by classifying the relationship between each cell and its k nearest neighbor cells;

[0112] GTFE (Yiren Li, Zheng Huang, Junchi Yan, Yi Zhou, Fan Ye, Xianhui Liu: GFTE: Graph-based Financial Table Extraction. CoRR abs / 2003.07560(2020)): GFTE also restores the table structure by predicting the relationship between a cell and its k-nearest neighbor cells. Compared with GraphTSR, it uses a model based on graph convolutional networks, and extracts the image information of the table, the position information of the cell, and the text information of the cell as features, and uses these features to assist in the judgment of the relationship between cells. For a fair comparison, we use the version that uses cell position information as a feature as a comparison method;

[0113] DGCNN *:DGCNN (Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E. Sarma, Michael M. Bronstein, Justin M. Solomon: Dynamic Graph CNN for Learning on Point Clouds. ACM Trans. Graph. 38(5): 146: 1-146: 12 (2019)) is a model that uses the spatial position of points in a point cloud and the relative positions of neighboring points to extract high-dimensional features of points. We implemented DGCNN based on DGCNN * In DGCNN * In this paper, we regard cells as points and the positions of cells as the coordinates of the points. We use DGCNN to extract the high-dimensional features of cells and concatenate the high-dimensional features of cells whose relationships are to be judged. Then we use a multi-layer perceptron to judge the concatenated vectors. Finally, we determine the relationship between cells based on the output of the multi-layer perceptron.

[0114] (2) Experimental results and analysis

[0115] The experiments involved mainly include: verification of overlapping rules, evaluation of the effects of initial rows and columns, verification of the effects of the graph model, and evaluation of the overall model effects.

[0116] Table 2 Verification of overlapping relationships

[0117] Dataset Column Precision Row precision SciTSR train 0.999 0.990 SciTSR test 0.999 0.992 SciTSR-COMP 1.000 0.997 ICDAR-2013 1.000 0.970

[0118] In order to verify our findings on the impact of cell overlap on the same column / row relationship, we verified whether cell overlap will lead to the existence of a row / column relationship from the dimension of accuracy. Specifically, we record the number of cell pairs with overlapping areas and real relationships as TP, and the number of cell pairs with overlapping areas but no relationship as FP. The accuracy calculation formula is defined as The results of column accuracy and row accuracy on different data sets are shown in Table 2, where SciTSR train represents the training set of the SciTSR data set, and SciTSR test represents the test set of the SciTSR data set. It can be found in Table 2 that the accuracy of the overlapping relationship is very high on each data set, so the validity of the overlapping relationship can be verified.

[0119] For the initial rows and columns, we mainly evaluate the initial rows and columns by judging whether the cell pairs in the same initial column / row exist in the real table column / row. We record the number of cell pairs that meet the judgment conditions as TP′, the number of cell pairs that exist in the initial column / row but not in the real table column / row as FP′, and the number of cell pairs that do not exist in the initial column / row but exist in the real table column / row as FN′, and use the above accuracy calculation formula to calculate the accuracy, The recall rate is calculated and the relevant results are shown in Table 3. In Table 3, we have two main findings: 1) The accuracy of the initial rows and columns is very high, which further verifies the effectiveness of our overlapping rules; 2) The recall rate of the initial rows and columns is slightly low, especially on the SciTSR-COMP dataset, which shows that when there are many cells across columns / rows in the table, the initial rows and columns generated completely based on the overlapping rules have some missing cells, indicating the necessity of further processing.

[0120] Table 3 Initial row and column evaluation

[0121]

[0122] When verifying the effect of the graph model, we mainly consider the verification of the effect of the graph model for judging the column relationship, because: 1) In the SciTSR dataset, cells with multiple lines of text are incorrectly divided into multiple cross-row cells, which will produce unnecessary noise on the experimental results; 2) The occurrence of cross-column cells is far more common than cross-row cells, and the matching of cross-column cells will also be more complicated. The evaluation of the model accuracy is based on whether the type of c2g edge classified by the model is correctly classified. Because the classification of edges is a binary classification problem, we calculated the accuracy, recall rate and F1 score of this binary classification problem, and verified the effect of the graph model based on this. The relevant verification results are shown in Table 4. It can be found that the accuracy and recall rate of the graph model are quite high, which verifies the effectiveness of our model.

[0123] Table 4 Graph model effect verification

[0124] Dataset Precision Recall F1 SciTSR test 0.998 0.996 0.997 SciTSR-COMP 0.993 0.981 0.987 ICDAR-2013 0.995 0.990 0.992

[0125] In order to verify the overall effect of the model and compare it with other methods, we adopted an evaluation method similar to the ICDAR-2013 table recognition competition, in which the table is converted into a series of adjacency relations, and then the recognition results are measured by judging the similarities and differences between the predicted relations and the true relations. Among them, relations only exist between adjacent pairs of cells with row / column relations, and each relation is identified by a triple relation: the text content of the related cells, the direction of the relation, and the number of blank cells between the related cells. Since we are more concerned about whether the relationship between cells is correctly predicted rather than whether the text content of the cells is correctly recognized and the number of blank cells between cells, we use the two-tuple ID of the related cells and the direction of the relation to identify the relationship.

[0126] Since the k-nearest neighbor method cannot directly restore the table structure, we use a post-processing step to generate the prediction results. The idea of ​​the post-processing step is: for each cell c i The prediction result of the prediction is to find the cell c that is related to it, located below it in the vertical direction, and has the smallest vertical coordinate difference j , construct c i With c j The adjacency relationship between them is then found i All cells in the same initial row {c i1 ,c i2 ,…,c in}, if c i is predicted to be and c ik If there is a relationship between them, then construct c i With c ik All constructed adjacency relationships are compared with all true adjacency relationships in the table as predicted results.

[0127] The evaluation results are shown in Table 5. From Table 5, we can see that the F1 score of our method is not lower than that of other methods on any dataset. Although the accuracy of our method is slightly lower than that of GraphTSR on the SciTSR-COMP and SciTSR test sets, the recall rate of our method has achieved the best results on all datasets. At the same time, we can find that the experimental effect of our method is much better than other methods on ICDAR-2013. This is mainly because compared with other methods, our method does not directly use the position of the cell as the input of the graph model, but pre-processes the position of the cell and obtains some prior results. Therefore, when facing different datasets and the absolute position of the cell is offset, it can have stronger generalization ability.

[0128] Table 5 Overall effect of the model

[0129]

[0130]

[0131] In order to illustrate the content and implementation method of the present invention, this specification provides specific embodiments. The purpose of introducing details in the embodiments is not to limit the scope of the claims, but to help understand the method of the present invention. Those skilled in the art should understand that various modifications, changes or replacements of the steps of the best embodiment are possible without departing from the spirit and scope of the present invention and the claims attached thereto. Therefore, the present invention should not be limited to the contents disclosed in the best embodiment and the drawings.

Claims

1. A table structure recognition method, characterized in that: It includes an initial row and column generation phase and a row and column generation phase; In the initial row and column generation stage, cells with overlapping areas are organized into initial rows and initial columns; In the row and column generation stage, a graph neural network is used to predict the row and column relationships between cells without overlapping areas, as a supplement to the omitted relationships in the initial row and column generation stage; In the initial row and column generation phase: Extracting cell information corresponding to a table from an input document, wherein the position of a cell is defined by the text actually contained in the cell; According to the cell information, the overlapping area between different cells in the horizontal / vertical direction is obtained, so as to obtain the same column / row relationship between different cells, and record the same row relationship in In , record the same column relationship in middle; Initialize the initial rowset and the initial set of columns ; ④To the collection Add elements to: If there are unmarked cells, select the unmarked cells from all cells and Find all cells that have a peer relationship with it, and merge the selected cell and all cells that have a peer relationship with it into the initial row , which will generate Add to PR and mark all existing If the cell is not found, return to ④; otherwise, save PR and exit ④; ⑤To the collection Add elements to: If there are unmarked cells, select the unmarked cells from all cells and Find all cells in the same column as the selected cell and merge the selected cell and all cells in the same column as the initial column. , which will generate Add to PC and mark all the In the cell, return ⑤; otherwise, save PC , exit⑤; In the row and column generation phase: Column generation: Calculate the ranking: PC For each initial column in , calculate its average horizontal boundary and rank the initial columns according to the average boundary. Since there are two boundary values ​​in the horizontal direction for each cell, there are also two ranking values ​​for each initial column. Initialize an undirected graph ; Construction diagram Nodes in: There are two types of nodes in the graph: initial column nodes and cell nodes; the i-th initial column node , using a three-dimensional vector Indicates that the first and second dimensions are the two ranking values ​​of the initial column, and the third dimension is the PC The number of initial columns in ; the i-th cell exists in several initial columns and some initial rows In the graph G, it corresponds to the cell node , using a four-dimensional vector Represents, where the first and second dimensions are the ranking values ​​of the initial columns with the smallest average left boundary and the largest average right boundary in the initial column set where the cell is located, the third dimension is the number of cells in the first initial row where the cell is located, and the fourth dimension is the index value of the first initial row where the cell is located; ④Structural diagram The edges in: There are two kinds of edges in the graph: the edge between cell nodes, denoted by c2c; the edge between the cell node and the initial column node, denoted by c2g; If two cells exist in the same initial row and are adjacent in the horizontal direction, a c2c edge is added between the corresponding cell nodes, and the corresponding cell nodes are called neighboring cell nodes; Add c2g edges between each cell node and all initial column nodes. There are two types of added edges: if the cell exists in the corresponding initial column, the type of the c2g edge is 1; otherwise, it is 0; ⑤ According to the type of c2g edge, initialize the vector representation of the edge by looking up the dictionary. The dictionary includes four types: the dictionary used for edge type mapping , the dictionary used for ranking value mapping , the dictionary used for node number mapping , the dictionary used to map the absolute values ​​of ranking differences ; Node number difference feature extraction: Count the number of cells contained in all initial rows and construct the number into a sequence ,for , the constructed sequence is ,in ,in, Indicates the number of cells contained in the i-th initial row; Processing sequences with bidirectional GRU , and obtain sequences of equal length , The Elements Reflects the The characteristics of the difference in the number of cells contained in the initial row and other initial rows; Dynamically update the vector representation corresponding to the c2g edge: The vector representation of the c2g edge is obtained by The final representation is obtained by round update, where Z is the number of hops of the graph neural network; in the zth round update, three aspects of information are mainly considered, where z=1, 2,…, : (1) Differences between cell nodes and initial column nodes ; (2) Information provided by the neighboring cell nodes of a cell node ; (3) Characteristics of the difference in the number of nodes in the initial row to which the cell belongs ; Update formula: ,in is the weight, weight vector ,in Normalize the vector, is a two-layer feedforward neural network with ReLU as the activation function. ; Based on the final vector representation of the c2g edge, a multi-layer perceptron is used to perform binary classification on the c2g edge. The classification categories include belonging and not belonging. Analyze the edge types between all cell nodes and the initial column nodes. If the edge type is belongs to, merge the corresponding cell to the corresponding initial column to obtain the corresponding generated column. Output all generated columns; Generation of rows: Rotate the cell's position coordinates 90 degrees clockwise, so , ,Will As the initial row set, As the initial column set, columns are generated by generating the columns, and the corresponding generated columns are the actual rows of the table, and all generated rows are output.

2. The method according to claim 1, characterized in that In the initial row and column generation stage, the document features are used to extract the cell position information from the document, and the cell position information is used to determine whether there is an overlapping area between different cells in the vertical / horizontal direction, so as to preliminarily determine whether there is a row / column relationship between different cells, and then organize the cells with a row / column relationship into initial rows / initial columns according to the cell height / width information.

3. The method according to claim 1 or 2, characterized in that: In the row and column generation stage, based on the initial row and the initial column, two graphs are constructed for matching cells to the initial row and the initial column respectively, and the graphs are used to determine the relationship between cells and the initial row or the initial column. The row finally generated is the union of the initial row and all cells matching the initial row, and the column finally generated is the union of the initial column and all cells matching the initial column.

4. The method according to claim 3, characterized in that The unmarked cell selected in ④ is to select an unmarked cell with the smallest height, the smallest left border in the horizontal direction, and the smallest border in the vertical direction.

5. The method according to claim 3, characterized in that: The unmarked cell selected in ⑤ is an unmarked cell with the smallest width, the smallest border in the vertical direction, and the smallest left border in the horizontal direction.

6. The method according to claim 1, characterized in that Said = )),in is a two-layer feedforward neural network with ReLU as the activation function. Represents the concatenation operation of vectors. The subscripts 1, 2, and 3 represent the first, second, and third dimensional data of the node respectively.

7. The method according to claim 6, characterized in that Said = ,in express The set of neighboring cell nodes, It is a two-layer feedforward neural network with ReLU as the activation function; ,in represents the absolute value function, Represents the current vector representation of the edge between the two nodes, the initial value ,in Indicates the type of c2g edge.

8. The method according to claim 7, characterized in that Said .

Citation Information

Patent Citations

  • PDF table structure identification method based on graph attention mechanism

    CN110751038A

  • Table summarizing method, device and system

    CN111027294A

  • Table recognition method and device and computer readable storage medium

    CN112528813A