首页 > 技术文章 > tesseract训练手写体

jnhs 2019-08-08 11:15 原文

前面的步骤都一样,从第4步开始 

4、使用tesseract生成.box文件:

tesseract eng.handwriting.exp0.tif eng.handwriting.exp0 -l eng -psm 7 batch.nochop makebox 

5、矫正一下识别有问题的字符

 

6、生成font_properties文件: 

只要字符部分,不要语言部分,也不要exp【数字】这里

echo handwriting 0 0 0 0 0 >font_properties

 

 

 7、使用tesseract生成.tr训练文件:

tesseract eng.handwriting.exp0.tif eng.handwriting.exp0 nobatch box.train

 

 

成功生成一个tr文件

8、生成字符集文件:

unicharset_extractor eng.handwriting.exp0.box

 

9、生成shape文件: 

shapeclustering -F font_properties -U unicharset -O eng.handwriting.exp0.unicharset eng.handwriting.exp0.tr

 

会生成 shapetable 和 zwp.unicharset 两个文件。

 

 

10、生成聚字符特征文件:

会生成 inttemp、pffmtable、shapetable和eng.handwriting.exp0.unicharset四个文件。

mftraining -F font_properties -U unicharset -O eng.handwriting.exp0.unicharset eng.handwriting.exp0.tr

 

 

 

11、生成字符正常化特征文件:会生成 normproto 文件。  

cntraining eng.handwriting.exp0.tr

 

 

 

12、文件重命名:

 

重新命名inttemp、pffmtable、shapetable和normproto这四个文件的名字为[lang].xxx。

这里修改为zwp.inttemp、zwp.pffmtable、zwp.shapetable和zwp.normproto

rename normproto eng.normproto
rename inttemp eng.inttemp 
rename pffmtable
eng.pffmtable
rename shapetable eng.shapetable

 

 

13、合并训练文件:

执行下面命令,会生成handwritingEng.traineddata文件。

combine_tessdata eng.

 

 

 

推荐阅读