gdp1368@outlook.com 's Blog
Love Leanote!
Toggle navigation
gdp1368@outlook.com 's Blog
主页
About Me
归档
标签
211服务器上安装部署OpenPose
2018-09-06 10:00:48
384
0
0
gump_don
OpenPose是用来做人体检测,描绘出人体的外形关节。发布在[GitHub](https://github.com/CMU-Perceptual-Computing-Lab/openpose)上。历经一个多礼拜,我们把它安装部署在211服务器上。过程曲折,记录留念。 OpenPose具体安装教程参考[installation](https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md),它依赖的环境如下: - CUDA 8.0 - cuDNN 5.1 - OpenCV 2.4 - caffe 1.0 我们系统的环境是Ubuntu 16.04,显卡GeForce GTX TITAN X 参考[Ubuntu16.04+CUDA8.0+cuDNN5.1+caffe安装教程](https://blog.csdn.net/autocyz/article/details/52299889) 首先安装CUDA-8.0。CUDA是由NVIDIA公司推出的一种并行运算架构,该架构能够使GPU解决复杂运算。安装CUDA之前我们需要安装NVIDIA驱动。这一点可以在[NVIDIA](https://www.nvidia.com/Download/index.aspx?lang=en-us)上根据设备的配置下载安装相应的驱动。也可以在安装CUDA时会提示是否安装drivier选择Yes。可通过命令`nvidia-smi`查看驱动。最后把CUDA的路径加入PATH。 cuDNN相当于是CUDA的一个加速器。根据CUDA版本选择相应版本的cuDNN。比如CUDA-8.0对应cuDNN的版本是cuDNN5.1。这里需要注意的是在/usr/local目录下会有两个目录,cuda和cuda-8.0。在安装cuDNN时,我们把解压得到的文件复制到cuda相应目录下。然后建立软连接。 最后在安装完成后,通过`nvcc--version`查看版本信息。也可以在/usr/local/cuda-8.0/samples/1_Utilities/deviceQuery目录下`make`以后运行`./deviceQuery`查看CUDA信息,若无报错,则安装成功。 以上是个人安装CUDA+cuDNN的经历。然而实际在openpose项目中, **只需要运行/openpose/ubuntu/install_cmake.sh即可!** 接下来,按照提示`apt-get install libopencv-dev`。caffe可以选择不安装。(因为安装caffe的坑特别多!) 然后麻烦来了,根据提示,我们在`cmake..`时,报错提示找不到cuDNN!!!这时,有两种方法解决。第一种:通过`cmake -DCUDNN_INCLUDE_DIR=/usr/local/cuda/include -DCUDNN_LIBRARY=/usr/local/cuda/lib64/libcudnn.so ..`编译。 第二种:`vim /openpose/cmake/Modules/Find_CuDNN.cmake'加入 ``` set(CUDNN_INCLUDE "/usr/local/cuda/include") set(CUDNN_LIBRARY "/usr/local/cuda/lib64/libcudnn.so") ``` 这个时候应该可以通过了,接下来在`make -j40`时,也会出现,cuDNN not find然后整个就报错。查看报错日志,报错原因是‘pthread_create’这个函数。然而我们折腾了许久找不到与这个函数相关的错误。实际上我们是被**误导**了!!最后我们把问题回到cuDNN not find上。查看寻找cudnn的路径。运行`grep 'cuda-8.0 -r ./*'`找到所有编译文件。把包含CUDNN的路径中'cuda-8.0'改为'cuda'此时即可通过。在make过程中要等一些时间,请耐心。 在编译通过后,即可运行测试用例`./build/examples/openpose/openpose.bin --image_dir examples/media `此时会出现'CUDA driver version is insufficient for CUDA runtime version'的错误!翻译过来是CUDA的驱动版本不支持它的运行版本!也就是说我们安装的CUDA的版本不对!前面提到过,我们用`./deviceQuery`查询CUDA时,此时显示的是驱动版本CUDA 9.0, 运行版本CUDA 8.0。会不会是这个原因昵。我们尝试卸载显卡驱动(不影响CUDA)nvidia 384, 安装nvidia 375之后。使得CUDA驱动版本和运行版本一致。再次重新安装openpose。然而,报同样的错误!!!再次查找原因,发现Nvidia 375不足以支撑我们的显卡配置。在这里,索性从头再来。恢复nvidia 384。按照教程重新安装openpose。按照之前的经验,一一排除坑。发现cudnn的版本升到了6.0。果然在make报错: ``` CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `train()': caffe.cpp:(.text+0x28ea): undefined reference to `google::protobuf::internal::StringTypeHandlerBase::New()' caffe.cpp:(.text+0x36a8): undefined reference to `google::protobuf::internal::StringTypeHandlerBase::New()' CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `std::string* google::MakeCheckOpString<cudaError, cudaError>(cudaError const&, cudaError const&, char const*)': caffe.cpp:(.text._ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringI9cudaErrorS1_EEPSsRKT_RKT0_PKc]+0x50): undefined reference to `google::base::CheckOpMessageBuilder::NewString()' CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `std::string* google::MakeCheckOpString<unsigned long, int>(unsigned long const&, int const&, char const*)': caffe.cpp:(.text._ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImiEEPSsRKT_RKT0_PKc]+0x50): undefined reference to `google::base::CheckOpMessageBuilder::NewString()' CMakeFiles/caffe.bin.dir/caffe.cpp.o: In function `main': caffe.cpp:(.text.startup+0x50): undefined reference to `google::SetVersionString(std::string const&)' caffe.cpp:(.text.startup+0x83): undefined reference to `google::SetUsageMessage(std::string const&)' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&, unsigned char*)' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::string*)' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::Message::GetTypeName() const' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::StringTypeHandlerBase::Delete(std::string*)' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::string const&))' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::Message::DebugString() const' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::MessageLite::ParseFromString(std::string const&)' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::empty_string_' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteString(int, std::string const&, google::protobuf::io::CodedOutputStream*)' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::DescriptorPool::FindFileByName(std::string const&) const' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::string*)' ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::Message::InitializationErrorString() const' collect2: error: ld returned 1 exit status tools/CMakeFiles/caffe.bin.dir/build.make:128: recipe for target 'tools/caffe' failed make[5]: *** [tools/caffe] Error 1 CMakeFiles/Makefile2:425: recipe for target 'tools/CMakeFiles/caffe.bin.dir/all' failed make[4]: *** [tools/CMakeFiles/caffe.bin.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make[3]: *** [all] Error 2 CMakeFiles/openpose_caffe.dir/build.make:110: recipe for target 'caffe/src/openpose_caffe-stamp/openpose_caffe-build' failed make[2]: *** [caffe/src/openpose_caffe-stamp/openpose_caffe-build] Error 2 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/openpose_caffe.dir/all' failed make[1]: *** [CMakeFiles/openpose_caffe.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2 ``` 原因是:ubuntu 16.04自带gcc版本是5.4的,与CUDA的一些配置冲突。另一方面,protubuf的版本是2.6的,不兼容。所以我们解决的办法是: 1. 修改cudn host_config.h配置文件`vim /usr/local/cuda/include/host_config.h`: >\#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) //#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) #error -- unsupported GNU version! gcc versions later than 4.9 are not supported! //#error -- unsupported GNU version! gcc versions later than 4.9 are not supported! #endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) */ //#endif /* __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 9) */ 2. 卸载libprotoc 2.6.0 `sudo apt-get autoremove libprotobuf-dev protobuf-compiler` 3. 安装libprotoc 2.5.0[教程参考](https://blog.csdn.net/tdmyl/article/details/31811317) 4. ./configure --prefix=/usr/local/ CC=/usr/bin/gcc 最后编译通过!运行测试脚本。`./build/examples/openpose/openpose.bin --image_dir examples/media --display 0`返回正确结果!
上一篇:
fasttext
下一篇:
一种基于Bigram二级哈希的中文索引结构
0
赞
384 人读过
新浪微博
微信
腾讯微博
QQ空间
人人网
提交评论
立即登录
, 发表评论.
没有帐号?
立即注册
0
条评论
More...
文档导航
没有帐号? 立即注册