0
2

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 3 years have passed since last update.

【初心者】OpenPose 1.7.0 を使ってみる

Posted at

1. 目的

  • 画像/映像分析の勉強のため、簡単に骨格/姿勢推定ができるフレームワークであるOpenPose(1.7.0)を使ってみて基本を理解する。

2. やったこと

  • AWS上のWindows Server (GPUインスタンス)でOpenPoseを動かす。
  • 別記事にて作成したRTMP/HLSの中継サーバを通じて、手元のPCのOBS Studioの映像をAWS上のOpenPoseに流し、リアルタイムで映像分析を行う。

3. 構成図

openpose構成図.png

4. 実施手順

4.1 GPUインスタンスの用意

  • OpenPose を動作させるためのインスタンスを用意する。今回は以下の環境とした。
  • 初心者用のOpenPoseがWindows版で提供されているため、今回はOSはWindowsを選択した。

4.2 OpenPose のインストールと初期設定

  • OpenPose公式サイト」によると、初心者はWindowsで起動する portable version を使うとよいとのことで、それを使用する。

Installation
If you want to use OpenPose without installing or writing any code, simply download and use the latest Windows portable version of OpenPose!
Otherwise, you could build OpenPose from source. See the installation doc for all the alternatives.

  • OpenPoseダウンロードサイト」に、CPU版/GPU版のインストーラがある。今回はGPU版(openpose-1.7.0-binaries-win64-gpu-python3.7-flir-3d_recommended.zip)をダウンロードし、用意したインスタンスにインストールする。
  • インストール後のフォルダにあるInstructions.txtの内容に従い、バッチファイル「models/getBaseModels.bat」を実行し、必要なデータを追加でダウンロードする。

4.3 OpenPose の動作確認

インスタンス内のサンプル動画分析

  • インストーラに付属するサンプルの動画ファイルを分析する。
C:\Users\Administrator\openpose>bin\OpenPoseDemo.exe --video examples\media\video.avi
Starting OpenPose demo...
Configuring OpenPose...
Starting thread(s)...
Auto-detecting all available GPUs... Detected 1 GPU(s), using 1 of them starting at GPU 0.
OpenPose demo successfully finished. Total time: 28.162658 seconds.

openpose01.png

  • 約3秒の動画を分析しながら表示するのに28秒かかった。

手元のPCからの映像ストリームの分析

C:\Users\Administrator\openpose>bin\OpenPoseDemo.exe --ip_camera http://10.0.0.124/hls/stream/index.m3u8
Starting OpenPose demo...
Configuring OpenPose...
Starting thread(s)...
Auto-detecting all available GPUs... Detected 1 GPU(s), using 1 of them starting at GPU 0.
Empty frame detected, frame number 1477 of -2147483648. In C:\openpose\src\openpose\producer\producer.cpp:op::Producer::checkFrameIntegrity():290
Empty frame detected, frame number 1477 of -2147483648. In C:\openpose\src\openpose\producer\producer.cpp:op::Producer::checkFrameIntegrity():290
Empty frame detected, frame number 1477 of -2147483648. In C:\openpose\src\openpose\producer\producer.cpp:op::Producer::checkFrameIntegrity():290
OpenPose demo successfully finished. Total time: 193.846961 seconds.

openpose02.png

  • 映像を受信してリアルタイムで分析しようとするものの、30fpsの映像に対して8fpsくらいの処理しかできず、実時間とOpenPoseでの再生時間がどんどん差が開いていく状態になった。

4.4 補足

  • 今回、CPUインスタンス(c5.2xlarge, vCPU x8, memory 16GB)などでCPU版も試してみたが、CPU高負荷となり映像の分析は不可であり、GPU版が必須だった。

5. 所感

  • まずは入門できたので、ユースケースを考えてみるなど深堀できるようにしたい。
0
2
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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?