使用Tesseract并启用OpenCL选项时出错

时间:2015-04-06 06:40:41

标签: c++ opencl tesseract

我正在使用Tesseract并在我的项目中启用OpenCL选项。执行GetUTF8Text()方法时,我收到以下错误:

DS] Profile read from file (tesseract_opencl_profile_devices.dat).
[DS] Device[1] 1:Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz score is 14049349632.000000
[DS] Device[2] 1:HD Graphics 5000 score is 14049349632.000000
[DS] Device[3] 0:(null) score is 21474836480.000000
[DS] Selected Device[1]: "Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz" (OpenCL)
OpenCL error code is -54 at   when clEnqueueNDRangeKernel kernel_HistogramRectAllChannels .
OpenCL error code is -54 at   when clEnqueueNDRangeKernel kernel_HistogramRectAllChannelsReduction .
OpenCL error code is -54 at   when clEnqueueNDRangeKernel kernel_ThresholdRectToPix .
OpenCL error code is -54 at   when clEnqueueNDRangeKernel kernel_HistogramRectAllChannels .
OpenCL error code is -54 at   when clEnqueueNDRangeKernel kernel_HistogramRectAllChannelsReduction .

使用的库版本:

tesseract 3.04.00
 leptonica-1.71
  zlib 1.2.5

 OpenCL info:
  Found 1 platforms.
  Platform name: Apple.
  Version: OpenCL 1.2 (Dec 14 2014 22:29:47).
  Found 2 devices.
    Device 1 name: Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz.
    Device 2 name: HD Graphics 5000.

以前有人遇到过这个问题吗?

1 个答案:

答案 0 :(得分:1)

看起来Tessaract将工作组大小16x16的内核排队,这是用于GPU上图像处理的相当典型的图块大小。但是,Apple的CPU的OpenCL实现有一个限制,即工作组大小只能是一维的(即第二个维度必须为1),因此该工作组大小将无效。您获得的错误代码(-54)对应于CL_INVALID_WORK_GROUP_SIZE

如果你可以让Tesseract在GPU上运行(HD Graphics 5000),你应该没问题。