human_pose_estimation_demo

human_pose_estimation_demo を試してみました
このデモプログラムはcppとPythonの二つがありますが、今回はcppにチャレンジしてみました

今回のターゲット環境は
Ubuntu18.04
Intel(R) Atom(TM) Processor E3950 @ 1.60GHz
MemTotal: 8012260 kB
です

上記サイトでビルドしているようにビルドすれば、
~/omz_demos_build/ ディレクトリにデモがビルドされています

super_resolution_demoがビルドされているのであれば、
~/omz_demos_build/intel64/Release/human_pose_estimation_demo
として実行できます

モデルは、
/opt/intel/openvino_2021/deployment_tools/open_model_zoo/demos/human_pose_estimation_demo/cpp
にリストがあります
こちらを下記のコマンドでダウンロードしましょう

python3 /opt/intel/openvino_2021/deployment_tools/tools/model_downloader/downloader.py –list models.lst -o ~/intel_models

これで実行環境が整いました
サンプルとなるビデオは、
https://github.com/intel-iot-devkit/sample-videos
こちらから使用させてもらいます
下記コマンドで実行していますが、ネットから直接ファイルを読み込んでいますので、効率は悪いと思います

./omz_demos_build/intel64/Release/human_pose_estimation_demo -i https://github.com/intel-iot-devkit/sample-videos/blob/master/face-demographics-walking.mp4?raw=true -m intel_models/intel/human-pose-estimation-0001/FP16/human-pose-estimation-0001.xml -at openpose

実際に実行したものは、下記の映像です

次にNeural Compute Stick2を使用して、実行してみました
コマンドライン にオプションで、-d MYRIADを付け加えるだけです

FPSが5倍程度違いますね
このくらい早いと実用になりそうです

手元にもう一つNCS2があったので、MYRIAD MULTI環境を試してみました

$ ./omz_demos_build/intel64/Release/human_pose_estimation_demo -h
 [ INFO ] InferenceEngine:       API version ……… 2.1
         Build ……….. 2021.3.0-2787-60059f2c755-releases/2021/3
 human_pose_estimation [OPTION]
 Options:
 -h                        Print a usage message. -at "<type>"              Required. Type of the network, either 'ae' for Associative Embedding or 'openpose' for OpenPose. -i                          Required. An input to process. The input must be a single image, a folder of images, video file or camera id. -m "<path>"               Required. Path to an .xml file with a trained model. -o "<path>"                Optional. Name of output to save. -limit "<num>"             Optional. Number of frames to store in output. If 0 is set, all frames are stored. -tsize                      Optional. Target input size.   -l "<absolute_path>"    Required for CPU custom layers. Absolute path to a shared library with the kernel implementations.       Or   -c "<absolute_path>"    Required for GPU custom kernels. Absolute path to the .xml file with the kernel descriptions. -d "<device>"             Optional. Specify the target device to infer on (the list of available devices is shown below). Default value is CPU. Use "-d HETERO:<comma-separated_devices_list>" format to specify HETERO plugin. The demo will look for a suitable plugin for a specified device. -pc                       Optional. Enables per-layer performance report. -t                        Optional. Probability threshold for poses filtering. -nireq "<integer>"        Optional. Number of infer requests. If this option is omitted, number of infer requests is determined automatically. -nthreads "<integer>"     Optional. Number of threads. -nstreams                 Optional. Number of streams to use for inference on the CPU or/and GPU in throughput mode (for HETERO and MULTI device cases use format <device1>:<nstreams1>,<device2>:<nstreams2> or just <nstreams>) -loop                     Optional. Enable reading the input in a loop. -no_show                  Optional. Do not show processed video. -u                        Optional. List of monitors to show initially.
 Available target devices:  CPU  GNA  GPU  HDDL  MYRIAD.1.4-ma2480  MYRIAD.3.1-ma2480

ここで、Available target devicesにMYRIADが二つ表示されています
これを使用して、デモプログラムを走らせてみます

./omz_demos_build/intel64/Release/human_pose_estimation_demo -m intel_models/intel/human-pose-estimation-0001/FP16/human-pose-estimation-0001.xml -at openpose -i https://github.com/intel-iot-devkit/sample-videos/blob/master/face-demographics-walking.mp4?raw=true -d MULTI:MYRIAD.1.4-ma2480,MYRIAD.3.1-ma2480 -nireq 8 -nthreads 4 -nstreams 4

-dの指定をMULTIにするのと、-nireqの値をNCS2の個数の4倍にすることがコツのようです(https://github.com/yas-sim/openvino-multi-ncs2-throughput-mode

なんと倍の速度になりました
CPUと比較すると10倍です
ちゃんとマルチで使用できているようです