Fast OCR models for printed and handwritten Cyrillic text, based on PP-OCRv6
Results on challenging OCR benchmarks featuring distortions, printing defects, and low-quality images.
Russian-language OCR benchmark: ru-ocr-benchmark-hard
Usage
🚀 Recommended for CPU (RapidOCR / ONNX)
🚀 Recommended for GPU (PaddlePaddle)
Installation
pip install rapidocr_onnxruntime huggingface_hub
# For AMD or Intel GPUs: pip install onnxruntime-directml
Full pipeline (Detection + Recognition)
from huggingface_hub import hf_hub_download
from rapidocr_onnxruntime import RapidOCR
# Download the model
model_path = hf_hub_download(repo_id="metrika-labs/PP-OCRv6_medium_rec_cyrillic_onnx", filename="inference.onnx")
keys_path = hf_hub_download(repo_id="metrika-labs/PP-OCRv6_medium_rec_cyrillic_onnx", filename="rec_keys.txt")
# Initialize OCR with standard detection and Cyrillic recognition
ocr = RapidOCR(
rec_model_path=model_path,
rec_keys_path=keys_path,
rec_img_shape=[3, 48, 640],
# For AMD or Intel GPUs: rec_use_dml=True, det_use_dml=True,
)
_orig_resize = ocr.text_rec.resize_norm_img
ocr.text_rec.rec_image_shape = [3, 48, 48]
ocr.text_rec.resize_norm_img = lambda img, r: _orig_resize(img, max(640 / 48, 1.5 * r))
# Recognize the document
results, _ = ocr("document.jpg")
for bbox, text, score in results:
print(f"{text} ({score:.4f})")
Details
PP-OCRv6 is a family of fast, lightweight text recognition models from PaddlePaddle. The models were trained by Metrika Labs on 7.5 million varied examples of printed and handwritten text from real document scans and synthetic images.
80% of the examples are in Russian. The other 20% are in Kazakh, Belarusian, Uzbek, Tajik, Ukrainian, Bulgarian, Serbian, Macedonian, Tatar, Kyrgyz, Mongolian, Bashkir, Ossetian, Chuvash, Chechen, Yakut, Avar, and other languages that use Cyrillic.
The models work with PaddleOCR and are also available in ONNX format for fast CPU inference with RapidOCR.
The current version supports handwritten text only in Russian. It reads clear handwriting well, but may make mistakes with cursive or less legible handwriting.
PP-OCRv6 Medium: Мир меняется быстро (score: 0.9882)
PP-OCRv6 Tiny: Пир меняется быстро (score: 0.8412)
Links
Benchmark for evaluating OCR model quality on Russian text: metrika-labs/ru-ocr-benchmark-hard
Some handwriting examples come from AntiplagiatCompany/HWR200
Original PaddleOCR repository: PaddlePaddle/PaddleOCR
RapidOCR repository: RapidAI/RapidOCR