当前位置:网站首页>一款优秀的中文识别库——ocr
一款优秀的中文识别库——ocr
2022-08-02 09:48:00 【AI浩】
CnOCR 是 Python 3 下的文字识别(Optical Character Recognition,简称OCR)工具包,支持简体中文、繁体中文(部分模型)、英文和数字的常见字符识别,支持竖排文字的识别。自带了20+个训练好的识别模型,适用于不同应用场景,安装后即可直接使用。同时,CnOCR也提供简单的训练命令供使用者训练自己的模型。欢迎加入 交流群。
github地址:https://github.com/breezedeus/cnocr
安装简单
pip install cnocr
各种场景的调用示例
常见的图片识别
所有参数都使用默认值即可。如果发现效果不够好,多调整下各个参数看效果,最终往往能获得比较理想的精度。
from cnocr import CnOcr
img_fp = './docs/examples/huochepiao.jpeg'
ocr = CnOcr() # 所有参数都使用默认值
out = ocr.ocr(img_fp)
print(out)

排版简单的印刷体截图图片识别
针对 排版简单的印刷体文字图片,如截图图片,扫描件图片等,可使用 det_model_name=‘naive_det’,相当于不使用文本检测模型,而使用简单的规则进行分行。
使用 det_model_name=‘naive_det’ 的最大优势是速度快,劣势是对图片比较挑剔。如何判断是否该使用此检测模型呢?最简单的方式就是拿应用图片试试效果,效果好就用,不好就不用。
from cnocr import CnOcr
img_fp = './docs/examples/multi-line_cn1.png'
ocr = CnOcr(det_model_name='naive_det')
out = ocr.ocr(img_fp)
print(out)
识别结果:
更多详见:
https://cnocr.readthedocs.io/zh/latest/
具体的测试,以后再写,先做个记录。
边栏推荐
猜你喜欢
随机推荐
YugaByte adds Voyager migration service in its 2.15 database update
李航《统计学习方法》笔记之监督学习Supervised learning
【Redis】Jedis
你认同这个观点吗?大多数企业的数字化都只是为了缓解焦虑
Daily practice of dynamic programming (3)
yolov7创新点
nacos项目搭建
STL中list实现
1对1视频源码——快速实现短视频功能提升竞争力
DVWA 通关记录 2 - 命令注入 Command Injection
The use of thread pool and analysis of ThreadPoolExecutor source code
Redis数据结构
适配器模式适配出栈和队列及优先级队列
Facebook自动化数据分析方案,广告投放省心省力
cococreator dynamically set sprite
CFdiv2-The Number of Imposters-(两种点集图上染色问题总结)
Spend 2 hours a day to make up for Tencent T8, play 688 pages of SSM framework and Redis, and successfully land on Meituan
Have you ever learned about these architecture designs and architecture knowledge systems?(Architecture book recommendation)
The 17th day of the special assault version of the sword offer
斯皮尔曼相关系数








