PP-OCRv6_small_rec_pl-husarz - fixing Polish diacritic recognition in OCR
2 min read
A text recognition model for OCR (optical character recognition) of Polish documents, created as a fine-tuned version of the official PaddlePaddle/PP-OCRv6_small_rec model and exported to the ONNX format. The base version often dropped Polish letters with diacritics (such as ą, ł, ę, ź), replacing them with base Latin characters. The new version solves this problem while fully preserving format, input data, and dictionary compatibility, making it easy to swap weights in existing applications without changing code (for example, in RapidOCR).
Key features
- Diacritic accuracy: Fixed the loss of Polish characters on clean printed text and document photographs.
- Full compatibility: Same input and output format with a built-in dictionary of 18,708 characters in the ONNX metadata.
- ONNX format: FP32 weights without quantization, ready for fast inference via ONNX Runtime.
- Easy deployment: Replaces only the line recognizer (`rec`), leaving the detection and classification blocks (`det` and `cls`) unchanged.
What you can do
- Integration into RapidOCR: Drop the model into a Python document processing pipeline to accurately read Polish text.
- Photo recognition: Process snapshots of Polish documents, forms, and printed materials with high accuracy.
- Archive automation: Set up batch scanning and digitization of paper documents in Polish.
- CPU pipelines: Run efficient OCR on standard processors without requiring powerful GPUs.
Example
from huggingface_hub import hf_hub_download
from rapidocr import EngineType, ModelType, OCRVersion, RapidOCR
rec_path = hf_hub_download("przemyslvwm/PP-OCRv6_small_rec_pl-husarz", "PP-OCRv6_rec_small_pl-v2.onnx")
engine = RapidOCR(params={
"Det.engine_type": EngineType.ONNXRUNTIME, "Det.lang_type": "pl",
"Det.model_type": ModelType("small"), "Det.ocr_version": OCRVersion("PP-OCRv6"),
"Rec.engine_type": EngineType.ONNXRUNTIME, "Rec.lang_type": "pl",
"Rec.model_type": ModelType("small"), "Rec.ocr_version": OCRVersion("PP-OCRv6"),
"Rec.model_path": rec_path,
})
result = engine("strona.jpg")
print("\n".join(result.txts or ()))Read more
Details• Benchmarks: Achieves 95.8% word recognition for Polish letters on real photos (compared to 75.2% for the base model) and reduces CER to 0.69% on synthetic lines.
• Hardware: Trained in about 20 minutes on a single RTX 5090 GPU; works great on CPU with ONNX Runtime.
• Training: Full fine-tune on 40k synthetic lines (fonts, distortions, grayscale levels, angles) using the SJP dictionary.
• Limitations: Not tested on handwritten text; does not include the Polish opening quotation mark („) in the dictionary.
• License: Apache-2.0.










Comments