A table recognition method, device and medium

By combining the K-nearest neighbor classification algorithm and a pre-set table template library with an OCR text recognition model, the problem of low recognition accuracy for multiple table images with different layouts was solved, achieving efficient table structure recognition.

CN115205881BActive Publication Date: 2026-03-31INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-02
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively process multiple table images with different layouts, resulting in low recognition accuracy.

Method used

The K-nearest neighbor classification algorithm is used to match the image features of the table image. Combined with a preset table template library and an OCR text recognition model, the table tilt is corrected by perspective transformation, cell coordinates are extracted and field matching is performed.

Benefits of technology

It improves the accuracy and efficiency of recognizing multiple different table formats, simplifies the table structure recognition process, and reduces manual intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115205881B_ABST
    Figure CN115205881B_ABST
Patent Text Reader

Abstract

The application discloses a table recognition method and device and a medium. The method comprises the following steps: obtaining a table picture uploaded to an OCR system, and extracting a cell of a table to be recognized in the table picture; determining an image feature of the table to be recognized according to the coordinates of the cell; matching the image feature by using a K nearest neighbor classification algorithm in a preset table template library, and determining a standard table template of the table to be recognized; wherein the standard table template comprises a field name of a standard field and coordinates of a cell where the standard field is located; and recognizing the table to be recognized according to the standard table template. The table recognition accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, device and medium for table recognition. Background Technology

[0002] Tables, as an important carrier of data, are characterized by their concise and concentrated information and ease of illustrating data relationships. However, when tables exist as image files, they lose the original structural information that is easily understood by computers. Manually reprocessing and re-entering tables leads to inefficiency and errors due to large data volumes.

[0003] Currently, most table recognition methods target relatively simple or template-based tables. These methods start with the table's layout and structure, extracting table lines or text blocks, and then using rule-based analysis. However, these methods often have poor generalization ability and struggle to handle complex tables, resulting in low accuracy when performing structured recognition of table images with multiple different layouts. Summary of the Invention

[0004] This application provides a table recognition method, device, and medium to solve the problem of low table recognition accuracy when performing structured recognition of table images with multiple different layouts.

[0005] The embodiments of this application adopt the following technical solutions:

[0006] On one hand, this application provides a table recognition method, which includes: acquiring a table image uploaded to an OCR system, extracting cells of the table to be recognized from the table image; determining image features of the table to be recognized based on the coordinates of the cells; matching the image features in a preset table template library using a K-nearest neighbor classification algorithm to determine a standard table template for the table to be recognized; wherein the standard table template includes the field name of a standard field and the coordinates of the cell where the standard field is located; and recognizing the table to be recognized based on the standard table template.

[0007] In one example, the step of matching the image features in a preset table template library using the K-nearest neighbor classification algorithm to determine the standard table template for the table to be identified specifically includes: matching the feature points in the image features with the feature points of each standard table template in the preset table template library using the K-nearest neighbor classification algorithm to obtain feature point pairs that match the table to be identified with each standard table; and using the standard table template corresponding to the feature point pair with the largest number of matches as the standard table template for the table to be identified.

[0008] In one example, the step of matching feature points in the image features with feature points of each standard table template in the preset table template library using the K-nearest neighbor classification algorithm to obtain feature point pairs that match the table to be identified with each standard table template specifically includes: determining a first feature point in the image features; determining a second feature point and a third feature point that are closest to the first feature point in terms of Euclidean distance in each standard table template; calculating the ratio between the Euclidean distance between the first feature point and the second feature point and the Euclidean distance between the first feature point and the third feature point; if the ratio is less than a preset threshold, then determining the first feature point and the second feature point as the feature point pair, and the first feature point and the third feature point as the feature point pair.

[0009] In one example, the step of recognizing the table to be recognized based on the standard table template specifically includes: determining a homography transformation matrix based on the feature point pairs between the standard table template and the table to be recognized; performing a perspective transformation on the table to be recognized based on the homography transformation matrix to convert the size of the image to be recognized to be consistent with the size of the standard table template; matching the corresponding cell to be recognized in the table to be recognized based on the coordinates of the cell where the standard field is located in the standard table template; and extracting the field information of the cell to be recognized using an OCR text recognition model to obtain the field recognition result.

[0010] In one example, extracting the cells of the table to be identified from the table image specifically includes: extracting the position coordinates of the horizontal and vertical line segments of the table to be identified in the table image according to a pre-built table detection neural network model; determining the coordinates of the four vertices of the cell in the table to be identified by using a preset intersecting line coordinate expression and the position coordinates of the horizontal and vertical line segments; and obtaining the cell of the table to be identified based on the coordinates of the four vertices of the cell in the table to be identified.

[0011] In one example, obtaining the cells of the table to be identified based on the coordinates of the four vertices of the cells in the table to be identified specifically includes: obtaining the initial cells of the table to be identified based on the coordinates of the four vertices of the cells in the table to be identified; determining the coordinates of the missing cells of the table to be identified by connecting component segmentation and parallel line detection based on the coordinates of the horizontal and vertical line segments and the coordinates of the initial cells; and obtaining the cells of the table to be identified based on the missing cells and the initial cells.

[0012] In one example, determining the coordinates of missing cells in the table to be identified based on the position coordinates of the horizontal and vertical line segments and the coordinates of the initial cell, through connected component segmentation and parallel line detection, specifically includes: determining the maximum rectangular area of ​​the table to be identified based on the position coordinates of the horizontal and vertical line segments according to the connected component segmentation; determining the rectangular areas of multiple cells in the table to be identified based on the coordinates of the initial cell; summing the rectangular areas of the multiple cells to obtain the total area of ​​the initial cell; and determining the coordinates of the missing cells in the table to be identified by comparing the total area with the maximum rectangular area based on the parallel line detection.

[0013] In one example, determining the coordinates of missing cells in the table to be identified by comparing the total area with the area of ​​the largest rectangle based on the parallel line detection specifically includes: determining whether the total area and the area of ​​the largest rectangle are consistent by comparing the total area with the area of ​​the largest rectangle; if not, determining that there are missing cells in the table to be identified; and determining the coordinates of the missing cells in the table to be identified based on the horizontal and vertical line segment position coordinates according to the parallel line detection.

[0014] On the other hand, embodiments of this application provide a table recognition device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: acquire a table image uploaded to an OCR system; extract cells of a table to be recognized from the table image; determine image features of the table to be recognized based on the coordinates of the cells; match the image features in a preset table template library using a K-nearest neighbor classification algorithm to determine a standard table template for the table to be recognized; wherein the standard table template includes field names of standard fields and coordinates of the cells where the standard fields are located; and recognize the table to be recognized based on the standard table template.

[0015] On the other hand, embodiments of this application provide a non-volatile computer storage medium for table recognition, storing computer-executable instructions. These computer-executable instructions are configured to: acquire a table image uploaded to an OCR system; extract cells of the table to be recognized from the table image; determine image features of the table to be recognized based on the coordinates of the cells; match the image features in a preset table template library using a K-nearest neighbor classification algorithm to determine a standard table template for the table to be recognized; wherein the standard table template includes the field names of standard fields and the coordinates of the cells containing the standard fields; and recognize the table to be recognized based on the standard table template.

[0016] The above-described technical solutions adopted in the embodiments of this application can achieve the following beneficial effects:

[0017] By pre-setting standard table templates, including multiple table images of different layouts, and then providing a KNN-based table classification method, the success rate of matching the table to be identified to the corresponding standard table template is high. This method is simple and efficient, and improves the accuracy and efficiency of table recognition when recognizing multiple table images of different layouts at the same time. Attached Figure Description

[0018] To more clearly illustrate the technical solution of this application, some embodiments of this application will be described in detail below with reference to the accompanying drawings, in which:

[0019] Figure 1 A flowchart illustrating a table recognition method provided in an embodiment of this application;

[0020] Figure 2 A schematic diagram of the detection results of the horizontal and vertical borders of a table to be identified, provided in an embodiment of this application;

[0021] Figure 3 A schematic diagram illustrating a perspective transformation process provided in an embodiment of this application;

[0022] Figure 4 This is a schematic diagram of the structure of a table recognition device provided in an embodiment of this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0024] Optical Character Recognition (OCR) is a technology that uses optical and computer techniques to read text printed or written on paper and convert it into a format that is both computer-readable and human-understandable. It extracts text from drawings as text and converts it into a human-readable format. Using structured techniques based on template matching, computers can convert images of common documents such as VAT invoices and train tickets into structured strings and store them in a database. In various business systems, referencing OCR recognition results reduces the workload of human verification and form entry, improving workflow efficiency. While OCR is increasingly effective at recognizing printed text, it has consistently struggled with recognizing forms and tables.

[0025] Unlike fixed-format documents such as ID cards and VAT invoices, tables have relatively complex layout features, including the number of rows, columns, and spacing. Template-matching-based OCR structured recognition systems often only classify tables by specifying table titles when processing internal corporate documents and other table-like images. This presents limitations when dealing with a wide variety of table types or images containing a lot of extra text. The main problem this invention addresses is how to implement an OCR system that can simultaneously process multiple table images of different layouts and perform structured recognition.

[0026] Some embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0027] Figure 1 This is a flowchart illustrating a table recognition method provided in this embodiment. This method can be applied to various business sectors, such as internet finance, e-commerce, instant messaging, gaming, and government services. Certain input parameters or intermediate results in this process can be manually adjusted to help improve accuracy.

[0028] The analysis method involved in the embodiments of this application can be implemented by a terminal device or a server, and this application does not impose any special limitations on it. For ease of understanding and description, the following embodiments are all described in detail using a server as an example.

[0029] It should be noted that the server can be a single device or a system composed of multiple devices, i.e., a distributed server. This application does not make any specific limitations on this.

[0030] Figure 1 The process may include the following steps:

[0031] S102: Obtain the table image uploaded to the OCR system, and extract the cells of the table to be recognized from the table image.

[0032] In some embodiments of this application, when extracting cells of the table to be identified from a table image, the position coordinates of the horizontal and vertical line segments of the table to be identified are extracted based on a pre-built table detection neural network model. Here, the position coordinates of the horizontal and vertical line segments refer to the coordinates of the two vertices of the line segment.

[0033] More intuitively, the detection results of the horizontal and vertical borders of the table to be identified are as follows: Figure 2 As shown. In Figure 2 In the middle, the solid white lines are the horizontal and vertical borders.

[0034] Then, by using the preset coordinate expressions of intersecting lines and the position coordinates of horizontal and vertical line segments, the coordinates of the four vertices of the cell in the table to be identified are determined, and the cell of the table to be identified is obtained based on the coordinates of the four vertices of the cell in the table to be identified.

[0035] In this study, considering the possibility of missing cells, to improve the accuracy of the extraction results, the coordinates of some cells that might have been missed during partial detection were supplemented using connected component segmentation and parallel line methods.

[0036] Specifically, the initial cells of the table to be identified are obtained based on the coordinates of the four vertices of the cells in the table to be identified. Based on the position coordinates of the horizontal and vertical line segments and the coordinates of the initial cells, the coordinates of the missing cells in the table to be identified are determined through connected component segmentation and parallel line detection. Finally, the cells of the table to be identified are obtained based on the missing cells and the initial cells.

[0037] Furthermore, when determining the coordinates of missing cells in the table to be identified, based on connected component segmentation and the position coordinates of horizontal and vertical line segments, the maximum rectangular area of ​​the table to be identified is determined. Based on the coordinates of the initial cells, the areas of multiple rectangular cells in the table to be identified are determined. The sum of the areas of multiple rectangular cells is then used to obtain the total area of ​​the initial cells. Then, based on parallel line detection, the coordinates of the missing cells in the table to be identified are determined by comparing the total area with the area of ​​the maximum rectangular cell.

[0038] Furthermore, when comparing the total area with the area of ​​the largest rectangle, it is determined whether the total area and the area of ​​the largest rectangle are consistent.

[0039] If not, then it is determined that there are missing cells in the table to be identified. Based on parallel line detection, the coordinates of the missing cells in the table to be identified are determined according to the position coordinates of the horizontal and vertical line segments.

[0040] If so, it means there are no missing cells in the table to be identified.

[0041] This solves the problem of rapid extraction of visual features from tables. Compared with feature detection algorithms such as DOG, SIFT, and ORB in traditional digital image processing, the extracted feature points are more accurate. Compared with object detection algorithms such as SSD, Faster RCNN, and YOLO in deep learning, it avoids retraining the network model every time a new table template is added, thus achieving higher efficiency.

[0042] S104: Determine the image features of the table to be identified based on the coordinates of the cell.

[0043] In other words, the coordinates of all cells in the table to be identified are used as the image features of the table.

[0044] S106: In a preset table template library, the image features are matched using the K-nearest neighbor classification algorithm to determine the standard table template of the table to be identified; wherein, the standard table template includes the field name of the standard field and the coordinates of the cell where the standard field is located.

[0045] This involves constructing a standard table template library. The library stores the following information: the coordinate set of feature points for the standard table template, the category name of the standard table template, and the names of the fields to be identified and the cell coordinates of the fields. For example, in the template library [T0,T1,…,TN], taking template T0 as an example, it stores the following information: 1. Table feature point coordinate set [(x0,y0),(x1,y1),…], 2. Table category name: “xx table”, 3. Field name and location information, represented by the coordinates of the upper left corner (tl) and lower right corner (br) of the bounding rectangle of the recognition area. For example: Number: (tl0, br0), Amount: (tl1, br1), Name: (tl2, br2).

[0046] In some embodiments of this application, the K-nearest neighbor classification algorithm is used to match the feature points in the image features with the feature points of each standard table template in the preset table template library to obtain feature point pairs that match the table to be identified with each standard table.

[0047] Then, the standard table template corresponding to the feature point pair with the largest number of features is used as the standard table template for the table to be identified.

[0048] Furthermore, when obtaining the feature point pairs that match the table to be identified with each standard table template, the first feature point in the image features is determined, and in each standard table template, the second feature point and the third feature point that are closest to the first feature point in terms of Euclidean distance are determined.

[0049] In other words, first take a feature point from the table to be identified, and find the two feature points in the standard table template that have the closest Euclidean distance to that feature point.

[0050] Then, the ratio of the Euclidean distance between the first and second feature points to the Euclidean distance between the first and third feature points is calculated. If the ratio is less than a preset threshold, the first and second feature points are determined to be a feature point pair, and the first and third feature points are also determined to be a feature point pair. In other words, if the ratio is less than the preset threshold, this pair of matching points is accepted.

[0051] By using the KNN (K-Nearest Neighbors) method in machine learning to quickly match and retrieve the visual image features of tables, the machine can automatically classify tables, reducing the unnecessary workload of manual classification and improving the efficiency of table image classification.

[0052] S108: Identify the table to be identified according to the standard table template.

[0053] In some embodiments of this application, a homography transformation matrix is ​​determined based on the feature point pairs of a standard table template and the table to be recognized. Based on the homography transformation matrix, a perspective transformation is performed on the table to be recognized to convert the size of the image to be recognized to be consistent with the size of the standard table template. Based on the coordinates of the cells where the standard fields are located in the standard table template, the corresponding cells to be recognized in the table to be recognized are matched. The field information of the cells to be recognized is extracted through the OCR text recognition model to obtain the field recognition result.

[0054] More intuitively, Figure 3 This is a schematic diagram of a perspective transformation process provided in an embodiment of this application. In the image, the left side is the table to be identified, and the right side is the table to be identified after perspective transformation. It can be seen that, to address the issue of some images being tilted, the tilt of the table is corrected through parallel line detection and perspective transformation, improving the success rate of table classification and thus increasing the accuracy of structured table recognition.

[0055] Furthermore, addressing the GPU computing resource dependency issue for table detection and OCR text recognition models, an API-based model invocation service is provided, reducing deployment complexity and facilitating overall management of computing resources. This allows for further integration with OCR services, improving development efficiency and the speed of structured table recognition.

[0056] It should be noted that, although the embodiments in this application are based on... Figure 1 Steps S102 to S108 will be described sequentially, but this does not mean that steps S102 to S108 must be performed in a strict order. The reason this embodiment follows this order is... Figure 1The order in which steps S102 to S108 are described is provided to facilitate understanding of the technical solutions of the embodiments of this application by those skilled in the art. In other words, in the embodiments of this application, the order of steps S102 to S108 can be appropriately adjusted according to actual needs.

[0057] pass Figure 1 The proposed method provides a feature extraction method for table images based on a table detection neural network model, balancing speed and accuracy. It also offers a table classification method based on KNN with a high success rate, and a table structure recognition method based on template matching and perspective transformation, solving the problem of OCR systems processing multiple table images of different layouts simultaneously.

[0058] Based on the same idea, some embodiments of this application also provide devices and non-volatile computer storage media corresponding to the above methods.

[0059] Figure 4 This is a schematic diagram of a table recognition device provided in an embodiment of this application. The device includes:

[0060] At least one processor; and,

[0061] A memory communicatively connected to the at least one processor; wherein,

[0062] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to:

[0063] Obtain the table image uploaded to the OCR system, and extract the cells of the table to be recognized from the table image;

[0064] Based on the coordinates of the cells, determine the image features of the table to be identified;

[0065] In a preset table template library, the image features are matched using the K-nearest neighbor classification algorithm to determine the standard table template for the table to be identified; wherein, the standard table template includes the field name of the standard field and the coordinates of the cell where the standard field is located;

[0066] The table to be identified is identified according to the standard table template.

[0067] Some embodiments of this application provide a table-based non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:

[0068] Obtain the table image uploaded to the OCR system, and extract the cells of the table to be recognized from the table image;

[0069] Based on the coordinates of the cells, determine the image features of the table to be identified;

[0070] In a preset table template library, the image features are matched using the K-nearest neighbor classification algorithm to determine the standard table template for the table to be identified; wherein, the standard table template includes the field name of the standard field and the coordinates of the cell where the standard field is located;

[0071] The table to be identified is identified according to the standard table template.

[0072] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and medium embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the description of the method embodiments.

[0073] The devices and media provided in this application are one-to-one with the methods. Therefore, the devices and media also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.

[0074] 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.

[0075] 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.

[0076] 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.

[0077] 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.

[0078] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0079] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0080] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0081] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0082] The above description is merely an embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the technical principles of this application should fall within the protection scope of this application.

Claims

1. A form recognition method characterized by, The method comprises: acquiring a table picture uploaded to an OCR system, and extracting a cell of a to-be-recognized table in the table picture; determining image features of the to-be-recognized table according to coordinates of the cell; matching the image features to a standard table template of the to-be-recognized table by using a K-nearest neighbor classification algorithm in a preset table template library, wherein the standard table template comprises a field name of a standard field and coordinates of a cell where the standard field is located; recognizing the to-be-recognized table according to the standard table template; the recognizing the to-be-recognized table according to the standard table template specifically comprises: determining a homography transformation matrix according to a feature point pair of the standard table template and the to-be-recognized table; performing perspective transformation on the to-be-recognized table according to the homography transformation matrix, so as to convert a size of the to-be-recognized picture into a size consistent with the standard table template; matching a to-be-recognized cell in the to-be-recognized table according to coordinates of a cell where the standard field is located in the standard table template; extracting field information of the to-be-recognized cell by using an OCR character recognition model, to obtain a field recognition result; the extracting the cell of the to-be-recognized table in the table picture specifically comprises: extracting position coordinates of horizontal and vertical line segments of the to-be-recognized table in the table picture according to a table detection neural network model constructed in advance; determining coordinates of four vertices of a cell in the to-be-recognized table by using a preset intersecting straight line coordinate expression and the position coordinates of the horizontal and vertical line segments; obtaining the cell of the to-be-recognized table according to the coordinates of the four vertices of the cell in the to-be-recognized table; the obtaining the cell of the to-be-recognized table according to the coordinates of the four vertices of the cell in the to-be-recognized table specifically comprises: obtaining an initial cell of the to-be-recognized table according to the coordinates of the four vertices of the cell in the to-be-recognized table; determining coordinates of a missing cell of the to-be-recognized table by using connected domain segmentation and parallel line detection according to the position coordinates of the horizontal and vertical line segments and the coordinates of the initial cell; obtaining the cell of the to-be-recognized table according to the missing cell and the initial cell; the determining the coordinates of the missing cell of the to-be-recognized table by using the connected domain segmentation and the parallel line detection according to the position coordinates of the horizontal and vertical line segments and the coordinates of the initial cell specifically comprises: determining a maximum rectangular area of the to-be-recognized table according to the position coordinates of the horizontal and vertical line segments based on the connected domain segmentation; determining a plurality of unit rectangular areas of the to-be-recognized table according to the coordinates of the initial cell; summing the plurality of unit rectangular areas to obtain a total area of the initial cell; determining the coordinates of the missing cell of the to-be-recognized table by comparing the total area and the maximum rectangular area based on the parallel line detection.

2. The method of claim 1, wherein, the matching the image features to the standard table template of the to-be-recognized table by using the K-nearest neighbor classification algorithm in the preset table template library specifically comprises: The feature points in the image features are matched with the feature points of each standard table template in the preset table template library through a K nearest neighbor classification algorithm, to obtain feature point pairs matched between the to-be-identified table and each standard table; The standard table template corresponding to the feature point pair with the largest quantity is taken as the standard table template of the to-be-identified table.

3. The method of claim 2, wherein, The feature points in the image features are matched with the feature points of each standard table template in the preset table template library through a K nearest neighbor classification algorithm, to obtain feature point pairs matched between the to-be-identified table and each standard table template, and specifically includes: A first feature point in the image features is determined; In each standard table template, a second feature point closest to the first feature point and a third feature point next closest to the first feature point in the Euclidean distance are determined; A ratio between the Euclidean distance between the first feature point and the second feature point and the Euclidean distance between the first feature point and the third feature point is calculated; If the ratio is less than a preset threshold, the first feature point and the second feature point are determined as the feature point pair, and the first feature point and the third feature point are determined as the feature point pair.

4. The method of claim 1, wherein, The existence of the coordinates of the missing cell of the to-be-identified table is determined based on the parallel line detection by comparing the total area with the maximum rectangular area, and specifically includes: Whether the total area is consistent with the maximum rectangular area is judged by comparing the total area with the maximum rectangular area; If not, it is determined that there is a missing cell of the to-be-identified table; Based on the parallel line detection, the coordinates of the missing cell of the to-be-identified table are determined according to the horizontal and vertical line segment position coordinates.

5. A form recognition apparatus, characterized by comprising: It includes: At least one processor; And The memory is in communication connection with the at least one processor; wherein The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute a table identification method as claimed in any one of claims 1-4.

6. A form recognition non-transitory computer storage medium having stored thereon computer-executable instructions that, based on execution by one or more computers, cause the one or more computers to perform operations comprising: The computer executable instructions are arranged to be able to execute a table identification method as claimed in any one of claims 1-4. The computer executable instructions are arranged to be able to execute a table identification method as claimed in any one of claims 1-4.

Citation Information

Patent Citations

  • Method and system for realizing customized template character recognition

    CN112836632A

  • Table identification method and device

    CN113269153A