pytesseract.image_to_string()
当我通过 supervisordd 运行脚本时花费了太多时间,但是当直接在 shell 中运行时几乎立即执行(在同一台服务器上并与主管脚本同时运行)。
除了花费太多时间之外,进程还显示出高 CPU 使用率。
通过采取时间pytesseract.image_to_string()
时,通过Supervisord运行:30岁〜
采取的时间pytesseract.image_to_string()
时,通过击运行:0.1S
只有在有很多进程pytesseract.image_to_string()
、正在执行、通过 supervisord 运行(大约 22 个实例)时才会出现此问题。如果我减少实例的数量(大约 10 个),通过 supervisord 执行的脚本也能顺利运行。
操作系统:Ubuntu 18.04.2 LTS(仿生)
Supervisord:版本 3.3.1
Tesseract:版本 4.0.0-beta.1
Python:版本 3.6
PyTesseract:版本 0.2.5
ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 127357
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files …
Run Code Online (Sandbox Code Playgroud) 跟进如何对 pdf 文件进行 OCR 并获取存储在 pdf 中的文本?我已经成功制作了 OCRed pdf 页面。
然而,在 Evince 中,没有显示这些字母。我的意思是我看不到字符,但我可以选择它们,复制它们并将它们成功粘贴到其他地方。这似乎不是 Evince 的 bug:https ://bugzilla.redhat.com/show_bug.cgi ? id = 1364201
使用 pdfsandwich 启动 pdf 页面的 OCR 时,tesseract 会生成一个页面
包含一种没有任何可用字形的字体(他们将其命名为 GlyphLessFont)。它只有 .notdef 和 .null 替换(正方形)。如果字符没有字形,Evince 将使用 .notdef 字形。Okular 突出显示文本的原因是因为它在图像中这样做,而不是像 evince 那样作为常规文本。
pdftotext 识别字符。
现在,问题是:可以告诉 tesseract 使用不同的字体吗?