首页 > 代码库 > py-faster-rcnn 的makefile.config 注意事项

py-faster-rcnn 的makefile.config 注意事项

 

 

 

在配置py-faster-rcnn的过程中,我遇到一些问题,记录如下

py-faster-rcnn文件夹下面有一个caffe-fast-rcnn文件夹

这个过程中,我们需要编译caffe, 

rbgirshick 大神的caffe和caffe官网的版本不太一样

我第一次直接照搬caffe的makefile.config,导致了很多错误

rbgirshick 大神说,需要打开 WITH_PYTHON_LAYER := 1
                     和  USE_CUDNN := 1

Note: Caffe must be built with support for Python layers!

# In your Makefile.config, make sure to have this line uncommented
WITH_PYTHON_LAYER := 1
# Unrelatedly, it‘s also recommended that you use CUDNN
USE_CUDNN := 1
但是由于我安装的cudnn版本不对,就造成下面的报
util/cudnn.hpp: In function ‘void caffe::cudnn::createPoolingDesc(cudnnPoolingStruct**, caffe::PoolingParameter_PoolMethod, cudnnPoolingMode_t*, int, int, int, int, int, int)’:  
./include/caffe/util/cudnn.hpp:117:13: error: ‘CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING’ was not declared in this scope  
     *mode = CUDNN_POOLING_AVERAGE_COUNT_INCLUDE_PADDING;  
             ^  
Makefile:510: recipe for target .build_release/src/caffe/util/im2col.o failed  
make: *** [.build_release/src/caffe/util/im2col.o] Error 1  

这个时候,可以换cudnn的版本,这样的话,需要重新配置和编译一下caffe,我比较懒,就没这么做。
还有最简单的办法是: 直接关掉 cudnn 这样就不会报这个错误了

接着 make all
出现了下面这个错误
我在编译单独caffe的时候,就已经把opencv安装好了,按理来说不应该出现这个错误

.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<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&).build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)collect2: error: ld returned 1 exit status
make: *** [.build_release/tools/convert_imageset.bin] Error 1

我 google到了解决办法

技术分享

意思就是在 makefile.config里面加一个LIBRARIES

我是这样加的  直接加在opencv下面

# Uncomment if youre using OpenCV 3
 OPENCV_VERSION := 3
LIBRARIES += glog gflags protobuf leveldb snappy lmdb boost_system hdf5_hl hdf5 m opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs

再make all就通过了

 

py-faster-rcnn 的makefile.config 注意事项