主要更新:
#476: 支持PP-OCRv5 PyTorch模型
#489 增加to_json格式
from rapidocr import RapidOCR
engine = RapidOCR()
img_url = "https://img1.baidu.com/it/u=3619974146,1266987475&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=516"
result = engine(img_url, return_word_box=True, return_single_char_box=True)
print(result)
result.vis("vis_result.jpg")
print(result.to_json())
结果示例:
[{'box': [[71.0, 363.0], [419.0, 363.0], [419.0, 382.0], [71.0, 382.0]], 'txt': '曲曲折折的荷塘上面,弥望的是田田的叶', 'score': 0.99052}, {'box': [[71.0, 392.0], [410.0, 392.0], [410.0, 412.0], [71.0, 412.0]], 'txt': '子。叶子出水很高,像亭亭的舞女的裙。', 'score': 0.99123}, {'box': [[185.0, 466.0], [317.0, 466.0], [317.0, 488.0], [185.0, 488.0]], 'txt': '—《荷塘月色》一', 'score': 0.89048}]
#498 修复指定font_path字体文件不生效
#499 集成PP-OCRv5小语种模型,包括Korean / Latin / Eslav
from rapidocr import EngineType, LangDet, LangRec, ModelType, RapidOCR
from rapidocr.utils.typings import OCRVersion
engine = RapidOCR(
params={
"Rec.lang_type": LangRec.ESLAV, # KOREAN / LATIN / ESLAV
"Rec.engine_type": EngineType.ONNXRUNTIME,
"Rec.ocr_version": OCRVersion.PPOCRV5,
}
)
img_path = "tests/test_files/eslav.jpg"
result = engine(img_path, use_det=False, use_cls=False, use_rec=True)
print(result)
result.vis("vis_result.jpg")
🚀 Features
- (openvino) 添加 OpenVINO 配置支持 (#503) by @wanghaichen1 in 36e042b
- (rapidocr) update ppocrv5 minor language config and unit testings by @SWHL in 66e00f4
- (rapidocr) add korean ppocrv5 config and update uniting testing by @SWHL in c50038b
- (rapidocr) support ppocr v5 minor language model(korean / latin / eslav) (#516) by @SWHL in 78b39ca
- (rapidocr) add font_path and lang_type parameter of cli by @SWHL in 4c4bcab
- (rapidocr) add ppocr v5 torch version (#511) by @SWHL in 1797850
- (rapidocr) 添加paddle对ascend npu(910B系列)的支持 (#496) by @narcissus in 1342bb5
- (rapidocr_web) add webp support (#512) by [@nate River](https://github.com/Nate River) in 8406acd
- (rapidocr) support to_json func (fixed issue #489) by @SWHL in 1a94bb1
- (rapidocr) add docker quickstart (#487) by @清尘 in 7df9a98
🐛 Bug Fixes
- (rapidocr) fixed issue #498 by @SWHL in b7bd220
- (rapidocr) merged PR #494 by @SWHL in 0285909
- (rapidocr_web) fixed version num by @SWHL in a1410ea
📚 Documentation
- udpate README by @SWHL in ab20888
- udpate README by @SWHL in 1bca700
- add discord invite link by @SWHL in 57c67c1
- update README by @SWHL in b2e2f2c
- update README by @SWHL in 27ab86f
- update README by @SWHL in cc674c1
- update README by @SWHL in 43919fa
- update Google Colab demo by @SWHL in f354440
- update error links by @SWHL in 4462bb1
🧪 Testing
⚙️ Miscellaneous Tasks
- (rapidocr) optim config code of openvino by @SWHL in ba9ad22
- (rapidocr_web) fixed python version by @SWHL in ac144f1
- update files (#513) by @SWHL in c46d012
- update demo code by @SWHL in 860adea
🎉 Contributors
Full Changelog: 3.3.0