paddlepaddle(一)文字识别 - PaddleOCR简单使用
PaddleOCR
Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
项目地址:https://gitcode.com/gh_mirrors/pa/PaddleOCR

·
PaddleOCR一步安装即可使用。
OCR结果如图:
步骤:可以直接使用pip安装PaddleOCR库。
pip install paddleocr
执行代码即可,示例:
from paddleocr import PaddleOCR, draw_ocr
# 模型路径下必须含有model和params文件
ocr = PaddleOCR(use_angle_cls=True,use_gpu=False)#det_model_dir='{your_det_model_dir}', rec_model_dir='{your_rec_model_dir}', rec_char_dict_path='{your_rec_char_dict_path}', cls_model_dir='{your_cls_model_dir}', use_angle_cls=True
img_path = 'D:/mypic/ocr2.jpg'
result = ocr.ocr(img_path, cls=True)
for line in result:
print(line)
# 显示结果
from PIL import Image
image = Image.open(img_path).convert('RGB')
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
im_show = draw_ocr(image, boxes, txts, scores, font_path='D:/paddle_pp/PaddleOCR/doc/simfang.ttf')
im_show = Image.fromarray(im_show)
im_show.save('result.jpg') #结果图片保存在代码同级文件夹中。
系列之(二)
paddlepaddle(二) 文字识别 PaddleOCR C++部署




Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
最近提交(Master分支:6 个月前 )
96a73291
12 天前
dc34f9b4
* use the env variable PADDLE_OCR_BASE_DIR to download models
* use PADDLE_OCR_BASE_DIR env variable to download models 13 天前
更多推荐
所有评论(0)