The main purpose of text image correction is to carry out geometric transformation on the image to correct the document distortion, inclination, perspective deformation and other problems in the image, so that the subsequent text recognition can be more accurate.
Model
CER
UVDoc
0.179
Note: Test data set: docunet benchmark data set.
Quick Start
Installation
PaddlePaddle
Please refer to the following commands to install PaddlePaddle using pip:
bash
1# for CUDA11.82python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
34# for CUDA12.65python -m pip install paddlepaddle-gpu==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
67# for CPU8python -m pip installpaddlepaddle==3.0.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
You can also integrate the model inference of the TextImageUnwarping module into your project. Before running the following code, please download the sample image to your local machine.
python
1from paddleocr import TextImageUnwarping
23model = TextImageUnwarping(model_name="UVDoc")4output = model.predict("SfMVKd0xnMII5KBDV6Mfz.jpeg", batch_size=1)5for res in output:6 res.print()7 res.save_to_img(save_path="./output/")8 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 scenarios.
PP-StructureV3
Layout analysis is a technique used to extract structured information from document images. PP-StructureV3 includes the following six modules:
You can experience the inference of the pipeline with just a few lines of code. Taking the PP-StructureV3 pipeline as an example:
python
1from paddleocr import PPStructureV3
23pipeline = PPStructureV3(use_doc_unwarping=True)# Use use_doc_unwarping to enable/disable document unwarping module4output = pipeline.predict("./KP10tiSZfAjMuwZUSLtRp.png")5for res in output:6 res.print()## Print the structured prediction output7 res.save_to_json(save_path="output")## Save the current image's structured result in JSON format8 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.