網頁

2019年1月10日 星期四

Tesseract 訓練, 使用 jTessBoxEditor

這是舊版的訓練方式,Tesseract 4.0 開始了新的 LSTM(AI) 的方式

D:\>java -jar jTessBoxEditor.jar
TIFF/Box Generator
text2image 不要勾
Input 選擇 .txt 文字檔
Output 按 ... 設定輸出位置
英文輸入 eng, 中文輸入 chi_tra
選擇字型
按 Generate 產生 .box 和 .font_properties

tif文面命名格式[lang].[fontname].exp[num].tif
lang:plt
fontname:normal
num:0

手動由 .tif -> .box
D:\>ttesseract.exe plt.normal.exp0.tif plt.normal.exp0 --psm 7 -l eng batch.nochop makebox

手動生成 .font_properties, 內容為 <fontname> <italic> <bold> <fixed> <serif> <fraktur>
echo normal 0 1 1 0 1 >plt.font_properties

由 .box 文件 -> .tr
D:\>tesseract.exe plt.normal.exp0.tif plt.normal.exp0 box.train.stderr
由 .box 文件 -> unicharset
D:\>unicharset_extractor.exe plt.normal.exp0.box
由 font_properties, unicharset, .tr -> shapetable
D:\>shapeclustering.exe -F plt.font_properties -U unicharset plt.normal.exp0.tr
由 font_properties, unicharset, .tr ->lang.unicharset, inttemp, pffmtable
D:\>mftraining.exe -F plt.font_properties -U unicharset -O plt.unicharset plt.normal.exp0.tr
由.tr 文件 -> normproto
D:\>cntraining.exe plt.normal.exp0.tr
重命名 以 lang. 開頭重命名 inttemp, normproto, pffmtable, shapetable
D:\>move inttemp plt.inttemp
D:\>move normproto plt.normproto
D:\>move pffmtable plt.pffmtable
D:\>move shapetable plt.shapetable
合併生成 lang.traineddata文件,在這裏爲 plt.traineddata
D:\>combine_tessdata.exe plt.

沒有留言:

張貼留言