3
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

windows環境でのOpenVINO導入テスト

Last updated at Posted at 2019-10-08

CEDECで見かけた&顔認識をOpenCVから進歩させたいので,やってみた.
やったことと,つまづきのメモ
ベースは
https://docs.openvinotoolkit.org/2019_R1/_docs_install_guides_installing_openvino_windows.html#Using-Demo-Scripts
https://docs.openvinotoolkit.org/2019_R2/_docs_install_guides_installing_openvino_windows.html#set-the-environment-variables
http://docs.openvinotoolkit.org/2019_R3/_docs_install_guides_installing_openvino_windows.html

#実行環境
2019.10.08
DELL Note
intel core i7-6700HQ
intel HD Graphics 530(GeForce 960Mも搭載)
windows10 64bit
Unityインストール済のため,Visual Studio 2015,2017が導入済み
グラフィックスドライバ(特にいじってない)
intel 23.20.16.4973
NVidia 391.25

#導入
OpenVINO 2019.R3
intelのサイトから登録とダウンロードし,インストールする.
(適当な情報でも問題なかった)
https://software.intel.com/en-us/openvino-toolkit/choose-download
このときserial numberがもらえるけど,いつ使うのかわからない.
フルパッケージ250MB

コマンドプロンプトから
c:\Program Files (x86)\IntelSWTools\openvino\bin>setupvars.bat

Python入ってないので,エラーがでる.
Python 3.5 or 3.6(64bit)が必要といわれる.
Python 3.7.4でもいいかと思って,入れたけど,エラーになった.
x86の32bit版もダメだった.
この場合,アンインストールしてから,入れなおす.

以下のリンクから
https://www.python.org/downloads/release/python-368/
Windows x86-64 executable installer
を辿り,
python-3.6.8-amd64.exe
をダウンロードする.
インストールする過程で,
add python pathにチェックし,パスを通す.
パスを通した後は,コマンドプロンプトを再起動する.
インストールの最後に,
disable path length~みたいなのが出たら,クリックして,実行する.(以降出なくなる)

さっき,動かなかった
c:\Program Files (x86)\IntelSWTools\openvino\bin>setupvars.bat
を実行する.
pythonのパスを通すだけなので,すぐに終わる.
パスを通した後は,コマンドプロンプトを再起動する.

モデルオプティマイザを行う.(意味わからない)
c:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\model_optimizer\install_prerequisites>install_prerequisites.bat
すると,いろいろダウンロードしながら,5分ぐらいかけて,エラーが出た.

まだCMake入ってないので入れる.
https://cmake.org/download/
から
cmake-3.15.4-win64-x64.msi
をダウンロードしてインストールする.
途中,pathを通す選択肢があるので,通す.
パスを通した後は,コマンドプロンプトを再起動する.

モデルオプティマイザを行うが,まだエラーが出る.
CMakeError.logを参照する.
gdi32.libが見つからないエラーが頻発しているのを確認.
調べると,windows creater updateが原因の様子.

Visual Studio 2017でこの問題が発生した場合は、Windows 10 Creators Updateの問題です。この問題を回避するには、Visual Studioインストーラーの「Cでのデスクトップ開発」ワークロードの下にある「デスクトップC x86およびx64用のWindows 10 SDK(10.0.15063.0)」を選択します。

解決法はwindows()SDKを,こちらからインストール.
https://developer.microsoft.com/ja-jp/windows/downloads/windows-10-sdk
3GBあるので,かなり時間がかかる
※しばらくして戻ったら,windows updateで再起動していた!

モデルオプティマイザを無事終える.

デモの実行をし,動作確認を行う.
cd C:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\demo
demo_squeezenet_download_convert_run.bat
数分かけて,結果が出るが,文字ベースなのでつまらない.
demo_security_barrier_camera.bat
demo_security_barrier_camera.bat -d GPU
CPUで59FPS
GPUで34FPS
あれ?
CPU.png
GPU.png

テスト完了
#顔認識
OpenCVより進んだ顔認識を見たかったので,それっぽいサンプルのビルドにトライ.
仕組みはわからないが,とりあえず動いた.pythonもxmlも使いどころが分からない.

c:\Program Files (x86)\IntelSWTools\openvino\deployment_tools\open_model_zoo\demos>build_demos_msvc.bat
めちゃくちゃ警告出て,最後に

121 個の警告
0 エラー
経過時間 00:05:59.46
Done.

ビルド結果はドキュメントの下に出力される.
コマンドラインから
~Documents\Intel\OpenVINO\omz_demos_build\intel64\Release
interactive_face_detection_demo.exe
を実行すると,dllが足りないとたくさん出るので,ファイル検索して,
inference_engin.dll
opencv_core412.dll
opencv_highgui412.dll
opencv_imgcodecs412.dll
opencv_imgproc412.dll
opencv_videoio412.dll
これらを同一フォルダにコピーする.

https://download.01.org/openvinotoolkit/2018_R4/open_model_zoo/face-detection-adas-0001/FP32/
ここから
face-detection-adas-0001.bin
face-detection-adas-0001.xml
をダウンロードして,同一フォルダに置く.

plugins.xmlがないといわれるので,ここ
C:\Program Files (x86)\IntelSWTools\openvino_2019.3.334\deployment_tools\inference_engine\bin\intel64\Release
の中の,plugins.xmlとdllファイルをすべて同一フォルダに置いて,やっと動いた.
interactive_face_detection_demo.exe -i cam -m "face-detection-adas-0001.xml"
CPU使用率は65%で,40FPS

さらに,以下を追加して,
https://download.01.org/openvinotoolkit/2018_R3/open_model_zoo/age-gender-recognition-retail-0013/FP16/
age-gender-recognition-retail-0013.bin
age-gender-recognition-retail-0013.xml

https://download.01.org/opencv/2019/open_model_zoo/R1/20190404_140900_models_bin/head-pose-estimation-adas-0001/FP32/
head-pose-estimation-adas-0001.bin
head-pose-estimation-adas-0001.xml

コマンド修正して
interactive_face_detection_demo.exe -i cam -m "face-detection-adas-0001.xml" -m_ag "age-gender-recognition-retail-0013.xml" -m_hp "head-pose-estimation-adas-0001.xml"

CPU使用率は75%で,23FPS
推定年齢は「27歳」前後と出ました.
https___qiita-image-store.s3.ap-northeast-1.amazonaws.com_0_510257_b1f65821-1ff5-02b7-bb2a-ad6c95ed7289.jpg

オプションの意味や使い方はこのあたりから.
https://docs.openvinotoolkit.org/2019_R1/_inference_engine_samples_interactive_face_detection_demo_README.html
https://docs.openvinotoolkit.org/2019_R1/_docs_Pre_Trained_Models.html

3
7
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
3
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?