0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PyInstallerでexe化したらOpenVINOモデルがエラーを吐き出すようになった

Posted at

背景

ディープラーニングモデルをCPU上でも高速に推論したい。

物体検出モデル(YOLO)を使ったアプリを作っているけど、ユーザーに高性能なGPUがないかもしれないからCPUで速く推論できるようにしたい。
OpenVINO形式に変換して量子化すればディープラーニングモデルを高速化できる。実際に変換した結果、結構速くなった。そこで、アプリを配布するためにPyInstallerでexe化した。

しかし、exe化したプログラムを実行したら、以下のエラーが出るようになった。exe化する前はエラーが出なかった。

RuntimeError: Exception from src\inference\src\cpp\core.cpp:124:
Exception from src\inference\src\dev\core_impl.cpp:567:
Device with "CPU" name is not registered in the OpenVINO Runtime

どうやら、OpenVINOが内部で使うDLLなどのライブラリが同封されていないことが原因っぽい。

解決法:specファイルでライブラリを明示的に同封

PyInstallerの.specファイルで、OpenVINOが必要とするライブラリを含めるよう指定。

a = Analysis(
    ...
    binaries=[(".venv/Lib/site-packages/openvino/libs", "openvino/libs")],
    ...
)

これで再exe化したら解決した。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?