概要
openposeをクローンから動かすまでを公式githubページに沿って動かしました
基本的にはgithubのページを見て動かしてほしいと思います
今回の記事ではエラーなどで引っかかった所を共有しています
mac mini(2018)
バージョン
macOS Big Sur 11.4
メモリはインテルCPUオンリー(M1もGPUも入っていません)
動かすまで
フレームワークやライブラリをインストール
homebrewをインストールする
- この部分は他のサイトを調べてください
CMake-GUIをインストール
- ここでエラーを出すことがあるので、遭遇したエラーを見てください
brew cask install cmake
OpenCV等インストール
bash scripts/osx/install_deps.sh
リポジトリのクローン
任意のディレクトリでクローンして、移動、gitアップデート
git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose
cd openpose/
git submodule update --init --recursive --remote
openposeのcmakeのビルド設定をする
cd {OpenPose_folder}
mkdir build/
cd build/
cmake-gui ..
Where is the source code:にはopenposeフォルダを指定する.
Where to the binaries:にはopenposeフォルダ内のbuildフォルダを指定する
BUILD_PYTHONにチェックを入れました
設定を変えた場合はconfigで設定を反映する
その後Generateボタンでバイナリを生成する
実際にbuildをする
cd build/
make -j`sysctl -n hw.logicalcpu`
ここでエラーが出てbuildがうまくいかないことがあるので遭遇エラーを見てください
遭遇したエラー
caskでのインストールエラー
$ brew tap caskroom/cask
Error: caskroom/cask was moved. Tap homebrew/cask instead.
解決方法
$ brew tap homebrew/cask
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'...
remote: Enumerating objects: 579900, done.
remote: Counting objects: 100% (90/90), done.
remote: Compressing objects: 100% (51/51), done.
remote: Total 579900 (delta 46), reused 78 (delta 39), pack-reused 579810
Receiving objects: 100% (579900/579900), 255.27 MiB | 26.45 MiB/s, done.
Resolving deltas: 100% (409542/409542), done.
Tapped 3941 casks (4,020 files, 273.9MB).
cmake-guiでの起動できないエラー
$ cmake-gui ..
zsh: command not found: cmake-gui
解決方法
$ brew uninstall cmake
Warning: Treating cmake as a formula. For the cask, use homebrew/cask/cmake
Uninstalling /usr/local/Cellar/cmake/3.20.5... (6,468 files, 69.6MB)
$ brew install --cask cmake
==> Downloading https://cmake.org/files/LatestRelease/cmake-3.20.5-macos-universal.dmg
Already downloaded: /Users/名前/Library/Caches/Homebrew/downloads/199a12a176e3b345c68ba2f3e276e1c90ee1861fb09036b0df711d29ede981bc--cmake-3.20.5-macos-universal.dmg
==> Installing Cask cmake
==> Moving App 'CMake.app' to '/Applications/CMake.app'
==> Linking Binary 'ccmake' to '/usr/local/bin/ccmake'
==> Linking Binary 'cpack' to '/usr/local/bin/cpack'
==> Linking Binary 'ctest' to '/usr/local/bin/ctest'
==> Linking Binary 'cmake-gui' to '/usr/local/bin/cmake-gui'
==> Linking Binary 'cmake' to '/usr/local/bin/cmake'
==> Linking Manpage 'cmake-buildsystem.7' to '/usr/local/share/man/man7/cmake-buildsystem.7'
==> Linking Manpage 'cmake-commands.7' to '/usr/local/share/man/man7/cmake-commands.7'
==> Linking Manpage 'cmake-compile-features.7' to '/usr/local/share/man/man7/cmake-compile-features.7'
==> Linking Manpage 'cmake-developer.7' to '/usr/local/share/man/man7/cmake-developer.7'
==> Linking Manpage 'cmake-file-api.7' to '/usr/local/share/man/man7/cmake-file-api.7'
==> Linking Manpage 'cmake-generator-expressions.7' to '/usr/local/share/man/man7/cmake-generator-expressions.7'
==> Linking Manpage 'cmake-generators.7' to '/usr/local/share/man/man7/cmake-generators.7'
==> Linking Manpage 'cmake-language.7' to '/usr/local/share/man/man7/cmake-language.7'
==> Linking Manpage 'cmake-modules.7' to '/usr/local/share/man/man7/cmake-modules.7'
==> Linking Manpage 'cmake-packages.7' to '/usr/local/share/man/man7/cmake-packages.7'
==> Linking Manpage 'cmake-policies.7' to '/usr/local/share/man/man7/cmake-policies.7'
==> Linking Manpage 'cmake-presets.7' to '/usr/local/share/man/man7/cmake-presets.7'
==> Linking Manpage 'cmake-properties.7' to '/usr/local/share/man/man7/cmake-properties.7'
==> Linking Manpage 'cmake-qt.7' to '/usr/local/share/man/man7/cmake-qt.7'
==> Linking Manpage 'cmake-server.7' to '/usr/local/share/man/man7/cmake-server.7'
==> Linking Manpage 'cmake-toolchains.7' to '/usr/local/share/man/man7/cmake-toolchains.7'
==> Linking Manpage 'cmake-variables.7' to '/usr/local/share/man/man7/cmake-variables.7'
==> Linking Manpage 'cpack-generators.7' to '/usr/local/share/man/man7/cpack-generators.7'
==> Linking Manpage 'cmake-env-variables.7' to '/usr/local/share/man/man7/cmake-env-variables.7'
==> Linking Manpage 'cmake.1' to '/usr/local/share/man/man1/cmake.1'
==> Linking Manpage 'ccmake.1' to '/usr/local/share/man/man1/ccmake.1'
==> Linking Manpage 'cpack.1' to '/usr/local/share/man/man1/cpack.1'
==> Linking Manpage 'ctest.1' to '/usr/local/share/man/man1/ctest.1'
==> Linking Manpage 'cmake-gui.1' to '/usr/local/share/man/man1/cmake-gui.1'
🍺 cmake was successfully installed!
build時のエラー
20個ほどのエラーが出ましたみたいなエラー
解決方法
$ rm -rf build
$ mkdir build
$ cd build
$ brew uninstall caffe
$ brew install caffe
動かす際
とりあえず動くか確認
# Ubuntu and Mac
./build/examples/openpose/openpose.bin --video examples/media/video.avi
以下は公式ページを確認して動かしてみてください
参照記事まとめ
openposeを動かすには公式githubを利用しました
デモプログラムを動かす際のインストールや設定など
https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation/0_index.md
プログラムを実際に動かす
https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/01_demo.md