Document image table detection method using double-branch hole content convolution module
By introducing a dual-branch hole content convolution module and a residual convolution structure into the Transformer detection framework, the problem of insufficient performance of existing technologies in detecting small-size table layouts is solved, and efficient identification and extraction of table areas in document images is achieved. , applicable to the financial services industry and other fields.
Patent Information
- Application Number
- CN202410708700.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-03
- Publication Date
- 2024-08-23
AI Technical Summary
Existing techniques have shortcomings in performance in detecting special table layouts such as small sizes, and insufficient training data sets, leading to challenges in accurately identifying table areas in document images.
The pre-trained Transformer detection framework is used for fine-tuning, and a dual-branch hole content convolution module and residual convolution structure are introduced, combined with a multi-head attention mechanism and cascade area network, to extract multi-scale features and enhance feature expressiveness for detection. The table area in the document image.
It improves the recognition accuracy and robustness of tables of different sizes and shapes, reduces dependence on manual operations, increases processing speed, and lays the foundation for subsequent table structure parsing tasks. It is suitable for financial services and other fields.
Smart Images

Figure CN118537878A
Abstract
Description
Technical Field
[0001] The present invention belongs to document image analysis in the field of image processing, and its application scenario is mainly to detect different shapes of table area parts of different document images. More specifically, it involves a document image table detection method using a dual-branch void content convolution module. Background Art
[0002] In the wave of digital transformation, document image processing is particularly critical, especially in extracting tabular data from documents. Tables are information-intensive media, and are widely used in many fields such as financial services and office automation with their clear structure. Although tables can efficiently transmit data, they face considerable technical challenges in automatically detecting and identifying these tables. These challenges mainly come from the diversity of the forms of the tables themselves, such as irregular sizes, cross-page layouts, and other complex situations, as well as the need to accurately distinguish tables from other visual elements (such as text boxes that look similar to tables) in text images containing multiple layout elements. Therefore, efficient table data extraction relies heavily on the technology that can accurately identify table areas in the past.
[0003] Table detection is considered a challenging task, and object detection algorithm is one of the key technologies to achieve table detection. Through the application of deep learning, the network is able to parse the table layout in document images more deeply. Convolutional neural networks and Transformer models are common choices for capturing feature information such as geometric morphology of document images for classification or recognition. In order to enhance the generalization performance of the model, self-supervised pre-training technology is gradually being introduced into the field of document image processing.
[0004] Given the presence of complex tables of varying sizes and shapes in document images, coupled with limitations on training data and inconsistencies between training sets and actual application scenarios, the detection framework networks currently used to detect objects in the real world may ignore some table areas of varying sizes when applied to document images. In addition, some networks use simple 3x3 convolutions when fusing multi-scale features, which is insufficient to fully capture effective feature information, and may result in less than ideal prediction accuracy. Therefore, the current existing technologies are still insufficient in terms of the performance of detecting certain small-sized and other special table layouts, and there is a lack of training data sets. Summary of the invention
[0005] In view of the fact that the prior art still has shortcomings in the performance of detecting certain special table layouts such as small sizes, and there is a technical problem of insufficient training data sets, the present invention provides a document image table detection method using a dual-branch void content convolution module.
[0006] The present invention uses a pre-trained Transformer detection framework as a starting point and fine-tunes it to enhance the adaptability of the model to various document image environments. First, the Transformer framework divides the document image into small, non-overlapping segments and assigns position information to each segment. These image segments are then fed into a Transformer encoder stack containing a multi-head attention mechanism to extract multi-scale features. After feature extraction, multi-scale fusion of features is performed. In order to more effectively handle various table sizes and shapes in different document scenarios, the present invention uses a dual-branch hole content convolution module to extract contextual information of high-dimensional features. Then, the attention mechanism enhancement module is used to improve the expressiveness of the features and reduce misleading contextual information. When processing the fusion of features at different scales, the present invention integrates a residual convolution structure rich in network depth information to replace the traditional 3x3 convolution to enrich the feature extraction capability of the network. Finally, the predicted bounding box is output through a cascaded region network, and the final XML file, cropped image, etc. are generated through a post-processing step for use by users or subsequent workflows.
[0007] In general, according to the document image provided by the user, and the document image contains multiple information such as graphics and tables, or contains table areas with different shapes and layouts, this method uses a Transformer architecture with a double-branch hole content convolution module to detect the table area, and outputs the results such as the xml file required by the user. Compared with the prior art, the above technical solution conceived by the present invention has beneficial effects:
[0008] 1) The present invention designs a method for detecting the table area of a document image using a Transformer architecture with a dual-branch hole content convolution module and combines it with pre-training fine-tuning processing. The pre-training fine-tuning method is used to effectively capture basic features to achieve effective detection tasks and enhance the training efficiency and prediction performance of the model. The present invention can automatically identify and extract the table area in the document image, providing convenience for further identification of the table structure and related processing tasks.
[0009] 2) The present invention automatically identifies tables in documents through end-to-end learning, which improves the processing speed while reducing the dependence on manual operations. Combined with the dual-branch void content convolution module to process context information, this method enhances the system's resistance to interference such as columnar graphics and text in documents, and improves the recognition accuracy and robustness of tables of different sizes and shapes. At the same time, accurate table detection lays the foundation for subsequent tasks such as table structure analysis, making this technology have broad application prospects in the fields of financial services, large model data systems, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 The present invention is a workflow diagram for stage prediction;
[0011] Figure 2 This is a diagram of the idea of table detection in document images;
[0012] Figure 3 Detect network framework diagram for the overall table;
[0013] Figure 4 Processing graphs for high-dimensional features;
[0014] Figure 5 It is the feature fusion structure diagram;
[0015] Figure 6 This is a flow chart of the document image table detection method using a dual-branch hole content convolution module of the present invention. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0017] 1. Overall design
[0018] The present invention modifies the existing table detection method and introduces a pre-trained weight fine-tuning and adds a hole content convolution module. The workflow of the method is as follows: Figure 1 As shown, the main working process of the present invention includes:
[0019] Perform preprocessing such as dividing the input image into blocks to improve the detection accuracy of the image in the detection network;
[0020] The preprocessed images and the pre-trained weights required by the backbone network are sent to the Transformer detection network model for detection training of the table area;
[0021] During the training process, a dual-branch dilated content convolution module is used to process high-dimensional features in order to more accurately capture key features such as the shape of the table;
[0022] For multi-scale feature fusion in model training, the residual convolution structure enriches the network's ability to extract fusion of features of different scales;
[0023] Use the trained detection network to perform inference detection on the preprocessed image, obtain the detection result of the model as output, and then post-process and convert it into an XML file for storage.
[0024] (II) Functional design
[0025] 1. Pretreatment process
[0026] The input document image is first randomly cropped and scaled to achieve the purpose of data enhancement. The image is also normalized and standardized. Then the image is divided into non-overlapping image blocks of 16*16 pixels in size, and each image block is added with the corresponding position code to complete the preprocessing process.
[0027] Random cropping: When inputting a document image, there is a 0.5 probability of cropping it into a random rectangular block and a 0.5 probability of not being cropped. The cropped image may or may not contain a table, or may contain part of a table, thereby increasing the robustness of the model to different input conditions;
[0028] Scaling: The purpose of scaling is to adjust the size of the image to meet the requirements of the input data and adapt to the processing needs of different original image sizes;
[0029] Normalization: refers to scaling the image pixel values to a standard range, such as (0, 1);
[0030] Standardization: convert image data to a standard distribution (usually with a mean of 0 and a standard deviation of 1);
[0031] Normalization and standardization help the model better understand and handle different input data.
[0032] 2. Training and testing process
[0033] In order to improve the detection efficiency and the effect of model training, and more accurately identify tables of various sizes and shapes in document images, the present invention uses the pre-trained weight fine-tuning of the loading detection network to capture various document image features. At the same time, a hole content convolution module is added to the high-dimensional features, and multi-scale feature fusion is performed on the features of different scales using the residual convolution structure. When reasoning on the test set, the detection results are obtained into different types such as pictures, XML files, etc. through post-processing and other methods. The idea is as follows Figure 2 .
[0034] Based on this detection idea, the following will introduce the detailed process of the training process and the detection process in the table detection:
[0035] i. Training Process
[0036] In the training stage, the model of the present invention is first trained by inputting an already annotated document image training set (the location area of the table in these images has been clearly marked). Each sample in the training set will have a paired image and the corresponding annotated detection box information for each image. As an embodiment of the present invention, the sample includes an image and the annotated xml information in its image, and the xml information includes the name of the image, the number of annotated tables and the area of the table. At the beginning of training, the pre-trained weights are loaded into the Transformer backbone network for effective feature extraction. For the pre-trained Transformer backbone network, the present invention selects the output of the {3,5,7,11} layers as the feature layer outputs of different scales. The output of the 11th layer is used as a high-dimensional feature. For the high-dimensional feature, it will be further processed by a dual-branch hole content convolution module to capture contextual information, and in order to pay attention to the effectiveness of the contextual information, the obtained contextual feature information will also be passed through an attention module to focus on identifying table features of different sizes and shapes. For feature fusion of different dimensions, a multi-level connected residual convolution layer is used to pay attention to the content of features of different scales. After several training cycles, the training is terminated and the model weights are saved for subsequent testing and prediction.
[0037] ii. Testing process
[0038] The detection process aims to evaluate the accuracy of the model in the task of detecting tables in document images. First, the model is fed with an unlabeled test set to obtain detection outputs. Subsequently, these detection results are evaluated using a variety of evaluation metrics, including average precision (AP) and accuracy at different intersection-over-union (IOU) thresholds. The results show that the techniques used in this paper improve the performance and efficiency of table detection in document images.
[0039] iii. Post-processing
[0040] When users actually use it, they only need to provide the location of the image to be detected, and then the detection results are obtained through the trained model. The post-processing module will convert the detection results into multiple formats according to user needs, such as XML format, or more intuitive cropped table area document images, etc.
[0041] The overall table detection training framework is introduced in the detailed description. This paper proposes to first load the pre-trained weights for fine-tuning training to solve the problem of insufficient training data and improve the effectiveness of detection and the efficiency of model training. Next, the present invention introduces a dual-branch hole content convolution module for processing high-dimensional features, focusing on identifying tables of different sizes and shapes. In addition, by using multiple layers of residual convolution layers to capture and fuse feature information of different scales, the detection capability of the model is further enhanced.
[0042] (III) Detailed description
[0043] The implementation details of the improved table detection network framework based on Transformer are introduced in detail here:
[0044] Vision Transformer is an encoder with a multi-layered multi-head attention mechanism and feedforward network. With the help of the Transformer detection network framework, the pre-trained Transformer backbone network is first loaded as fine-tuning training to assist the table detection task of the present invention. The output of different layers is selected as multi-scale features. When it comes to high-dimensional features, the dual-branch hole content convolution module is applied to focus on different table shapes and other features, and the residual convolution layer is used to capture features at different feature scales. Finally, the cascaded regional convolution network is used to generate the final detection result. The flowchart of this method detection is as follows Figure 3 shown.
[0045] The pre-trained Transformer backbone network uses its powerful feature extraction capabilities to effectively learn low-level features (such as edges) from images, thus laying the foundation for the accurate extraction of different features in document images. These extracted multi-scale features will undergo different processing flows. For high-dimensional features, they will flow through a dual-branch dilated convolution content module, where the upper branch is composed of dense dilated convolution layers to focus on the global shape, and the lower branch is equipped with a large-kernel convolution attention layer to extract different local shapes and sizes. The obtained contextual information is further enhanced through self-attention and cross-attention mechanisms to enhance the representation ability of the features. Features of different scales are fused through multiple layers of residual convolution layers to improve the accuracy of table detection.
[0046] For the processing of high-dimensional features, the dual-branch hole content convolution module will process the feature information simultaneously and in parallel. The upper branch will pass through the 1*1 convolution adjustment channel, and then pass through the hole convolution with different expansion rates in succession and adopt the form of dense connection to pay attention to the global content feature information; the lower branch passes through 1*1 convolution and normalization, and then passes through the large kernel convolution attention including deep hole convolution. The features obtained are added with Drop operation to improve the generalization ability of the model. The lower branch focuses on the local information feature layer and processes high-dimensional features as follows Figure 4 shown.
[0047] The application of dual branches can obtain rich context information, table shape and other feature information. However, in order to better utilize the context, the self-attention mechanism is used to improve the feature expression ability obtained by the dual branches. The calculation formula is:
[0048] Attention=Gate(QK T )V
[0049] In the formula, Attention is the attention matrix, {Q, K, V} are all outputs from the dual-branch hole content convolution module, T represents transposition, Gate is a combination of Sigmoid and pooling functions, and Gate is used to generate the attention matrix:
[0050] Gate=Sigmoid(Pooling(x));
[0051] Sigmoid(x)=1 / (1+e^(-x)),
[0052] Pooling(x)=1 / n*∑x;
[0053] x represents the function variable.
[0054] Since the features of the hole convolution will destroy the positional relationship of the original features to a certain extent and cause certain information misleading, the present invention uses a cross-attention enhancement module to reduce misleading contextual information. Its calculation formula is similar to the self-attention mechanism, but it should be noted that {q, k} is the output of the double-branch hole content convolution module, and {v} is the feature map after the high-dimensional feature is adjusted by the 1*1 convolution channel, so as to help better locate the positional relationship.
[0055] If a simple 3*3 convolution is used to fuse features of different scales, many key feature information will be lost. In order to alleviate this problem, the present invention integrates multiple layers of residual convolution layers to capture and fuse feature information of different scales, thereby improving the detection performance of the network. The structure diagram of feature fusion is shown in the figure. Figure 5 shown.
[0056] Before feature fusion, features of different scales need to be adjusted to a uniform size. The present invention uses interpolation to achieve 2x upsampling, first through a convolution block, and then through a multi-layer residual layer, which is composed of two convolution blocks. After the features pass through the two convolution blocks, they are added with the original features, and the present invention retains the output of the residual layer of each layer for feature combination, so as to keep the rich feature information and finally adjust it to the specified channel dimension through the convolution block. The channel dimension after the fusion of features of different scales is set to 256 channels in the present invention.
[0057] refer to Figure 6 Based on the above analysis and introduction, the document image table detection method using the dual-branch hole content convolution module of the present invention is finally formed. The complete table detection training process is as follows:
[0058] Step 1: Input the preprocessed image into the table detection network, which is a Transformer backbone network;
[0059] Step 1.1: Import the Transformer backbone network pre-trained weights required by the network;
[0060] Step 1.2: Divide the image into non-overlapping image blocks of size 16*16 pixels, perform linear projection, and then flatten the features.
[0061] Step 2.1: The features processed in step 1.2 are output through the pre-trained Transformer backbone network block, and the {3, 5, 7, 11} layers of the Transformer are selected to obtain features C2 to C5 of different scales.
[0062] Step 2.2: The high-dimensional feature C5 obtained in step 2.1 will pass through the dual-branch dilated content convolution module. The upper branch uses densely connected dilated convolutions with different dilation rates (3, 6, 12, 18, 24). The lower branch is normalized and passed through the attention layer with dilated convolution and large kernel convolution and random discard. The dual-branch feature combination obtains the output dual-branch content information.
[0063] Step 2.3: The dual-branch content information output from step 2.2 is sent to the self-attention module, and the high-dimensional feature C5 obtained in step 2.1 is sent to the cross-attention module through a 1*1 convolution channel and the upper branch content information. Finally, the features of the two modules are added together to obtain the final feature P5 output;
[0064] Step 2.4: The features of different scales obtained in steps 2.1 and 2.3 are sent to the feature fusion module, which first unifies the size, then passes through a convolution block consisting of a 3*3 convolution layer, a normalization layer, and a RELU activation function, and then passes through a residual layer consisting of multiple convolutions to obtain the P4-P2 output after multi-scale feature fusion;
[0065] Step 2.5: After the multi-scale feature fusion of steps 2.3 and 2.4, the features P5-P2 are combined and sent to the cascaded regional network to predict the detection frame, so as to complete the training of the detection model using the image in step 1, and then use the detection model to generate the detection result. During the training process, the weight of the model will be adjusted according to the back propagation with the true value, and the training will be re-performed after adjustment until the specified training effect is achieved, such as the weight in the Transformer backbone network, the weight in the dual-branch hole content convolution module, the weight in the self-attention module, the weight in the feature fusion module, etc.
[0066] Step 3: Post-process the detection results, such as generating a corresponding XML file, or restoring the corresponding detection coordinate points back to the original document image, or cropping the original document image to obtain a table image with only the table area, etc.
[0067] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
[0068] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0069] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
[0070] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
[0071] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0072] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A document image table detection method using a dual-branch hole content convolution module, characterized in that: Contains the following: Step 1: Input the preprocessed image into the table detection network, which is a Transformer backbone network; Step 1.1: Import the Transformer backbone network pre-trained weights required by the network; Step 1.2: Divide the image into non-overlapping image blocks and then flatten the features through linear projection; Step 2.1: The features processed in step 1.2 are output through the pre-trained Transformer backbone network block, and the {3, 5, 7, 11} layers of the Transformer are selected to obtain features C2 to C5 of different scales; Step 2.2: The high-dimensional feature C5 obtained in step 2.1 will pass through the dual-branch dilated content convolution module. The upper branch uses densely connected dilated convolutions with different expansion rates. The lower branch is normalized and passed through the attention layer with dilated convolution and large kernel convolution and random discard. The dual-branch feature combination obtains the output dual-branch content information. Step 2.3: The dual-branch content information output from step 2.2 is sent to the self-attention module, and the high-dimensional feature C5 obtained in step 2.1 is sent to the cross-attention module through a 1*1 convolution channel and the upper branch content information. Finally, the features of the two modules are added together to obtain the final feature P5 output; Step 2.4: The features of different scales obtained in steps 2.1 and 2.3 are sent to the feature fusion module, which first unifies the size, then passes through a convolution block consisting of a 3*3 convolution layer, a normalization layer, and a RELU activation function, and then passes through a residual layer consisting of multiple convolutions to obtain the P4 to P2 outputs after multi-scale feature fusion; Step 2.5: After the multi-scale feature fusion of steps 2.3 and 2.4, the features P5-P2 are combined and sent to the cascaded region network to predict the detection box, so as to complete the training of the detection model using the picture in step 1, and then use the detection model to generate the detection result.
2. The document image table detection method using a dual-branch hole content convolution module according to claim 1, characterized in that: Also includes: Step 3: Post-process the detection results to generate the corresponding XML file, or restore the corresponding detection coordinate points back to the original document image, or crop the original document image to obtain a table image with only the table area.
3. The document image table detection method using a dual-branch hole content convolution module according to claim 1, characterized in that: The pre-processing comprises: The input image is first randomly cropped and scaled to achieve the purpose of data augmentation, and the image is also normalized and standardized.
4. The document image table detection method using a dual-branch hole content convolution module according to claim 1, characterized in that: In step 2.2, the different expansion ratios specifically refer to 3, 6, 12, 18 and 24.
5. The document image table detection method using a dual-branch hole content convolution module according to claim 1, characterized in that: In step 1.2, dividing the image into non-overlapping image blocks specifically refers to dividing the image into image blocks of 16*16 pixels.
Citation Information
Patent Citations
Multi-scale target detection method, multi-scale target detection model, electronic equipment and application thereof
CN113420729A
Electronic component X-ray image hole segmentation method based on aggregation convolution and self-attention features
CN115908819A
Method and device for detecting table in power grid construction file, medium and equipment
CN116071773A
Target detection method based on pre-training network and related equipment
CN116597283A
OCR error detection method based on multi-modal information fusion
CN117953524A
Cited By
Three-dimensional modeling method and device for secondary screen cabinet of transformer substation and electronic equipment
CN114444323A
Three-dimensional modeling method, device and electronic equipment for secondary panel cabinet of substation
CN114444323B
Background document layout analysis method based on visual model and graph model
CN119339390A
Antibody-oriented double-branch structure feature prediction method
CN119832992A
