遇到问题训练 tesseract

Posted

技术标签:

【中文标题】遇到问题训练 tesseract【英文标题】:running into issues training tesseract 【发布时间】:2015-11-08 22:26:04 【问题描述】:

我是 tesseract 的新手,对 github 页面中的不同目录有点困惑。

tesserac-ocr 代码库是我安装的。在 /usr/local/share/tessdata/ 中安装了一个 tessdata 目录

所以现在在训练 tesseract 时,我运行以下命令 -

# tesseract img.tif img box.train

我收到以下错误

Tesseract Open Source OCR Engine v3.03 with Leptonica
Error opening data file /usr/local/share/tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
Could not initialize tesseract.

显然它无法找到 tessdata 文件夹。

所以现在我从 github (https://github.com/tesseract-ocr/tessdata) 获得了 tessdata 目录。然后将 TESSDATA_PREFIX 指向从 github 下载的 tessdata。不会改变任何东西。我收到以下错误 -

Tesseract Open Source OCR Engine v3.03 with Leptonica
read_params_file: Can't open box.train

所以我的问题是 tessdata 应该指向什么? tesseract在训练命令中从哪里获取box.train?

【问题讨论】:

您是否创建并检查了 box.train 文件?如果不是,您必须先使用tesseract img.tif img batch.nochop makebox 创建box.train。之后,如果您的字符被正确检测到,您将必须检查 box 文件。 【参考方案1】:

作为新手,你可以做的最愚蠢的事情之一就是尝试训练 tesseract ;-)

下一步:3.03 版本不在官方 github.com 存储库中(顺便说一句:3.03 从未正式发布...只是 Ubuntu 发布了该版本。)

下一步:如果您正确安装了 tesseract(从源代码),则安装 box.train。您是从 Ubuntu 软件包/repo 安装的(我不这么认为,因为在这种情况下,tesseract 不会使用 /usr/local/... ),而不是您应该联系打包者如何打包 tesseract。

【讨论】:

他们从 code.google.com 搬到了 github,但没有更新他们的文档。问题是他们改变了代码打包和分发的方式。我是从源代码安装的。 Move to github.com 与其他项目一样记录在主页上。

以上是关于遇到问题训练 tesseract的主要内容,如果未能解决你的问题,请参考以下文章

Python:在使用 python tesseract API 接口时遇到 OCR 问题

通过 Tesseract OCR 在七段显示器上进行文本检测

安装reserocr遇到的问题

手写文本的训练 tesseract

如何在 Windows 上训练 Tesseract

tesseract训练模型问题总结