A method and system for structuring table pictures based on specific business features
By extracting table features and redrawing horizontal and vertical lines using a self-learning method, the problem of inaccurate table image parsing in bond financing was solved, improving the efficiency and accuracy of table structuring.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING DASHUYUAN TECH DEV CO LTD
- Filing Date
- 2023-01-30
- Publication Date
- 2026-05-15
AI Technical Summary
In the field of bond financing, existing technologies often result in table distortion in the fundraising reports provided during bond issuance due to factors such as closely spaced cell data or line breaks within the table. This reduces the accuracy of structured parsing of the table images.
By inputting the image of the table to be parsed into a preset table feature self-learning method, the table title and data are extracted, the table features are determined, new horizontal and vertical lines are drawn, and the table is re-parsed based on these lines to generate a structured table.
It improves the efficiency and accuracy of structured parsing of table images. In particular, through the self-learning method, the accuracy of features gradually increases with the number of images, reducing the reliance on manually defined templates.
Smart Images

Figure CN116110064B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image data processing technology, specifically relating to a method and system for structuring table images based on specific business characteristics. Background Technology
[0002] In the field of bond financing, financial statements are required for bond issuance. For example, when issuing some special-purpose bonds, issuing institutions require applicants to provide project fundraising reports. These reports typically include data tables with a consistent format for each business category, such as project fundraising status tables, cost calculation details tables, and project investment estimation tables. These data tables are valuable for analyzing the various economic indicators of the bond. However, for security and anti-counterfeiting reasons, these fundraising reports are usually scanned copies, with the data tables presented as image tables. The application of structured parsing of these image tables has expanded. However, in some image tables, the spacing between cells is too close together or there are line breaks within the table, leading to errors in recognizing horizontal and vertical lines, causing table distortion, and thus reducing the accuracy of structured parsing of the image tables. Figure 1 As shown in the example image, the circled portion of the original table has issues due to insufficient spacing between data cells and line breaks within cells. Figure 2 As shown in the results of existing table image structured parsing software, inaccurate table parsing occurs during the recognition process. Summary of the Invention
[0003] To overcome the shortcomings of the existing technology, this invention proposes a method for structuring table images based on specific business characteristics, including:
[0004] The table image to be parsed is input into a preset table feature self-learning method to obtain the table features corresponding to the table image to be parsed.
[0005] Based on the table features and the table intersection values corresponding to the table image to be parsed, table lines are drawn to obtain new horizontal and vertical lines. Based on the horizontal and vertical lines, the table image to be parsed is re-parsed to obtain a structured table.
[0006] Preferably, the step of inputting the table image to be parsed into a preset table feature self-learning method to obtain the table features corresponding to the table image to be parsed includes:
[0007] The table title corresponding to the table image to be parsed is extracted using OPEN-CV and OCR methods. It is then determined whether the table title exists. If it does, the table data is extracted; otherwise, the table is classified.
[0008] Determine whether the table data exists in a preset feature storage table. If it does, determine the feature weight value corresponding to the table data in the feature table and increase it by a preset value. Otherwise, insert the table data as new data into the feature storage table and set the feature weight value corresponding to the table data to a preset initial value.
[0009] Based on the table title, the number of header rows and the number of vertical lines with the largest feature weight values are determined as the table features of the table image to be parsed;
[0010] The table data includes: table title, number of header rows, and number of vertical lines.
[0011] Preferably, the table classification process includes:
[0012] Based on the extracted Chinese content of the table image to be parsed, the table is classified using a preset classification algorithm to obtain the table category and the corresponding table data.
[0013] Preferably, the step of drawing table lines based on the table features and the table intersection values corresponding to the table image to be parsed, obtaining new horizontal and vertical lines, and re-parseing the table image to be parsed based on the horizontal and vertical lines to obtain a structured table, includes:
[0014] Based on the table title and the table image to be parsed, the corresponding template table is determined from the preset table template library, and the feature values of the number of header rows and the number of vertical lines are obtained.
[0015] By performing binarization and dilation / erosion processing on the table image to be parsed, the table intersection values corresponding to the table image to be parsed are obtained, and the table intersection values are stored as a list.
[0016] The table intersection values in the list are sorted according to the position order of the table intersections in the table image to be parsed, resulting in a sorted intersection matrix;
[0017] Based on the intersection point value of a row in the intersection matrix that has the same number of vertical lines as the table, determine the horizontal intersection point. Then, group all columns according to the number of vertical intersection points in the intersection matrix, and determine the column intersection point value and corresponding vertical intersection point of the group with the most columns.
[0018] Draw horizontal and vertical lines based on the horizontal and vertical intersections to obtain a new table;
[0019] Based on the intersection value of the new table and the new table cell, the table content in the table image to be parsed is extracted and identified, and a structured table is generated according to the table content, the number of header rows, and the new table.
[0020] Preferably, the step of sorting the table intersection point values in the list according to the positional order of the table intersection points in the table image to be parsed, to obtain a sorted intersection point matrix, includes:
[0021] Establish a preset initial matrix, starting from the intersection value of the first table in the list, and iterate through the intersection values of each table in the list;
[0022] The intersection values of the traversed tables are sequentially filled into the initial matrix to obtain the sorted intersection matrix.
[0023] Preferably, the step of sequentially filling the intersection values of the traversed tables into the initial matrix to obtain the sorted intersection matrix includes the following steps:
[0024] Step S10: When the table intersection value of the target intersection point is equal to the preset first table intersection value or greater than the table intersection value of the previous intersection point, the target intersection point is placed in the row of the initial matrix and the process jumps to step S30; otherwise, the process jumps to step S20.
[0025] Step S20: Perform line breaks on the initial matrix and jump to step S10;
[0026] Step S30: Determine whether all table intersections have been traversed. If yes, obtain the intersection matrix; otherwise, proceed to step S10.
[0027] Preferably, the step of determining the horizontal intersection point based on the intersection point value of a row in the intersection matrix that has the same number of vertical lines as the table, and grouping all columns according to the number of vertical intersection points in the intersection matrix to determine the column intersection point value and corresponding vertical intersection point of the group with the most columns includes:
[0028] Traverse the intersection values of each row in the intersection matrix, filter out all rows whose intersection values are equal to the number of vertical lines and all rows in which every intersection value is the same, determine the first row in all rows as the row intersection value, and obtain the corresponding horizontal intersection.
[0029] Traverse the intersection values of each column of the intersection matrix. Based on the number of intersections collected in each column, group the columns with the same number of intersections into one group. Determine the first column of the group with the largest number of intersections as the column intersection value and obtain the corresponding vertical intersection.
[0030] Preferably, the step of extracting and identifying the table content in the image to be parsed based on the intersection value of the new table and the new table cells, and generating a structured table according to the table content, the number of header rows, and the new table, includes:
[0031] The coordinates of the preset location points are determined based on the new table;
[0032] Based on the coordinate values, cell images are extracted from the table image to be parsed, and the cell data of the current cell image is recognized based on the OCR algorithm;
[0033] The unit data is input into the corresponding cells of the new table to obtain a structured table.
[0034] This invention also proposes a system for structuring table images based on specific business characteristics, including:
[0035] Feature module: Used to input the table image to be parsed into a preset table feature self-learning method to obtain the table features corresponding to the table image to be parsed;
[0036] The structuring module is used to draw table lines based on the table features and the table intersection values corresponding to the table image to be parsed, to obtain new horizontal and vertical lines, and to re-parse the table image to be parsed based on the horizontal and vertical lines to obtain a structured table.
[0037] Preferably, the feature module is specifically used for:
[0038] The table title corresponding to the table image to be parsed is extracted using OPEN-CV and OCR methods. It is then determined whether the table title exists. If it does, the table data is extracted; otherwise, the table is classified.
[0039] Determine whether the table data exists in a preset feature storage table. If it does, determine the feature weight value corresponding to the table data in the feature table and increase it by a preset value. Otherwise, insert the table data as new data into the feature storage table and set the feature weight value corresponding to the table data to a preset initial value.
[0040] Based on the table title, the number of header rows and the number of vertical lines with the largest feature weight values are determined as the table features of the table image to be parsed;
[0041] The table data includes: table title, number of header rows, and number of vertical lines.
[0042] Preferably, the table classification processing in the feature module includes:
[0043] Based on the extracted Chinese content of the table image to be parsed, the table is classified using a preset classification algorithm to obtain the table category and the corresponding table data.
[0044] Preferably, the structured module includes:
[0045] Feature submodule: Used to determine the corresponding template table in the preset table template library based on the table title and the table image to be parsed, and obtain the feature values of the number of header rows and the number of vertical lines;
[0046] List submodule: used to obtain the table intersection values corresponding to the table image to be parsed by performing binarization and dilation-erosion processing on the table image to be parsed, and store the table intersection values as a list;
[0047] Sorting submodule: Used to sort the table intersection point values in the list according to the position order of the table intersection points in the table image to be parsed, and obtain the sorted intersection point matrix;
[0048] Intersection Submodule: Used to determine the horizontal intersection point based on the intersection point value of a row in the intersection matrix that has the same number of vertical lines as the table, and to group all columns according to the number of vertical intersection points in the intersection matrix, determining the column intersection point value and corresponding vertical intersection point of the group with the most columns.
[0049] New Table Submodule: Used to draw horizontal and vertical lines based on the horizontal and vertical intersections to obtain a new table;
[0050] The structured submodule is used to extract and identify the table content in the image of the table to be parsed based on the intersection value of the new table and the new table cells, and generate a structured table according to the table content, the number of header rows and the new table.
[0051] Preferably, the sorting submodule is specifically used for:
[0052] Establish a preset initial matrix, starting from the intersection value of the first table in the list, and iterate through the intersection values of each table in the list;
[0053] The intersection values of the traversed tables are sequentially filled into the initial matrix to obtain the sorted intersection matrix.
[0054] Preferably, the sorting submodule involves sequentially filling the intersection values of the traversed tables into the initial matrix to obtain the sorted intersection matrix, including:
[0055] First execution unit: When the table intersection value of the target intersection point is equal to the preset first table intersection value or greater than the table intersection value of the previous intersection point, the target intersection point is placed in the row of the initial matrix and the execution unit is jumped to the third execution unit; otherwise, the execution unit is jumped to the second execution unit.
[0056] The second execution unit performs line breaks on the initial matrix and then jumps to the first execution unit;
[0057] The third execution unit determines whether all table intersections have been traversed. If so, the intersection matrix is obtained; otherwise, the execution unit jumps to the first execution unit.
[0058] Preferably, the intersection submodule is specifically used for:
[0059] Traverse the intersection values of each row in the intersection matrix, filter out all rows whose intersection values are equal to the number of vertical lines and all rows in which every intersection value is the same, determine the first row in all rows as the row intersection value, and obtain the corresponding horizontal intersection.
[0060] Traverse the intersection values of each column of the intersection matrix. Based on the number of intersections collected in each column, group the columns with the same number of intersections into one group. Determine the first column of the group with the largest number of intersections as the column intersection value and obtain the corresponding vertical intersection.
[0061] Preferably, the structured submodule is specifically used for:
[0062] The coordinates of the preset location points are determined based on the new table;
[0063] Based on the coordinate values, cell images are extracted from the table image to be parsed, and the cell data of the current cell image is recognized based on the OCR algorithm;
[0064] The unit data is input into the corresponding cells of the new table to obtain a structured table.
[0065] Compared with the closest existing technology, the present invention has the following beneficial effects:
[0066] This invention provides a method and system for structuring table images based on specific business features. The method includes: inputting the table image to be parsed into a preset table feature self-learning method to obtain the table features corresponding to the table image; drawing table lines based on the intersection values of the table features and the corresponding table lines in the table image to obtain new horizontal and vertical lines; and re-parsing the table image based on these lines to obtain a structured table. This invention improves the efficiency and accuracy of table image parsing and structuring by using a business feature self-learning method and redrawing the horizontal and vertical lines of the table image based on business features. It eliminates the need for manually defining template features, instead using most features from the actual image as default feature values. Furthermore, the more images parsed, the more accurate the features become, thus improving feature accuracy. Attached Figure Description
[0067] Figure 1 This is an example of the original table in a method for structuring table images based on specific business characteristics provided by the present invention;
[0068] Figure 2 This is an example diagram of the existing table structuring parsing results in a method for structuring table images based on specific business characteristics provided by the present invention;
[0069] Figure 3 This is a flowchart illustrating a method for structuring table images based on specific business characteristics, provided by the present invention.
[0070] Figure 4 This is a flowchart illustrating step 1 of a method for structuring table images based on specific business characteristics provided by the present invention.
[0071] Figure 5 This is a flowchart illustrating step 2 of a method for structuring table images based on specific business characteristics provided by the present invention.
[0072] Figure 6 This is a table image to be parsed in an embodiment of a method for structuring table images based on specific business characteristics provided by the present invention.
[0073] Figure 7 This is a table intersection diagram from an embodiment of a method for structuring table images based on specific business characteristics provided by the present invention.
[0074] Figure 8 This is a new table illustration of an embodiment of a method for structuring table images based on specific business characteristics provided by the present invention;
[0075] Figure 9 This invention provides a functional diagram of a system for structuring table images based on specific business characteristics. Detailed Implementation
[0076] The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0077] Example 1:
[0078] This invention provides a method for structuring table images based on specific business characteristics, such as... Figure 3 As shown, it includes:
[0079] Step 1: Input the image of the table to be parsed into the preset table feature self-learning method to obtain the table features corresponding to the image of the table to be parsed;
[0080] Step 2: Draw table lines based on the table features and the table intersection values corresponding to the table image to be parsed, to obtain new horizontal and vertical lines, and re-parse the table image to be parsed based on the horizontal and vertical lines to obtain a structured table.
[0081] Specifically, step 1 is as follows: Figure 4 As shown, it includes:
[0082] The table title corresponding to the table image to be parsed is extracted using OPEN-CV and OCR methods. It is then determined whether the table title exists. If it does, the table data is extracted; otherwise, the table is classified.
[0083] Determine whether the table data exists in a preset feature storage table. If it does, determine the feature weight value corresponding to the table data in the feature table and increase it by a preset value. Otherwise, insert the table data as new data into the feature storage table and set the feature weight value corresponding to the table data to a preset initial value.
[0084] Based on the table title, the number of header rows and the number of vertical lines with the largest feature weight values are determined as the table features of the table image to be parsed;
[0085] The table data includes: table title, number of header rows, and number of vertical lines.
[0086] Specifically, step 2 is as follows: Figure 5 As shown, it includes:
[0087] Based on the table title and the table image to be parsed, the corresponding template table is determined from the preset table template library, and the feature values of the number of header rows and the number of vertical lines are obtained.
[0088] By performing binarization and dilation / erosion processing on the table image to be parsed, the table intersection values corresponding to the table image to be parsed are obtained, and the table intersection values are stored as a list.
[0089] The table intersection values in the list are sorted according to the position order of the table intersections in the table image to be parsed, resulting in a sorted intersection matrix;
[0090] Based on the intersection point value of a row in the intersection matrix that has the same number of vertical lines as the table, determine the horizontal intersection point. Then, group all columns according to the number of vertical intersection points in the intersection matrix, and determine the column intersection point value and corresponding vertical intersection point of the group with the most columns.
[0091] Draw horizontal and vertical lines based on the horizontal and vertical intersections to obtain a new table;
[0092] Based on the intersection value of the new table and the new table cell, the table content in the table image to be parsed is extracted and identified. A structured table is generated according to the table content, the number of header rows, and the new table.
[0093] Specifically, for example Figure 6 The image of the table to be parsed shown undergoes structured processing, including:
[0094] Table feature storage table
[0095] Serial Number Table ID Table title name Number of header rows Number of vertical lines Weight 1 001 Cost Calculation Details 1 6 36 2 002 Project Investment Estimate Table 1 3 49 3 003 Project funding status 2 8 23 4 004 Project funding status 2 6 165
[0096] Specifically, step S1: Perform feature self-learning processing on the image to be parsed and obtain the features with the highest weights, including:
[0097] 1.1 Use OPEN-CV and OCR methods to parse table images and obtain the title, number of header rows, and number of vertical lines;
[0098] 1.2 If the table title does not exist, retrieve all Chinese content of the table and classify the table using a classification algorithm;
[0099] 1.2.1 The existing Chinese table dataset with table category labels is processed through steps such as word segmentation and text vectorization. A TextRCNN neural network model is constructed and trained to form a table classification model, as shown in the table below:
[0100]
[0101] 1.2.2 Based on the trained TextRCNN model, the category of the table is predicted, and the table title is "Project Funding Status";
[0102] 1.3 Store the table title (project funding status), the number of header rows (2) and the number of vertical lines (6) into the table feature storage table. Since this value already exists in the table (ID is 004), the feature weight value is 165+1, which is 166.
[0103] 1.4 Based on the table title, in reverse order of feature weight values, take the number of header rows and vertical lines (2,6) with the largest weight as the table feature.
[0104] Specifically, in step S2, the table image to be parsed is extracted based on the table name of the "Project Funding Status" table and the preceding text (Project Funding Status) and the following text (Overall Evaluation), as shown in the figure. The table template with the highest weight in the table template library is table template 004, which has 2 header rows and 6 vertical lines.
[0105] 2.2 Perform dilation and erosion on the table to obtain the table intersections, as shown below. Figure 7 As shown;
[0106] Record the x and y coordinates of the intersection points sequentially to form a list of intersection points:
[0107] [[88,89],[260,89],[544,89],[180,134],[260,134],[359,134],[445,134],[544,134],[88,209],[179,209],[260,209],[359,209],[445,209],[ [544,209],[88,275],[179,275],[260,275],[359,275],[445,275],[544,275],[88,341],[179,341],[260,341],[359,341],[445,341],[544,341]]
[0108] 2.3 Sort the list;
[0109] 2.3.1 Create a new matrix Matrix and iterate through the list List;
[0110] 2.3.2 For the first point [88,89], place it in the first row and first column of the matrix Matrix; for the second point [260,89], its x value 260 is greater than the previous point 88, so place this point in the first row and second column of the matrix; for the third point [544,89], place it in the first row and third column of the matrix.
[0111] 2.3.3 For the 4th point [180, 134], its x value 180 is less than the previous point 544. The matrix starts recording from the second row, and [180, 134] is stored in the first column of the second row of the matrix.
[0112] 2.3.4 After traversing all points in the List, the resulting matrix is as follows:
[0113] [[88,89],[260,89],[544,89]]
[0114] [[180,134],[260,134],[359,134],[445,134],[544,134]]
[0115] [[88,209],[179,209],[260,209],[359,209],[445,209],[544,209]]
[0116] [[88,275],[179,275],[260,275],[359,275],[445,275],[544,275]]
[0117] [[88,341],[179,341],[260,341],[359,341],[445,341],[544,341]]
[0118] 2.4 Take the intersection value of a row whose number of intersection points is equal to the number of vertical lines defined in the table feature. Group all columns according to the number of vertical intersection points, grouping columns with the same number of intersection points into one group, and take the intersection value of the column in the group with the most columns.
[0119] 2.4.1 The table header has two rows. Due to the complex header style and the largely irregular intersection data, the first two rows of the matrix are removed to reduce interference. The result is as follows:
[0120] [[88,209],[179,209],[260,209],[359,209],[445,209],[544,209]]
[0121] [[88,275],[179,275],[260,275],[359,275],[445,275],[544,275]]
[0122] [[88,341],[179,341],[260,341],[359,341],[445,341],[544,341]]
[0123] 2.4.2 Iterate through the intersection points of each row of the matrix. The first row has 6 intersection points, matching the number of vertical lines in the table template. The second and third rows each have 6 columns. Take the intersection points of the first row as the same row of intersection points as the table feature definition.
[0124] 2.4.3 Iterate through each column of the matrix to count the number of intersections. The first column has 3, the second column has 3, and after counting, there are 6 columns with 3 points in the first group. The column with the largest common column intersection can be any column in the first group. Finally, take the intersection of the first column as the column with the largest common column intersection.
[0125] 2.4.4 The sequence of intersection points X[1-n] that yields an intersection point count equal to the defined vertical line count is: ([88,209]-[544,209]).
[0126] Find the intersection point Y[1-n] of the column with the largest number of identical columns: ([88,209],[88,275],[88,341])
[0127] 5. Take the intersection points of the horizontal lines, and draw vertical lines in sequence. Take the intersection points of the vertical lines, and draw horizontal lines in sequence to form a new table.
[0128] 2.5.1 For the points ([88,209]-[544,209]), draw a vertical line starting from point 88,209 and ending at point 88,341; draw a vertical line starting from point 179,209 and ending at point 179,341; draw a vertical line starting from point 544,209 and ending at point 544,341.
[0129] 2.5.2 For the point ([88,209],[88,275],[88,341]), draw a horizontal line starting from 88,209 and ending at 544,209; draw a horizontal line starting from 88,275 and ending at 544,275; draw a horizontal line starting from 88,341 and ending at 544,341.
[0130] 2.5.3 The numbers at the intersections of the horizontal and vertical lines are shown in the following figure, resulting in the following... Figure 8 The new table shown;
[0131] 2.6.1 Starting from the first row and first column, take the coordinates of the four vertices of the first cell as [88,209], [179,209], [88,275], and [179,275].
[0132] 2.6.2 Extract the corresponding image from the original image based on the coordinates of the four vertices;
[0133] 2.6.3 The data is identified as "total" using OCR.
[0134] 2.6.4 Enter the "Total" data into the first cell of the new table.
[0135] 2.6.5 Following the above four steps, traverse all cells to form a structured table.
[0136] 2.6.6 Assemble the table header structure onto the table, complete the table image parsing, and the final result is as follows:
[0137]
[0138] For table images with low clarity or too many interfering elements, directly identifying the horizontal and vertical lines is ineffective. This invention, however, uses a table feature self-learning method to obtain the number of header rows and vertical lines of the table. Based on the intersections of each row and column, the table is redrawn. The redrawn table is then used for structured parsing of the table image, thus avoiding the excessive influence of table clarity and interference, and significantly improving the accuracy of table structuring.
[0139] Example 2:
[0140] This invention provides a system for structuring table images based on specific business characteristics, such as... Figure 3 As shown, it includes:
[0141] Feature module: Used to input the table image to be parsed into a preset table feature self-learning method to obtain the table features corresponding to the table image to be parsed;
[0142] The structuring module is used to draw table lines based on the table features and the table intersection values corresponding to the table image to be parsed, to obtain new horizontal and vertical lines, and to re-parse the table image to be parsed based on the horizontal and vertical lines to obtain a structured table.
[0143] Specifically, the feature module is used for:
[0144] The table title corresponding to the table image to be parsed is extracted using OPEN-CV and OCR methods. It is then determined whether the table title exists. If it does, the table data is extracted; otherwise, the table is classified.
[0145] Determine whether the table data exists in a preset feature storage table. If it does, determine the feature weight value corresponding to the table data in the feature table and increase it by a preset value. Otherwise, insert the table data as new data into the feature storage table and set the feature weight value corresponding to the table data to a preset initial value.
[0146] Based on the table title, the number of header rows and the number of vertical lines with the largest feature weight values are determined as the table features of the table image to be parsed;
[0147] The table data includes: table title, number of header rows, and number of vertical lines.
[0148] Specifically, the table classification processing in the feature module includes:
[0149] Based on the extracted Chinese content of the table image to be parsed, the table is classified using a preset classification algorithm to obtain the table category and the corresponding table data.
[0150] Specifically, the structured module includes:
[0151] Feature submodule: Used to determine the corresponding template table in the preset table template library based on the table title and the table image to be parsed, and obtain the feature values of the number of header rows and the number of vertical lines;
[0152] List submodule: used to obtain the table intersection values corresponding to the table image to be parsed by performing binarization and dilation-erosion processing on the table image to be parsed, and store the table intersection values as a list;
[0153] Sorting submodule: Used to sort the table intersection point values in the list according to the position order of the table intersection points in the table image to be parsed, and obtain the sorted intersection point matrix;
[0154] Intersection Submodule: Used to determine the horizontal intersection point based on the intersection point value of a row in the intersection matrix that has the same number of vertical lines as the table, and to group all columns according to the number of vertical intersection points in the intersection matrix, determining the column intersection point value and corresponding vertical intersection point of the group with the most columns.
[0155] New Table Submodule: Used to draw horizontal and vertical lines based on the horizontal and vertical intersections to obtain a new table;
[0156] The structured submodule is used to extract and identify the table content in the image of the table to be parsed based on the intersection value of the new table and the new table cells, and generate a structured table according to the table content, the number of header rows and the new table.
[0157] Specifically, the sorting submodule is used for:
[0158] Establish a preset initial matrix, starting from the intersection value of the first table in the list, and iterate through the intersection values of each table in the list;
[0159] The intersection values of the traversed tables are sequentially filled into the initial matrix to obtain the sorted intersection matrix.
[0160] Specifically, the sorting submodule sequentially fills the intersection values of the traversed tables into the initial matrix to obtain the sorted intersection matrix, including:
[0161] First execution unit: When the table intersection value of the target intersection point is equal to the preset first table intersection value or greater than the table intersection value of the previous intersection point, the target intersection point is placed in the row of the initial matrix and the execution unit is jumped to the third execution unit; otherwise, the execution unit is jumped to the second execution unit.
[0162] The second execution unit performs line breaks on the initial matrix and then jumps to the first execution unit;
[0163] The third execution unit determines whether all table intersections have been traversed. If so, the intersection matrix is obtained; otherwise, the execution unit jumps to the first execution unit.
[0164] Specifically, the intersection submodule is used for:
[0165] Traverse the intersection values of each row in the intersection matrix, filter out all rows whose intersection values are equal to the number of vertical lines and all rows in which every intersection value is the same, determine the first row in all rows as the row intersection value, and obtain the corresponding horizontal intersection.
[0166] Traverse the intersection values of each column of the intersection matrix. Based on the number of intersections collected in each column, group the columns with the same number of intersections into one group. Determine the first column of the group with the largest number of intersections as the column intersection value and obtain the corresponding vertical intersection.
[0167] Specifically, the structured submodule is used for:
[0168] The coordinates of the preset location points are determined based on the new table;
[0169] Based on the coordinate values, cell images are extracted from the table image to be parsed, and the cell data of the current cell image is recognized based on the OCR algorithm;
[0170] The unit data is input into the corresponding cells of the new table to obtain a structured table.
[0171] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0172] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0173] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0174] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0175] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit its scope of protection. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that after reading the present invention, they can still make various changes, modifications or equivalent substitutions to the specific implementation methods of the application, but these changes, modifications or equivalent substitutions are all within the scope of protection of the claims pending approval.
Claims
1. A method for structuring table images based on specific business characteristics, characterized in that, include: The table image to be parsed is input into a preset table feature self-learning method to obtain the table features corresponding to the table image to be parsed. Table lines are drawn based on the table features and the table intersection values corresponding to the table image to be parsed, resulting in new horizontal and vertical lines. Based on the horizontal and vertical lines, the table image to be parsed is re-parsed to obtain a structured table. The table intersection value is the coordinate value of the table intersection point. The step of inputting the image of the table to be parsed into a preset table feature self-learning method to obtain the table features corresponding to the image of the table to be parsed includes: The table title corresponding to the table image to be parsed is extracted using OPEN-CV and OCR methods. It is then determined whether the table title exists. If it does, the table data is extracted; otherwise, the table is classified. Determine whether the table data exists in a preset feature storage table. If it does, determine the feature weight value corresponding to the table data in the feature storage table and increase it by a preset value. Otherwise, insert the table data as new data into the feature storage table and set the feature weight value corresponding to the table data to a preset initial value. Based on the table title, the number of header rows and the number of vertical lines with the largest feature weight values are determined as the table features of the table image to be parsed; The table data includes: table title, number of header rows, and number of vertical lines.
2. The method as described in claim 1, characterized in that, The table classification process includes: Based on the extracted Chinese content of the table image to be parsed, the table is classified using a preset classification algorithm to obtain the table category and the corresponding table data.
3. The method as described in claim 1, characterized in that, The process involves drawing table lines based on the intersection values of the table features and the table image to be parsed, obtaining new horizontal and vertical lines, and then re-parseing the table image to be parsed based on these lines to obtain a structured table, including: By performing binarization and dilation / erosion processing on the table image to be parsed, the table intersection values corresponding to the table image to be parsed are obtained, and the table intersection values are stored as a list. The table intersection values in the list are sorted according to the position order of the table intersections in the table image to be parsed, resulting in a sorted intersection matrix; Based on the intersection point value of a row in the intersection matrix that has the same number of vertical lines as the table, determine the horizontal intersection point. Then, group all columns according to the number of vertical intersection points in the intersection matrix, and determine the column intersection point value and corresponding vertical intersection point of the group with the most columns. Draw horizontal and vertical lines based on the horizontal and vertical intersections to obtain a new table; Based on the intersection value of the new table and the new table cell, the table content in the table image to be parsed is extracted and identified. A structured table is generated according to the table content, the number of header rows, and the new table.
4. The method as described in claim 3, characterized in that, The step of sorting the table intersection point values in the list according to the positional order of the table intersection points in the table image to be parsed, to obtain a sorted intersection point matrix, includes: Establish a preset initial matrix, starting from the intersection value of the first table in the list, and iterate through the intersection values of each table in the list; The intersection values of the traversed tables are sequentially filled into the initial matrix to obtain the sorted intersection matrix.
5. The method as described in claim 4, characterized in that, The step of filling the intersection values of the traversed tables into the initial matrix in sequence to obtain the sorted intersection matrix includes the following steps: Step S10: When the x-coordinate of the target intersection point's table intersection value is equal to or greater than the x-coordinate of the first table intersection point's table intersection value, then the target intersection point is placed in the row of the initial matrix, and the process jumps to step S30; otherwise, the process jumps to step S20. Step S20: Perform line breaks on the initial matrix and jump to step S10; Step S30: Determine whether all table intersections have been traversed. If yes, obtain the intersection matrix; otherwise, proceed to step S10.
6. The method as described in claim 3, characterized in that, The step of determining the horizontal intersection point based on the intersection point value of a row in the intersection point matrix that has the same number of vertical lines as the table, and grouping all columns according to the number of vertical intersection points in the intersection point matrix to determine the column intersection point value and corresponding vertical intersection point of the group with the most columns, includes: Traverse the intersection values of each row in the intersection matrix, filter out all rows whose number of intersections equals the number of vertical lines in the table and all rows in which the vertical coordinate value of each intersection value is the same, determine the first row in all rows as the row intersection value, and obtain the corresponding horizontal intersection. Traverse the intersection values of each column of the intersection matrix. Based on the number of intersections collected in each column, group the columns with the same number of intersections into one group. Determine the first column of the group with the largest number of intersections as the column intersection value and obtain the corresponding vertical intersection.
7. The method as described in claim 3, characterized in that, The process involves extracting and identifying the table content from the image of the table to be parsed based on the intersection values of the new table and its cells, and generating a structured table according to the table content, the number of header rows, and the new table, including: The coordinates of the preset location points are determined based on the new table; Based on the coordinate values, cell images are extracted from the table image to be parsed, and the cell data of the current cell image is recognized based on the OCR algorithm; The unit data is input into the corresponding cells of the new table to obtain a structured table.
8. A system for structuring table images based on specific business characteristics, characterized in that, include: Feature module: Used to input the table image to be parsed into a preset table feature self-learning method to obtain the table features corresponding to the table image to be parsed; The structuring module is used to draw table lines based on the table features and the table intersection values corresponding to the table image to be parsed, to obtain new horizontal and vertical lines, and to re-parse the table image to be parsed based on the horizontal and vertical lines to obtain a structured table; the table intersection value is the coordinate value of the table intersection point. The feature module is specifically used for: The table title corresponding to the table image to be parsed is extracted using OPEN-CV and OCR methods. It is then determined whether the table title exists. If it does, the table data is extracted; otherwise, the table is classified. Determine whether the table data exists in a preset feature storage table. If it does, determine the feature weight value corresponding to the table data in the feature storage table and increase it by a preset value. Otherwise, insert the table data as new data into the feature storage table and set the feature weight value corresponding to the table data to a preset initial value. Based on the table title, the number of header rows and the number of vertical lines with the largest feature weight values are determined as the table features of the table image to be parsed; The table data includes: table title, number of header rows, and number of vertical lines.
9. The system as described in claim 8, characterized in that, The structured module includes: List submodule: used to obtain the table intersection values corresponding to the table image to be parsed by performing binarization and dilation-erosion processing on the table image to be parsed, and store the table intersection values as a list; Sorting submodule: Used to sort the table intersection point values in the list according to the position order of the table intersection points in the table image to be parsed, and obtain the sorted intersection point matrix; Intersection Submodule: Used to determine the horizontal intersection point based on the intersection point value of a row in the intersection matrix that has the same number of vertical lines as the table, and to group all columns according to the number of vertical intersection points in the intersection matrix, determining the column intersection point value and corresponding vertical intersection point of the group with the most columns. New Table Submodule: Used to draw horizontal and vertical lines based on the horizontal and vertical intersections to obtain a new table; The structured submodule is used to extract and identify the table content in the image of the table to be parsed based on the intersection value of the new table and the new table cells, and generate a structured table according to the table content, the number of header rows and the new table.