モデルは生成できたので、実際のプログラムについて学習するため、まずはOpenVINOを使った人物検出のサンプルを動かそうとしています。
実施ステップ自体は、以下を除いて順調でした。
- ダウンロードしたモデルのパスが指示されたものと違う場所に保存される
- 以下を実行していないと、ライブラリが見つからずエラーになる
https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_linux.html#additional-GPU-steps
動画処理のサーバーと、結果表示のサーバーを立ち上げた後、以下のコマンドで推論エンジンを動かします。オプションがいっぱい…
$ python main.py -i resources/Pedestrain_Detect_2_1_1.mp4 -m /opt/intel/openvino_2020.2.120/deployment_tools/open_model_zoo/tools/downloader/intel/person-detection-retail-0013/FP16/person-detection-retail-0013.xml -d GPU -pt 0.6 | ffmpeg -v warning -f rawvideo -pixel_format bgr24 -video_size 768x432 -framerate 24 -i - http://localhost:8090/fac.ffm
/home/hajime/anaconda3/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.6 of module 'openvino.inference_engine.ie_api' does not match runtime version 3.7
return f(*args, **kwds)
/home/hajime/git/people-counter-python/inference.py:64: DeprecationWarning: IEPlugin class is deprecated. Please use IECore class instead.
self.plugin = IEPlugin(device=device)
/home/hajime/git/people-counter-python/inference.py:73: DeprecationWarning: Reading network using constructor is deprecated. Please, use IECore.read_network() method instead
self.net = IENetwork(model=model_xml, weights=model_bin)
何か処理している模様(コマンドtopで確認)
Tasks: 396 total, 1 running, 298 sleeping, 0 stopped, 0 zombie
%Cpu(s): 4.3 us, 1.5 sy, 0.0 ni, 93.5 id, 0.6 wa, 0.0 hi, 0.1 si, 0.0 st
KiB Mem : 16229240 total, 4563420 free, 3769144 used, 7896676 buff/cache
KiB Swap: 32226300 total, 32226300 free, 0 used. 11937984 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
22442 hajime 20 0 7655008 569916 148320 S 42.5 3.5 0:45.51 python
22443 hajime 20 0 625216 50556 31144 S 7.3 0.3 0:00.35 ffmpeg
9388 hajime 20 0 4316264 661736 216508 S 7.0 4.1 123:09.63 firefox
9516 hajime 20 0 2905272 312560 93984 S 4.7 1.9 64:51.66 WebExtensi+
3615 root 20 0 500308 130992 78716 S 3.0 0.8 18:16.52 Xorg
3818 hajime 20 0 4398420 343244 112984 S 1.7 2.1 17:00.24 gnome-shell
4213 hajime 20 0 836384 47336 30168 S 1.3 0.3 0:36.15 gnome-term+
8023 hajime 20 0 2991952 241960 166936 S 0.7 1.5 3:49.20 Web Content
18103 hajime 20 0 730636 54768 29292 S 0.7 0.3 0:00.56 node
1 root 20 0 225980 9844 6784 S 0.3 0.1 0:43.63 systemd
809 root -51 0 0 0 0 S 0.3 0.0 0:39.39 irq/51-SYN+
1648 root -51 0 0 0 0 S 0.3 0.0 3:37.85 irq/184-nv+
17219 hajime 20 0 3361916 337700 242180 S 0.3 2.1 5:23.82 Web Content
17955 root 20 0 510784 36504 28704 S 0.3 0.2 0:00.14 ffserver
19914 root 20 0 0 0 0 I 0.3 0.0 0:00.13 kworker/0:+
22511 root 20 0 0 0 0 I 0.3 0.0 0:00.02 kworker/u2+
22561 hajime 20 0 52472 4300 3472 R 0.3 0.0 0:00.08 top
人物もまったり検出
Published to person <- {"count": 0}
Published to person <- {"count": 0}
Published to person <- {"count": 0}
Published to person <- {"count": 0}
Published to person <- {"total": 1}
Published to person <- {"count": 1}
Published to person <- {"count": 1}
Published to person <- {"count": 1}
Published to person <- {"count": 1}
Published to person <- {"count": 1}
でも http://localhost:8080 がエラー。検出結果見られず。
何故かログオフして、サーバーを起動しなおしたら、無事に動きました。
-i オプションを、サンプル動画の代わりにCAMとすると、PCのカメラ画像から人物の検出を行ってくれます。2人以上の人でも検出することができました。
Intel NCS2で推論を実行するには、こちらを参照に環境セットアップを行って、PCを再起動した上で、Intel NCS2をUSBポートに挿し、-d MYRIADオプションを指定して実行して下さい。
$ python main.py -i resources/Pedestrain_Detect_2_1_1.mp4 -m /opt/intel/openvino_2020.2.120/deployment_tools/open_model_zoo/tools/downloader/intel/person-detection-retail-0013/FP16/person-detection-retail-0013.xml -d MYRIAD -pt 0.6 | ffmpeg -v warning -f rawvideo -pixel_format bgr24 -video_size 768x432 -framerate 24 -i - http://localhost:8090/fac.ffm
コメント
[…] 前回の投稿の続きです。今回は学習済みモデルとしてNVIDIAがPyTorchで学習させたSSD300のモデルを利用を検討してみます。検討にあたり、NVIDIAがPyTorchで学習させたSSD300のモデルの特徴を分析してみます。 […]