参考的博客:https://blog.csdn.net/qq_35468937/article/details/81514198,按照博客上的步骤操作,但是在安装过程中还是遇到了问题。我遇到的这些问题都非常诡异,谷歌、github issue上都没有类似的问题。苦思冥想,多次实验,终于找到了原因和解决办法。
操作系统:Ubuntu 18.04 LTS 64位
已安装的CUDA版本:CUDA9.0,安装教程https://blog.csdn.net/blgpb/article/details/82048478
OpenPose版本:OpenPose V1.4.0(https://github.com/CMU-Perceptual-Computing-Lab/openpose,Latest commit f4984c0 at 2019.2.20)
error详细内容:
ptxas /tmp/tmpxft_00002121_00000000-5_pyramidalLK.ptx, line 9; fatal : Unsupported .version 6.1; current version is '6.0'
ptxas fatal : Ptx assembly aborted due to errors
CMake Error at openpose_generated_pyramidalLK.cu.o.Release.cmake:279 (message):
Error generating file
/home/a421/YuWentao/huawei_fatigue_driving_detection/openpose/build/src/openpose/CMakeFiles/openpose.dir/tracking/./openpose_generated_pyramidalLK.cu.o
src/openpose/CMakeFiles/openpose.dir/build.make:112: recipe for target 'src/openpose/CMakeFiles/openpose.dir/tracking/openpose_generated_pyramidalLK.cu.o' failed
make[5]: *** [src/openpose/CMakeFiles/openpose.dir/tracking/openpose_generated_pyramidalLK.cu.o] Error 1
make[5]: *** Waiting for unfinished jobs....
ptxas /tmp/tmpxft_00002133_00000000-5_renderFace.ptx, line 9; fatal : Unsupported .version 6.1; current version is '6.0'
ptxas fatal : Ptx assembly aborted due to errors
ptxas /tmp/tmpxft_00002116_00000000-5_renderHand.ptx, line 9; fatal : Unsupported .version 6.1; current version is '6.0'
ptxas fatal : Ptx assembly aborted due to errors
CMake Error at openpose_generated_renderFace.cu.o.Release.cmake:279 (message):
Error generating file
/home/a421/YuWentao/huawei_fatigue_driving_detection/openpose/build/src/openpose/CMakeFiles/openpose.dir/face/./openpose_generated_renderFace.cu.o
src/openpose/CMakeFiles/openpose.dir/build.make:63: recipe for target 'src/openpose/CMakeFiles/openpose.dir/face/openpose_generated_renderFace.cu.o' failed
make[5]: *** [src/openpose/CMakeFiles/openpose.dir/face/openpose_generated_renderFace.cu.o] Error 1
CMake Error at openpose_generated_renderHand.cu.o.Release.cmake:279 (message):
Error generating file
/home/a421/YuWentao/huawei_fatigue_driving_detection/openpose/build/src/openpose/CMakeFiles/openpose.dir/hand/./openpose_generated_renderHand.cu.o
在按照上述参考博客在cmake GUI中配置CUDA_TOOLKIT_ROOT_DIR时填写错误。不应该写/usr/local/cuda-8.0或者/usr/local/cuda(虽然这两个目录在安装了CUDA9.0时也会自动生成),正确的应该是/usr/local/cuda-9.0
在安装教程步骤成功编译通过,准备运行demo程序时,又报错如下:
Starting OpenPose demo...
Error:
Unity plugin only available on Windows.
Coming from:
- /home/a421/YuWentao/huawei_fatigue_driving_detection/openpose/src/openpose/utilities/errorAndLog.cpp:DebugInUnity():47
在cmake GUI中配置时,错误地多勾选了一项。下图中红色区域第六行的BUILD_UNITY_SUPPORT应该不勾选。
在成功编译OpenPose后,准备运行demo程序时,报如下错误:
root@/openpose# ./build/examples/openpose/openpose.bin
Starting OpenPose demo...
Configuring OpenPose...
Starting thread(s)...
Desired webcam resolution 1280x720 could not being set. Final resolution: 640x480 in /home/a421/YuWentao/huawei_fatigue_driving_detection/openpose/src/openpose/producer/webcamReader.cpp:WebcamReader():36
Auto-detecting camera index... Detected and opened camera 0.
Auto-detecting all available GPUs... Detected 2 GPU(s), using 2 of them starting at GPU 0.
[libprotobuf ERROR google/protobuf/message_lite.cc:118] Can't parse message of type "caffe.NetParameter" because it is missing required fields: layer[0].clip_param.min, layer[0].clip_param.max
F0224 20:12:24.419100 309 upgrade_proto.cpp:97] Check failed: ReadProtoFromBinaryFile(param_file, param) Failed to parse NetParameter file: models/pose/body_25/pose_iter_584000.caffemodel
*** Check failure stack trace: ***
@ 0x7f9caf6f60cd google::LogMessage::Fail()
@ 0x7f9caf6f7f33 google::LogMessage::SendToLog()
@ 0x7f9caf6f5c28 google::LogMessage::Flush()
@ 0x7f9caf6f8999 google::LogMessageFatal::~LogMessageFatal()
@ 0x7f9caf294d71 caffe::ReadNetParamsFromBinaryFileOrDie()
@ 0x7f9caf2742ba caffe::Net<>::CopyTrainedLayersFromBinaryProto()
@ 0x7f9cb15246c8 op::NetCaffe::initializationOnThread()
@ 0x7f9cb154066e op::addCaffeNetOnThread()
@ 0x7f9cb1541971 op::PoseExtractorCaffe::netInitializationOnThread()
@ 0x7f9cb15467f0 op::PoseExtractorNet::initializationOnThread()
@ 0x7f9cb153d281 op::PoseExtractor::initializationOnThread()
@ 0x7f9cb1537c91 op::WPoseExtractor<>::initializationOnThread()
@ 0x7f9cb1575b11 op::Worker<>::initializationOnThreadNoException()
@ 0x7f9cb1575c50 op::SubThread<>::initializationOnThread()
@ 0x7f9cb1578b68 op::Thread<>::initializationOnThread()
@ 0x7f9cb1578d6d op::Thread<>::threadFunction()
@ 0x7f9cb08878f0 (unknown)
@ 0x7f9caffa96db start_thread
@ 0x7f9cb02e288f clone
Aborted (core dumped)
这个问题是OpenPose调用Caffe时导致的,当前的Caffe不支持OpenPose。在安装OpenPose之前,我的系统已经安装了Caffe(版本1.0,https://github.com/BVLC/caffe,Latest commit 99bd997 on Aug 21, 2018)但是,这个版本不支持OpenPose。需要安装OpenPose官方支持的版本(https://github.com/CMU-Perceptual-Computing-Lab/caffe),不必删除系统中原有的Caffe安装此Caffe版本,可以直接在编译OpenPose时添加这个BUILD_CAFFE功能。
当然这个产生这个错误还有一个原因,就是caffemodel文件下载出错,下文的第4点有详细说明。
1.勾选BUILD_CAFFE
2.此时按下“Configure"按钮可能会报错:
CMake Error at /usr/share/cmake-3.10/Modules/ExternalProject.cmake:2474 (message):
No download info given for 'openpose_lib' and its source directory:
/home/a421/YuWentao/huawei_fatigue_driving_detection/openpose/3rdparty/caffe
is not an existing non-empty directory. Please specify one of:
* SOURCE_DIR with an existing non-empty directory
* DOWNLOAD_COMMAND
* URL
* GIT_REPOSITORY
* SVN_REPOSITORY
* HG_REPOSITORY
* CVS_REPOSITORY and CVS_MODULE
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/ExternalProject.cmake:3029 (_ep_add_download_command)
CMakeLists.txt:726 (ExternalProject_Add)
意思是cmake GUI无法为我们直接下载Caffe安装包。所以,我们需要操作一下,帮助cmake GUI下载。进入OpenPose目录
mkdir 3rdparty
cd 3rdparty
git clone https://github.com/CMU-Perceptual-Computing-Lab/caffe
3.在cmake GUI下按下Configure,Generate,按照正常的步骤完成安装。特别需要注意的一点是,如果在系统中自己安装过别的版本的caffe,一定要确认在系统环境变量中没有自己原来版本的caffe,不然还是会报错
4.如果还是报错,重新下载caffemodel文件。具体细节参见https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/faq.md#check-failed-for-readprotofrombinaryfile-failed-to-parse-netparameter-file