frame_decoration
original (2019/05/14 付) Google 翻訳 (2019/05/23 付)
# Tesseract and OpenCL #TesseractとOpenCL
OpenCL is an API which allows portable usage of GPU computing resources. OpenCLはGPUコンピューティングリソースの移植可能な使用を可能にするAPIです。
It is support for Linux, macOS and Windows. それはLinux、macOSそしてWindowsのサポートです。
Modern graphic cards can do some computations which are needed for Tesseract very fast. 最近のグラフィックカードはTesseractに必要ないくつかの計算を非常に速くすることができます。
By using that compute power, Tesseract ideally can be made faster. その計算能力を使うことによって、Tesseractは理想的にはより速くすることができます。
# How to build Tesseract with OpenCL #OpenCLでTesseractをビルドする方法
Important note: OpenCL support in Tesseract is still considered experimental. There are some major bugs associated with it (see issue 837). Building Tesseract with OpenCL support is not recommended (for any version of Tesseract), unless you are a developer and want to improve the OpenCL code. 重要な注意事項:TesseractでのOpenCLサポートはまだ実験的なものと見なされています。それに関連するいくつかの主要なバグがあります(issue 837を参照してください)。あなたが開発者であり、OpenCLコードを改善したいのでなければ、OpenCLサポートでTesseractをビルドすることはお勧めできません(Tesseractのどのバージョンでも)。
## Building Tesseract on VS 2010 with OpenCL ## OpenCLによるVS 2010でのTesseractの構築
1 Open the Tesseract Visual Studio 2010 solution file under \tesseract-ocr\vs2010\tesseract.sln
2 Select the required build configuration (LIB_DEBUG / LIB_RELEASE / DLL_DEBUG / DLL_RELEASE)
3 Set up the OpenCL paths in “tesseract” project:
* Right click on “tesseract” project and select Properties *「tesseract」プロジェクトを右クリックして「プロパティ」を選択します。
* Header file paths : Go to Configuration Properties -> C/C++ -> General -> Additional Include Directories. Add the directory path where OpenCL header files are located on the given machine. E.g: On a machine with AMD APP SDK installed, this path will be $(AMDAPPSDKROOT)include. *ヘッダーファイルのパス:[構成プロパティ] - > [C / C ++] - > [一般] - > [追加のインクルードディレクトリ]に移動します。指定されたマシン上のOpenCLヘッダーファイルが配置されているディレクトリパスを追加します。例:AMD APP SDKがインストールされているコンピュータにパスは$(AMDAPPSDKROOT)インクルードになります。
* Library file path : Go to Configuration Properties -> Linker -> General -> Additional Library Directories. Add the directory path where OpenCL library file, OpenCL.lib is located on the given machine. E.g: On a machine with AMD APP SDK installed, this path will be $(AMDAPPSDKROOT)lib\x86. *ライブラリファイルのパス:[構成プロパティ] - > [リンカ] - > [一般] - > [追加のライブラリディレクトリ]に移動します。 OpenCLライブラリファイルOpenCL.libが所定のマシン上にあるディレクトリパスを追加します。例:AMD APP SDKがインストールされているコンピュータにパスは$(AMDAPPSDKROOT)lib \ x86になります。
* Library reference : Go to Configuration Properties -> Linker -> Input -> Additional Dependencies. Add OpenCL.lib to the list of dependent libraries. *ライブラリ参照:[構成プロパティ] - > [リンカ] - > [入力] - > [その他の依存関係]に移動します。依存ライブラリのリストにOpenCL.libを追加します。
* Preprocessor definition : Go to Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions. Add USE_OPENCL to the list of preprocessor definitions list. *プリプロセッサー定義:「構成プロパティー」 - >「C / C ++」 - >「プリプロセッサー」 - >「プリプロセッサー定義」に進みます。プリプロセッサ定義リストのリストにUSE \ _OPENCLを追加します。
4 Repeat the same steps as point 3 above to set OpenCL paths for “libtesseract” project
5 Build and run the solution.
## Building Tesseract on Linux with OpenCL ## OpenCLを使ってLinuxでTesseractをビルドする
1. Make sure you have installed OpenCL sdk and libtiff-dev 1. OpenCL SDKとlibtiff-devがインストールされていることを確認してください。
1. The OpenCL header and library paths are currently defined by the variables OPENCL_HDR_PATH and OPENCL_LIB in configure.ac. These have to be set to the appropriate paths depending on the OpenCL installation. 1. OpenCLヘッダーとライブラリパスは現在configure.acの変数OPENCL \ _HDR \ _PATHとOPENCL \ _LIBによって定義されています。これらはOpenCLのインストールに応じて適切なパスに設定する必要があります。
1. To build on Linux use 1. Linux上でビルドする
` | `
./configure --enable-opencl ./configure --enable-opencl
` | `
or if you want to specified opencl include (/opt/AMDAPP/include/) and library (/opt/AMDAPP/lib/x86_64/) paths: またはopencl include( / opt / AMDAPP / include /)とライブラリ( / opt / AMDAPP / lib / x86_64 /)のパスを指定したい場合は、
` | `
export LIBRARY_PATH=/opt/AMDAPP/lib/x86_64/:$LIBRARY_PATH export LIBRARY_PATH = / opt / AMDAPP / lib / x86_64 /:$ LIBRARY_PATH
CPPFLAGS+=-I/opt/AMDAPP/include/ ./configure --enable-opencl CPPFLAGS + = - I / opt / AMDAPP / include / ./configure --enable-opencl
` | `
# Using Tesseract with OpenCL #OpenCLでTesseractを使う
Normally Tesseract works with OpenCL Installable Client Drivers (ICD). 通常Tesseractは OpenCL Installable Client Drivers (ICD)で動作します。
It tests for available OpenCL drivers at runtime, so a Tesseract binary can work with different GPU hardware on different computers. All you have to do is installing the OpenCL driver for your GPU hardware. There also exists a generic OpenCL driver which uses the CPU instead of a GPU. More than one OpenCL driver can be enabled for a computer system. 実行時に利用可能なOpenCLドライバをテストするので、Tesseractバイナリは異なるコンピュータ上の異なるGPUハードウェアで動作することができます。 GPUハードウェア用のOpenCLドライバをインストールするだけです。 GPUの代わりにCPUを使用する一般的なOpenCLドライバもあります。コンピュータシステムに対して複数のOpenCLドライバを有効にすることができます。
When Tesseract with OpenCL support is started the first time, it looks for the available OpenCL drivers and runs benchmarks for each of them. In addition, the same benchmarks are run using the native CPU (without OpenCL). The benchmark results are saved in a file tesseract_opencl_profile_devices.dat in the current directory for future runs. Tesseract calculates a weighted performance index from all benchmark results and choses the fastest method for its calculations. Delete the file to force a rebuild. The generated GPU code for each OpenCL driver is also saved in individual files named kernel- plus the name of the driver plus .bin, for example kernel-Intel(R)_HD_Graphics_IvyBridge_M_GT2.bin. Delete those files after an update of your OpenCL software to force a rebuild. Tesseract with OpenCLサポートが最初に起動されるとき、それは利用可能なOpenCLドライバを探し、それぞれのベンチマークを実行します。さらに、同じベンチマークがネイティブCPU(OpenCLなし)を使用して実行されます。ベンチマーク結果は将来の実行のために現在のディレクトリのファイル tesseract_opencl_profile_devices.datに保存されます。 Tesseractは、すべてのベンチマーク結果から加重パフォーマンスインデックスを計算し、その計算に最速の方法を選択しました。ファイルを削除して再構築を強制します。各OpenCLドライバ用に生成されたGPUコードは、 kernel-という名前の個々のファイルにドライバの名前と .bin 'を加えたものにも保存されます。例えば、 kernel-Intel(R)_HD_Graphics_IvyBridge_M_GT2.bin`です。強制的に再構築するには、OpenCLソフトウェアの更新後にこれらのファイルを削除してください。
It is possible to override the automatic choice by setting the environment variable TESSERACT_OPENCL_DEVICE, for example TESSERACT_OPENCL_DEVICE=1 selects the first OpenCL device. As the native CPU has also a device number (always the highest number) in Tesseract, use of OpenCL can be disabled by setting that number. 環境変数TESSERACT_OPENCL_DEVICEを設定することで自動選択を無効にすることができます。例えば、TESSERACT OPENCL DEVICE = 1は最初のOpenCLデバイスを選択します。 TesseractではネイティブCPUにもデバイス番号(常に最大の番号)があるため、その番号を設定することでOpenCLの使用を無効にすることができます。
## Installable Client Drivers for OpenCL (ICD) ## OpenCL用のインストール可能なクライアントドライバ(ICD)
These Debian packages provide such drivers: これらのDebianパッケージは、そのようなドライバを提供します。
* amd-opencl-icd – AMD Radeon GPU * amd-opencl-icd - AMD Radeon GPU
* beignet-opencl-icd – Intel GPU * beignet-opencl-icd - インテルGPU
* mesa-opencl-icd – AMD GPU * mesa-opencl-icd - AMD GPU
* nvidia-egl-icd – NVIDIA GPU * nvidia-egl-icd - NVIDIA GPU
* nvidia-legacy-304xx-opencl-icd – NVIDIA GPU * nvidia-legacy-304xx-opencl-icd - NVIDIA GPU
* nvidia-legacy-340xx-opencl-icd – NVIDIA GPU * nvidia-legacy-340xx-opencl-icd - NVIDIA GPU
* nvidia-opencl-icd – NVIDIA GPU * nvidia-opencl-icd - NVIDIA GPU
* pocl-opencl-icd – native CPU * pocl-opencl-icd - ネイティブCPU
It is possible to enable debug messages for some drivers by setting environment variables (example). 環境変数を設定することで、一部のドライバのデバッグメッセージを有効にすることができます(example)。
## OpenCL devices (examples) ## OpenCLデバイス(例)
### Linux (x86) ### Linux(x86)
* Intel(R) HD Graphics IvyBridge M GT2 *インテル(R)HDグラフィックスIvyBridge M GT2
* pthread-Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz * pthread-インテル(R)コア(TM)i7-3520M CPU @ 2.90GHz
* pthread-Intel(R) Xeon(R) CPU E5620 @ 2.40GHz * pthread-インテル(R)Xeon(R)CPU E5620 @ 2.40 GHz
### macOS ### マックOS
### Windows ###ウィンドウズ
* pthread-Intel(R) Core(TM) i5 CPU 650 @ 3.20GHz * pthread-インテル(R)コア(TM)i5 CPU 650 @ 3.20 GHz
## Performance ##パフォーマンス
Only some parts of the OCR process are handled by OpenCL, so using OpenCL does not necessarily result in much faster OCR. More precise measurements have to be done. OCRプロセスの一部のみがOpenCLによって処理されるため、OpenCLを使用しても必ずしもOCRが高速になるわけではありません。より正確な測定をする必要があります。
## Known problems ##既知の問題
OpenCL is still experimental, so expect possible crashes, wrong OCR results or bad instead of improved performance. OpenCLはまだ実験的なものなので、パフォーマンスの向上ではなく、起こり得るクラッシュ、誤ったOCR結果、または悪い結果が予想されます。
最終更新:2019年06月18日 20:17