--- comments: true --- # Table Structure Recognition Module Tutorial ## 1. Overview Table structure recognition is an important component of table recognition systems, capable of converting non-editable table images into editable table formats (such as HTML). The goal of table structure recognition is to identify the positions of rows, columns, and cells in tables. The performance of this module directly affects the accuracy and efficiency of the entire table recognition system. The table structure recognition module usually outputs HTML code for the table area, which is then passed as input to the tabl recognition pipeline for further processing. ## 2. Supported Model List
Model | Model Download Link | Accuracy (%) | GPU Inference Time (ms) [Normal Mode / High Performance Mode] |
CPU Inference Time (ms) [Normal Mode / High Performance Mode] |
Model Storage Size (M) | Description |
---|---|---|---|---|---|---|
SLANet | Inference Model/Training Model | 59.52 | 103.08 / 103.08 | 197.99 / 197.99 | 6.9 M | SLANet is a table structure recognition model independently developed by Baidu PaddlePaddle Vision Team. By adopting a CPU-friendly lightweight backbone network PP-LCNet, high-low level feature fusion module CSP-PAN, and SLA Head, a feature decoding module aligning structure and position information, this model greatly improves the accuracy and inference speed of table structure recognition. |
SLANet_plus | Inference Model/Training Model | 63.69 | 140.29 / 140.29 | 195.39 / 195.39 | 6.9 M | SLANet_plus is an enhanced version of the table structure recognition model SLANet independently developed by the Baidu PaddlePaddle Vision Team. Compared to SLANet, SLANet_plus has greatly improved the recognition ability for wireless and complex tables, and reduced the model's sensitivity to table positioning accuracy. Even if the table positioning is offset, it can still be accurately recognized. |
SLANeXt_wired | Inference Model/Training Model | 69.65 | -- | -- | 351M | The SLANeXt series is a new generation of table structure recognition models independently developed by the Baidu PaddlePaddle Vision Team. Compared to SLANet and SLANet_plus, SLANeXt focuses on table structure recognition, and trains dedicated weights for wired and wireless tables separately. The recognition ability for all types of tables has been significantly improved, especially for wired tables. |
SLANeXt_wireless | Inference Model/Training Model |
Mode | GPU Configuration | CPU Configuration | Acceleration Technology Combination |
---|---|---|---|
Normal Mode | FP32 precision / No TRT acceleration | FP32 precision / 8 threads | PaddleInference |
High Performance Mode | Optimal combination of prior precision type and acceleration strategy | FP32 precision / 8 threads | Selects the prior optimal backend (Paddle/OpenVINO/TRT, etc.) |
Parameter | Description | Parameter Type | Default Value |
---|---|---|---|
input |
Data to be predicted, required.
Local path of image or PDF file, e.g., /root/data/img.jpg ; URL link, e.g., network URL of image or PDF file: Example; Local directory, the directory should contain images to be predicted, e.g., local path: /root/data/ (currently does not support prediction of PDF files in directories; PDF files must be specified with a specific file path).
|
str |
|
save_path |
Specify the path to save the inference results file. If not set, the inference results will not be saved locally. | str |
|
doc_orientation_classify_model_name |
The name of the document orientation classification model. If not set, the default model in pipeline will be used. | str |
|
doc_orientation_classify_model_dir |
The directory path of the document orientation classification model. If not set, the official model will be downloaded. | str |
|
doc_unwarping_model_name |
The name of the text image unwarping model. If not set, the default model in pipeline will be used. | str |
|
doc_unwarping_model_dir |
The directory path of the text image unwarping model. If not set, the official model will be downloaded. | str |
|
layout_detection_model_name |
The name of the layout detection model. If not set, the default model in pipeline will be used. | str |
|
layout_detection_model_dir |
The directory path of the layout detection model. If not set, the official model will be downloaded. | str |
|
seal_text_detection_model_name |
The name of the seal text detection model. If not set, the pipeline's default model will be used. | str |
|
seal_text_detection_model_dir |
The directory path of the seal text detection model. If not set, the official model will be downloaded. | str |
|
text_recognition_model_name |
Name of the text recognition model. If not set, the default pipeline model is used. | str |
|
text_recognition_model_dir |
Directory path of the text recognition model. If not set, the official model is downloaded. | str |
|
text_recognition_batch_size |
Batch size for the text recognition model. If not set, defaults to 1 . |
int |
|
use_doc_orientation_classify |
Whether to load and use document orientation classification. If not set, defaults to pipeline initialization value (True ). |
bool |
|
use_doc_unwarping |
Whether to load and use text image correction. If not set, defaults to pipeline initialization value (True ). |
bool |
|
use_layout_detection |
Whether to load and use the layout detection module. If not set, the parameter will default to the value initialized in the pipeline, which is True . |
bool |
|
layout_threshold |
Threshold for layout detection, used to filter out predictions with low confidence. Such as 0.2, indicates filtering out all bounding boxes with a confidence score less than 0.2. If not set, the default PaddleX official model configuration will be used. | float |
|
layout_nms |
Whether to load and use NMS (Non-Maximum Suppression) post-processing for layout region detection to filter out overlapping boxes. If not set, the default configuration of the official model will be used. | bool |
|
layout_unclip_ratio |
The scaling factor for the side length of the detection boxes in layout region detection. A positive float number, e.g., 1.1, indicating that the center of the bounding box remains unchanged while the width and height are both scaled up by a factor of 1.1. If not set, the default PaddleX official model configuration will be used. | float |
|
layout_merge_bboxes_mode |
The merging mode for the detection boxes output by the model in layout region detection.
|
str |
|
seal_det_limit_side_len |
Image side length limit for seal text detection.
Any integer > 0 . If not set, the default is 736 .
|
int |
|
seal_det_limit_type |
Limit type for image side in seal text detection.
Supports min and max ; min ensures shortest side ≥ det_limit_side_len , max ensures longest side ≤ limit_side_len . If not set, default is min .
|
str |
|
seal_det_thresh |
Pixel threshold. Pixels with scores above this value in the probability map are considered text.
any float > 0 . If not set, default is 0.2 .
|
float |
|
seal_det_box_thresh |
Box threshold. Boxes with average pixel scores above this value are considered text regions.
any float > 0 . If not set, default is 0.6 .
|
float |
|
seal_det_unclip_ratio |
Expansion ratio for seal text detection. Higher value means larger expansion area.
Any float > 0 . If not set, default is 0.5 .
|
float |
|
seal_rec_score_thresh |
Recognition score threshold. Text results above this value will be kept.
Any float > 0 . If not set, default is 0.0 (no threshold).
|
float |
|
device |
The device used for inference. Support for specifying specific card numbers.
|
str |
|
enable_hpi |
Whether to enable high-performance inference. | bool |
False |
use_tensorrt |
Whether to use TensorRT for inference acceleration. | bool |
False |
min_subgraph_size |
The minimum subgraph size, used to optimize the computation of model subgraphs. | int |
3 |
precision |
The computational precision, such as fp32, fp16. | str |
fp32 |
enable_mkldnn |
Whether to enable the MKL-DNN acceleration library. | bool |
True |
cpu_threads |
The number of threads used for inference on the CPU. | int |
8 |
paddlex_config |
Path to PaddleX pipeline configuration file. | str |
', ' | ', '|||
', ' | ', ' | ', ' | ', ' |
', ' | ', ' | ', ' | ', ' |
', ' | ', ' | ', ' | ', ' |
Parameter | Description | Type | Options | Default |
---|---|---|---|---|
doc_orientation_classify_model_name |
Name of the document orientation classification model. If set to None , the pipeline default model is used. |
str |
All model names | None |
doc_orientation_classify_model_dir |
Directory path of the document orientation classification model. If set to None , the official model will be downloaded. |
str |
None |
|
doc_unwarping_model_name |
Name of the document unwarping model. If set to None , the pipeline default model is used. |
str |
None |
|
doc_unwarping_model_dir |
Directory path of the document unwarping model. If set to None , the official model will be downloaded. |
str |
None |
|
layout_detection_model_name |
Name of the layout detection model. If set to None , the pipeline default model is used. |
str |
None |
|
layout_detection_model_dir |
Directory path of the layout detection model. If set to None , the official model will be downloaded. |
str |
None |
|
seal_text_detection_model_name |
Name of the seal text detection model. If set to None , the default model will be used. |
str |
||
seal_text_detection_model_dir |
Directory of the seal text detection model. If set to None , the official model will be downloaded. |
str |
||
text_recognition_model_name |
Name of the text recognition model. If set to None , the pipeline default model is used. |
str |
None |
|
text_recognition_model_dir |
Directory path of the text recognition model. If set to None , the official model will be downloaded. |
str |
None |
|
text_recognition_batch_size |
Batch size for the text recognition model. If set to None , the default batch size is 1 . |
int |
None |
|
use_doc_orientation_classify |
Whether to enable the document orientation classification module. If set to None , the default value is True . |
bool |
None |
|
use_doc_unwarping |
Whether to enable the document image unwarping module. If set to None , the default value is True . |
bool |
None |
|
use_layout_detection |
Whether to load and use the layout detection module. If set to None , the parameter will default to the value initialized in the pipeline, which is True . |
bool |
None |
|
layout_threshold |
Same as the parameter used during initialization. | float|dict |
None |
|
layout_nms |
Same as the parameter used during initialization. | bool |
None |
|
layout_unclip_ratio |
Same as the parameter used during initialization. | float|Tuple[float,float]|dict |
None |
|
layout_merge_bboxes_mode |
Same as the parameter used during initialization. | str|dict |
None |
|
seal_det_limit_side_len |
Image side length limit for seal text detection.
|
int |
None |
|
seal_det_limit_type |
Limit type for seal text detection image side length.
|
str |
None |
|
seal_det_thresh |
Pixel threshold for detection. Pixels with scores greater than this value in the probability map are considered text pixels.
|
float |
None |
|
seal_det_box_thresh |
Bounding box threshold. If the average score of all pixels inside a detection box exceeds this threshold, it is considered a text region.
|
float |
None |
|
seal_det_unclip_ratio |
Expansion ratio for seal text detection. The larger the value, the larger the expanded area.
|
float |
None |
|
seal_rec_score_thresh |
Score threshold for seal text recognition. Text results with scores above this threshold will be retained.
|
float |
None |
|
device |
Device used for inference. Supports specifying device ID.
|
str |
None |
|
enable_hpi |
Whether to enable high-performance inference. | bool |
False |
|
use_tensorrt |
Whether to use TensorRT for accelerated inference. | bool |
False |
|
min_subgraph_size |
Minimum subgraph size used to optimize model subgraph computation. | int |
3 |
|
precision |
Computation precision, e.g., fp32, fp16. | str |
"fp32" |
|
enable_mkldnn |
Whether to enable MKL-DNN acceleration. | bool |
True |
|
cpu_threads |
Number of threads used for inference on CPU. | int |
8 |
|
paddlex_config |
Path to the PaddleX pipeline configuration file. | str |
None |
Parameter | Parameter Description | Parameter Type | Default Value |
---|---|---|---|
input |
Input data to be predicted. Required. Supports multiple types:
|
Python Var|str|list |
|
use_doc_orientation_classify |
Whether to use the document orientation classification module during inference. | bool |
None |
use_doc_unwarping |
Whether to use the text image correction module during inference. | bool |
None |
use_layout_detection |
Whether to use the layout detection module during inference. | bool |
None |
layout_threshold |
Same as the parameter during instantiation. | float|dict |
None |
layout_nms |
Same as the parameter during instantiation. | bool |
None |
layout_unclip_ratio |
Same as the parameter during instantiation. | float|Tuple[float,float]|dict |
None |
layout_merge_bboxes_mode |
Same as the parameter during instantiation. | str|dict |
None |
seal_det_limit_side_len |
Same as the parameter during instantiation. | int |
None |
seal_det_limit_type |
Same as the parameter during instantiation. | str |
None |
seal_det_thresh |
Same as the parameter during instantiation. | float |
None |
seal_det_box_thresh |
Same as the parameter during instantiation. | float |
None |
seal_det_unclip_ratio |
Same as the parameter during instantiation. | float |
None |
seal_rec_score_thresh |
Same as the parameter during instantiation. | float |
None |
Method | Description | Parameter | Type | Parameter Description | Default |
---|---|---|---|---|---|
print() |
Print result to terminal | format_json |
bool |
Whether to format the output content using JSON indentation. |
True |
indent |
int |
Specify the indentation level to beautify the output JSON data for better readability, effective only when format_json is True . |
4 | ||
ensure_ascii |
bool |
Control whether to escape non-ASCII characters to Unicode . When set to True , all non-ASCII characters will be escaped; False will retain the original characters, effective only when format_json is True . |
False |
||
save_to_json() |
Save result as json format file | save_path |
str |
The file path to save the results. When it is a directory, the saved file name will be consistent with the input file type. | None |
indent |
int |
Specify the indentation level to beautify the output JSON data for better readability, effective only when format_json is True . |
4 | ||
ensure_ascii |
bool |
Control whether to escape non-ASCII characters to Unicode . When set to True , all non-ASCII characters will be escaped; False will retain the original characters, effective only when format_json is True . |
False |
||
save_to_img() |
Save results as an image file | save_path |
str |
The file path to save the results, supports directory or file path. | None |
Attribute | Description |
---|---|
json |
Get the prediction result in json format |