Instructions to use PaddlePaddle/PP-LCNet_x1_0_doc_ori_onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PaddleOCR
How to use PaddlePaddle/PP-LCNet_x1_0_doc_ori_onnx with PaddleOCR:
# 1. See https://www.paddlepaddle.org.cn/en/install to install paddlepaddle # 2. pip install paddleocr from paddleocr import DocImgOrientationClassification model = DocImgOrientationClassification(model_name="PP-LCNet_x1_0_doc_ori_onnx") output = model.predict(input="path/to/image.png", batch_size=1) for res in output: res.print() res.save_to_img(save_path="./output/") res.save_to_json(save_path="./output/res.json") - Notebooks
- Google Colab
- Kaggle
PP-LCNet_x1_0_doc_ori
Introduction
The Document Image Orientation Classification Module is primarily designed to distinguish the orientation of document images and correct them through post-processing. During processes such as document scanning or ID photo capturing, the device might be rotated to achieve clearer images, resulting in images with various orientations. Standard OCR pipelines may not handle these images effectively. By leveraging image classification techniques, the orientation of documents or IDs containing text regions can be pre-determined and adjusted, thereby improving the accuracy of OCR processing. The key accuracy metrics are as follow:
| Model | Recognition Avg Accuracy(%) | Model Storage Size (M) | Introduction |
|---|---|---|---|
| PP-LCNet_x1_0_doc_ori | 99.06 | 7 | A document image classification model based on PP-LCNet_x1_0, with four categories: 0°, 90°, 180°, and 270°. |
Model Usage
Install Dependencies
pip install -U paddleocr
pip install -U onnxruntime-gpu
CLI Usage
paddleocr doc_img_orientation_classification -i ./demo.jpg --model_name PP-LCNet_x1_0_doc_ori --engine onnxruntime
Python API Usage
from paddleocr import DocImgOrientationClassification
model = DocImgOrientationClassification(
model_name="PP-LCNet_x1_0_doc_ori",
engine="onnxruntime",
)
output = model.predict("./demo.jpg", batch_size=1)
for res in output:
res.print()
res.save_to_json(save_path="./output/res.json")
- Downloads last month
- -