Instructions to use rizzoaiacademy/rizzo-ocr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PaddleOCR
How to use rizzoaiacademy/rizzo-ocr with PaddleOCR:
# 1. See https://www.paddlepaddle.org.cn/en/install to install paddlepaddle # 2. pip install paddleocr from paddleocr import LayoutDetection model = LayoutDetection(model_name="rizzo-ocr") 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
rizzo-ocr
ONNX models used by the local OCR of Rizzo PII to read scanned documents and photos on the CPU, with ONNX Runtime only (no Paddle, no PyTorch).
This repository hosts the pieces that PaddlePaddle does not publish in ONNX format. Everything
else (PP-OCRv6 detection/recognition, SLANet_plus, PP-DocLayout_plus-L) is downloaded from the
official PaddlePaddle/<model>_onnx repositories.
| Folder | Model | Size | Notes |
|---|---|---|---|
PP-DocLayout-M/ |
PaddlePaddle/PP-DocLayout-M (PicoDet-L, 23 layout classes) | 23 MB | converted with paddle2onnx 2.1.0 from the official inference weights, no fine-tuning, weights unchanged |
Each folder contains inference.onnx (the graph + weights) and inference.yml (the original
PaddleX config: label list and preprocessing).
Usage
In Rizzo PII the models are fetched by
scripts/fetch_ocr_models.py:
python scripts/fetch_ocr_models.py # -> models/ocr/
Standalone:
from huggingface_hub import hf_hub_download
import onnxruntime as ort
path = hf_hub_download("rizzoaiacademy/rizzo-ocr", "inference.onnx", subfolder="PP-DocLayout-M")
sess = ort.InferenceSession(path, providers=["CPUExecutionProvider"])
# inputs: image [1,3,H,W] (RGB, resized to the target size in inference.yml),
# im_shape [1,2], scale_factor [1,2]
# output: [N, 6] -> class_id, score, x1, y1, x2, y2
License
Apache-2.0, same as the original PaddleOCR / PaddleX models. Original model and training by the PaddlePaddle team: https://github.com/PaddlePaddle/PaddleOCR.
Model tree for rizzoaiacademy/rizzo-ocr
Base model
PaddlePaddle/PP-DocLayout-M