一、环境配置
电脑配置:Ubuntu 16.04 64位
GPU:GTX 1080Ti
主要参考了这篇博客:
http://blog.csdn.net/xuzhongxiong/article/details/52717285
记录一下遇到的一些坑
1、安装NVIDIA驱动的时候不要安装官方发布的最新驱动!!!(我第一次安装就直接下载了最新驱动导致配置进行到最后一步跑caffe手写数字例子的时候发现出错。然后又重新来过……)
我安装的是375
2、测试CUDA的samples时按照博客里提到的方法无法显示GPU信息
cd /usr/local/cuda/samples
sudo make all -j8运行编译可执行结果文件:
./deviceQuery
3、安装Opencv 3.1.0的时候在cmake那一步会因为ippicv_linux_20151201.tgz卡住,我第一次能下载成功后面就不行了。
解决办法:先下载好ippicv_linux_20151201.tgz,放入opencv-3.1.0/3rdpatry/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e,替换掉未成功下载的文件,然后再一次运行cmake命令
下载地址:
4、编译时没注意直接输了make,导致OpenCV编译极其缓慢……大概用了1个小时编译进度50%都不到,请务必要记得根据自己的电脑配置采用并行计算。
如:
make -j8
(最后大概只用了十几分钟就好了……)
注:这里只是编译 别忘了安装
sudo make install
5、验证OpenCV是否安装成功
参考:http://www.linuxidc.com/Linux/2015-05/116960.htm第4步
遇到的问题:在执行cmake . 时报错:
Found package configurationfile:
../cmake/OpenCVConfig,cmake
But it set OpenCV_FOUND toFALSE so package “OpenCV” is considered to be NOT FOUND.
解决方法1:参考:http://blog.csdn.net/catherine627/article/details/53375620
若无法更改:
解决办法2:在确认OpenCV安装无误的情况下,打开OpenCVConfig.cmake(有两处,一处在/cmake文件夹下,一处在/release(或者/build)文件夹下)在第一行设置OpenCV_FOUND为1:
set (OpenCV_FOUND 1)
二、Faster RCNN配置
1、git clone py-faster-rcnn源码
git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git
由于其中的caffe-faster-rcnn是远程分支,所以需要使用—recursive
但由于网络的问题,有可能会遇到无法下载的情况:Submodule path ‘caffe-faster-rcnn’: checked out ‘bcd9b4eadc7d8fbc433aeefd564e82ec63aaf69c’
解决办法:
1)git clone https://github.com/rbgirshick/py-faster-rcnn.git
此时在/home文件夹下会有一个py-faster-rcnn其中的caffe-faster-rcnn是个空文件夹
2)点开https://github.com/rbgirshick/py-faster-rcnn.git打开caffe-faster-rcnn @ 0dcd397下载这个项目的zip压缩文件:
https://github.com/rbgirshick/caffe-fast-rcnn/tree/0dcd397b29507b8314e252e850518c5695efbb83
然后解压到caffe-faster-rcnn中
2、caffe-faster-rcnn 编译出错
1)make: *** [.build_release/src/caffe/common.o] Error1
解决办法:http://blog.csdn.net/u011070171/article/details/52292680
2)/usr/bin/ld:cannot find -lippicv
make:*** [.build_release/lib/libcaffe.so.1.0.0-rc3]Error 1
一开始搜解决办法的时候搜的是libcaffe.so.1.0.0-rc3发现有很多类似错误,这个问题的关键在于cannot find -lippicv【不知道为什么我错的地方就比较奇葩】
搜索很久之后找到解决办法:
sudo apt-get install libippicv-dev
如果,libippicv 还是not found!
cd /usr/local/include
sudo mkdir ippicv && cd ippicv
sudo cp ~/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx/include/* .
cd ~
cd /usr/local/lib
# 如果你用的是64位Ubuntu系统
sudo cp~/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx/lib/intel64/libippicv.a .
# 如果你是32位系统Ubuntu系统
sudo cp~/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_lnx/lib/ia32/libippicv.a .
参考:http://blog.csdn.net/tianzhaixing2013/article/details/53242625
注:每次make失败之后都要先执行一遍make clean再进行新一次的make
3、demo.py运行
cd ./data/scripts/fetch_faster_rcnn_models.sh
这行命令是下载一个faster_rcnn_models.tgz文件,模型有700MB+建议提前下载之后解压到data文件夹。下载地址:https://pan.baidu.com/share/init?surl=o8NdJrc密码gbpo
运行demo
./tools/demo.py
1)ImportError: No module named skimage.io
解决办法:sudo pip install scikit-image
2)ImportError: No module named google.protobuf.internal
解决办法:sudo pip install droneapi
参考:http://blog.csdn.net/u010668907/article/details/50295379
3)SystemError: NULL result without error inPyObject_Call
解决办法:sudo apt-get install python-yaml
参考:http://blog.csdn.net/u013832707/article/details/53501478
4、在跑自己所需数据库的目标检测程序时报错:AttributeError:’NoneType’ object has no attribute ‘astype’
这个错误的是由于我的测试图片没有正确读入。发现由于我的图片路径是在Windows系统下生成的,到Ubuntu系统下无法正确读入。原因:两个系统采用的反斜杠不同,Ubuntu的反斜杠是’/’