惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
爱范儿
爱范儿
P
Proofpoint News Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
小众软件
小众软件
F
Full Disclosure
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Announcements
Recent Announcements
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
F
Fortinet All Blogs
Google DeepMind News
Google DeepMind News
Jina AI
Jina AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
S
SegmentFault 最新的问题
S
Schneier on Security
V
Vulnerabilities – Threatpost
T
Tenable Blog
P
Privacy & Cybersecurity Law Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Latest news
Latest news
Simon Willison's Weblog
Simon Willison's Weblog
D
DataBreaches.Net
L
LINUX DO - 热门话题
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
Stack Overflow Blog
Stack Overflow Blog
SecWiki News
SecWiki News
H
Hacker News: Front Page
aimingoo的专栏
aimingoo的专栏
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
Threatpost
罗磊的独立博客
L
LangChain Blog
The Last Watchdog
The Last Watchdog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
K
Kaspersky official blog
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
N
News | PayPal Newsroom
美团技术团队
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Docker
T
The Blog of Author Tim Ferriss
N
Netflix TechBlog - Medium
博客园 - 【当耐特】
Cyberwarzone
Cyberwarzone

博客园 - gxh973121

Windbg在Managed App中设置函数断点的几种方法 TeamTalk---服务端架构 找不到资产文件 project.assets.json windows 2008 VPN(PPTP/L2TP)搭建 - gxh973121 vs 调试时 QuickWatch 不能计算变量值 wireshark 分析过滤数据 go module 设置 逻辑漏洞之支付漏洞 java holdsLock()方法检测一个线程是否拥有锁 c#编程指南(十) 平台调用P-INVOKE完全掌握, 字符串和指针 Git过滤文件和文夹 VC CComboBox用法总结 WideCharToMultiByte和MultiByteToWideChar函数的用法 c++ 时间类型详解 time_t 链接报error LNK2019: unresolved external symbol错误,解决 VS2008 工程只生成dll不生成lib的解决方案 vs2010中的MSBuild输出warning MSB8012问题 在VS2010下编译和使用tesseract_ocr识别验证码 Windows下Qt5搭建Android开发环境笔记
tesseract-ocr 提高验证码识别率手段之---识别码库训练方法
gxh973121 · 2013-12-16 · via 博客园 - gxh973121

本文是对tesseract-ocr 使用的进一步技术升级说明,使用默认的识别库识别率比较低怎么办?

不用着急,tesseract-ocr本身的工具中提供了使用你提供的素材进行人工修正以提高识别率的方法。下面我们就来看一下。

参考:

http://my.oschina.net/lixinspace/blog/60124

1    下载并安装3.02版本的tesseract

2     如果你的训练素材是很多张非tiff格式的图片,首先要做的事情就是将这么图片合并(个人觉得素材越多,基本每个字母和数字都覆盖了训练出来的识别率比较好)

http://sourceforge.net/projects/vietocr/files/latest/download?source=files

下载这个工具:VietOCR.NET-3.3.zip

首先进行jpg,gif,bmptiff的转换,这个用自带的画图就可以。然后使用VietOCR.NET-3.3进行多张 tiffmerge

3      Make Box Files。在orderNo.tif所在的目录下打开一个命令行,输入

C:\Program Files\Tesseract-OCR>tesseract.exe lang.jhy.exp8.TIF lang.jhy.exp8 batch.nochop makebox

4       使用jTessBoxEditor打开orderNo.tif文件,需要记住的是第2步生成的orderNo.box要和这个orderNo.tif文件同在一个目录下。逐个校正文字,后保存。

http://sourceforge.net/projects/vietocr/files/

 下载jTessBoxEditor工具进行每个自的纠正(注意有nextpage逐页进行纠正)

 

5       Run Tesseract for Training。输入命令:

C:\Program Files\Tesseract-OCR>tesseract.exe lang.jhy.exp8.TIF lang.jhy.exp8 nob

atch box.train

补充关于命名格式解释:lang.jhy.exp8.TIF

Make Box Files

For the next step below, Tesseract needs a 'box' file to go with each training image. The box file is a text file that lists the characters in the training image, in order, one per line, with the coordinates of the bounding box around the image. Tesseract 3.0 has a mode in which it will output a text file of the required format, but if the character set is different to its current training, it will naturally have the text incorrect. So the key process here is to manually edit the file to put the correct characters in it.

Run Tesseract on each of your training images using this command line:

tesseract [lang].[fontname].exp[num].tif [lang].[fontname].exp[num] batch.nochop makebox

6      Compute the Character Set。输入命令:

C:\Program Files\Tesseract-OCR>unicharset_extractor.exe lang.jhy.exp8.box

Extracting unicharset from lang.jhy.exp8.box

Wrote unicharset file ./unicharset.

7        新建文件“font_properties”。如果是3.01版本,那么需要在目录下新建一个名字为“font_properties”的文件,并且输入文本  :(这里的jhy就是lang.jhy.exp8的中间字段)

jhy   1 0 0 1 0

C:\Program Files\Tesseract-OCR>mftraining.exe -F font_properties -U unicharset

ang.jhy.exp8.tr

Warning: No shape table file present: shapetable

Reading lang.jhy.exp8.tr ...

Flat shape table summary: Number of shapes = 18 max unichars = 1 number with mu

tiple unichars = 0

Done!

8      Clustering。输入命令:

C:\Program Files\Tesseract-OCR>cntraining.exe lang.jhy.exp8.tr

Reading lang.jhy.exp8.tr ...

Clustering ...

Writing normproto ...

9         此时,在目录下应该生成若干个文件了,把unicharset, inttemp, normproto, pfftable这几个文件加上前缀“selfverify.”。然后输入命令:

必须确定的是1、3、4、5、13行的数据不是-1,那么一个新的字典就算生成了。

此时目录下“selfverify.traineddata”的文件拷贝到tesseract程序目录下的“tessdata”目录。

以后就可以使用该该字典来识别了,例如:

tesseract.exe test.jpg out –l selfverify

通过训练出来的新语言,识别率提高了不少。