Table recognition method, electronic equipment and storage medium

By introducing a process for identifying and re-recognizing stuck cells, and using a method based on preset templates, the problem of structural instability and stuck text processing in handwritten table recognition is solved, achieving efficient and accurate table content attribution, and is suitable for batch recognition of fixed-format tables.

CN122067263APending Publication Date: 2026-05-19SHANGHAI INST OF COMPUTING TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI INST OF COMPUTING TECH
Filing Date
2025-12-17
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing technologies for processing handwritten forms suffer from problems such as unstable structure recognition, low accuracy in content attribution, weak ability to handle connected text, and high implementation costs, making it difficult to achieve efficient and accurate recognition of fixed-format handwritten forms.

Method used

By introducing the identification of stuck cells and a dedicated re-identification process, the OCR recognition results of the table image are obtained. The cell bounding box is determined based on the preset template. Stuck cells are identified and cropped for independent OCR recognition. Non-stuck cells are assigned content according to preset attribution conditions and filled into the template.

Benefits of technology

It improves the accuracy of handwritten table recognition, has high stability and low cost, and is suitable for batch recognition of fixed-format tables with high accuracy requirements, solving the problem of handwritten text overlapping across cells.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122067263A_ABST
    Figure CN122067263A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the field of image recognition, and discloses a table recognition method, electronic equipment and a storage medium. The method comprises the following steps: acquiring an OCR recognition result of a table image; determining a bounding box of each cell based on a predefined template; and for each cell, judging whether the cell is an adhesion cell or not according to the overlapping relationship between the OCR character recognition box and the bounding box thereof. If the cells are adhered cells, cutting the cell region image to carry out independent OCR (Optical Character Recognition) so as to obtain contents; and if the cells are not adhered, directly determining the content according to the character recognition box meeting the preset attribution condition. And finally, filling all contents into the template. By introducing'adhesion cell 'judgment and a special re-identification process, the problem of cross-cell adhesion of handwritten characters is effectively solved, and the attribution accuracy is improved; meanwhile, the method based on the template avoids complex model training, is high in stability and low in cost, and is particularly suitable for a fixed format table batch identification scene with high precision requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image recognition, and in particular to a table recognition method, electronic device, and storage medium. Background Technology

[0002] In government, healthcare, and scientific research, efficiently and accurately converting large amounts of manually filled paper forms into structured electronic data is a crucial step in achieving digital transformation. Optical Character Recognition (OCR) technology is fundamental to this process. For printed, well-structured tables, existing technologies are relatively mature and can be mainly divided into two categories: one is end-to-end table recognition methods based on deep learning models, which automatically detect table borders, segment cells, and associate text by training on a large amount of labeled data; the other is rule- and template-based methods, which use predefined table structures to assist in content extraction.

[0003] However, existing technologies face significant challenges when processing handwritten paper forms: First, handwriting often involves writing across cells, overlapping characters, and offsetting outside the frame, causing the OCR output text recognition box to frequently cover multiple cells simultaneously. Traditional simple attribution methods based on "center point placement" or "maximum intersection area" are prone to errors in such scenarios, leading to content misalignment. Second, deep learning-based table structure prediction models lack stability in complex situations such as blurred lines, merged cells, and scanning distortion. Furthermore, model training relies on large amounts of labeled data, resulting in high costs and difficulty adapting to business scenarios with fixed table styles but extremely high accuracy requirements. Finally, existing solutions generally lack dedicated mechanisms for handling overlapping text. Once overlapping text occurs across cells, either forced attribution leads to errors, or the text is discarded directly, resulting in information loss.

[0004] Therefore, the relevant technologies in this field have problems such as unstable structure recognition, low accuracy of content attribution, weak ability to handle overlapping situations, and high implementation costs in the case of handwritten table recognition. There is an urgent need for a recognition method that can stably, accurately, and cost-effectively process fixed-format handwritten tables. Summary of the Invention

[0005] The purpose of this application is to provide a table recognition method, electronic device and storage medium. By introducing the determination of "adhering cells" and a dedicated re-recognition process, the problem of handwritten text adhering across cells is effectively solved, and the accuracy of classification is improved.

[0006] To address the aforementioned technical problems, embodiments of this application provide a table recognition method, comprising: acquiring an OCR recognition result of a table image, the OCR recognition result including at least one text recognition box and corresponding text content; determining the boundary box of each cell to be recognized in the table image based on a preset table template; for each cell to be recognized in the table template, determining whether the cell is a connected cell based on the overlap relationship between the text recognition box in the OCR recognition result and the boundary box of the cell; when determined to be a connected cell, cropping the area image corresponding to the boundary box of the cell from the table image, and performing OCR recognition on the area image to obtain the content of the cell; when determined to be a non-connected cell, selecting at least one text recognition box that satisfies a preset attribution condition from the OCR recognition result, determining the cell content based on the text content of the selected text recognition box; and filling the determined content of each cell into the corresponding position of the table template.

[0007] Embodiments of this application also provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the table recognition method described above.

[0008] The embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described table recognition method.

[0009] In this embodiment, the OCR recognition results of the table image are obtained; the bounding boxes of each cell are determined based on a predefined template; for each cell, it is determined whether it is a connected cell based on the overlap relationship between the OCR text recognition box and its bounding box. If it is a connected cell, the image of that cell area is cropped and independently OCR recognized to obtain the content; if it is not a connected cell, the content is directly determined based on the text recognition box that meets the preset attribution conditions. Finally, all content is filled into the template. By introducing the determination of "connected cells" and a dedicated re-recognition process, the problem of handwritten text overlapping across cells is effectively solved, improving the attribution accuracy; at the same time, the template-based method avoids complex model training, has high stability and low cost, and is particularly suitable for batch recognition scenarios of fixed-format tables with high accuracy requirements. Attached Figure Description

[0010] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0011] Figure 1 This is a flowchart of a table recognition method according to an embodiment of this application; Figure 2 This is a scanned original image of a form provided according to an embodiment of this application; Figure 3 This is a schematic diagram of corner detection results provided according to an embodiment of this application; Figure 4 This is a schematic diagram of perspective transformation effect provided according to an embodiment of this application; Figure 5 This is a schematic diagram of character detection results provided according to an embodiment of this application; Figure 6 This is a schematic diagram of ownership determination rule A according to an embodiment of this application; Figure 7 This is a schematic diagram of ownership determination rule B according to an embodiment of this application; Figure 8 This is a schematic diagram of the structure of an electronic device according to another embodiment of this application. Detailed Implementation

[0012] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details have been presented in the various embodiments of this application to enable readers to better understand this application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in this application can be implemented. The division of the various embodiments below is for the convenience of description and should not constitute any limitation on the specific implementation of this application. The various embodiments can be combined with and referenced by each other without contradiction.

[0013] One embodiment of this application relates to a table recognition method, which can be applied to a table recognition device. The table recognition device can be an electronic device such as a mobile phone or computer, or an integrated device composed of electronic components such as chips capable of data processing. In this embodiment, the OCR recognition result of the table image is obtained; the bounding boxes of each cell are determined based on a predefined template; for each cell, it is determined whether it is a connected cell based on the overlap relationship between the OCR text recognition box and its bounding box. If it is a connected cell, the cell area image is cropped for independent OCR recognition to obtain the content; if it is not a connected cell, the content is directly determined based on the text recognition boxes that meet the preset attribution conditions. Finally, all content is filled into the template. By introducing the determination of "connected cells" and a dedicated re-recognition process, the problem of handwritten text overlapping across cells is effectively solved, improving the attribution accuracy. At the same time, the template-based method avoids complex model training, has high stability and low cost, and is particularly suitable for batch recognition scenarios of fixed-format tables with high accuracy requirements. The implementation details of the table recognition method in this embodiment are described below. The following content is only for ease of understanding and is not necessary for implementing this solution.

[0014] like Figure 1 As shown, in step 101, the OCR recognition result of the table image is obtained. The OCR recognition result includes at least one text recognition box and the corresponding text content.

[0015] In one example, before obtaining the OCR recognition result of the table image in step 101 above, the method may further include: performing a perspective transformation on the table area in the table image based on the preset table reference corner coordinates in the table template, so that the transformed image is aligned with the coordinate system defined by the table template. This solves the problem of table image tilt and distortion caused by shooting or scanning, laying the foundation for subsequent accurate geometric calculations.

[0016] In one example, the above table template can be generated as follows: Obtain a standard image of the table style and perform perspective correction to obtain a standard table image; in the standard table image, annotate the bounding box coordinates of all cells to be identified, generating a coordinate mapping file; create a spreadsheet file with the same logical structure as the table style, where the cells to be identified are identified by placeholders; the coordinate mapping file and the spreadsheet file are linked through placeholders, together forming the table template. This makes the creation, modification, and version management of the template very flexible. Users only need to focus on the logical design of the table; the coordinate annotation can be completed (semi-)automatically, which greatly simplifies the work of adapting to new table styles and improves the practicality of the entire solution. Specifically, this example could be: 1. Perform table image acquisition, i.e., print out the sample table (no blank table required), scan it into a high-resolution PDF format (PDF format stands for Portable Document Format; converting to PDF is only for easier recognition), and convert it to the format shown below. Figure 2 The image file shown.

[0017] 2. Locate the four corner points of the table area in the scanned image, and construct an axis-aligned target rectangle based on the coordinates of the four corner points. That is: during the template creation process, the four corner points of the table marked in the scanned image are used for positioning. , , , .like Figure 3 As shown, although it approximates a rectangle, it usually involves slight rotation or deformation. To normalize this region into an axis-aligned rectangle while preserving as much of the original width and height as possible and reducing computational complexity, a simplified construction method is illustrated below: (1) First, sort the corner points according to their spatial positions, and record them as the top left, top right, bottom right, and bottom left points in sequence: , , , .

[0018] (2) Based on this, the x and y coordinates of the upper left and lower right corners are directly used as the boundaries of the target rectangle to construct a set of axis-aligned target corner coordinates: , , , .

[0019] That is, take [in the horizontal direction] As the left and right boundaries of the rectangle, take [the following] in the vertical direction. The rectangle is defined by the top and bottom boundaries, resulting in a rectangular region with edges parallel to the image coordinate axes. This construction method can approximately maintain the aspect ratio and coverage of the original region when the table has only a slight tilt, and it involves only simple addition and subtraction comparison operations, resulting in low computational cost.

[0020] 3. According to the original Figure 4 Calculate the perspective transformation matrix using the coordinates of the corner points and the four corner points of the target rectangle. For example, let's take perspective correction of a table area using a four-point homography model: (1) Let the pixel coordinates of the four corner points of the table in the original scanned image be . , , , ; The coordinates of the four corner points of the axis-aligned rectangle in the corrected target image are: , , , ; For example, it can be set as follows: , , , ; Where W and H are the width and height of the corrected table area.

[0021] (2) Perspective transformation is represented by a 3×3 homography matrix H as follows: =H =

[0022] (3) The actual coordinates are then obtained from the homogeneous coordinate relationship:

[0023] (4) Pair the four corresponding points ( ) → ( Substituting the above relationships, we obtain eight linear equations to solve for the eight unknowns in matrix H (h32 is fixed to 1 to eliminate scale non-uniqueness). In practice, these equations are rearranged into matrix form Ah = b; Where h=[ Then, numerical algorithms such as least squares or singular value decomposition (SVD) are used to solve for the perspective transformation matrix H.

[0024] After obtaining matrix H, the above transformation relationship is applied to the coordinates (x, y) of each pixel within the table area. Combined with resampling methods such as bilinear interpolation, a corrected image is generated. The corrected image is shown below. Figure 4 As shown, this achieves horizontal and vertical alignment correction of the table area, ensuring the stability and consistency of subsequent template coordinate definitions.

[0025] 4. Perform structural line annotation: Manually annotate all horizontal and vertical lines in the image using graphic annotation tools to generate a structural annotation file containing the coordinates of all horizontal and vertical lines. (This can be in JSON format; JSON stands for JavaScript Object Notation, a lightweight data interchange format.)

[0026] 5. Table Structure Definition: Manually create a spreadsheet file (template.xlsx) with the same structure as the target table in Microsoft Excel. Use the unique identifier "TBD" to place all cells to be identified. These placeholders are for later generation of template.json. Some cells in the table may contain pre-filled content (such as headers or titles). When actually identifying the content within the table, the content in these cells does not need to be recognized, so they will not be identified as TBD, and their corresponding positions and row / column information will not be recorded in template.json.

[0027] 6. Template Composition: Combining the line coordinate information from step 4 and the "TBD" placeholder cell position from step 5, calculate the image coordinate area (Bounding Box, abbreviated as bbox) corresponding to each "TBD" cell, and encapsulate the cell's row number, column number, and bbox into a template structure file (template.json).

[0028] Ultimately, each table style corresponds to a template, consisting of two parts: template.xlsx and template.json, used for subsequent identification, location, matching, and content input. The template construction provides a "description" of the blank table, including header information, corner positions, and the row, column, and position of all cells to be identified. By introducing a perspective transformation alignment step based on the template's reference corner points, it is ensured that the image to be identified and the template are strictly consistent in the geometric coordinate system. This eliminates the interference of image distortion on cell location and overlap calculation.

[0029] Next, proceed to step 101, which involves using an OCR engine (such as PaddleOCR) to perform text detection and recognition on the entire image, outputting several text boxes (rec_boxes) and their corresponding text content (rec_text). The character detection results are as follows: Figure 5 As shown, each box is a rectangular area (it can be a quadrilateral, but it will be converted to a bounding box format).

[0030] In one example, the coordinate mapping file is in JSON format, and the spreadsheet file is in Excel format (Excel is Microsoft Spreadsheet software, a proper noun). The ability to adapt to the widely supported JSON and Excel formats ensures the template's universality, readability, and ease of use. It facilitates integration with existing workflows and also allows for manual verification and editing.

[0031] In step 102, based on a preset table template, the bounding boxes of each cell to be identified in the table image are determined. For example, Hough transform can be used to detect table corners in the uploaded image. The relevant process is mainly an engineering problem; for example, various combinations of algorithms based on Hough transform can be used to detect table corners.

[0032] In one example, template matching can be performed before step 102 above. For instance: extract the table title content from the recognized image, compare its similarity with the table titles of all templates in the template library (using fuzzy matching or vector matching), select the best-matching template, and load its corresponding template.xlsx and template.json files. If the title is covered by handwriting, missing, or blurred, it is resolved using edit distance.

[0033] In one example, the above template matching can be performed first, and then the above warp perspective transformation can be applied according to the corner position information of the template recorded in template.json to align the table area in the image with the template.

[0034] In step 103, for each cell to be recognized in the table template, the overlap relationship between the text recognition box in the OCR recognition result and the cell's bounding box is used to determine whether the cell is a stuck cell.

[0035] In one example, determining whether a cell is a "stuck" cell can be done by: calculating the first and second overlap rates of each text recognition box in the OCR result with the cell's bounding box; the first overlap rate is the ratio of the intersection area of ​​the text recognition box and the cell's bounding box to the area of ​​the text recognition box; the second overlap rate is the ratio of the intersection area to the area of ​​the cell's bounding box. If at least one text recognition box has a second overlap rate greater than the first threshold with the current cell, and the text recognition box also has a second overlap rate greater than the first threshold with at least one other cell to be recognized, then the current cell is determined to be a stuck cell. This example provides a clear, quantifiable, and efficient determination criterion, accurately capturing the typical geometric features of handwritten stuck cells. Compared to other vague and unreliable intuitive judgments, this method has the advantages of simple calculation and strong interpretability, making it key to achieving automated and highly reliable data splitting.

[0036] In one example, the aforementioned preset attribution condition could be: the first overlap rate between the text recognition box and the cell's bounding box is greater than a second threshold. This ensures that the content is correctly assigned when the text box primarily falls within a cell. This rule, together with the example above, constitutes a complete and complementary dual overlap rate determination system, significantly enhancing the fault tolerance and accuracy of the attribution logic in complex scenarios.

[0037] In one example, the first threshold is 0.25, and the second threshold is 0.7. These specific values ​​have been verified through extensive experiments and represent a stable, optimally performing industrial-grade solution, further ensuring that the above embodiments achieve the highest recognition accuracy in typical application scenarios. Specifically: 1. For each recognized text box rec_box, calculate the overlap rate with all cells defined in template.json using the following two methods: - Intersection over Box (IOB) = (cell ∩ rec_box) area / rec_box area; - Intersection over Cell (IOC) = (cell ∩ rec_box) area / cell_box area; 2. The attribution determination shall be made in accordance with the following rules and order: - If a rec_box and multiple cells simultaneously have an IOC > 0.25, then the rec_box is determined to be contiguous text, and all cells with an IOC > 0.25 with it are placed in the "pending group"; otherwise: - If the IOB calculated for a rec_box and a certain cell is greater than 0.7 (it can be selected from 0.5 to 1, and 0.7 has been tested to be the best), it is determined that the rec_box belongs to the cell, and the cell is assigned to the "determined group".

[0038] It is known that, theoretically, a rec_box can only enter one of the "pending group" or the "confirmed group". This rule can be supplemented, but theoretically, it should be ensured that the text boxes of elements in the "confirmed group" belong to only one corresponding cell.

[0039] To better understand the rules for determining whether a cell is a connected cell as proposed in step 103 above, the following will illustrate two typical cases of the attribution determination rules.

[0040] Case A Figure 6 As shown, examine rec_box A ( Figure 6 The box labeled A) and the cells that intersect it (a, b, c, d, e, f, g).

[0041] 1. Calculate the IOC of rec_box A with each of the 8 cells. It's easy to notice that the IOC of rec_box A with cells c and d is greater than 0.25, meaning: The area of ​​the intersection of rec_box A and cell c / the area of ​​cell c > 0.25 The area of ​​the intersection of rec_box A and cell d / the area of ​​cell d > 0.25 Therefore, cells c and d are divided into groups to be determined (the relationship between them cannot be determined, and the content of these two cells depends on the subsequent cutting out of the independent images of each cell and using OCR to detect them separately).

[0042] 2. Calculate the IOB of rec_box A and the remaining 6 cells. It is not difficult to notice that the IOB of rec_box A and all the remaining 6 cells is less than 0.7. Therefore, the remaining 6 cells are not assigned to a specific group.

[0043] Situation B, for example Figure 7 As shown: Examine rec_box A( Figure 7 The box labeled A) and the cells (a, b) that intersect it.

[0044] 1. Calculate the IOC of rec_box A and the two cells separately. It is not difficult to notice that the calculated IOC results of rec_box A and cells a and b are not all greater than 0.25 (the calculated IOC of rec_box A and cell b is significantly less than 0.25). 2. Calculate the IOB of rec_box A and the two cells respectively. The calculated IOB of rec_box A and cell a is significantly greater than 0.7, that is: The area of ​​the intersection of rec_box A and cell a / the area of ​​rec_box A > 0.7 Therefore, cell a is assigned to a specific group, the content of which is the text content corresponding to rec_box A.

[0045] In step 104, when cells are determined to be stuck together, the region corresponding to the cell's bounding box is cropped from the table image, and OCR recognition is performed on the region image to obtain the cell's content. Taking the "pending group" as an example, the corresponding cell region is cropped from the original image into an independent image, and OCR is called again for separate recognition (i.e., fallback OCR mechanism) to fill in the corresponding cell. Cropping from the original image can be done by using Template.json, which records the position information of all cells, to crop the corresponding region from the image according to this position information to obtain an independent cell image.

[0046] In step 105, when a cell is determined to be non-adhesive, at least one text recognition box that meets the preset attribution conditions is selected from the OCR recognition results, and the cell content is determined based on the text content of the selected text recognition box.

[0047] In one example, when multiple text recognition boxes exist in a non-adhesive cell, the text content corresponding to each text recognition box is concatenated according to their spatial order in the image. This spatial order concatenation rule ensures the correct word order and integrity of the text content within the cell, avoids content corruption, and improves the direct usability of the output results. Taking the "determined group" example above, the rec_text corresponding to each cell is written to the corresponding row and column position in template.xlsx. If multiple rec_boxes belong to the same cell, the text is concatenated in the order of top→bottom and left→right.

[0048] In step 106, the content of each determined cell is filled into the corresponding position in the table template. The completed template.xlsx file can be exported as a structured spreadsheet file, completing the structure reconstruction and content recognition of the entire table. The output can be printed text.

[0049] Thus, this embodiment has solved the fundamental problem of inaccurate content classification caused by characters spanning multiple cells or sticking together in handwritten table recognition. It ensures that even with complex handwriting and irregular layout, the content of each cell can be accurately extracted in the most suitable way, thereby significantly improving the accuracy and robustness of the entire table structure recognition.

[0050] In this implementation, standardized input images and template matching are used to introduce prior structural information. Dual overlap rate calculations (IOB / IOC) address the uncertainty in attribution caused by text boxes crossing or sticking together. A fallback OCR mechanism ensures reliable content completion in cases of ambiguous attribution. The overall solution does not rely on deep learning training, exhibiting high adaptability and engineering practicality. A dual-file template mechanism ("template.xlsx + template.json") decouples the logical structure from image position information, facilitating template maintenance and version management. The overlap rate calculation combines rec_box subjective perspective (IOB) and cell objective perspective (IOC), making the attribution logic more robust. The sticking back strategy effectively avoids misattribution and content loss, ensuring the integrity of the structural output. The output is a standard Excel spreadsheet, offering good compatibility and facilitating downstream system integration and manual verification. The overall technical solution has strong scalability and operability, particularly suitable for the digitization needs of paper forms in fields such as government archives, medical data, and financial records.

[0051] The steps described above are for clarity only. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this application. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this application.

[0052] It is worth mentioning that all modules involved in this embodiment are logical modules. In practical applications, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. Furthermore, to highlight the innovative aspects of this application, this embodiment does not introduce units that are not closely related to solving the technical problem proposed in this application; however, this does not mean that other units are absent from this embodiment.

[0053] Another embodiment of this application relates to an electronic device, such as... Figure 8 As shown, it includes at least one processor 501; and a memory 502 communicatively connected to the at least one processor; wherein the memory 502 stores instructions executable by the at least one processor 501, the instructions being executed by the at least one processor 501 to enable the at least one processor 501 to perform the table recognition method as described above.

[0054] The memory 502 and processor 501 are connected via a bus, which can include any number of interconnecting buses and bridges. The bus connects various circuits of one or more processors 501 and memory 502 together. The bus can also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by processor 501 is transmitted over a wireless medium via an antenna, which further receives data and transmits it to processor 501.

[0055] Processor 501 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory 502 can be used to store data used by processor 501 during operation.

[0056] Another embodiment of this application relates to a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the method embodiments described above.

[0057] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0058] Those skilled in the art will understand that the above embodiments are specific implementations of this application, and in practical applications, various changes can be made in form and detail without departing from the spirit and scope of this application.

Claims

1. A table recognition method, characterized in that, include: Obtain the OCR recognition result of the table image, wherein the OCR recognition result includes at least one text recognition box and the corresponding text content; Based on a preset table template, the bounding box of each cell to be identified in the table image is determined. For each cell to be recognized in the table template, the cell is determined to be a connected cell based on the overlap between the text recognition box in the OCR recognition result and the bounding box of the cell. When a cell is determined to be stuck together, the region image corresponding to the bounding box of the cell is cropped from the table image, and the region image is subjected to OCR recognition to obtain the content of the cell; When a cell is determined to be non-adhesive, at least one of the text recognition boxes that meet the preset attribution conditions is selected from the OCR recognition results, and the content of the cell is determined based on the text content of the selected text recognition box. Fill the contents of all the determined cells into the corresponding positions in the table template.

2. The table recognition method according to claim 1, characterized in that, The determination of whether the cell is a stuck cell includes: Calculate the first overlap rate and the second overlap rate between each text recognition box and the bounding box of the cell in the OCR recognition result; the first overlap rate is the ratio of the intersection area of ​​the text recognition box and the bounding box of the cell to the area of ​​the text recognition box, and the second overlap rate is the ratio of the intersection area to the area of ​​the cell bounding box; If at least one of the text recognition boxes has a second overlap rate with the current cell that is greater than the first threshold, and the text recognition box also has a second overlap rate with at least one other cell to be recognized that is greater than the first threshold, then the current cell is determined to be an adhered cell.

3. The table recognition method according to claim 2, characterized in that, The preset attribution condition is: the first overlap rate between the text recognition box and the bounding box of the cell is greater than the second threshold.

4. The table recognition method according to claim 3, characterized in that, The first threshold is 0.25, and the second threshold is 0.

7.

5. The table recognition method according to claim 1, characterized in that, The method further includes: Before obtaining the OCR recognition result of the table image, the table area in the table image is subjected to perspective transformation based on the preset table reference corner coordinates in the table template, so that the transformed image is aligned with the coordinate system defined by the table template.

6. The table recognition method according to claim 5, characterized in that, The table template is generated in the following way: Obtain a standard image of the table style and perform perspective correction to obtain a standard table image; In the standard table image, the bounding box coordinates of all cells to be identified are marked, and a coordinate mapping file is generated; Create a spreadsheet file with the same logical structure as the table style, wherein the cells to be identified are identified by placeholders; The coordinate mapping file and the spreadsheet file are associated through the placeholders, together forming the spreadsheet template.

7. The table recognition method according to claim 6, characterized in that, The coordinate mapping file is a JSON format file, and the spreadsheet file is an Excel format file.

8. The table recognition method according to claim 1, characterized in that, The method further includes: When a non-adhesive cell contains multiple text recognition boxes, the text content corresponding to the text recognition boxes is concatenated according to their spatial position order in the image.

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 that can be executed by the at least one processor to enable the at least one processor to perform the table recognition method as described in any one of claims 1 to 8.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the table recognition method according to any one of claims 1 to 8.