image segmentation demo

image segmentation Demoを使う

Open Model Zoo内のDemoに格納されている
image segmentation demoのPython版 を使ってみましょう

実行環境

CPU: Intel(R) Core(TM) i7-6770HQ CPU @ 2.60GHz
MemTotal:       16318440 kB
OS: Ubuntu 16.04LTS

モデルのダウンロード

このデモ用のモデルはIntelから提供されていません
そのため、下記のサイトからダウンロードし、model optimizerでの変換が必要になります

ダウンロードサイト
https://github.com/shelhamer/fcn.berkeleyvision.org/tree/master/voc-fcn8s
deploy.prototxt と caffemodel-url を使用してモデルをダウンロードしてください

モデルの変換

fcn8s-heavy-pascal.caffemodel と deploy.prototxtと言う名前でダウンロードしたとします

python3 /opt/intel/openvino/deployment_tools/model_optimizer/mo.py --input_model ./fcn8s-heavy-pascal.caffemodel --input_proto deploy.prototxt
 
 Model Optimizer arguments:
 Common parameters:
 - Path to the Input Model:  /home/klf/download_model/./fcn8s-heavy-pascal.caffemodel
 - Path for generated IR:  /home/klf/download_model/.
 - IR output name:  fcn8s-heavy-pascal
 - Log level:  ERROR
 - Batch:  Not specified, inherited from the model
 - Input layers:  Not specified, inherited from the model
 - Output layers:  Not specified, inherited from the model
 - Input shapes:  Not specified, inherited from the model
 - Mean values:  Not specified
 - Scale values:  Not specified
 - Scale factor:  Not specified
 - Precision of IR:  FP32
 - Enable fusing:  True
 - Enable grouped convolutions fusing:  True
 - Move mean values to preprocess section:  False
 - Reverse input channels:  False
 Caffe specific parameters:
 - Path to Python Caffe* parser generated from caffe.proto:  /opt/intel/openvino/deployment_tools/model_optimizer/mo/front/caffe/proto
 - Enable resnet optimization:  True
 - Path to the Input prototxt:  /home/klf/download_model/deploy.prototxt
 - Path to CustomLayersMapping.xml:  Default
 - Path to a mean file:  Not specified
 - Offsets for a mean file:  Not specified
 Model Optimizer version:  2020.1.0-61-gd349c3ba4a
 

 [ SUCCESS ] Generated IR version 10 model.
 [ SUCCESS ] XML file: /home/klf/download_model/./fcn8s-heavy-pascal.xml
 [ SUCCESS ] BIN file: /home/klf/download_model/./fcn8s-heavy-pascal.bin
 [ SUCCESS ] Total execution time: 23.75 seconds. 
 [ SUCCESS ] Memory consumed: 3382 MB.   

こちらで変換が完了です

実行

 python3 ./segmentation_demo.py -i /opt/intel/openvino/deployment_tools/demo/car_1.bmp -m ~/download_model/fcn8s-heavy-pascal.xml
 [ INFO ] Creating Inference Engine
 [ INFO ] Loading network files:
 /home/klf/download_model/fcn8s-heavy-pascal.xml
 /home/klf/download_model/fcn8s-heavy-pascal.bin
 [ INFO ] Preparing input blobs
 [ WARNING ] Image /opt/intel/openvino/deployment_tools/demo/car_1.bmp is resized from (637, 749) to (500, 500)
 [ INFO ] Batch size is 1
 [ INFO ] Loading model to the plugin
 [ INFO ] Starting inference
 [ INFO ] Processing output blob
 [ INFO ] Result image was saved to ./out_0.bmp
 [ INFO ] This demo is an API example, for any performance measurements please use the dedicated benchmark_app tool from the openVINO toolkit 
input画像
output画像