tesseract-ocr / tesseract

Tesseract Open Source OCR Engine (main repository)
https://tesseract-ocr.github.io/
Apache License 2.0
61.72k stars 9.45k forks source link

Issue with AVX support #3137

Closed Shatur closed 3 years ago

Shatur commented 3 years ago

Environment

Current Behavior:

I am using TessBaseAPI to translate text from the screen. But users who do not have a CPU with AVX instructions faced a crash (https://github.com/crow-translate/crow-translate/issues/193). I took a quick look at the code and it looks like Tesseract can detect instructions support at runtime. So, I suppose that there is a problem with AVX instruction detection.

Expected Behavior:

Tesseract does not use AVX instructions on processors that do not support them.

Additional information

tesseract v5.0.0.20190623
leptonica-1.78.0
libgif 5.1.4 : libjpeg 8d (libjpeg-turbo 1.5.3) : libpng 1.6.34 : libtiff 4.0.9 : zlib 1.2.11 : libwebp 0.6.1 : libopenjp2 2.3.0
Found SSE
stweil commented 3 years ago

I cannot find a commit 27a2418e91179d8607862348d7b498558e98a0ab.

The user who faced the crash reported tesseract v4.0.0.20190314. That is an old unsupported version which is known to have bugs. Does the problem also occur with newer Tesseract versions? If yes: the crash was reported for Windows. There are no official binaries for Windows. So please make sure that your Windows binaries were not compiled with AVX options for all code (then the runtime detection is useless). If you are using binaries from https://digi.bib.uni-mannheim.de/tesseract/ you should say so and use the latest version.

I close this issue because I think it is either from an old version or unrelated to the Tesseract source code.

Shatur commented 3 years ago

I cannot find a commit 27a2418e91179d8607862348d7b498558e98a0ab.

I'm sorry! I accidentally pasted the vcpkg commit instead of the Tesseract commit. Fixed the first message.

The user who faced the crash reported tesseract v4.0.0.20190314.

It's just the version of the Tesseract CLI that he had installed. He ran it to check which instructions were being detected. The application (Crow Translate) used libesseract 4.1.1 (it was compiled with it).

please make sure that your Windows binaries were not compiled with AVX options for all code (then the runtime detection is useless)

I compiled Tesseract with vcpkg with the default options. (vcpkg install tesseract:x64-windows). But my machine support AVX instructions. Does this mean that I have built with AVX options for all code?

stweil commented 3 years ago

Short answer: yes.

Shatur commented 3 years ago

Thanks! I will use tesseract[cpu-independed]:x64-windows variant next time. I just thought that the CPU instructions support will be detected at runtime.