OSX 10.13.6
注意事项:官方说如果装有anaconda的话,会出现 protobuf 问题。不过可以解决。我还是选择在anaconda虚拟环境里安装opnepose。
- Ubuntu - Anaconda should not be installed on your system. Anaconda includes a Protobuf version that is incompatible with Caffe. Either you uninstall anaconda and install protobuf via apt-get, or you compile your own Caffe and link it to OpenPose.
一、环境准备
1、创建anaconda虚拟环境
conda create -n pose python=3.6
2、激活conda环境
source activate pose
二、安装
安装mac版的openpose官方安装教程: https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md#mac-osx-version
1、安装CMake GUI
- Mac:
brew cask install cmake
.
2、安装 Caffe Opencv Caffe
Mac - Caffe, OpenCV, and Caffe prerequisites:
- Install deps by running
bash 3rdparty/osx/install_deps.sh
on your terminal.
三、openpose配置
1、打开CMake GUI 配置
直接搜索CMake 打开即可
如果build文件夹不存在,将会询问是否创建build文件夹,建议提前手动创建一个build
2、点击Configure按钮,选择unix Makefiles,然后点击Finish
3、 如果这一步正常,将会出现这样的页面
这步如果报错:
CMake Error at /usr/share/cmake-3.5/Modules/ExternalProject.cmake:1915 (message):
No download info given for 'openpose_caffe' and its source directory:
/home/ashwin/center_for_robolution/Intelligent retail store Demonstration/Body detection/openpose/3rdparty/caffe
is not an existing non-empty directory. Please specify one of:
* SOURCE_DIR with an existing non-empty directory
* URL
* GIT_REPOSITORY
* HG_REPOSITORY
* CVS_REPOSITORY and CVS_MODULE
* SVN_REVISION
* DOWNLOAD_COMMAND
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/ExternalProject.cmake:2459 (_ep_add_download_command)
CMakeLists.txt:471 (ExternalProject_Add)
解决办法:
- cd 3rdparty
- git clone https://github.com/CMU-Perceptual-Computing-Lab/caffe.git
- Now, run cmake gui to Configure and Generate. (关闭CMake GUI,重新打开CMake,重新设置创建即可成功)
4、创建成功后即可关闭CMake GUI
5、编译OpenPose
cd build/
make -j`nproc`
如果一步出现如下问题:
fatal error: too many errors emitted, stopping now [-ferror-limit=]
45 warnings and 20 errors generated.
make[5]: *** [src/caffe/CMakeFiles/caffeproto.dir/__/__/include/caffe/proto/caffe.pb.cc.o] Error 1
make[4]: *** [src/caffe/CMakeFiles/caffeproto.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [caffe/src/openpose_caffe-stamp/openpose_caffe-build] Error 2
make[1]: *** [CMakeFiles/openpose_caffe.dir/all] Error 2
make: *** [all] Error 2
解决办法:
在以下两个文件里添加
set(CMAKE_CXX_STANDARD 11)
openpose/build/caffe/src/openpose_caffe-build/CMakeFiles/3.12.1/CMakeCXXCompiler.cmake
openpose/build/CMakeFiles/3.12.1/CMakeCXXCompiler.cmake
修改之后重新执行
make -j`nproc`
6、 编译结束,就可以开始使用OpenPose了
./build/examples/openpose/openpose.bin --video examples/media/video.avi
参考网站:
https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/423
https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/809