v0.4.0
PaddleOCR Engine Update for v3.x Compatibility
This release updates the PaddleOCR engine to work with PaddleOCR 3.x (the current version available on PyPI). The PaddleOCR library underwent a major API overhaul between v2 and v3, making the previous engine code non-functional with current installations.
Breaking Changes
- PaddleOCR minimum version: Now requires
paddleocr>=3.0.0andpaddlepaddle>=3.0.0 use_v4_serverconfig deprecated: Useocr_version="PP-OCRv4"instead. Model management is now handled automatically by PaddleOCR.use_gpuconfig deprecated: GPU/CPU device selection is now automatic in PaddleOCR 3.x.- Engine name: All PaddleOCR results now use
"PADDLE_OCR"as the engine name (previously V4 server results used"PADDLE_OCR_SERVER_V4").
New Features
PaddleOCRVersionenum: Choose betweenPP-OCRv3,PP-OCRv4, orPP-OCRv5model versions.- PP-OCRv5 by default: PaddleOCR now auto-selects the latest PP-OCRv5 models for most languages.
- Custom model overrides: Pass
text_detection_model_name,text_recognition_model_name,text_det_limit_side_len, ortext_rec_score_threshin config. - Automatic model downloads: Models are automatically downloaded from HuggingFace and cached locally.
- PaddlePaddle dependency check: Clear error message if
paddlepaddleis not installed.
Fixes
- Replaced deprecated
ocr()call withpredict()API - Replaced
use_angle_clswithuse_textline_orientation - Updated result parsing for new
OCRResultformat (rec_texts,rec_scores,dt_polys) - Disabled unnecessary document preprocessing (orientation classify, unwarping) for perspective image crops
- Suppressed PaddleOCR connectivity check by default for faster initialization
Installation
pip install "panoocr[paddleocr]"This now automatically installs both paddleocr and paddlepaddle.
Migration Guide
# Before (v0.3.x)
engine = PaddleOCREngine(config={
"language_preference": PaddleOCRLanguageCode.CHINESE,
"use_v4_server": True,
"use_gpu": True,
})
# After (v0.4.0)
engine = PaddleOCREngine(config={
"language_preference": PaddleOCRLanguageCode.CHINESE,
"ocr_version": "PP-OCRv4", # or PaddleOCRVersion.PP_OCRV4
})