Table information extraction method, apparatus and device, and storage medium
By detecting the outline and parent-child relationship of the table image, setting cell identification information, combining control instructions and OCR technology, the efficient extraction of table-free nested tables is solved, and efficient and accurate extraction of table information is achieved.
Patent Information
- Application Number
- CN202510479758.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2025-08-29
AI Technical Summary
The existing technology is difficult to efficiently extract and structure the complex table information without table headers and nested structures, the manual entry efficiency is low, and AI technology is low in accuracy and cost in many scenarios.
By acquiring the table image, detecting the contour and the parent-child order relationship, determining the cell outline and setting identification information, receiving control instructions to extract target information, and accurately extracting the table contents with OCR technology.
It realizes efficient and accurate extraction of multiple table structures, improves the universality and accuracy of information extraction, and reduces the computational complexity.
Smart Images

Figure CN120564211A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a table information extraction method, device, equipment and storage medium. Background Art
[0002] In enterprise production activities, efficient extraction and structured processing of table information are key links in improving production management efficiency. Especially when faced with a large number of complex tables without headers and nested structures, traditional manual entry or simple OCR technology often cannot meet the needs. Summary of the Invention
[0003] The present disclosure provides a table information extraction method, device, equipment and storage medium to at least solve the above technical problems existing in the prior art.
[0004] In a first aspect of the present disclosure, a method for extracting table information is provided, the method comprising:
[0005] Get the table image to be extracted;
[0006] Determine all outlines of the table image and parent-child hierarchical relationships of the outlines, wherein the outlines include table outlines and text outlines;
[0007] Determine a cell outline based on the table outline, the text outline, and a parent-child hierarchy relationship of the outlines;
[0008] Determining identification information of each cell outline based on a preset rule;
[0009] Receive control instructions;
[0010] The target cell is determined according to the control instruction and the identification information of each cell outline, and the target information in the target cell is extracted.
[0011] In one embodiment, after obtaining the table image to be extracted, the method further includes:
[0012] The table image is preprocessed, and the preprocessing includes one or more of grayscale processing, binarization and noise reduction processing.
[0013] In one embodiment, determining all contours of the table image and the parent-child hierarchical relationships of the contours includes:
[0014] Detecting all contours and level information in the table image according to a contour detection algorithm;
[0015] The parent-child hierarchical relationship between the contours is determined according to the hierarchical information.
[0016] In one possible implementation, determining the cell outline based on the table outline, the text outline, and the parent-child hierarchy relationship of the outlines includes:
[0017] filtering text contours based on image features and / or text features;
[0018] The innermost contour is selected from the table contour based on the parent-child hierarchy relationship of the contours as the cell contour.
[0019] In one possible implementation, determining the cell outline based on the table outline, the text outline, and the parent-child hierarchy relationship of the outlines includes:
[0020] Traverse all contours and the parent-child order relationship of contours and select contours without child contours from all contours as candidate contours;
[0021] A contour among the candidate contours that meets the contour features of the table contour is determined as a cell contour, where the contour features at least include a contour shape.
[0022] In one embodiment, the method further comprises:
[0023] Verify the cell outline.
[0024] In one possible implementation manner, determining the target cell according to the control instruction and the identification information of each cell outline and extracting the target information in the target cell includes:
[0025] determining a target cell in response to a control instruction and identification information of each cell outline;
[0026] Extracting text information in the target cell;
[0027] Target information is determined based on the text information.
[0028] In a second aspect of the present disclosure, a table information extraction device is provided, the device comprising:
[0029] An acquisition module, used for acquiring the table image to be extracted;
[0030] A first determining module is used to determine all outlines of the table image and the parent-child hierarchy relationship of the outlines, wherein the outlines include table outlines and text outlines;
[0031] A second determining module is used to determine a cell outline based on the table outline, the text outline and the parent-child hierarchy relationship of the outlines;
[0032] A third determining module, configured to determine identification information of each cell outline based on a preset rule;
[0033] A receiving module, used for receiving control instructions;
[0034] A processing module is used to determine a target cell according to the control instruction and identification information of each cell outline and extract target information in the target cell.
[0035] According to a third aspect of the present disclosure, an electronic device is provided, including:
[0036] at least one processor; and
[0037] a memory communicatively connected to the at least one processor; wherein,
[0038] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.
[0039] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.
[0040] The present disclosure provides a table information extraction method, apparatus, device and storage medium. The method obtains a table image to be extracted, and then determines all the contours of the table image and the parent-child hierarchy relationship of the contours, including the table contour and the text contour; then determines the cell contour based on the table contour, the text contour and the parent-child hierarchy relationship of the contour; then determines the identification information of each cell contour based on a preset rule; receives a control instruction, and finally determines the target cell and extracts the target information in the target cell based on the control instruction and the identification information of each cell contour. In the above scheme, by parsing the table structure, the smallest cell contour is extracted as the processing object, and then unique identification information is set for each cell contour. Finally, based on the control instruction, the target cell is located and the corresponding target information is extracted. This scheme is applicable to a variety of table structures, has strong versatility, and has high accuracy in target information extraction.
[0041] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings, in which several embodiments of the present disclosure are shown by way of example and not limitation, wherein:
[0043] In the drawings, the same or corresponding reference numerals denote the same or corresponding parts.
[0044] Figure 1 A schematic diagram showing a flow chart of a table information extraction method according to an embodiment of the present disclosure is shown;
[0045] Figure 2 A schematic diagram showing a flow chart of another table information extraction method according to an embodiment of the present disclosure is shown;
[0046] Figure 3 A schematic diagram of an invoice form according to an embodiment of the present disclosure is shown;
[0047] Figure 4 A schematic diagram of a mechanical drawing table according to an embodiment of the present disclosure is shown;
[0048] Figure 5 A schematic diagram illustrating the outline of a cell of an invoice form according to an embodiment of the present disclosure is shown;
[0049] Figure 6 A schematic diagram illustrating the outline of a cell of a mechanical drawing table according to an embodiment of the present disclosure is shown;
[0050] Figure 7 A schematic structural diagram of a table information extraction device according to an embodiment of the present disclosure is shown;
[0051] Figure 8 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0052] To make the purposes, features, and advantages of the present disclosure more apparent and understandable, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present disclosure without creative work shall fall within the scope of protection of the present disclosure.
[0053] During enterprise production activities, a large amount of tabular information needs to be extracted and entered into relevant production systems, such as bills, invoices, delivery notes, bills of materials, and product specification sheets. These tables often have a row or column in a cell that corresponds to multiple rows or columns in other cells. These tables are considered nested tables. Headerless nested tables lack a header but contain complex structures with subtables within the cells. In this case, the hierarchy and associations of the data are unclear, making parsing more difficult. Manually entering tabular information can flexibly extract information from complex nested tables, such as special symbols like "¥." However, manual extraction of tabular information suffers from low efficiency and the lack of standardization and accuracy when different people extract and express the same information. Related technologies also use artificial intelligence (AI) technologies such as text feature matching, semantic entity recognition, and deep learning to first extract all the text content of the target table and then use natural language processing (NLP) techniques to extract key information from the text. In a single scenario, relatively good robustness can be achieved by annotating and training a large number of samples. However, extracting key information in a single scenario is highly dependent on the quantity and quality of sample annotations, and the accuracy of extracting key information from text content with unclear features such as special symbols is low. In addition, the cost of annotating and training a large number of samples for different scenarios is very high, and for scenarios with large differences in text content, multiple pre-trained models will need to be trained to improve the accuracy of semantic entity recognition. Based on this, the present disclosure provides a method for extracting tabular information.
[0054] According to the embodiments of the present disclosure, Figure 1 A flow chart of a method for extracting table information is shown, the method comprising:
[0055] S1. Obtain the table image to be extracted.
[0056] The table image from which information extraction is to be performed can be obtained from a variety of sources and in a variety of ways. For example, the table image can be obtained from a local storage device, downloaded from a network (e.g., from a server), or acquired in real time using an image acquisition device (e.g., a camera or scanner). This disclosure does not limit the method for obtaining the table image.
[0057] In one example, after obtaining the table image to be extracted, the method further includes:
[0058] The table image is preprocessed, wherein the preprocessing includes one or more of grayscale processing, binarization and noise reduction processing.
[0059] To more accurately detect contours, you can first perform image preprocessing, such as grayscale conversion, binarization, and noise reduction. Grayscale conversion converts a color image into a grayscale image to reduce the amount of data; binarization converts a grayscale image into only black and white, making it easier to distinguish foreground and background; and noise reduction removes noise interference from the image, making the contours clearer.
[0060] S2. Determine all outlines of the table image and the parent-child hierarchy relationship of the outlines, where the outlines include table outlines and text outlines.
[0061] In one example, all contours of a table image and their parent-child relationships are determined, including:
[0062] Detect all contours and hierarchical information in the table image according to the contour detection algorithm;
[0063] The parent-child hierarchy relationship between the contours is determined based on the hierarchical information.
[0064] To detect all the contours of a table image, a contour detection algorithm, such as the cv2.findContours function in OpenCV, can be used to extract the contours of all closed areas in the preprocessed image, including the outer frame, internal grid lines and text areas. These contours include the table contour and the text contour. Morphological operations (such as corrosion and expansion) combined with edge detection algorithms (such as the Canny operator) can also be used to extract all the contours in the image. The present disclosure does not limit the contour detection algorithm. In the process of contour detection, the hierarchical information of the contour can be obtained at the same time, and the parent-child relationship between each contour can be determined through the hierarchical information. For example, the findContours function of OpenCV can return the hierarchical structure information of the contour at the same time when detecting the contour. A contour tree structure can also be constructed based on the RETR_TREE mode of OpenCV to record the parent-child nested relationship. The outer frame of the table is the parent contour, the internal cell line is the child contour, and the text area is attached to the cell as a leaf node.
[0065] In one example, if no hierarchical structure information for contours is available, the parent-child relationship can be determined by analyzing the spatial positional relationships of the contours. If one contour is completely contained within another, then the inner contour is a child of the outer contour. Based on this, for all detected contours, for each pair of contours, check whether all points of one contour are inside the other. If contour A completely contains contour B, then contour B is a child of contour A.
[0066] The parent-child relationship of outlines is used to subsequently determine which outlines are nested within other outlines, thereby better identifying the structure of the table.
[0067] S3. Determine the cell outline based on the table outline, the text outline, and the parent-child hierarchy relationship of the outlines.
[0068] A cell outline refers to an independent closed area without child outlines. Table outlines without child outlines are selected from all outlines according to the parent-child order relationship of the outlines as cell outlines.
[0069] S4. Determine identification information of each cell outline based on preset rules.
[0070] Assign a unique identifier to each cell outline. For example, the preset rule is to determine the row and column coordinates of the cell outline. Based on the relative position of the cell in the table, such as the upper left corner coordinates or the row and column index, the upper left corner coordinates or the row and column index are used as its unique identifier. For example, (1,1) represents the cell in the first row and the first column. Alternatively, determine the upper left corner coordinates of the cell, sort and number each cell outline by the size of the horizontal and vertical coordinates, and use the sorting number as the unique identifier. The above is only an exemplary description of the preset rules. The present disclosure does not impose specific restrictions on the preset rules, as long as the preset rules can assign a unique identifier to each cell outline.
[0071] S5. Receive control instructions.
[0072] Control instructions represent the user's operational intentions conveyed through various interaction methods, such as voice, gesture, text, or touch, and are used to define the positioning rules of the target cell and data extraction requirements.
[0073] In one example, the control instruction can be coordinate selection, directly specifying the target cell location, such as directly entering the coordinates (2,3), which means extracting the cell in the 2nd row and 3rd column; or voice input: extracting the cell in the 2nd row and 3rd column; or selecting a specific area in the 2nd row and 3rd column in the image.
[0074] In one example, the control instruction may also be template matching, where the user uploads a predefined form template, maps the target area according to the field name, and extracts the content within the target area.
[0075] S6. Determine the target cell according to the control instruction and the identification information of each cell outline and extract the target information in the target cell.
[0076] When the user inputs a specific control instruction, the corresponding cell outline is searched in the previously assigned identification information based on the control instruction, and the target information is extracted from the located target cell using optical character recognition (OCR) technology or other text extraction methods.
[0077] In the above scheme, the table image to be extracted is obtained, and then all the contours of the table image and the parent-child hierarchy relationship of the contours are determined, including the table contour and the text contour; then the cell contours are determined based on the table contour, the text contour, and the parent-child hierarchy relationship of the contours; then the identification information of each cell contour is determined based on preset rules; control instructions are received, and finally, the target cell is determined and the target information within the target cell is extracted based on the control instructions and the identification information of each cell contour. In the above scheme, the table structure is parsed, the smallest cell contour is extracted as the processing object, and then unique identification information is set for each cell contour. Finally, the target cell is located based on the control instruction and the corresponding target information is extracted. This scheme is applicable to a variety of table structures, has strong versatility, and can extract target information with high accuracy.
[0078] In one example, determining a cell outline based on a table outline, a text outline, and a parent-child hierarchy of the outlines includes:
[0079] filtering text contours based on image features and / or text features;
[0080] The innermost contour is selected from the table contour based on the parent-child hierarchy relationship of the contours as the cell contour.
[0081] According to the parent-child order relationship of the contours, table contours without child contours are filtered from all contours as cell contours. First, text contours can be filtered based on image features, where image features include the shape of the contour. By performing polygonal approximation on all contours, only contours that meet the quadrilateral features are identified as table contours. Because the number of contour edges of the text polygon is greater than 4, contours with more than 4 contour edges are filtered out, that is, text contours are filtered out. It is also possible to distinguish between table contours and text contours based on text features, such as the text font and texture.
[0082] After filtering out text outlines, what remains are table outlines related to the table. Based on the parent-child hierarchy of these outlines, the innermost outline is selected as the cell outline. By filtering out text outlines first, this method can reduce the amount of data required for subsequent processing, lower computational complexity, and improve processing speed.
[0083] In one example, determining a cell outline based on a table outline, a text outline, and a parent-child hierarchy of the outlines includes:
[0084] Traverse all contours and the parent-child order relationship of contours and select contours without child contours from all contours as candidate contours;
[0085] A contour that meets the contour features of the table contour among the candidate contours is determined as a cell contour, where the contour features at least include a contour shape.
[0086] For all detected contours, we analyze their parent-child hierarchical relationships. By traversing the contour hierarchy, we identify the innermost contours without sub-contours as candidate contours. These candidate contours include cell contours and text contours. We then perform feature analysis on the innermost contours we have selected, using the aforementioned image and text features to filter out text contours. The remaining contours are cell contours.
[0087] In one example, the method further includes:
[0088] Verify cell outlines.
[0089] For example, for the method of filtering the text outline first and then filtering the cell outline, after filtering the text outline, check for abnormal number of edges (for example, the number of edges is greater than 4) or redundant vertex problems caused by complex table lines. Because the intersection of complex table lines may cause redundant contour vertices, the contour can be made to conform to the quadrilateral features by merging or correcting the vertices. In addition, residual text interference can be further removed. Although the text outline has been filtered, there may be a situation where the outline contains only simple text symbols (such as punctuation marks, short horizontal lines), which needs to be further excluded.
[0090] For another example, for the method of first determining the innermost contour and then filtering the text contour, it is necessary to verify the situation where text symbols are misjudged as cells due to incomplete filtering of the text contour. Some text contours may be retained because their shapes are similar to table lines and need to be excluded in the verification.
[0091] Through the above verification method, the misjudgment risk of different scenarios can be optimized, further improving the accuracy of cell outline determination.
[0092] In one example, determining a target cell according to the control instruction and identification information of each cell outline and extracting target information in the target cell includes:
[0093] determining a target cell in response to a control instruction and identification information of each cell outline;
[0094] Extracting text information in the target cell;
[0095] Target information is determined based on the text information.
[0096] The target cell is located according to the control instruction and the identification information of the cell outline, and the original text in the target cell is extracted as text information through text recognition technology such as OCR.
[0097] For vertical scenarios such as invoices and customs declarations, texts of the same data type will be entered in cells at the same position. The post-processing steps of the text information are based on the data characteristics and predefined rules of the vertical scenario to achieve accurate screening of the target information. For example, through semantic keyword filtering, the domain keywords in the text (such as "amount:" and "total") are identified, and the target value is located in combination with the context, which is the target information. Another example is data type verification, which uses predefined data type templates (such as date format and currency format) to verify and extract valid fields and eliminate irrelevant text.
[0098] The following is a further detailed description of this solution based on specific application scenarios.
[0099] like Figure 2 A flowchart of a method for extracting table information is shown, wherein the table is an invoice and a mechanical drawing table as an example. The method includes:
[0100] S21, read the nested table image through opencv. Figure 3 The following is a schematic diagram of the invoice form; Figure 4 Shown is a schematic diagram of a mechanical drawing form.
[0101] S22. Perform grayscale and binarization preprocessing on the table image to improve the effect of contour detection.
[0102] S23. Detect all contours of the table image, including table contours and text contours, and retain the parent-child hierarchy relationship of all contours.
[0103] S24. Perform polygonal approximation on all contours. Since the number of edges of the text polygon is greater than 4, only contours with 4 polygon edges need to be retained to filter the text contours.
[0104] S25. Then, through the parent-child hierarchy of the contours, retain the innermost contour without sub-contours as the cell contour.
[0105] S26, determine the coordinates of the upper left corner of the cell outline, sort and number each cell outline according to the size of the horizontal and vertical coordinates x, y, that is, determine the identification information of each cell outline. Figure 5 The following is a schematic diagram of the identification information of the invoice cell outline; Figure 6 Shown is a schematic diagram of the identification information of the outline of the table cell in the mechanical drawing.
[0106] S27. By inputting a control instruction, i.e., the index number of the cell outline, the area of the corresponding image is intercepted by the cell outline with the corresponding number for OCR recognition, the text content of the corresponding cell can be obtained, and then the text is post-processed to extract the target information.
[0107] Taking the invoice form as an example, when the user enters the index number 5 / 7 / 2, the text information recognized by OCR is as follows:
[0108] (5, ['Name: Company B', 'Uniform Social Credit Code / Taxpayer Identification Number: abcdefg'])
[0109] (7, ['Name: Company A', 'Uniform Social Credit Code / Taxpayer Identification Number: 12345678'])
[0110] (2, ['One hundred and twenty-eight yuan and five cents', '(lowercase)¥128.50'])
[0111] After post-processing the text and unifying the data processing process, the target information obtained is as follows:
[0112] Seller: Company
[0113] Buyer: Company A
[0114] Total price and tax: ¥128.50.
[0115] Taking a mechanical drawing table as an example, when the user enters the index number 87 / 79 / 0, the text information recognized by OCR is as follows:
[0116] (87, ['Wang, Quanbiao'1)
[0117] (79, ['Wang, Sweair'])
[0118] (0, ['OB'])
[0119] After unifying the data processing process, the target information obtained is as follows:
[0120] Illustrations by: Wang, Quanbiao
[0121] Reviewer: Wang, Sweair
[0122] Version number: OB
[0123] According to an embodiment of the present disclosure, the present disclosure also provides a table information extraction device, such as Figure 7 The figure shows a schematic structural diagram of the device, which includes:
[0124] An acquisition module 10 is used to acquire a table image to be extracted;
[0125] A first determining module 20 is configured to determine all outlines of the table image and the parent-child hierarchical relationship of the outlines, wherein the outlines include table outlines and text outlines;
[0126] A second determining module 30 is configured to determine a cell outline based on the table outline, the text outline, and the parent-child hierarchy relationship of the outlines;
[0127] A third determination module 40 is used to determine identification information of each cell outline based on a preset rule;
[0128] A receiving module 50 is configured to receive a control instruction;
[0129] The processing module 60 is configured to determine a target cell according to the control instruction and identification information of each cell outline and extract target information in the target cell.
[0130] In one example, the acquisition module 10 is further configured to:
[0131] The table image is preprocessed, and the preprocessing includes one or more of grayscale processing, binarization and noise reduction processing.
[0132] In one example, the first determining module 20 is further configured to:
[0133] Detecting all contours and level information in the table image according to a contour detection algorithm;
[0134] The parent-child hierarchical relationship between the contours is determined according to the hierarchical information.
[0135] In one example, the second determining module 30 is further configured to:
[0136] filtering text contours based on image features and / or text features;
[0137] The innermost contour is selected from the table contour based on the parent-child hierarchy relationship of the contours as the cell contour.
[0138] In one example, the second determining module 30 is further configured to:
[0139] Traverse all contours and the parent-child order relationship of contours and select contours without child contours from all contours as candidate contours;
[0140] A contour among the candidate contours that meets the contour features of the table contour is determined as a cell contour, where the contour features at least include a contour shape.
[0141] In one example, the second determining module 30 is further configured to:
[0142] Verify the cell outline.
[0143] In one example, the processing module 60 is configured to:
[0144] determining a target cell in response to a control instruction and identification information of each cell outline;
[0145] Extracting text information in the target cell;
[0146] Target information is determined based on the text information.
[0147] According to an embodiment of the present disclosure, there is further provided an electronic device, including:
[0148] at least one processor; and
[0149] a memory communicatively connected to the at least one processor; wherein,
[0150] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.
[0151] According to an embodiment of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is further provided, where the computer instructions are used to enable the computer to execute the method described in the present disclosure.
[0152] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0153] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0154] like Figure 8 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. Various programs and data required for the operation of the device 800 can also be stored in the RAM 803. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0155] Various components in device 800 are connected to I / O interface 805, including an input unit 806, such as a keyboard, mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a magnetic disk, optical disk, etc.; and a communication unit 809, such as a network card, modem, wireless communication transceiver, etc. The communication unit 809 allows device 800 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0156] The computing unit 801 can be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the table information extraction method. For example, in some embodiments, the table information extraction method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the table information extraction method described above can be performed. Alternatively, in other embodiments, the computing unit 801 can be configured to perform the table information extraction method by any other appropriate means (e.g., by means of firmware).
[0157] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0158] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0159] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0160] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0161] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0162] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.
[0163] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.
[0164] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. Throughout the present disclosure, "plurality" means two or more, unless otherwise specifically defined.
[0165] The above description is merely a specific embodiment of the present disclosure, but the scope of protection of the present disclosure is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this disclosure should be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure should be based on the scope of protection of the claims.
Claims
1. A table information extraction method, characterized in that: The method comprises: Get the table image to be extracted; Determine all outlines of the table image and parent-child hierarchical relationships of the outlines, wherein the outlines include table outlines and text outlines; Determine a cell outline based on the table outline, the text outline, and a parent-child hierarchy relationship of the outlines; Determining identification information of each cell outline based on a preset rule; Receive control instructions; The target cell is determined according to the control instruction and the identification information of each cell outline, and the target information in the target cell is extracted.
2. The table information extraction method according to claim 1, characterized in that: After obtaining the table image to be extracted, the method further includes: The table image is preprocessed, and the preprocessing includes one or more of grayscale processing, binarization and noise reduction processing.
3. The table information extraction method according to claim 1, characterized in that: The step of determining all the contours of the table image and the parent-child hierarchical relationship of the contours includes: Detecting all contours and level information in the table image according to a contour detection algorithm; The parent-child hierarchical relationship between the contours is determined according to the hierarchical information.
4. The table information extraction method according to claim 1, characterized in that: The determining of the cell outline based on the table outline, the text outline, and the parent-child hierarchy relationship of the outlines includes: filtering text contours based on image features and / or text features; The innermost contour is selected from the table contour based on the parent-child hierarchy relationship of the contours as the cell contour.
5. The table information extraction method according to claim 1, characterized in that: The determining of the cell outline based on the table outline, the text outline, and the parent-child hierarchy relationship of the outlines includes: Traverse all contours and the parent-child order relationship of contours and select contours without child contours from all contours as candidate contours; A contour among the candidate contours that meets the contour features of the table contour is determined as a cell contour, where the contour features at least include a contour shape.
6. The table information extraction method according to claim 4 or 5, characterized in that: The method further includes: Verify the cell outline.
7. The table information extraction method according to claim 1, characterized in that: The step of determining a target cell according to the control instruction and the identification information of each cell outline and extracting target information in the target cell includes: determining a target cell in response to a control instruction and identification information of each cell outline; Extracting text information in the target cell; Target information is determined based on the text information.
8. A table information extraction device, characterized in that: The device comprises: An acquisition module, used for acquiring the table image to be extracted; A first determining module is used to determine all outlines of the table image and the parent-child hierarchy relationship of the outlines, wherein the outlines include table outlines and text outlines; A second determining module is used to determine a cell outline based on the table outline, the text outline and the parent-child hierarchy relationship of the outlines; A third determining module, configured to determine identification information of each cell outline based on a preset rule; A receiving module, used for receiving control instructions; A processing module is used to determine a target cell according to the control instruction and identification information of each cell outline and extract target information in the target cell.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, wherein the instructions are executed by the at least one processor to enable the at least one processor to perform: Get the table image to be extracted; Determine all outlines of the table image and parent-child hierarchical relationships of the outlines, wherein the outlines include table outlines and text outlines; Determine a cell outline based on the table outline, the text outline, and a parent-child hierarchy relationship of the outlines; Determining identification information of each cell outline based on a preset rule; Receive control instructions; The target cell is determined according to the control instruction and the identification information of each cell outline, and the target information in the target cell is extracted.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute: Get the table image to be extracted; Determine all outlines of the table image and parent-child hierarchical relationships of the outlines, wherein the outlines include table outlines and text outlines; Determine a cell outline based on the table outline, the text outline, and a parent-child hierarchy relationship of the outlines; Determining identification information of each cell outline based on a preset rule; Receive control instructions; The target cell is determined according to the control instruction and the identification information of each cell outline, and the target information in the target cell is extracted.