简言
这里记录一下openpose(CPU)的安装过程,以及遇到的问题,耗费两天的时间,终于把openpose安好了。
之前我已经安装过caffe(CPU版本)了,但这里不推荐先安装caffe,应为目前最新版本的caffe是不与openpose兼容的,使用openpose自带的caffe比较好,即使已经安装了caffe使用openpose自带的caffe也不用卸载以前的caffe环境。
因为最后在python环境下调用openpose,这里没有选择编译example中的内容(因为选择它编译出错的问题还没有解决,正好也不需要)。
最主要还是参考作者提供的文档。
运行环境
Ubuntu16.04
Caffe cpu版本
protobuf 2.6.1
opencv 3.4.3
安装过程
如果有安装anaconda需要先将anaconda的环境先注释掉,因为anaconda自带的protobuf和caffe需要的protobuf版本冲突。
① git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git
② 根据官方文档指导安装CMake-GUI
③ 根据官方文档操作CMake-GUI完成预编译准备操作:
这里因为我使用是OpenPose推荐的caffe版本,所以还需要完成下面的操作:
cd OpenPoseRoot/3rdparty
rm -rf caffe/
git clone https://github.com/BVLC/caffe.git
这一步主要是将推荐的caffe版本下载到OpenPose工程中(若原先安装了caffe,不需要卸载)。
下面是我的Cmake选项:
④ sudo make -j8
⑤ 进入/home/pzs/husin/openPose/openpose-master/build/python/openpose
运行openpose.py就可以看到运行结果了
安装出现的问题
深度学习环境的安装所带来的问题非常令人头大,但出现的问题往往都有人遇到过,这里个人建议谷歌去解决这些问题(百度在解决该问题上表现得十分垃圾)
这里记录几个我遇到的问题及其解决办法
问题一(编译过程)
user@user-computer:~/caffe/build$ cmake -DBLAS=open ..
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- chrono
-- date_time
-- atomic
-- Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
-- Found glog (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so)
CMake Error at cmake/ProtoBuf.cmake:13 (message):
Could not find PROTOBUF Compiler
Call Stack (most recent call first):
cmake/Dependencies.cmake:43 (include)
CMakeLists.txt:46 (include)
-- Configuring incomplete, errors occurred!
See also "/home/user/caffe/build/CMakeFiles/CMakeOutput.log".
See also "/home/user/caffe/build/CMakeFiles/CMakeError.log".
这个问题折腾了我好半天,protobuf明明是已近安装了的,但是这里不断提示没有找到PROTOBUF Compiler,最后查看OpenPoseRoot/3rdparty/caffe/cmake/ProtoBuf.cmake
# As of Ubuntu 14.04 protoc is no longer a part of libprotobuf-dev package
# and should be installed separately as in: sudo apt-get install protobuf-compiler
if(EXISTS ${PROTOBUF_PROTOC_EXECUTABLE})
message(STATUS "Found PROTOBUF Compiler: ${PROTOBUF_PROTOC_EXECUTABLE}")
else()
message(FATAL_ERROR "Could not find PROTOBUF Compiler")
endif()
我选择重新安装一遍protobuf-compiler 该错误就解决了:
卸载:
sudo apt-get remove protobuf-compiler
安装:
sudo apt-get install protobuf-compiler
这个错误也太奇怪了。。。。。
问题二(编译过程):
这个问题比较普遍
提示找不到caffe/proto/caffe.pb.h,导致编译失败。
解决:
在caffe根目录下,终端操作:
caffe$ protoc src/caffe/proto/caffe.proto --cpp_out=.
caffe$ mkdir include/caffe/proto
caffe$ mv src/caffe/proto/caffe.pb.h include/caffe/proto/
问题3:
当在Cmake阶段选择USE_MKL选项编译会出现下面错误
fatal error: mkl.h: No such file or directory compilation terminated.
mkl是intel开发数学库,进过多线程优化,一般编译caffe(CPU)版本为了加快计算速度可以加入使用MKL,个人喜好,喜欢装就装。
运行代价
如果想用openPose来做一些应用的话考量其代价是很有必要的,下面是OpenPose在不同GPU/CPU下的运行速度:
可以说是非常吃硬件的了,想要实时运行至少需要两块GTX1080Ti显卡。
在Openpose安装的过程中有遇到问题的小伙伴可以在下面留言,don’t forget give the thumbs-up.