1

I have built Tesseract from the source with the option OpenCL enabled in order to speed up the time taken to execute the GetUTF8Text(). I followed these steps:

cd tesseract-3.03/
./autogen.sh
CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure --enable-opencl
make 
sudo make install 

However, when I run my code that uses Tesseract, I am not able to experience any speedup in comparison to using Tesseract built without the enabling OpenCL option. Am I missing something here? Am I supposed to make some changes in the Tesseract source?

sashoalm
  • 75,001
  • 122
  • 434
  • 781
Raghav
  • 570
  • 1
  • 13
  • 24
  • How much speedup do you expect? Who told there would be a speedup and how much did they tell you it is? Can you point your sources? I mean is there a site or blog post saying "compiling under OpenCL makes Tesseract ten times as fast". – sashoalm Apr 01 '15 at 11:23
  • Please refer this article http://www.sk-spell.sk.cx/tesseract-meets-the-opencl-first-test – Raghav Apr 01 '15 at 11:33
  • How much does it say it will speed up Tesseract? I won't read the entire article, I assume you've read it, so just quote the part of it that deals with the expected speed-up, and I'll use Ctrl+F to find it. – sashoalm Apr 01 '15 at 12:50
  • "total time was improved too. 12.18 to 21.95 means 44% less time to OCR one page with enabled OpenCL support." the above is the output after using Tesseract with OpenCL on a Linux machine. – Raghav Apr 01 '15 at 13:14
  • OK, they also imply that not all graphics card models support OpenCL. I assume you have checked that your model supports it? The relevant quote is: "According Intel web page this graphic card is supported by their OpenCL package". – sashoalm Apr 01 '15 at 13:53
  • My machine is a Macbook Air Mid-2013 - Intel HD 5000 Graphics and OpenCL 1.2 is supported. – Raghav Apr 01 '15 at 14:02
  • Have you installed the OpenCL drivers? What is probably happening is that your code runs on the CPU (with OpenCL) because it can not find an enabled GPU. – sbabbi Apr 01 '15 at 21:41

3 Answers3

2

I had the same problem. I was able to find out if my device was OpenCL compatible with this code answer.

If your device is not OpenCL compatible, the above code will return a (null) score along with the profiled time.

Also, you make sure you clone the latest version of the tesseract (3.04.00) source since they may have fixed the bug you are having in their latest release.

Community
  • 1
  • 1
everconfusedGuy
  • 2,709
  • 27
  • 43
2

Anyway, i'm not sure if OpenCL speeds tesseract at all:

Here you are some quick tests, using nvidia opencl driver, amd opencl driver (via CPU), and native tesseract processor.

[DS] Device[1] 1:GeForce GTX 960 score is 0.140693
[DS] Device[2] 1:AMD FX(tm)-8350 Eight-Core Processor score is 0.751782
[DS] Device[3] 0:(null) score is 0.891833


[DS] Selected Device[1]: "GeForce GTX 960" (OpenCL)
real    0m3.385s
user    0m2.872s
sys     0m0.476s

[DS] Overridden Device[2]: "AMD FX(tm)-8350 Eight-Core Processor" (OpenCL)
real    0m3.581s
user    0m6.700s
sys     0m0.188s

[DS] Overridden Device[3]: "(null)" (Native)
real    0m3.307s
user    0m3.144s
sys     0m0.160s
Augusto Beiro
  • 73
  • 1
  • 5
0

Probably you don't have an appropriate board. Take a look of all the OpenCL conformant boards

neves
  • 33,186
  • 27
  • 159
  • 192