首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >[tesseract-ocr][原创]tesseract训练lstm模型报错:LSTM: Training - Error msg - Encoding of string failed!

[tesseract-ocr][原创]tesseract训练lstm模型报错:LSTM: Training - Error msg - Encoding of string failed!

作者头像
云未归来
发布2025-07-19 12:40:45
发布2025-07-19 12:40:45
1040
举报

报错原因:

请参阅TrainingTesseract 4.00 · tesseract-ocr/tesseract Wiki · GitHub

Encoding of string failed! results when the text string for a training image cannot be encoded using the given unicharset.

Possible causes are:

- There is an un-represented character in the text, say a British Pound sign that is not in your unicharset.

- A stray unprintable character (like tab or a control character) in the text.

- There is an un-represented Indic grapheme/aksara in the text.

In any case it will result in that training image being ignored by the trainer.

If the error is infrequent, it is harmless, but it may indicate that your unicharset is inadequate for representing the language that you are training.

其实上面意思归根到底是你训练的数据集里面不在字符集里面,由于是finetune模型一般是不需要自己做字符集,这就导致使用字符集刚好不包含你自定义的数据集中的字符,一般会忽略这种字符,不会使得训练受到影响,但是会导致你无法识别出来,因此我们可以在训练时候指定字符集

mkdir -p ~/tesstutorial/tellayer_from_tel

combine_tessdata -e ../tessdata/tel.traineddata \ ~/tesstutorial/tellayer_from_tel/tel.lstm lstmtraining -U ~/tesstutorial/tel/tel.unicharset \ --script_dir ../langdata --debug_interval 0 \ --continue_from ~/tesstutorial/tellayer_from_tel/tel.lstm \ --append_index 5 --net_spec '[Lfx256 O1c105]' \ --model_output ~/tesstutorial/tellayer_from_tel/tellayer \ --train_listfile ~/tesstutorial/tel/tel.training_files.txt \ --target_error_rate 0.01

字符集怎么生成呢:

采用下面命令:

unicharset_extractor --output_unicharset chi_sim.unicharset --norm_mode 1 FIRC.box

set_unicharset_properties -U chi_sim.unicharset -O chi_sim.unicharset --script_dir ./

参考文献:

怎样使用已有的工具训练Tesseract 3.03–3.05来识别新的语言_Wordsky的博客-CSDN博客

https://github.com/tesseract-ocr/tesseract/issues/549

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-08-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档