-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Significant speed drop on Tesseract4 vs 3 with identical image #1278
Comments
How zlib is related here? |
It is not related at all, that is simply a well-formed sample image I was using to test the performance. Performance is similar with other images of similar dimensions |
Unlike the Linux build, OpenMP and AVX2 are currently not activated in the Windows build. |
Thank you for the info. I added /openmp in Visual Studio as per https://msdn.microsoft.com/en-us/library/fw509c3b.aspx - this nearly doubled the speed and now puts the process at 50% CPU usage. On windows Tesseract3 is still almost twice as fast, but at least this helped! |
Also see #898 |
CC: @egorpugin |
I see wall time of about 4.5 seconds on a six core Xeon E5-1650 running at 3.2 Ghz under Linux. About 3.5 seconds under optimal throughput conditions (repeated OCR of the same image over and over). |
|
theraysmith commented on May 23, 2017
theraysmith commented on Jul 12, 2017
|
I did further testing and the plot thickens a bit.. I ran Tesseract4 with the official datafiles that support the legacy engine (from https://github.com/tesseract-ocr/tessdata) and set EngineMode to TESSERACT so that only the legacy engine is running, not LSTM. I then compared the wall time on a 200 page image file to that of Tesseract 3.02, and found that Tesseract4.00 took over 50% longer (260 seconds vs 160 seconds), despite the fact that its should be using the same engine?? |
That's another issue. #263 (comment) |
In ref to the quote above:
I have not found the above to be true, at least on windows with English, here are some results: Do I need to manually turn on AVX for windows builds somehow? |
Interesting.. so you think that if I test with Tesseract3.05 it will be about the same speed as 4.00 with legacy engine, and significantly slower than 3.02? If so thats very unfortunate... why such a change if speed with 3.02 vs 3.05 if they the same engine? |
Line 210 in a538cd1
AVX is turn on but AVX2 is not. |
Ray/Jeff need to confirm that the files in tessdata_fast are indeed the final fast models that Ray was referring to. |
If not I would love to test with the final fast models! |
The CMake file is incomplete. |
The fast models on Github are final. (To the degree that anything in life is final.) |
Pinging @egorpugin again. |
So, do you want /openmp for the whole tess or only for specific files? |
With autotools it is global. |
Done. 4b6fefb |
Thanks Egor. Please also add avx2 flag to arch/intsimdmatrixavx2.cpp, This is needed to make the use of traineddata from the 'fast' repo actually faster than 'best'. |
Done. 2da95d6 MS issue for reference. Feel free to upvote. |
Does anybody know how a GCC based build (for example from UB-Mannheim) compares with the MSVC results? |
Here are the current options to run Tesseract on Windows:
And they say that on Linux you have too many options to choose from, which confuses people... |
There is also the choice of building 32 or 64 bit software for Windows. Personally I typically built 32 bit Tesseract for Windows up to now, but maybe there might be good reasons for 64 bit code? |
Just to add some information from a Debian bug report, without AVX2 tesseract 4 is much slower than 3.05 ... (See also manisandro/gImageReader#285 for another example of the slowdown) |
If someone prefers speed over accuracy, Tesseract 4.00 still includes the legacy ocr engine; Use |
@zdenop Please label Performance |
Post in forum by David Tran
|
It looks like the local machine is rather new hardware, while the server is older. So it could be AVX / SSE none at all. The user can run The number of CPU cores and the memory bandwidth are also very important. The user uses the UB Mannheim installer for Windows. He should update to the latest version. |
AVX2 and SSE are found but performance is terrible on my machine. It takes over a minute to OCR a single sentence. Tesseract 3 did it about a second, tesseract 4 is not usable on my machine. |
Closing as duplicate to #263. |
Hello, i read a line of text (about 8 characters) for about 1.8 seconds. My system is 32 bit Debian 10, I use Tesseract 4.0.0. I want to ask if it is possible under these conditions to speed up the reading? |
Don't use unsupported old versions. Use Tesseract 4.1.1 or latest Tesseract from git master. |
Thanks for the reply @stweil . I will try it right away. |
Hello, I installed version 4.1.1, but every time I call tesseract from the command line or from api, I get the following error: tesseract: symbol lookup error: tesseract: undefined symbol: _ZTVN9tesseract19TessLSTMBoxRendererE . I use the most basic installation process:
Any help is highly appreciated. Тhank you. |
Remove any other installation of Tesseract (for example the distributed package). |
Thanks for the reply @stweil . I will try it right away. |
Hi @stweil , you were right it was really a problem with another version of tesseract, but after I managed to install version 4.1.1 there was no difference in execution time. |
Recent Tesseract releases like 5.0.0-alpha-20201224 or later support 32-bit ARM (ideally with NEON for faster execution). I use it on 32-bit ARM with Ubuntu. |
Thanks @stweil , my processor supports NEON instructions. I will try it now. |
Hi @stweil , I installed version tesseract 5.0.0-alpha-20201224, but the time is at most 100 milliseconds faster. tesseract 5.0.0-alpha-20201224 From the command above I see Found NEON, but does that mean that I managed to build tesseract to use NEON? |
Yes, it uses NEON. I see that you are also using OpenMP. Do you have at least 4 ARM cores? I'd try a build with OpenMP disabled and compare the timing. |
@stweil I only have two cores. |
Then OpenMP will waste lots of time with switching between 4 threads. Run |
OK @stweil , thank you. |
@stweil I just tried but without success the time is the same.
|
Environment
Current Behavior:
Using the same input image (attached), Tesseract4 performs over three times slower than Tesseract3. On my system this image took ~5 seconds with Tesseract3, and ~20 seconds with Tesseract4.
Tested using the pre-built 4.00 and 3.51 windows binaries from https://github.com/tesseract-ocr/tesseract/wiki/Downloads, as well as with the latest 4.00 git source I built locally using cppan with MSVC 2015, in Release config
Using the 'fast' version of eng.traineddata did not make a significant difference.
Expected Behavior:
https://github.com/tesseract-ocr/tesseract/wiki/4.0-Accuracy-and-Performance implies we should not be expecting such significantly slower results
EDIT: The following image is one of a handful of test images I am using. Zlib isn't relevant here.
The text was updated successfully, but these errors were encountered: