Table extraction method, device, computer equipment and storage medium

By performing feature extraction and prediction processing on the image, combined with boundary erasing and cropping techniques, the problem of inaccurate table and table line extraction in the prior art is solved, and a more accurate and efficient table extraction effect is achieved.

CN113989820BActive Publication Date: 2025-04-18SHENZHEN QIANHAI HUANRONG LIANYI INFORMATION TECHNOLOGY SERVICES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111294836.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-03
Publication Date
2025-04-18
Estimated Expiration
2041-11-03

AI Technical Summary

Technical Problem

The existing wired table extraction method has inaccurate problems in the extraction process of tables and table lines, resulting in the incorrect merge of cells.

Method used

By performing maximum pooling and upsampling on the original image, a feature map is obtained, and tabular prediction and boundary prediction are performed, the boundary threshold is obtained for erasing, and after cropping the image, horizontal and vertical lines are extracted, and finally the extraction results are superimposed in the channel direction and tabularized.

Benefits of technology

It improves the accuracy and effect of table extraction, avoids the problems of missegment of adjacent tables and inaccurate table line extraction, and can extract Excel tables more clearly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113989820B_ABST
    Figure CN113989820B_ABST
Patent Text Reader

Abstract

The present invention discloses a table extraction method, device, computer equipment and storage medium. The method includes performing maximum pooling and upsampling processing on the original image to obtain a first feature map; performing table prediction processing and boundary prediction processing on the first feature map to obtain a table prediction map and a boundary prediction map respectively; obtaining a boundary threshold in the boundary prediction map, erasing the table prediction map according to the boundary threshold to obtain a first output image; mapping the first output image to the original image and cropping to obtain a cropped image; performing maximum pooling and upsampling processing on the cropped image to obtain a second feature map; performing horizontal line extraction processing and vertical line extraction processing on the second feature map to obtain a horizontal line prediction map and a vertical line prediction map respectively; superimposing the horizontal line prediction map and the vertical line prediction map in the channel direction to obtain a second output image, and tabulating the second output image to obtain an Excel table. The present invention has the advantage of improving the table extraction effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing, and in particular to a table extraction method, device, computer equipment and storage medium. Background Art

[0002] In order to manage data in an orderly manner, the application scenarios of wired tables are becoming more and more extensive and complex. In practical applications, it is often necessary to extract tables from images, but there are often situations where multiple tables are adjacent to each other or text appears between tables.

[0003] In view of the above situation, the existing technology adopts a wired table extraction method based on segmentation tasks to extract the table and table lines by segmenting them. However, this method is prone to adjacent tables being segmented into one table, and inaccurate table line extraction leading to incorrect cell merging. Summary of the invention

[0004] The purpose of the present invention is to provide a table extraction method, device, computer equipment and storage medium, aiming to solve the problem of inaccurate extraction of tables and table lines in existing wired table extraction methods.

[0005] In order to solve the above technical problems, the object of the present invention is to achieve the following technical solutions: provide a table extraction method, which comprises:

[0006] Perform maximum pooling and upsampling processing on the original image to obtain a first feature map;

[0007] Performing table prediction processing and boundary prediction processing on the first feature map to obtain a table prediction probability map and a boundary prediction probability map respectively;

[0008] Obtaining a boundary threshold in the boundary prediction probability map, and performing an erasing process on the table prediction probability map according to the boundary threshold to obtain a first output image;

[0009] Mapping the first output image to the original image and cropping it to obtain a cropped image;

[0010] Performing maximum pooling and upsampling processing on the cropped image to obtain a second feature map;

[0011] Performing a horizontal line extraction process and a vertical line extraction process on the second feature map to obtain a horizontal line prediction map and a vertical line prediction map respectively;

[0012] The horizontal line prediction image and the vertical line prediction image are superimposed in the channel direction to obtain a second output image, and the second output image is tabulated to obtain an Excel table.

[0013] In addition, the technical problem to be solved by the present invention is to provide a table extraction device, which includes:

[0014] A first preprocessing unit, used to perform maximum pooling and upsampling processing on the original image to obtain a first feature map;

[0015] A first prediction unit, configured to perform table prediction processing and boundary prediction processing on the first feature map to obtain a table prediction probability map and a boundary prediction probability map, respectively;

[0016] an erasing unit, configured to obtain a boundary threshold in the boundary prediction probability map, and perform an erasing process on the table prediction probability map according to the boundary threshold to obtain a first output image;

[0017] A cropping unit, used for mapping the first output image to the original image and cropping the image to obtain a cropped image;

[0018] A second preprocessing unit, configured to perform maximum pooling and upsampling processing on the cropped image to obtain a second feature map;

[0019] A second prediction unit is used to perform a horizontal line extraction process and a vertical line extraction process on the second feature map to obtain a horizontal line prediction map and a vertical line prediction map respectively;

[0020] The output unit is used to superimpose the horizontal line prediction image and the vertical line prediction image in the channel direction to obtain a second output image, and to tabulate the second output image to obtain an Excel table.

[0021] In addition, an embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the table extraction method described in the first aspect when executing the computer program.

[0022] In addition, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the table extraction method described in the first aspect above.

[0023] The embodiment of the present invention discloses a table extraction method, device, computer equipment and storage medium. The method includes performing maximum pooling and upsampling processing on the original image to obtain a first feature map; performing table prediction processing and boundary prediction processing on the first feature map to obtain a table prediction probability map and a boundary prediction probability map respectively; obtaining a boundary threshold in the boundary prediction probability map, erasing the table prediction probability map according to the boundary threshold to obtain a first output image; mapping the first output image to the original image and cropping to obtain a cropped image; performing maximum pooling and upsampling processing on the cropped image to obtain a second feature map; performing horizontal line extraction processing and vertical line extraction processing on the second feature map to obtain a horizontal line prediction map and a vertical line prediction map respectively; superimposing the horizontal line prediction map and the vertical line prediction map according to the channel direction to obtain a second output image, and tabulating the second output image to obtain an Excel table. The embodiment of the present invention has the advantage of improving the table extraction effect. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0025] Figure 1 A schematic diagram of a flow chart of a table extraction method provided in an embodiment of the present invention;

[0026] Figure 2 A schematic diagram of a sub-process of a table extraction method provided in an embodiment of the present invention;

[0027] Figure 3 A schematic diagram of another sub-process of the table extraction method provided in an embodiment of the present invention;

[0028] Figure 4 A schematic diagram of another sub-process of the table extraction method provided in an embodiment of the present invention;

[0029] Figure 5 A schematic block diagram of a table segmentation network provided by an embodiment of the present invention;

[0030] Figure 6 A schematic block diagram of a table line segmentation network provided in an embodiment of the present invention;

[0031] Figure 7 A schematic block diagram of a table extraction device provided in an embodiment of the present invention;

[0032] Figure 8 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

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

[0034] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0035] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0036] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0037] See also Figure 1 , Figure 1 A schematic diagram of a flow chart of a table extraction method provided in an embodiment of the present invention;

[0038] Combination Figure 1 , Figure 5 and Figure 6 As shown, the method includes steps S101 to S107.

[0039] S101, performing maximum pooling and upsampling processing on the original image to obtain a first feature map;

[0040] In this step, the original image of 3×H×W is input into the table segmentation network, and the encoder-decoder in the table segmentation network performs maximum pooling and upsampling respectively to obtain a first feature map of 64×H×W, where H represents the image height and W represents the image width.

[0041] S102, performing table prediction processing and boundary prediction processing on the first feature map to obtain a table prediction probability map and a boundary prediction probability map respectively;

[0042] S103, obtaining a boundary threshold in the boundary prediction probability map, and performing an erasing process on the table prediction probability map according to the boundary threshold to obtain a first output image;

[0043] In steps S102-S103, the first feature map is subjected to table prediction processing and boundary prediction processing respectively by the boundary erasing module, and a table prediction probability map and a boundary prediction probability map are obtained respectively. In the boundary erasing module, two prediction paths are set, one path is used to predict the table position in the first feature map, and the boundaries of adjacent tables with a short distance predicted by the path may be connected, so the boundary of the table is predicted by another path and a boundary threshold is obtained, and the table prediction probability map is erased by the boundary threshold so that adjacent tables are clearly segmented, thereby obtaining a first output image with a good table extraction effect.

[0044] In steps S101-S103, a table segmentation network is used for processing. The table segmentation network in this embodiment is composed of an encoder-decoder module and a boundary erasure module. Different from the ordinary encoder-decoder table segmentation network, the table segmentation network proposed in this embodiment adds a boundary erasure module on the basis of the encoder-decoder module, which can detect the boundaries of the table more clearly, so that even in complex scenarios where tables are adjacent and table texts are adjacent, a stronger segmentation result can be obtained.

[0045] S104, mapping the first output image to the original image and cropping it to obtain a cropped image;

[0046] S105, performing maximum pooling and upsampling processing on the cropped image to obtain a second feature map;

[0047] In this step, the 3×H×W cropped image is input into the table line segmentation network, and the encoder-decoder in the table line segmentation network performs maximum pooling and upsampling respectively to obtain a second feature map of 64×H×W.

[0048] S106, performing horizontal line extraction processing and vertical line extraction processing on the second feature map to obtain a horizontal line prediction map and a vertical line prediction map respectively;

[0049] S107 , superimposing the horizontal line prediction image and the vertical line prediction image in the channel direction to obtain a second output image, and tabulating the second output image to obtain an Excel table.

[0050] In steps S106-S107, the horizontal lines in the second feature map are extracted by the horizontal line perception module to obtain a horizontal line prediction map, and the vertical lines in the second feature map are extracted by the vertical line perception module to obtain a vertical line prediction map; the obtained horizontal line prediction map and vertical line prediction map are then superimposed in the channel direction to obtain a second output image with better table line extraction effect, and finally the second output image is tabulated to obtain an Excel table.

[0051] In steps S105-S107, a table line segmentation network is used for processing. The table line segmentation network in this embodiment is composed of an encoder-decoder module, a horizontal line perception module and a vertical line perception module. Different from the ordinary encoder-decoder table line segmentation network, the table line segmentation network proposed in this embodiment adds a horizontal line perception module and a vertical line perception module. The two modules use different convolution kernels for horizontal lines and vertical lines, respectively, thereby improving the network's perception ability of horizontal and vertical lines to produce better table line segmentation results.

[0052] In one embodiment, if Figure 2 As shown, step S102 is further introduced, including:

[0053] S201, using a table judgment path to perform two convolution operations and one sigmoid function activation operation on the first feature map, to obtain a table prediction probability map with values ​​normalized to 0 to 1, wherein the size of the value in the table prediction probability map represents the probability that the position of the value is in the table area, and the convolution kernel of the two convolution operations has a zero padding of 1, a step size of 1, and a size of 3×3;

[0054] S202, using the boundary judgment path to perform two convolution operations and one sigmoid function operation on the first feature map, to obtain a boundary prediction probability map whose values ​​are normalized to 0 to 1, wherein the magnitude of the value in the boundary prediction probability map indicates the probability that the position of the value is the boundary of the table, and the zero padding of the convolution kernel of the two convolution operations is 1, the step length is 1, and the size is 3×3;

[0055] In this embodiment, a table judgment path is used to perform two convolution operations and one sigmoid function activation operation on the first feature map. During pre-training, label values ​​0 and 1 are assigned to the table judgment path, 1 represents that the pixel is a table, and 0 represents that the pixel is not a table. During prediction, after two convolution operations and one sigmoid function activation operation, a table prediction probability map with values ​​normalized to 0 to 1 is obtained. In the obtained table prediction probability map, values ​​very close to 1 and values ​​very close to 0 will be presented. The position where the value close to 1 is located is predicted to be a table. The specific value is also used to represent the probability that the position of the value is a table. Therefore, the larger the value, the greater the probability that the position where the value is located is a table.

[0056] In addition, the boundary judgment path is used to perform two convolution operations and one sigmoid function activation operation on the first feature map. During pre-training, a threshold between 0 and 1 is assigned to the boundary judgment path. In the predicted boundary prediction probability map, the size of the numerical value presented indicates that the numerical position is the threshold (i.e., probability) of the table boundary, and the threshold of the actual table boundary is usually higher. Therefore, the position with a higher threshold can be confirmed as the table boundary, and the boundary threshold of the table boundary is obtained.

[0057] Based on the judgment of these two paths, in the table prediction probability map, the position with a higher value is the table, so the value in the center area of ​​the table will be higher than the value in the edge area of ​​the table. In this case, by erasing the table prediction probability map using the boundary threshold, the accurate table position can be extracted, which can avoid the situation where adjacent tables are predicted as one table.

[0058] Specifically, the erasing formula for erasing the table prediction probability map is:

[0059] ;

[0060] Among them, e is a constant, and its value can be 2.71828, P is the table prediction probability map, B is the boundary prediction probability map, and k is the amplification factor, and its value can be 50.

[0061] e, P, B, and k are input into the above formula to perform calculations and output a first output image having a good table extraction effect.

[0062] In one embodiment, if Figure 3 As shown, step S104 is further introduced, including:

[0063] S301, performing a binarization operation on the first output image;

[0064] S302, finding the outline of each table according to the binary value in the first output image, and obtaining the minimum circumscribed rectangle of each outline;

[0065] S303: Taking the minimum bounding rectangle as the table area, and cropping the image of the table area from the original image as a cropped image.

[0066] In this embodiment, the first output image is binarized, the binarization threshold may be 0.5, the values ​​of the area predicted as the table are all 1, and the values ​​of other areas are all 0; then the opencv package is used to find the outline of each table according to these values, and the minimum bounding rectangle of each outline is obtained. At this time, the minimum bounding rectangle can be used as the area of ​​the table, and the area is mapped to the original image and cropped from the original image to obtain a cropped image.

[0067] In one embodiment, step S106 is further introduced, including:

[0068] Perform two convolution operations on the second feature map to obtain a horizontal line feature map, where the convolution kernel of the two convolution operations has a zero padding of [3,1], a step size of 1, and a size of 7×3;

[0069] The sigmoid function is activated on the horizontal line feature map to obtain a horizontal line prediction map with values ​​normalized to 0 to 1.

[0070] In this embodiment, the second feature map is input into the horizontal line perception module, and a convolution operation is performed first through a convolution kernel with zero padding of [3,1], step size of 1, and size of 7×3 to obtain a feature map of size 16×H×W, and then a convolution operation is performed through a convolution kernel with zero padding of [3,1], step size of 1, and size of 7×3 to obtain a feature map of size 1×H×W. The network's perception of horizontal lines is improved by two convolution kernels of size 7×3. Finally, a sigmoid activation layer is used to normalize the values ​​in the map to between 0 and 1, and a horizontal line prediction map is obtained.

[0071] In one embodiment, step S106 is further described to further include:

[0072] Perform two convolution operations on the second feature map to obtain a vertical line feature map, where the convolution kernel of the two convolution operations has a zero padding of [1,3], a step size of 1, and a size of 3×7;

[0073] The sigmoid function is activated on the vertical line feature map to obtain a vertical line prediction map with values ​​normalized to 0 to 1.

[0074] In this embodiment, the second feature map is input into the vertical line perception module, and a convolution operation is performed first through a convolution kernel with zero padding of [1,3], step size of 1, and size of 3×7 to obtain a feature map of size 16×H×W, and then a convolution operation is performed through a convolution kernel with zero padding of [1,3], step size of 1, and size of 3×7 to obtain a feature map of 1×H×W. The two sizes of 3×7 improve the network's perception of vertical lines. Finally, a sigmoid activation layer is used to normalize the values ​​in the image to between 0 and 1 to obtain a vertical line prediction map.

[0075] In one embodiment, if Figure 4 As shown, S107 includes:

[0076] S401, superimposing the horizontal line prediction image and the vertical line prediction image to obtain a second output image, and obtaining a set of intersection points of the horizontal lines and the vertical lines according to the second output image;

[0077] In this step, the horizontal line prediction map and the vertical line prediction map are superimposed in the channel direction to obtain a second output image with a final size of 2×H×W, and all intersections between the horizontal lines and the vertical lines in the second output image are obtained to obtain an intersection set.

[0078] S402, taking the upper leftmost intersection point as the starting point, calculating the four intersection points constituting all the smallest cells in the intersection point set;

[0079] In this step, take the upper left intersection as the starting point, calculate the two intersections in the intersection set that are closest to the starting point in the horizontal and vertical directions, and the four intersection coordinates of the first cell can be obtained from the coordinates of these two points. Select the next intersection and use it as the new starting point to obtain the four intersection coordinates of the next cell. Based on this, the intersection coordinates of all minimum cells can be calculated and obtained in sequence.

[0080] S403, taking the coordinates of the upper leftmost intersection as the origin, and calculating the relative coordinates of the four intersections of all the smallest cells relative to the origin according to the distance between two adjacent horizontal lines in the horizontal line and the distance between two adjacent vertical lines in the vertical line;

[0081] In steps S402-S403, the coordinates of the upper left intersection are taken as the origin and recorded as (0,0). The distance between two adjacent horizontal lines in the horizontal line is the horizontal coordinate distance between two adjacent intersections in the horizontal direction. Based on this, the relative coordinates of the adjacent intersections of the origin (0,0) in the horizontal direction relative to the origin can be calculated; similarly, the distance between two adjacent vertical lines in the vertical line is the vertical coordinate distance between two adjacent intersections in the vertical direction. Based on this, the relative coordinates of the adjacent intersections of the origin (0,0) in the vertical direction relative to the origin can be calculated; it can be understood that by calculating the distances between the intersections, the relative coordinates of all intersections relative to the origin (0,0) can be obtained in the end.

[0082] S404. The relative coordinates of all intersections are converted by using the openpyxl package to obtain an Excel table.

[0083] This embodiment adopts a horizontal line perception module and a vertical line perception module, which improves the segmentation performance of horizontal and vertical lines and thus improves the effect of table extraction.

[0084] The embodiment of the present invention further provides a table extraction device, which is used to execute any embodiment of the above table extraction method. Figure 7 , Figure 7 It is a schematic block diagram of a table extraction device provided by an embodiment of the present invention.

[0085] like Figure 7As shown, the table extraction device 700 includes: a first preprocessing unit 701, a first prediction unit 702, an erasing unit 703, a cropping unit 704, a second preprocessing unit 705, a second prediction unit 706 and an output unit 707.

[0086] A first preprocessing unit 701 is used to perform maximum pooling and upsampling processing on the original image to obtain a first feature map;

[0087] A first prediction unit 702 is used to perform table prediction processing and boundary prediction processing on the first feature map to obtain a table prediction probability map and a boundary prediction probability map respectively;

[0088] An erasing unit 703 is used to obtain a boundary threshold in the boundary prediction probability map, and perform an erasing process on the table prediction probability map according to the boundary threshold to obtain a first output image;

[0089] A cropping unit 704, configured to map the first output image to the original image and crop it to obtain a cropped image;

[0090] A second preprocessing unit 705 is used to perform maximum pooling and upsampling processing on the cropped image to obtain a second feature map;

[0091] The second prediction unit 706 is used to perform horizontal line extraction processing and vertical line extraction processing on the second feature map to obtain a horizontal line prediction map and a vertical line prediction map respectively;

[0092] The output unit 707 is used to perform superposition processing on the horizontal line prediction image and the vertical line prediction image in the channel direction to obtain a second output image, and perform tabular processing on the second output image to obtain an Excel table.

[0093] The device uses a boundary erasing module to make the boundary more obvious, so that the performance of table segmentation is better, thereby improving the effect of table extraction. At the same time, when segmenting the table lines, a horizontal line perception module and a vertical line perception module are used to improve the segmentation performance of the horizontal and vertical lines of the table, thereby further improving the effect of table extraction.

[0094] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0095] The above table extraction device can be implemented in the form of a computer program. The computer program can be used in Figure 8 Runs on the computer device shown.

[0096] See also Figure 8 , Figure 8800 is a schematic block diagram of a computer device provided by an embodiment of the present invention. The computer device 800 is a server, which can be an independent server or a server cluster composed of multiple servers.

[0097] See also Figure 8 The computer device 800 includes a processor 802 , a memory and a network interface 805 connected via a system bus 801 , wherein the memory may include a non-volatile storage medium 803 and an internal memory 804 .

[0098] The non-volatile storage medium 803 may store an operating system 8031 ​​and a computer program 8032. When the computer program 8032 is executed, the processor 802 may execute a table extraction method.

[0099] The processor 802 is used to provide computing and control capabilities and support the operation of the entire computer device 800.

[0100] The internal memory 804 provides an environment for the operation of the computer program 8032 in the non-volatile storage medium 803. When the computer program 8032 is executed by the processor 802, the processor 802 can execute the table extraction method.

[0101] The network interface 805 is used for network communication, such as providing data information transmission, etc. Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device 800 to which the solution of the present invention is applied. The specific computer device 800 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0102] Those skilled in the art will understand that Figure 8 The embodiments of the computer device shown in the figure do not constitute a limitation on the specific composition of the computer device. In other embodiments, the computer device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, in some embodiments, the computer device may only include a memory and a processor. In such embodiments, the structure and function of the memory and the processor are the same as those of the embodiment of the present invention. Figure 8 The embodiments shown are consistent and will not be described again here.

[0103] It should be understood that in the embodiment of the present invention, the processor 802 may be a central processing unit (CPU), and the processor 802 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0104] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the table extraction method of the embodiment of the present invention is implemented.

[0105] The storage medium is a physical, non-transient storage medium, for example, it can be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, etc., which can store program codes.

[0106] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0107] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A table extraction method, characterized in that: include: Perform maximum pooling and upsampling processing on the original image to obtain a first feature map; Performing table prediction processing and boundary prediction processing on the first feature map to obtain a table prediction probability map and a boundary prediction probability map respectively; Obtaining a boundary threshold in the boundary prediction probability map, and performing an erasing process on the table prediction probability map according to the boundary threshold to obtain a first output image; Mapping the first output image to the original image and cropping it to obtain a cropped image; Performing maximum pooling and upsampling processing on the cropped image to obtain a second feature map; Performing a horizontal line extraction process and a vertical line extraction process on the second feature map to obtain a horizontal line prediction map and a vertical line prediction map respectively; The horizontal line prediction image and the vertical line prediction image are superimposed in the channel direction to obtain a second output image, and the second output image is tabulated to obtain an Excel table; Among them, the erasing formula for erasing the table prediction probability map is: ; Among them, Output represents the first output image, e is a constant, P is the table prediction probability map, B is the boundary prediction probability map, and k is the magnification coefficient.

2. The table extraction method according to claim 1, characterized in that: The performing table prediction processing and boundary prediction processing on the first feature map to obtain a table prediction probability map and a table boundary prediction probability map includes: Perform two convolution operations and one sigmoid function activation operation on the first feature map using a table judgment path to obtain a table probability prediction map with values ​​normalized to 0 to 1, wherein the size of the value in the table probability prediction map represents the probability that the value position is in the table area, and the convolution kernel of the two convolution operations has a zero padding of 1, a step size of 1, and a size of 3×3; The first feature map is subjected to two convolution operations and one sigmoid function operation using a boundary judgment path to obtain a boundary probability prediction map whose values ​​are normalized to 0 to 1, wherein the size of the values ​​in the boundary probability prediction map represents the probability that the position of the value is the boundary of the table, and the convolution kernels of the two convolution operations have zero padding of 1, a step size of 1, and a size of 3×3.

3. The table extraction method according to claim 1, characterized in that: Mapping the first output image to the original image and cropping it to obtain a cropped image; performing a binarization operation on the first output image; Find the outline of each table according to the binary values ​​in the first output image, and obtain the minimum circumscribed rectangle of each outline; The minimum circumscribed rectangle is used as a table area, and an image of the table area is cropped from the original image as a cropped image.

4. The table extraction method according to claim 1, characterized in that: The performing horizontal line extraction processing and vertical line extraction processing on the second feature map to obtain a horizontal line prediction map and a vertical line prediction map includes: Perform two convolution operations on the second feature map to obtain a horizontal line feature map, wherein the convolution kernels of the two convolution operations have zero padding of [3, 1], a step size of 1, and a size of 7×3; A sigmoid function activation operation is performed on the horizontal line feature map to obtain a horizontal line prediction map with values ​​normalized to 0 to 1.

5. The table extraction method according to claim 1, characterized in that: The performing of horizontal line extraction processing and vertical line extraction processing on the second feature map to obtain a horizontal line prediction map and a vertical line prediction map also includes: Perform two convolution operations on the second feature map to obtain a vertical line feature map, wherein the convolution kernels of the two convolution operations have zero padding of [1,3], a step size of 1, and a size of 3×7; A sigmoid function activation operation is performed on the vertical line feature map to obtain a vertical line prediction map with a value normalized to 0 to 1.

6. The table extraction method according to claim 1, characterized in that: The step of superimposing the horizontal line prediction image and the vertical line prediction image to obtain a second output image, and tabulating the second output image to obtain an Excel table includes: Superimposing the horizontal line prediction image and the vertical line prediction image to obtain a second output image, and obtaining a set of intersection points of the horizontal lines and the vertical lines according to the second output image; Taking the upper leftmost intersection point as the starting point, calculate the four intersection points constituting all the smallest cells in the intersection point set; Taking the coordinates of the upper leftmost intersection as the origin, the relative coordinates of the four intersections of all the smallest cells relative to the origin are calculated according to the distance between two adjacent horizontal lines in the horizontal line and the distance between two adjacent vertical lines in the vertical line; The relative coordinates of all intersections are transformed through the openpyxl package to obtain an Excel table.

7. A table extraction device, characterized in that: include: A first preprocessing unit, used to perform maximum pooling and upsampling processing on the original image to obtain a first feature map; A first prediction unit, configured to perform table prediction processing and boundary prediction processing on the first feature map to obtain a table prediction probability map and a boundary prediction probability map, respectively; an erasing unit, configured to obtain a boundary threshold in the boundary prediction probability map, and perform an erasing process on the table prediction probability map according to the boundary threshold to obtain a first output image; A cropping unit, used for mapping the first output image to the original image and cropping the image to obtain a cropped image; A second preprocessing unit, configured to perform maximum pooling and upsampling processing on the cropped image to obtain a second feature map; A second prediction unit is used to perform a horizontal line extraction process and a vertical line extraction process on the second feature map to obtain a horizontal line prediction map and a vertical line prediction map respectively; An output unit, used for superimposing the horizontal line prediction image and the vertical line prediction image in a channel direction to obtain a second output image, and tabulating the second output image to obtain an Excel table; Among them, the erasing formula for erasing the table prediction probability map is: ; Among them, Output represents the first output image, e is a constant, P is the table prediction probability map, B is the boundary prediction probability map, and k is the magnification coefficient.

8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the table extraction method according to any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the table extraction method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Table extraction method and device, electronic equipment and readable storage medium

    CN112766073A

  • Table reconstruction method and device based on semantic segmentation, equipment and storage medium

    CN113052181A