如何将 tessdata_best 用于 tesseract (pytesseract)。论据和程序是什么?

Des*_*wal 7 python ocr tesseract python-tesseract tesseract.js

TL;DR:如何安装以与inside intessdata_best一起使用pytesseractcondaUbuntu 18

我已经使用pytesseract内部conda环境相当多了,但需要提高准确性,我发现这可以tessdata_best为您提供最佳准确性。我如何安装和使用该版本?我正在使用Ubuntu 18并且必须与pytesseract.

我已经tesseract安装了/usr/share/tesseract-ocr/,里面只有 1 个tessdata

我是否需要通过将其复制到旁边的tessdata_best目录来从 github获取它?/usr/share/tesseract-ocr/tessdata

即使如此,如果我想使用tessdata-best,我必须使用什么?我需要更改configas 吗--oem 0/1/2/3

第三件事也是最后一件事是我的language.trainedata文件位于/home/deshwal/anaconda3/envs/py36/share/tessdata/eng.traineddata. 我也需要粘贴tessdata_best到这个位置吗?因为当我尝试更改语言目录时,它给我错误如下:

/home/deshwal/anaconda3/envs/py36/share/tessdata/equ.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language \'equ\' Tesseract couldn\'t load any languages! Could not initialize tesseract.'

Mau*_*tha 0

我不知道我是否清楚地理解你的问题,但是请告诉我以下是否有帮助......你需要设置数据路径以及复制 tessdata_best 训练模型的位置,例如,

Tesseract tesseract = new Tesseract(); // JNA接口映射 tesseract.setDatapath("/home/tesseract/tessdata_best_4_0_0/tessdata");

您从(https://github.com/tesseract-ocr/tessdata_best)下载的所有 .traineddata 文件应放置在您在 setDataPath 中定义的目录中(例如:/home/tesseract/tessdata_best_4_0_0/tessdata)。

请注意:这些模型仅适用于 Tesseract 4 的 LSTM OCR 引擎,因此请确保您使用的是 4.1 或更高版本的库。

问候, 毛利克