简单记录一下服务器端安装openpose遇到的问题与解决办法
1.若无caffe,首先编译生成caffe
$ cd 3rdparty/caffe
$ cp Makefile.config.Ubuntu14_cuda7.example Makefile.config #Ubuntu14.04 + Cuda7.5
$ make all -j8 #8核
$ make distribute -j8 #制作caffe的发布版本
遇到错误:
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector >&, std::vector > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector >&, std::vector > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit statusmake: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1make: ***
Waiting for unfinished jobs....
原因:服务器装的是opencv3.0,opencv3.0把imread相关函数放到imgcodecs.lib中了,而非原来的imgproc.lib
Makefile
(注意不是Makefile.config) ,在如下位置加入imgcodecs等库
LIBRARIES += glog gflags protobuf leveldb snappy lmdb boost_system hdf5_hl hdf5 m
opencv_core opencv_imgproc opencv_imgcodecs
//在后面加入opencv_core opencv_imgproc opencv_imgcodecs
注意事项:
$ make clean
$ make all -j8 && make diatribute -j8
参考:https://blog.csdn.net/fansetcool/article/details/51569374
$ cd models
$ ./getModels.sh
$ mkdir build
$ cd build
$ cmake ..
$ make all -j8
二、问题
Could not find a package configuration file provided by "OpenCV" with any of the following names:
OpenCVConfig.cmake
opencv-config.cmake
原因:OpenCV路径不是cmake的默认路径,编译时找不到OpenCV
$ export OpenCV_DIR=/usr/local/opencv-3.0.0
CMake Error at cmake/Utils.cmake:8 (file):
file DOWNLOAD HASH mismatch
for file: [/home/wuyan-ding/data/Projects/openpose/models/pose/coco/pose_iter_440000.caffemodel]
expected hash: [5156d31f670511fce9b4e28b403f2939]
actual hash: [ef1ffc880e3f690af76e05477654755d]
F0704 09:30:35.277140 13587 cudnn_conv_layer.cpp:53] Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNAL_ERROR
*** Check failure stack trace: ***
# Uncomment if you're using OpenCV 3
OPENCV_VERSION := 3 #取消本行注释
#本服务器用的GPU算力3.5,将高于35的均注释掉
CUDA_ARCH := -gencode arch=compute_20,code=sm_20\
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35
#增加对hdf5的索引
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial
F0704 14:27:12.379647 5860 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: ***