You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

从零训练Tesseract数字识别模型后识别效果极差求助

训练Tesseract数字识别模型全错问题求助

我从零开始训练Tesseract,参考了Tesseract4和Tesseract5的官方文档,按步骤操作无报错,但训练出的.traineddata文件测试时识别全错,几乎没有正确结果。

我的操作步骤如下:

  • 创建num.txt文件,内容为:0123456789,目标是训练仅识别数字的.traineddata模型。
  • 生成unicharset文件:unicharset_extractor --norm_mode 3 --output_unicharset .\num.lstm-unicharset num.txt
  • 生成初始traineddata文件(langdata_lstm-main为GitHub下载的langdata解压文件夹):combine_lang_model --input_unicharset num.lstm-unicharset --lang chi_sim --script_dir .\langdata_lstm-main --output_dir .\ --version_str "num:20220908[1,48,0,1Ct3,3,16Mp3,3Lfys64Lfx96Lrx96Lfx512O1c1]" --pass_through_recoder true
  • 使用text2image命令生成训练所需的.tif和.box文件:
    通过jTessBoxEditorFX查看.tif及对应.box文件
    .box文件内容
  • 生成.lstmf文件:tesseract train.tif train -l chi_sim --psm 7 lstm.train
  • 创建train_listfile.txt文件,写入lstmf文件路径
  • 执行训练:lstmtraining --traineddata .\chi_sim\chi_sim.traineddata --net_spec "[1,48,0,1 Ct3,3,16 Mp3,3 Lfys64 Lfx96 Lrx96 Lfx512 O1c13]" --model_output .\output\output --train_listfile train_listfile.txt --max_iterations 0 --target_error_rate 0.01 --debug_interval 0
  • 训练完成后生成可运行模型:lstmtraining --stop_training --continue_from .\output\output_checkpoint --traineddata .\chi_sim\chi_sim.traineddata --model_output .\output\num.traineddata

我使用了约5000条数据训练,但测试结果极差(左为正确答案,右为Tesseract识别结果):
测试结果对比

多次查阅Tesseract文档仍未找到原因,恳请帮忙解决。

内容的提问来源于stack exchange,提问作者xl c

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 07:21:32