Table recognition method, device, electronic device and storage medium

By detecting and restoring table frames in documents, combined with image segmentation and target detection networks, we solve the problem of low table recognition efficiency in the existing technology, achieve accurate recognition and redrawing of multiple table types, and improve document processing efficiency. .

CN114565927BActive Publication Date: 2024-10-25SHANGHAI HUNDSUN JUYUAN DATA SERVICE CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202210208111.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-03
Publication Date
2024-10-25
Estimated Expiration
2042-03-03

AI Technical Summary

Technical Problem

It is difficult for the existing technology to accurately identify and redraw table areas in documents with mixed table structures, especially due to the lack of table lines and the existence of multiple table types, resulting in low information extraction efficiency.

Method used

By obtaining the target document image, detecting the table area, classifying the table type, restoring the table frame based on the type, and parsing it combined with the text, using the image segmentation network, target detection network, generative adversarial network and deep learning model to restore the table frame and combination.

Benefits of technology

It achieves accurate detection and redrawing of different types of tables, improves recognition efficiency, supports recognition tasks of multiple table types, and reduces noise interference and model training complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114565927B_ABST
    Figure CN114565927B_ABST
Patent Text Reader

Abstract

The table recognition method, device, electronic device and storage medium provided by the present invention can detect the table area in the target document image for the acquired target document image, and then determine the table type corresponding to the table area by classification, and further detect and restore the table frame line in the table area based on the table type, thereby detecting and identifying the text in the table area, combining the text in the table area with the table frame line, so as to realize parsing and restoring the target document image. Based on the present invention, different types of table detection and redrawing can be effectively performed, different types of table recognition tasks can be realized, and recognition efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software technology, and more specifically, to a table recognition method, device, electronic equipment and storage medium. Background Art

[0002] With the development of artificial intelligence, OCR (Optical Character Recognition) recognition technology has been widely used in enterprise document processing business, and table recognition is one of the most important tasks in current OCR detection tasks.

[0003] At present, the main method is to use image processing, deep learning, rules and other algorithms to perform text recognition in the table area of ​​the document and redraw the table lines, so that electronic documents such as scans and camera shots can be recognized and saved as editable electronic documents or corresponding information can be extracted.

[0004] However, since the document is presented in a mixed form of tables and text, although the direction of the text in the document is neater than that of scene recognition, the distribution, structure, and style of the table area are very uncertain, making it difficult to accurately recognize the table. At the same time, due to the lack of table lines, it is further difficult to effectively redraw wireless tables, which has caused great limitations for information extraction. Summary of the invention

[0005] In view of this, in order to solve the above problems, the present invention provides a table recognition method, device, electronic device and storage medium, and the technical solution is as follows:

[0006] A table recognition method, the method comprising:

[0007] Acquire a target document image, and detect a table area in the target document image;

[0008] Classifying the table area to determine the table type corresponding to the table area;

[0009] Restoring the table border lines in the table area based on the table type detection;

[0010] The text in the table area is detected and recognized, and the text in the table area is combined with the table frame line to parse and restore the target document image.

[0011] Optionally, obtaining the target document image includes:

[0012] Receive input file;

[0013] A document image in the input file is extracted according to the file type as the target document image.

[0014] Optionally, detecting a table area in the target document image includes:

[0015] Segmenting the table area of ​​the target document image using an image segmentation network, and detecting the table area of ​​the target document image using an object detection network;

[0016] Based on the segmentation result output by the image segmentation network and the detection result output by the target detection network, a table area in the target document image is determined.

[0017] Optionally, the detecting and restoring the table border in the table area based on the table type includes:

[0018] In the case where the table type is a single-line table / three-line table / underline table, removing interference lines in the table area to convert the table type from a single-line table / three-line table / underline table to a wireless table;

[0019] In the case where the table type is a wireless table, using a generative adversarial network to respectively restore the row lines and column lines in the table area, and combining the row lines and the column lines to obtain the table frame lines;

[0020] In the case where the table type is a dotted line table, performing image processing on the table area to convert the table type from a dotted line table to a wired table;

[0021] When the table type is a wired table, table lines in the table area are detected based on a deep learning model to combine the table lines into the table frame lines.

[0022] Optionally, the using a generative adversarial network to respectively restore row lines and column lines in the table area includes:

[0023] Determine a first cell area in the table area using the generative adversarial network;

[0024] Performing a connected domain search on the first cell area to obtain the cell area coordinates corresponding to the first cell area, and performing text detection on the table area to obtain the text area coordinates within the first cell area;

[0025] If it is determined according to the cell region coordinates that the first cell region is not a merged cell in the column direction, then the first cell region is horizontally penetrated through the table region to obtain row lines in the table region;

[0026] If it is determined according to the text area coordinates that the first cell area is not a merged cell in the row direction, the first cell area is vertically penetrated through the table area to obtain column lines in the table area.

[0027] Optionally, combining the text in the table area with the table border includes:

[0028] Determine a second cell area according to the table border line in the table area;

[0029] Traversing each text in the table area, and for the traversed target text, calculating the overlap ratio between the target text and the second cell area;

[0030] The target text is bound to the second cell area whose overlap ratio satisfies a corresponding threshold.

[0031] A table recognition device, comprising:

[0032] A table detection module, used to acquire a target document image and detect a table area in the target document image;

[0033] A table classification module, used for classifying the table area to determine the table type corresponding to the table area;

[0034] A table border restoration module, used for restoring the table border in the table area based on the table type detection;

[0035] The combination module is used to detect and recognize the text in the table area, and combine the text in the table area with the table frame line to parse and restore the target document image.

[0036] Optionally, the table border restoration module is specifically used to:

[0037] In the case where the table type is a single-line table / three-line table / underline table, removing interference lines in the table area to convert the table type from a single-line table / three-line table / underline table to a wireless table;

[0038] In the case where the table type is a wireless table, using a generative adversarial network to respectively restore the row lines and column lines in the table area, and combining the row lines and the column lines to obtain the table frame lines;

[0039] In the case where the table type is a dotted line table, performing image processing on the table area to convert the table type from a dotted line table to a wired table;

[0040] When the table type is a wired table, table lines in the table area are detected based on a deep learning model to combine the table lines into the table frame lines.

[0041] An electronic device comprises: at least one memory and at least one processor; the memory stores a program, the processor calls the program stored in the memory, and the program is used to implement the table recognition method.

[0042] A storage medium stores computer executable instructions, wherein the computer executable instructions are used to execute the table recognition method.

[0043] Compared with the prior art, the present invention has the following beneficial effects:

[0044] The table recognition method, device, electronic device and storage medium provided by the present invention can detect the table area in the target document image for the acquired target document image, and then determine the table type corresponding to the table area by classification, and further detect and restore the table frame line in the table area based on the table type, thereby detecting and identifying the text in the table area, combining the text in the table area with the table frame line, so as to realize parsing and restoring the target document image. Based on the present invention, different types of table detection and redrawing can be effectively performed, different types of table recognition tasks can be realized, and recognition efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0046] Figure 1 A method flow chart of a table recognition method provided by an embodiment of the present invention;

[0047] Figure 2 A partial method flow chart of a table recognition method provided by an embodiment of the present invention;

[0048] Figure 3 An example of table area detection provided by an embodiment of the present invention;

[0049] Figure 4 A flowchart of another part of the table recognition method provided by an embodiment of the present invention;

[0050] Figure 5 An example of three-line table restoration provided by an embodiment of the present invention;

[0051] Figure 6 An example of wireless table restoration provided by an embodiment of the present invention;

[0052] Figure 7 A schematic diagram of the structure of a table recognition device provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0054] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0055] The development of deep learning has greatly promoted the application of OCR detection technology, especially greatly improving the efficiency of automated document processing in enterprises. OCR detection technology uses image processing and deep learning methods to identify the content in image files into editable text, which has very important application significance for the processing of electronic documents.

[0056] In fact, OCR technology has long been widely used, such as card and driver's license recognition, photo uploading and recognition of address information of express delivery numbers, etc. At the same time, in the field of computer vision research, there has been an endless stream of research and innovation on OCR in recent years. End-to-end target detection algorithms (such as Yolo and MaskRCNN) have made table detection and text recognition a popular direction. Many famous domestic and foreign competitions such as CVPR are also paying more and more attention to OCR, among which document OCR detection is the most important research hotspot. The reason is that compared with card and scene text recognition, the pages of electronic documents present a mixture of tables and texts. Although the text direction of text pages is neater than that of scene recognition, there are more text lines. At the same time, the distribution of table structure and document structure is the difficulty that affects detection and recognition. Not only that, compared with the above-mentioned text recognition scenarios, the pages of electronic documents have obvious differences in text length and dense distribution of text content on document pages, which are more susceptible to various interferences such as noise, seals, and blur. In addition, table structures come in a variety of forms. Different documents may contain wired, wireless, three-line, dotted, and single-line tables. Merged cells and underlines are also key factors that affect document OCR detection.

[0057] To solve the above problems, the present invention provides a table recognition solution, which can effectively detect and redraw different types of tables, realize different types of table recognition tasks, and improve recognition efficiency.

[0058] To facilitate understanding of the present invention, the following first describes the relevant concepts of the present invention:

[0059] OCR (Optical Character Recognition) refers to the process in which an electronic device (such as a scanner or digital camera) examines characters printed on paper, determines their shape by detecting dark and light patterns, and then translates the shape into computer text using character recognition methods.

[0060] Image segmentation is the process of segmenting different target areas in an image by combining image processing with deep learning to determine the area to which the target belongs.

[0061] Deep learning is the process of using deep neural networks to build, train and test models.

[0062] Generate adversarial networks, a network model that uses generative models and discriminative models to enhance each other in deep learning and adversarial learning.

[0063] Object detection is the process of using deep learning models to obtain the location information of objects in images.

[0064] See also Figure 1 , Figure 1 A method flow chart of a table recognition method provided by an embodiment of the present invention, the table recognition method comprises the following steps:

[0065] S10, acquiring a target document image, and detecting a table area in the target document image.

[0066] In the embodiment of the present invention, the target document image is the image of the input electronic document to be subjected to table recognition. For the target document image, an image segmentation network or an object detection network can be used to detect the table area therein.

[0067] In the specific implementation process, in order to support different file input types, the "obtaining the target document image" in step S10 can adopt the following steps:

[0068] Receive an input file; extract a document image from the input file as a target document image according to the file type.

[0069] In the embodiment of the present invention, the input files may be preprocessed according to different file types to extract document images therein as target document images.

[0070] Specifically, if the file type of the input file is pdf, the input file can be sliced ​​to obtain one or more single-page images, and each single-page image can be used as the target document image; if the file type of the input file is html, the nodes are traversed to find all image elements, and each image element can be used as the target document image; of course, if the file type of the input file is image, no processing is done, and the image is used as the target document image.

[0071] During the specific implementation process, in order to make the image segmentation result more accurately approach the edge of the table area, while reducing the amount of corpus required for model training and saving labeling manpower, the embodiment of the present invention adopts an image segmentation network and a target detection network to comprehensively detect the table area.

[0072] In step S10, the process of “detecting the table area in the target document image” can be performed by the following steps. The method flow chart is as follows: Figure 2 As shown:

[0073] S101, segmenting the table area of ​​the target document image using an image segmentation network, and detecting the table area of ​​the target document image using an object detection network;

[0074] S102, determining a table area in the target document image based on the segmentation result output by the image segmentation network and the detection result output by the target detection network.

[0075] In the embodiment of the present invention, the image segmentation network and the target detection network are trained by conventional means to adapt to the table recognition scenario, and the training process is not repeated here. The image segmentation network can be a Unet image segmentation network, and the target detection network can be a Yolo network.

[0076] In addition, the present invention adopts dual-channel processing and analysis of image segmentation network and target detection network, respectively uses image segmentation network and target detection network to detect the table area of ​​target document image, further, the segmentation result output by image segmentation network and the detection result output by target detection network are integrated, if the image segmentation network effectively obtains the table area, the table area is determined based on the segmentation result output by image segmentation network, otherwise, the table area is determined based on the detection result output by target detection network. This improves the detection accuracy and recall rate of table area, and supports multiple formats such as pdf, image, and html.

[0077] Furthermore, if the table area is determined based on the segmentation result output by the image segmentation network, a connected domain search is further performed on the table area to obtain the position coordinates of the table area. If the table area is determined based on the detection result output by the object detection network, the position coordinates of the table area can be directly obtained. Figure 3This is an example of table area detection provided by an embodiment of the present invention.

[0078] S20, classifying the table area to determine the table type corresponding to the table area.

[0079] In the embodiment of the present invention, the table area is cut out from the target document image according to the position coordinates of the table area. In this process, the cutting area can be restricted according to the size of the target document image, and the table area is cut after obtaining a table area with a more suitable size.

[0080] Furthermore, the deep learning image classification model can be used to classify the table area to determine the table type corresponding to the table area, where the table types are mainly divided into wired tables and wireless tables, and of course there are other types, such as dotted-line tables, single-line tables, three-line tables, and underline tables. The image classification model is trained using conventional means to use the table recognition scenario, and the training process will not be repeated here.

[0081] S30, restoring the table border lines in the table area based on the table type detection.

[0082] In the embodiment of the present invention, firstly, the table area is restored and pre-processed based on the table type, and the table type of the table area is finally processed into a wireless table or a wired table; further, the table area whose table type is a wireless table / wired table is restored to obtain the table frame line in the table area. The present invention can support the restoration of various different types of tables, including relatively complex wireless tables, dotted line tables, single line tables, etc.

[0083] In the specific implementation process, step S30 "restoring the table border in the table area based on the table type detection" can adopt the following steps:

[0084] When the table type is a single-line table / three-line table / underline table, remove the interference lines in the table area to convert the table type from the single-line table / three-line table / underline table to a wireless table;

[0085] When the table type is a wireless table, the generative adversarial network is used to restore the row lines and column lines in the table area respectively, and the row lines and column lines are combined to obtain the table frame lines;

[0086] When the table type is a dotted-line table, image processing is performed on the table area to convert the table type from a dotted-line table to a wired table;

[0087] When the table type is a wired table, the table lines in the table area are detected based on the deep learning model to combine the table lines into table frame lines.

[0088] In an embodiment of the present invention, if the table type of the table area is a single-line table / three-line table / underline table, the table area can be morphologically processed to obtain table lines, and the table lines are inverted and ORed with the table area to remove single lines, short lines and other line interferences in the table area, and the table type of the table area is converted from a single-line table / three-line table / underline table to a wireless table.

[0089] If the table type in the table area is a wireless table, the generative adversarial network model and OCR text detection can be used to restore the row lines and column lines, and finally combine them into the table frame lines and obtain the cell position.

[0090] If the table type of the table area is a dotted table, the table area can be morphologically processed to obtain corresponding solid row lines and column lines from the dotted lines in the table area, and the row solid lines and column solid lines are combined to obtain the table frame lines, which are then reorganized with the table area, that is, the table type of the table area is converted from a dotted table to a wired table.

[0091] If the table type in the table area is a wired table, table line detection can be performed. Specifically, a deep learning table line detection model can be used to detect table lines in the table area, and the obtained table lines are screened and merged to form table frame lines. In the process of training the table line detection model, each row line and column line area on the wired table training set is annotated to obtain a label image, and then trained using a deep learning model to obtain a detection model that effectively predicts wired table lines.

[0092] In the specific implementation process, the row lines and column lines of the wireless table are restored separately. The generative adversarial network is used to obtain the position coordinates of each cell area, and after searching for merged cells, the area where the table lines are located is determined according to the position coordinates of the non-merged cell area, and then the table lines are drawn at the appropriate coordinate position, thereby realizing the recognition and redrawing of the wireless table.

[0093] Step "Use the generative adversarial network to restore the row and column lines in the table area respectively" can be done as follows. The method flow chart is as follows Figure 4 As shown:

[0094] S301, using a generative adversarial network to determine a first cell area in a table area.

[0095] In the embodiment of the present invention, a generative adversarial network is used to determine a cell area within a table area, namely, a first cell area, to solve the problem of line breaks within cells.

[0096] S302, performing a connected domain search on the first cell area to obtain the cell area coordinates corresponding to the first cell area, and performing text detection on the table area to obtain the text area coordinates in the first cell area.

[0097] In the embodiment of the present invention, the position coordinates of the first cell area, that is, the coordinates of the cell area, are determined by searching for a connected domain; the OCR text detection model is used to perform text detection on the table area to obtain the text area coordinates in the first cell area.

[0098] S303: If it is determined according to the cell region coordinates that the first cell region is not a merged cell in the column direction, the table region is horizontally penetrated according to the first cell region to obtain row lines in the table region.

[0099] In the embodiment of the present invention, it is determined whether the first cell area is a merged cell in the column direction according to the cell area coordinates. If so, it remains unchanged. Otherwise, it runs through the table area horizontally and is set as a white pixel band. After traversing the first cell area, the center line inside each black area is the row line.

[0100] S304: If it is determined according to the coordinates of the text area that the first cell area is not a merged cell in the row direction, vertically penetrate the table area according to the first cell area to obtain column lines in the table area.

[0101] In the embodiment of the present invention, it is determined whether the first cell area is a merged cell in the row direction according to the coordinates of the text area. If so, it remains unchanged. Otherwise, it runs through the table area vertically and is set as a white pixel band. After traversing the first cell area, the center line of each black area is the column line.

[0102] Figure 5 An example of three-line table restoration provided by an embodiment of the present invention. For text areas that are close to each other on the left and right sides, an adhesion area will also be generated, resulting in misjudgment of merged cells in the restoration of column lines. In this regard, the present invention simultaneously determines the merged cells based on the coordinates of the cell area and the text area, and finally determines the row lines and column lines. Finally, the row lines and column lines are combined to obtain the table frame lines after wireless table restoration.

[0103] Figure 6 This is an example of wireless table restoration provided by an embodiment of the present invention. It can be seen that for a wireless table containing multiple tables, the present invention can effectively restore the table frame line of the table area, which is an important step in wireless table parsing and restoration. The subsequent text and table area combination process of the present invention is also completed based on this table frame line.

[0104] S40, detecting and identifying text in the table area, and combining the text in the table area with the table border to parse and restore the target document image.

[0105] In an embodiment of the present invention, an OCR text detection model, such as a CRNN (Convolutional Recurrent Neural Network) + CTC (Connectionist Temporal Classification, i.e., CTC Loss, a deep learning loss function) model, is used to detect and identify text in a table area, and further obtain a real cell area based on a table frame line in the table area, and combine the text and the table frame line based on the overlapping ratio between a single text (i.e., text or character) and the cell area.

[0106] In the specific implementation process, the "combining the text in the table area with the table border" in step S40 can be performed by the following steps:

[0107] Determine the second cell area according to the table frame line in the table area; traverse each text in the table area, and for the text area of ​​the traversed target text, calculate the overlap ratio between the target text and the second cell area; bind the target text to the second cell area whose overlap ratio meets the corresponding threshold.

[0108] In the embodiment of the present invention, the real cell area in the table area, i.e. the second cell area, can be determined according to the table frame line, and further, each text in the table area is traversed. For the file traversed to each time, i.e. the target text, the overlap ratio (i.e. the intersection ratio) of the target text and the second cell area is calculated, and for the second cell area whose overlap ratio is greater than the threshold value, the target text is bound to the second cell area. This selects the cell area where the target text is located from all real cell areas and completes the binding with the target file, thereby realizing the combination of text and table frame line. The overlap ratio of a single text and a cell area is adopted in the present invention, rather than the overlap ratio of a text area and a cell area, so as to solve the problem of text area position error.

[0109] It should be noted that each text traversed in the embodiment of the present invention is a single text, which can be words or characters, and the embodiment of the present invention does not limit this. After all text traversal is completed, the table area after the text and the table frame are combined is encapsulated as an html table element. If the file type of the input file is pdf or image, the remaining text area in the target document image that is not in the table area is encapsulated as an html text area, and combined with the html table element to obtain the final response return result; if the file type of the input file is html, the html table element is inserted into the original node position for replacement to obtain the final response return result.

[0110] Therefore, the present invention can effectively detect different types of tables, and parse and restore two types of tables: wired tables and wireless tables. In this process, it also includes the detection and recognition of more detailed table types, such as single-line tables, three-line tables, underline tables, and dotted-line tables. The present invention realizes the following functions:

[0111] (1) Supports table border restoration and recognition of wired, wireless, and dotted tables; (2) Provides an effective method for processing common merged cells; (3) Eliminates the impact of underlines on wireless table border restoration, uses image segmentation networks and object detection networks to perform table detection, and improves the accuracy of table border prediction; (4) Solve the problem of line breaks within cells to a certain extent; (5) Uses a simpler and lighter model, greatly reducing the use of rule logic, making it easier to implement and apply.

[0112] Based on the table recognition method provided in the above embodiment, an embodiment of the present invention provides a device for executing the above table recognition method. The structural diagram of the device is shown in FIG. Figure 7 As shown, including:

[0113] The table detection module 10 is used to obtain a target document image and detect a table area in the target document image;

[0114] A table classification module 20, used to classify the table area to determine the table type corresponding to the table area;

[0115] A table border restoration module 30 is used to restore the table border within the table area based on the table type detection;

[0116] The combining module 40 is used to detect and recognize the text in the table area, and combine the text in the table area with the table frame line to parse and restore the target document image.

[0117] Optionally, the table detection module 10 for acquiring the target document image is specifically used for:

[0118] Receive an input file; extract a document image from the input file as a target document image according to the file type.

[0119] Optionally, the table detection module 10 for detecting a table area in a target document image is specifically used for:

[0120] The table area of ​​the target document image is segmented by using an image segmentation network, and the table area of ​​the target document image is detected by using an object detection network; based on the segmentation result output by the image segmentation network and the detection result output by the object detection network, the table area in the target document image is determined.

[0121] Optionally, the table border restoration module 30 is specifically used for:

[0122] When the table type is a single-line table / three-line table / underline table, remove the interference lines in the table area to convert the table type from the single-line table / three-line table / underline table to a wireless table;

[0123] When the table type is a wireless table, a generative adversarial network is used to restore the row lines and column lines in the table area respectively, and the row lines and column lines are combined to obtain the table frame lines; when the table type is a dotted line table, image processing is performed on the table area to convert the table type from a dotted line table to a wired table; when the table type is a wired table, the table lines in the table area are detected based on a deep learning model to combine the table lines into table frame lines.

[0124] Optionally, a table frame line restoration module 30 that uses a generative adversarial network to restore row lines and column lines in a table area is specifically used to:

[0125] Determine a first cell region in the table region using a generative adversarial network;

[0126] A connected domain search is performed on the first cell area to obtain the cell area coordinates corresponding to the first cell area, and text detection is performed on the table area to obtain the text area coordinates within the first cell area; if it is determined according to the cell area coordinates that the first cell area is not a merged cell in the column direction, the table area is horizontally penetrated according to the first cell area to obtain the row lines within the table area; if it is determined according to the text area coordinates that the first cell area is not a merged cell in the row direction, the table area is vertically penetrated according to the first cell area to obtain the column lines within the table area.

[0127] Optionally, the combining module 40 for combining the text in the table area with the table border is specifically used for:

[0128] Determine the second cell area according to the table frame line in the table area; traverse each text in the table area, and calculate the overlap ratio of the target text and the second cell area for the traversed target text; bind the target text to the second cell area whose overlap ratio meets the corresponding threshold.

[0129] It should be noted that the detailed functions of each module in the embodiment of the present invention can be found in the corresponding disclosed part of the above-mentioned table recognition method embodiment, and will not be repeated here.

[0130] Based on the table recognition method provided in the above embodiment, an embodiment of the present invention further provides an electronic device, which includes: at least one memory and at least one processor; the memory stores a program, the processor calls the program stored in the memory, and the program is used to implement the table recognition method.

[0131] Based on the table recognition method provided in the above embodiment, an embodiment of the present invention further provides a storage medium, in which computer executable instructions are stored, and the computer executable instructions are used to execute the table recognition method.

[0132] The above is a detailed introduction to a table recognition method, device, electronic device and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for a person skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

[0133] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0134] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device that includes a series of elements is inherent to the elements, or also includes elements inherent to these processes, methods, articles or devices. In the absence of further restrictions, the elements defined by the sentence "including a..." do not exclude the presence of other identical elements in the process, method, article or device that includes the elements.

[0135] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A table recognition method, It is characterized in that The method comprises: Acquire a target document image, and detect a table area in the target document image; Classifying the table area to determine the table type corresponding to the table area; Restoring the table border lines in the table area based on the table type detection; Detecting and identifying text in the table area, and combining the text in the table area with the table frame line to parse and restore the target document image; The detecting and restoring the table border in the table area based on the table type includes: In the case where the table type is a wireless table, determining a first cell area within the table area using a generative adversarial network; Performing a connected domain search on the first cell area to obtain the cell area coordinates corresponding to the first cell area, and performing text detection on the table area to obtain the text area coordinates within the first cell area; If it is determined according to the cell region coordinates that the first cell region is not a merged cell in the column direction, then the first cell region is horizontally penetrated through the table region to obtain row lines in the table region; If it is determined according to the text area coordinates that the first cell area is not a merged cell in the row direction, the first cell area is vertically penetrated through the table area to obtain column lines in the table area, and the row lines and the column lines are combined to obtain the table frame lines.

2. The method according to claim 1, It is characterized in that The step of acquiring the target document image comprises: Receive input file; A document image in the input file is extracted according to the file type as the target document image.

3. The method according to claim 1, It is characterized in that The detecting of the table area in the target document image comprises: Segmenting the table area of ​​the target document image using an image segmentation network, and detecting the table area of ​​the target document image using an object detection network; Based on the segmentation result output by the image segmentation network and the detection result output by the target detection network, a table area in the target document image is determined.

4. The method according to claim 1, It is characterized in that The restoring the table border lines in the table area based on the table type detection includes: In the case where the table type is a single-line table / three-line table / underline table, removing interference lines in the table area to convert the table type from a single-line table / three-line table / underline table to a wireless table; In the case where the table type is a dotted line table, performing image processing on the table area to convert the table type from a dotted line table to a wired table; When the table type is a wired table, table lines in the table area are detected based on a deep learning model to combine the table lines into the table frame lines.

5. The method according to claim 1, It is characterized in that The combining of the text in the table area with the table border includes: Determine a second cell area according to the table border line in the table area; Traversing each text in the table area, and for the traversed target text, calculating the overlap ratio between the target text and the second cell area; The target text is bound to the second cell area whose overlap ratio satisfies a corresponding threshold.

6. A table recognition device, It is characterized in that The device comprises: A table detection module, used to acquire a target document image and detect a table area in the target document image; A table classification module, used for classifying the table area to determine the table type corresponding to the table area; A table border restoration module, used for restoring the table border in the table area based on the table type detection; A combination module, used for detecting and identifying text in the table area, and combining the text in the table area with the table frame line to parse and restore the target document image; The table frame restoration module is specifically used to: when the table type is a wireless table, determine the first cell area in the table area by using a generative adversarial network; Performing a connected domain search on the first cell area to obtain the cell area coordinates corresponding to the first cell area, and performing text detection on the table area to obtain the text area coordinates within the first cell area; If it is determined according to the cell region coordinates that the first cell region is not a merged cell in the column direction, then the first cell region is horizontally penetrated through the table region to obtain row lines in the table region; If it is determined according to the text area coordinates that the first cell area is not a merged cell in the row direction, the first cell area is vertically penetrated through the table area to obtain column lines in the table area, and the row lines and the column lines are combined to obtain the table frame lines.

7. The device according to claim 6, It is characterized in that The table frame line restoration module is specifically used for: In the case where the table type is a single-line table / three-line table / underline table, removing interference lines in the table area to convert the table type from a single-line table / three-line table / underline table to a wireless table; In the case where the table type is a dotted line table, performing image processing on the table area to convert the table type from a dotted line table to a wired table; When the table type is a wired table, table lines in the table area are detected based on a deep learning model to combine the table lines into the table frame lines.

8. An electronic device, It is characterized in that The electronic device comprises: at least one memory and at least one processor; the memory stores a program, the processor calls the program stored in the memory, and the program is used to implement the table recognition method described in any one of claims 1-5.

9. A storage medium, It is characterized in that The storage medium stores computer executable instructions, and the computer executable instructions are used to execute the table recognition method described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Table vector analysis method and apparatus for PDF document

    CN108446264A

  • Table recognition and reconstruction method and device and storage medium

    CN110163198A

  • Form recognition method and device in image, electronic equipment and storage medium

    CN111814722A

  • Financial statement information detection and recognition method based on OCR

    CN112016481A

  • Table structure identification method and device, electronic equipment and storage medium

    CN112528863A