LoginSignup
1
1

More than 5 years have passed since last update.

openpose-plus をコンパイルする(動作までは未確認)

Last updated at Posted at 2018-10-08

推論部分が C++ で書かれている openpose-plus を動かしたいですね

動作までは確認できませんでしたが, コンパイルまでは確認しました.

環境

  • Ubuntu 16.04
  • CUDA 9.0(CUDA 9.2 でも動くかも)
  • cuDNN 7.3, TensorRT4
  • conda で python 3.6 環境
  • CMake <= 3.10(3.11 以降だと openpose-plus の CMake の書き方が悪いのか No SOURCE given to target というエラーが出ます)

TensorRT は deb パッケージをインストール後, sudo apt update し, sudo apt install libnvinfer-dev で開発ライブラリ(NvInter.h)をインストールしておく必要があります.

Ubuntu 16.04 では OpenCV3 は apt では提供されないため, conda のパッケージ, もしくは自前で OpenCV3 をビルドします.
(自前 OpenCV ビルドだと, CUDA のビルドをうまく処理しないといけないので注意です)

conda の場合は以下です.

$ conda install -c conda-forge opencv

opencv_DIR で cmake OpenCV package のパスを指定して cmake を bootstrap するように Makefile を書き換えます.

...
cmake_targets:
        mkdir -p $(BUILD_DIR)
        cd $(BUILD_DIR); opencv_DIR=$HOME/miniconda3/envs/py36/share/OpenCV cmake ...
...

また, Ubuntu では file system は case sensitive にしているので,
cmake/openpose-plus.cmake, cmake/example.cmake

find_package(opencv)

となっていたら

find_package(OpenCV)

に修正しておきます. (PR は取り込まれているので最新 repo なら修正不要: https://github.com/tensorlayer/openpose-plus/pull/102 )

必要に応じて cmake/openpose-plus.cmake での CUDA_RT のパスを変えます.

すでに cmake-build があればそれを消して, 再度 cmake && make します.

$ make

gflags が見つからないと出ますが, apt で入る libgflags-dev では gflags の CMake パッケージがないので warning が出ますがとりあえずビルドできるはずです
(https://github.com/gflags/gflags/issues/248)

TODO

  • サンプルの実行まで行う(pretrained model のセットアップやらが必要だがそのあたりドキュメントがない. openpose から持ってきて freeze すればいいのかな?)
  • openpose-plus のコード自体は Apache 2.0 ライセンスで商用利用も可能だが, OpenPose 自体は別のライセンスなので, OpenPose 由来のモデルデータを使っていたり, openpose-plus に OpenPose のコードが含まれている場合は注意が必要なので, ライセンス周りクリアにする.
1
1
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
1
1