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.
Model
Accuracy (%)
GPU Inference Time (ms)
[Normal Mode / High Performance Mode]
CPU Inference Time (ms)
[Normal Mode / High Performance Mode]
Model Storage Size (M)
SLANeXt_wireless
69.65
--
--
351M
Note
: The accuracy of SLANeXt_wireless comes from the results of joint testing with SLANeXt_wired.
Installation
PaddlePaddle
Please refer to the following commands to install PaddlePaddle using pip:
# for CUDA11.8
python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
# for CUDA12.6
python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
# for CPU
python -m pip install paddlepaddle==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
You can also integrate the model inference of the table classification module into your project. Before running the following code, please download the sample image to your local machine.
from paddleocr import TableStructureRecognition
model = TableStructureRecognition(model_name="SLANeXt_wireless")
output = model.predict(input="6rfhb-CXOHowonjpBsaUJ.png", batch_size=1)
for res in output:
res.print(json_format=False)
res.save_to_json("./output/res.json")
For details about usage command and descriptions of parameters, please refer to the
Document
.
Pipeline Usage
The ability of a single model is limited. But the pipeline consists of several models can provide more capacity to resolve difficult problems in real-world scenarios.
General Table Recognition V2 Pipeline
The general table recognition V2 pipeline is used to solve table recognition tasks by extracting information from images and outputting it in HTML or Excel format. And there are 8 modules in the pipeline:
If save_path is specified, the visualization results will be saved under
save_path
. The visualization output is shown below:
The command-line method is for quick experience. For project integration, also only a few codes are needed as well:
from paddleocr import TableRecognitionPipelineV2
pipeline = TableRecognitionPipelineV2(
use_doc_orientation_classify=False, # Use use_doc_orientation_classify to enable/disable document orientation classification model
use_doc_unwarping=False, # Use use_doc_unwarping to enable/disable document unwarping module
)
# pipeline = TableRecognitionPipelineV2(use_doc_orientation_classify=True) # Specify whether to use the document orientation classification model with use_doc_orientation_classify# pipeline = TableRecognitionPipelineV2(use_doc_unwarping=True) # Specify whether to use the text image unwarping module with use_doc_unwarping# pipeline = TableRecognitionPipelineV2(device="gpu") # Specify the device to use GPU for model inference
output = pipeline.predict("https://cdn-uploads.huggingface.co/production/uploads/681c1ecd9539bdde5ae1733c/mabagznApI1k9R8qFoTLc.png")
for res in output:
res.print() ## Print the predicted structured output
res.save_to_img("./output/")
res.save_to_xlsx("./output/")
res.save_to_html("./output/")
res.save_to_json("./output/")
For details about usage command and descriptions of parameters, please refer to the
Document
.
PP-StructureV3
Layout analysis is a technique used to extract structured information from document images. PP-StructureV3 includes the following six modules:
Layout Detection Module
General OCR Pipeline
Document Image Preprocessing Pipeline (Optional)
Table Recognition Pipeline (Optional)
Seal Recognition Pipeline (Optional)
Formula Recognition Pipeline (Optional)
Run a single command to quickly experience the PP-StructureV3 pipeline:
Results would be printed to the terminal. If save_path is specified, the results will be saved under
save_path
.
Just a few lines of code can experience the inference of the pipeline. Taking the PP-StructureV3 pipeline as an example:
from paddleocr import PPStructureV3
pipeline = PPStructureV3(
use_doc_orientation_classify=False, # Use use_doc_orientation_classify to enable/disable document orientation classification model
use_doc_unwarping=False, # Use use_doc_unwarping to enable/disable document unwarping module
use_textline_orientation=False, # Use use_textline_orientation to enable/disable textline orientation classification model
device="gpu:0", # Use device to specify GPU for model inference
)
output = pipeline.predict(".mG4tnwfrvECoFMu-S9mxo.png")
for res in output:
res.print() # Print the structured prediction output
res.save_to_json(save_path="output") ## Save the current image's structured result in JSON format
res.save_to_markdown(save_path="output") ## Save the current image's result in Markdown format
For details about usage command and descriptions of parameters, please refer to the
Document
.
SLANeXt_wireless huggingface.co is an AI model on huggingface.co that provides SLANeXt_wireless's model effect (), which can be used instantly with this PaddlePaddle SLANeXt_wireless model. huggingface.co supports a free trial of the SLANeXt_wireless model, and also provides paid use of the SLANeXt_wireless. Support call SLANeXt_wireless model through api, including Node.js, Python, http.
SLANeXt_wireless huggingface.co is an online trial and call api platform, which integrates SLANeXt_wireless's modeling effects, including api services, and provides a free online trial of SLANeXt_wireless, you can try SLANeXt_wireless online for free by clicking the link below.
PaddlePaddle SLANeXt_wireless online free url in huggingface.co:
SLANeXt_wireless is an open source model from GitHub that offers a free installation service, and any user can find SLANeXt_wireless on GitHub to install. At the same time, huggingface.co provides the effect of SLANeXt_wireless install, users can directly use SLANeXt_wireless installed effect in huggingface.co for debugging and trial. It also supports api for free installation.