cvl-robot's diary

研究ノート メモメモ https://github.com/dotchang/

せっかくインストールしたのでOpenVINOのサンプルを実行してみる

このページのサンプルを試してみます。
software.intel.com

画像分類

AlexNetモデルの変換

OpenCV-extraのAlexNetのモデルをOpenVINO向けに変換して使います。
モデル変換用コードは、C:\Intel\computer_vision_sdk_2018.2.304\deployment_tools\model_optimizerフォルダにあります。

mo_caffe.py --input_model e:\opencv_extra\testdata\dnn\bvlc_alexnet.caffemodel --input_proto e:\opencv_extra\testdata\dnn\bvlc_alexnet.prototxt

bvlc_alexnet.bin, bvlc_alexnet.mapping, bvlc_alexnet.xmlの3つのファイルが出力されます。これを、clasification_sample.exeから見える場所に置きます。手っ取り早くは、同じ場所にコピーします。

実行テスト

classification_sample.exe -i e:\opencv_extra\testdata\dnn\dog416.png -m bvlc_alexnet.xml

[ INFO ] InferenceEngine:
API version ............ 1.1
Build .................. 11653
[ INFO ] Parsing input parameters
[ INFO ] Loading plugin

API version ............ 1.1
Build .................. win_20180511
Description ....... MKLDNNPlugin
[ INFO ] Loading network files:
bvlc_alexnet.xml
bvlc_alexnet.bin
[ INFO ] Preparing input blobs
[ WARNING ] Image is resized from (416, 416) to (227, 227)
[ INFO ] Batch size is 1
[ INFO ] Preparing output blobs
[ INFO ] Loading model to the plugin
[ INFO ] Starting inference (1 iterations)
[ INFO ] Average running time of one iteration: 24.5096 ms
[ INFO ] Processing output blobs

Top 10 results:

Image e:\opencv_extra\testdata\dnn\dog416.png

250 0.1841287 label #250
249 0.1796786 label #249
248 0.0701520 label #248
537 0.0376270 label #537
174 0.0250397 label #174
257 0.0247385 label #257
254 0.0223720 label #254
245 0.0205516 label #245
151 0.0167213 label #151
171 0.0140692 label #171

[ INFO ] Execution successful

動いてはいるようですが、合っているかどうか分かりませんね。

同じようにGoogleNetの変換とテスト

mo_caffe.py --input_model e:\opencv_extra\testdata\dnn\bvlc_googlenet.caffemodel --input_proto e:\opencv_extra\testdata\dnn\bvlc_googlenet.prototxt

> classification_sample.exe -i e:\opencv_extra\testdata\dnn\dog416.png -m bvlc_googlenet.xml

[ INFO ] InferenceEngine:
API version ............ 1.1
Build .................. 11653
[ INFO ] Parsing input parameters
[ INFO ] Loading plugin

API version ............ 1.1
Build .................. win_20180511
Description ....... MKLDNNPlugin
[ INFO ] Loading network files:
bvlc_googlenet.xml
bvlc_googlenet.bin
[ INFO ] Preparing input blobs
[ WARNING ] Image is resized from (416, 416) to (224, 224)
[ INFO ] Batch size is 1
[ INFO ] Preparing output blobs
[ INFO ] Loading model to the plugin
[ INFO ] Starting inference (1 iterations)
[ INFO ] Average running time of one iteration: 24.9105 ms
[ INFO ] Processing output blobs

Top 10 results:

Image e:\opencv_extra\testdata\dnn\dog416.png

250 0.3507370 label #250
249 0.2820407 label #249
248 0.1186542 label #248
198 0.1117227 label #198
196 0.0621706 label #196
537 0.0218948 label #537
172 0.0084112 label #172
176 0.0068888 label #176
676 0.0056729 label #676
197 0.0039623 label #197

[ INFO ] Execution successful

画像分類非同期

classification_sample_async.exe e:\opencv_extra\testdata\dnn\dog416.png -m bvlc_googlenet.xml -i e:\opencv_extra\testdata\dnn\dog416.png
[ INFO ] InferenceEngine:
API version ............ 1.1
Build .................. 11653
[ INFO ] Parsing input parameters
[ INFO ] Parsing input parameters
[ INFO ] Loading plugin

API version ............ 1.1
Build .................. win_20180511
Description ....... MKLDNNPlugin
[ INFO ] Loading network files
[ INFO ] Preparing input blobs
[ WARNING ] Image is resized from (416, 416) to (224, 224)
[ INFO ] Batch size is 1
[ INFO ] Preparing output blobs
[ INFO ] Loading model to the plugin
[ INFO ] Start inference (1 iterations)
total: 39.2591

Throughput: 25.4718 FPS

[ INFO ] Processing output blobs

Top 10 results:

Image e:\opencv_extra\testdata\dnn\dog416.png

250 0.3507370 label #250
249 0.2820407 label #249
248 0.1186542 label #248
198 0.1117227 label #198
196 0.0621706 label #196
537 0.0218948 label #537
172 0.0084112 label #172
176 0.0068888 label #176
676 0.0056729 label #676
197 0.0039623 label #197

[ INFO ] Execution successful

セキュリティバリアカメラ

security_barrier_camera_sample.exe -m C:\Intel\computer_vision_sdk_2018.2.304\deployment_tools\intel_models\vehicle-license-plate-detection-barrier-0007\FP32\vehicle-license-plate-detection-barrier-0007.xml -m_va C:\Intel\computer_vision_sdk_2018.2.304\deployment_tools\intel_models\vehicle-attributes-recognition-barrier-0039\FP32\vehicle-attributes-recognition-barrier-0039.xml -m_lpr C:\Intel\computer_vision_sdk_2018.2.304\deployment_tools\intel_models\license-plate-recognition-barrier-0001\FP32\license-plate-recognition-barrier-0001.xml

InferenceEngine:
API version ............ 1.1
Build .................. 11653
[ INFO ] Parsing input parameters
[ INFO ] Reading input
[ INFO ] Loading plugin CPU

API version ............ 1.1
Build .................. win_20180511
Description ....... MKLDNNPlugin
[ INFO ] Loading network files for VehicleDetection
[ INFO ] Batch size is forced to 1
[ INFO ] Checking Vehicle Detection inputs
[ INFO ] Checking Vehicle Detection outputs
[ INFO ] Loading Vehicle Detection model to the CPU plugin
[ INFO ] Loading network files for VehicleAttribs
[ INFO ] Batch size is forced to 1 for Vehicle Attribs
[ INFO ] Checking VehicleAttribs inputs
[ INFO ] Checking Vehicle Attribs outputs
[ INFO ] Loading Vehicle Attribs model to the CPU plugin
[ INFO ] Loading network files for Licence Plate Recognition (LPR)
[ INFO ] Batch size is forced to 1 for LPR Network
[ INFO ] Checking LPR Network inputs
[ INFO ] Checking LPR Network outputs
[ INFO ] Loading LPR model to the CPU plugin
[ INFO ] Start inference

f:id:cvl-robot:20180725211106p:plain

mo_caffe.py --input_model e:\opencv_extra\testdata\dnn\bvlc_googlenet.caffemodel --input_proto e:\opencv_extra\testdata\dnn\bvlc_googlenet.prototxt

object_detection_sample.exe -i e:\opencv_extra\testdata\dnn\dog416.png -m VGG16_faster_rcnn_final.xml

f:id:cvl-robot:20180725214907j:plain

**

object_detection_sample.exe -m C:\Intel\computer_vision_sdk_2018.2.304\deployment_tools\intel_models\person-detection-retail-0001\FP32\person-detection-retail-0001.xml --bbox_name detector/bbox/ave_pred -i e:\opencv_extra\testdata\dnn\googlenet_0.png

f:id:cvl-robot:20180725215603j:plain

あっさり簡単に動きます。
まだ途中ですが、面倒くさくなってしまったので今日はここまで。