A high-efficiency layout area localization model trained on a self-built dataset using PicoDet-1x, capable of detecting 5-Class english document area, including Text, Title, Table, Figure, and List. The key metrics are as follow:
Model
mAP(0.5) (%)
PicoDet_layout_1x
97.8
Quick Start
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 layout detection module into your project. Before running the following code, please download the sample image to your local machine.
from paddleocr import LayoutDetection
model = LayoutDetection(model_name="PicoDet_layout_1x")
output = model.predict("-oU2IpNLcA0gTMJ34wDBR.png", batch_size=1, layout_nms=True)
for res in output:
res.print()
res.save_to_img(save_path="./output/")
res.save_to_json(save_path="./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 scenJust a few lines of code can experience the inference of the pipelinearios.
PP-TableMagic (table_recognition_v2)
The General Table Recognition v2 pipeline (PP-TableMagic) is designed to tackle table recognition tasks, identifying tables in images and outputting them in HTML format. PP-TableMagic includes the following 8 modules:
You can also integrate the PP-TableMagic pipeline into your project. Before running the following code, please download the sample image to your local machine.
from paddleocr import TableRecognitionPipelineV2
pipeline = TableRecognitionPipelineV2(
layout_detection_model_name=PicoDet_layout_1x,
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
device="gpu:0", # Use device to specify GPU for model inference
)
output = pipeline.predict("-oU2IpNLcA0gTMJ34wDBR.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/")
The default model used in pipeline is
PP-DocLayout-L
, so it is needed that specifing to
PicoDet_layout_1x
by argument
layout_detection_model_name
. And you can also use the local model file by argument
layout_detection_model_dir
. For details about usage command and descriptions of parameters, please refer to the
Document
.
PicoDet_layout_1x huggingface.co is an AI model on huggingface.co that provides PicoDet_layout_1x's model effect (), which can be used instantly with this PaddlePaddle PicoDet_layout_1x model. huggingface.co supports a free trial of the PicoDet_layout_1x model, and also provides paid use of the PicoDet_layout_1x. Support call PicoDet_layout_1x model through api, including Node.js, Python, http.
PicoDet_layout_1x huggingface.co is an online trial and call api platform, which integrates PicoDet_layout_1x's modeling effects, including api services, and provides a free online trial of PicoDet_layout_1x, you can try PicoDet_layout_1x online for free by clicking the link below.
PaddlePaddle PicoDet_layout_1x online free url in huggingface.co:
PicoDet_layout_1x is an open source model from GitHub that offers a free installation service, and any user can find PicoDet_layout_1x on GitHub to install. At the same time, huggingface.co provides the effect of PicoDet_layout_1x install, users can directly use PicoDet_layout_1x installed effect in huggingface.co for debugging and trial. It also supports api for free installation.