2. 本地安装
请参考安装指南完成PaddlePaddle 3.0的安装,然后安装paddleocr。
# 安装 paddleocr pip install paddleocr==3.0.0
3. 命令行方式推理
# 运行 PP-OCRv5 推理 paddleocr ocr -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png --use_doc_orientation_classify False --use_doc_unwarping False --use_textline_orientation False # 运行 PP-StructureV3 推理 paddleocr pp_structurev3 -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/pp_structure_v3_demo.png --use_doc_orientation_classify False --use_doc_unwarping False # 运行 PP-ChatOCRv4 推理前,需要先获得千帆API Key paddleocr pp_chatocrv4_doc -i https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/vehicle_certificate-1.png -k 驾驶室准乘人数 --qianfan_api_key your_api_key --use_doc_orientation_classify False --use_doc_unwarping False # 查看 "paddleocr ocr" 详细参数 paddleocr ocr --help
4. API方式推理
4.1 PP-OCRv5 示例
from paddleocr import PaddleOCR
# 初始化 PaddleOCR 实例
ocr = PaddleOCR(
use_doc_orientation_classify=False,
use_doc_unwarping=False,
use_textline_orientation=False)
# 对示例图像执行 OCR 推理
result = ocr.predict(
input="https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_002.png")
# 可视化结果并保存 json 结果
for res in result:
res.print()
res.save_to_img("output")
res.save_to_json("output")
1188

被折叠的 条评论
为什么被折叠?



