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

推荐订阅源

J
Java Code Geeks
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
C
Check Point Blog
G
Google Developers Blog
V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
有赞技术团队
有赞技术团队
MongoDB | Blog
MongoDB | Blog
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
D
Docker
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
博客园 - 三生石上(FineUI控件)
A
About on SuperTechFans
Recent Announcements
Recent Announcements
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
阮一峰的网络日志
阮一峰的网络日志
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News

博客园 - 一 缕 阳 光

macOS 安装cocoapods记录 Flowable笔记 VUE项目中同时使用API代理与MockJs Ruoyi-Cloud-服务间的调用 Ruoyi-Cloud-增加单元测试和Mybatis-plus 使用Typro+dotnet-cnblog在博客园写博客 T4模板插件 使用Open Live Writer在博客园中写博文 Windows与CentOS8虚拟机网络共享与互通 因数据库连接串导致的netcore发布到IIS后报500错误 【转】使用ASP.NET Web API构建Restful API 表单设计器的探索 解决C#中dynamic类型作为泛型参数的反射问题 【原创】AltiumDesigner 6 的自定义菜单 估计项目的重要几点 从Project 2007导出WBS图表到Visio 2007 CMS: DNN And Umbraco ORA-01489: result of string concatenation is too long 【原创】长尾关键词的挖掘与使用方法
【原创】Tesseract-OCR 3.02 训练笔记
一 缕 阳 光 · 2013-04-15 · via 博客园 - 一 缕 阳 光

目的:识别http://www.computrabajo.com.mx/bt-ofrd-human1985-207292.htm中的Email地址

官方文档:https://code.google.com/p/tesseract-ocr/wiki/TrainingTesseract3

官方的英文文档很长,这里记录几个关键步骤。

特别注意:训练时用的版本与运行时用的版本一定要保持一致。

  • 准备:

1、安装Tesseract

2、下载图片,保存到本地,并转换成Tif格式。

  • Make Box Files

1、tesseract eng.timesitalic.exp0.tif eng.timesitalic.exp0 batch.nochop makebox

2、把生成的box文件用文本编辑器编辑,使之与图片中的文字一致

PS:此步骤亦可以使用jTessBoxEditor工具代替

  • Run Tesseract for Training

tesseract [lang].[fontname].exp[num].tif [lang].[fontname].exp[num] nobatch box.train

此步骤生成一个.tr的文件

  • Compute the Character Set

unicharset_extractor lang.fontname.exp0.box

此步骤生成一个unicharset文件

  • font_properties (new in 3.01)

用记事本新建一个名为font_properties的文件,内容格式为:<fontname> <italic> <bold> <fixed> <serif> <fraktur>

如:timesitalic 1 0 0 1 0

这个步骤要注意:<fontname>应与步骤"Run Tesseract for Training”命令中指定的[fontname]一致,如果没有指定,则为UnknownFont

如:UnknownFont 0 0 0 0 0

  • Clustering

三个命令:

shapeclustering -F font_properties -U unicharset lang.fontname.exp0.tr

mftraining -F font_properties -U unicharset -O lang.unicharset lang.fontname.exp0.tr

cntraining lang.fontname.exp0.tr lang.fontname.exp1.tr

  • Putting it all together

combine_tessdata lang.

注意:一定要把Clustering生成的文件重命名,我在开始训练时,没仔细看官方的最关键的一段话:

That is all there is to it! All you need to do now is collect together all (shapetable, normproto, inttemp, pffmtable) the files and rename them with a lang. prefix, where lang is the 3-letter code for your language taken from http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes

后来在CSDN上看到边城骆驼的博文http://blog.csdn.net/marvinhong/article/details/8459591,才恍然大悟。

  • 测试

tesseract image.tif output -l lang

  • 最后附上几个有用的链接:

tesseract-ocr - An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google. - Google Project Hosting

VietOCR | Free Graphics software downloads at SourceForge.net

tesseractdotnet - tesseract-ocr .net - Google Project Hosting