安装paddleocr_convert
pip install paddleocr_convert
命令行使用
$ paddleocr_convert -h
usage: paddleocr_convert [-h] [-p MODEL_PATH] [-o SAVE_DIR][-txt_path TXT_PATH]optional arguments:
-h, --help show this help message and exit
-p MODEL_PATH, --model_path MODEL_PATHThe inference model url or local path of paddleocr.e.g. https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar ormodels/ch_PP-OCRv3_det_infer.tar
-o SAVE_DIR, --save_dir SAVE_DIRThe directory of saving the model.
-txt_path TXT_PATH, --txt_path TXT_PATHThe raw txt url or local txt path, if the model isrecognition model.
# online
$ paddleocr_convert -p https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar \-o models$ paddleocr_convert -p https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar \-o models \-txt_path https://raw.githubusercontent.com/PaddlePaddle/PaddleOCR/release/2.6/ppocr/utils/ppocr_keys_v1.txt# offline
$ paddleocr_convert -p models/ch_PP-OCRv3_det_infer.tar \-o models$ paddleocr_convert -p models/ch_PP-OCRv3_rec_infer.tar \-o models \-txt_path models/ppocr_keys_v1.txt
脚本使用
from paddleocr_convert import PaddleOCRModelConvertconverter = PaddleOCRModelConvert()save_dir = 'models'# online
url = 'https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar'
txt_url = 'https://raw.githubusercontent.com/PaddlePaddle/PaddleOCR/release/2.6/ppocr/utils/ppocr_keys_v1.txt'converter(url, save_dir, txt_path=txt_url)# offline
model_path = 'models/ch_PP-OCRv3_rec_infer.tar'
txt_path = 'models/ppocr_keys_v1.txt'
converter(model_path, save_dir, txt_path=txt_path)
使用模型方法:
local/models/japan.onnx
rapidocr_onnxruntime
库pip install rapidocr_onnxruntime
from rapidocr_onnxruntime import RapidOCRmodel_path = 'local/models/japan.onnx'
engine = RapidOCR(rec_model_path=model_path)img = '1.jpg'
result, elapse = engine(img)
$ rapidocr_onnxruntime -img 1.jpg --rec_model_path local/models/japan.onnx
2023-03-05 v0.0.4~7 update:
2023-02-28 v0.0.3 update:
2023-02-27 v0.0.2 update:
2022-08-15 v0.0.1 update:
上一篇:Android Studio 中使用 Gradle 配置多渠道打包 配置不同的渠道名称 配置不同的App名称 配置不同的Logo
下一篇:新消费周报 | 上海乐高乐园即将开园;小红书与复旦达成AI合作;大疆进入扫地机器人市场 新消费周报 | 上海乐高乐园即将开园;小红书与复旦达成AI合作;大疆进入扫地机器人市场