Ubuntu 16.04+Faster-Rcnn+ZF

Ubuntu 16.04+Faster-Rcnn+ZF

1.Ubuntu16.04安装NVIDIA显卡驱动

显卡型号NVIDIA Geforce 960M

Ubuntu 16.04安装NVIDIA驱动

http://blog.csdn.net/cosmoshua/article/details/76644029

1.1驱动安装下载

从Nvidia 官网下载显卡对应的驱动安装文件

http://www.nvidia.com/Download/index.aspx?lang=cn

NVIDIA-Linux-x86_64-390.25.run

1.2禁用nouveau驱动

sudo gedit /etc/modprobe.d/blacklist.conf

在文本最后添加:(禁用nouveau第三方驱动,之后也不需要改回来)

blacklist nouveau

options nouveau modeset=0

然后执行:sudo update-initramfs -u

重启后,执行:lsmod | grep nouveau。如果没有屏幕输出,说明禁用nouveau成功。

1.3命令行安装驱动

sudo ./NVIDIA-Linux-x86_64-384.59.run -no-opengl-files

之后,按照提示安装,成功后重启即可。
如果提示安装失败,不要急着重启电脑,重复以上步骤,多安装几次即可。

nvidia-smi #若列出GPU的信息列表,表示驱动安装成功

nvidia-settings #若弹出设置对话框,亦表示驱动安装成功

2.安装cuda8.0.61

2.1下载安装软件

https://developer.nvidia.com/cuda-80-ga2-download-archive

cuda_8.0.61_375.26_linux.run

2.2安装CUDA

sudo ./cuda_8.0.61_375.26_linux.run –no-opengl-libs

accept #同意安装

n #不安装Driver,因为已安装最新驱动

y #安装CUDA Toolkit

<Enter> #安装到默认目录

y #创建安装目录的软链接

n #不复制Samples,因为在安装目录下有/samples

2.3CUDA Sample测试:

#编译并测试设备 deviceQuery:

cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery

sudo make

./deviceQuery

 

#编译并测试带宽 bandwidthTest:

cd ../bandwidthTest

sudo make

./bandwidthTest

3.安装cuDNN caffe

cudnn-8.0-linux-x64-v5.0-ga.tgz

http://blog.sina.com.cn/s/blog_a5fdbf010102w7f6.html

Ubuntu16.04 Caffe 安装步骤记录(超详尽)

http://blog.csdn.net/yhaolpz/article/details/71375762

4、Faster-RCNN+ZF

http://blog.csdn.net/sinat_30071459/article/details/51332084

4.1安装cython, python-opencv,easydict

pip install cython

pip install easydict

apt-get install python-opencv

4.2安装py-faster-rcnn

git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git 


 

4.3参考:此微博Ubuntu16.04+Faster R-CNN编译

https://www.jianshu.com/p/02468f9273e9

cd caffe-fast-rcnn

git remote add caffe https://github.com/BVLC/caffe.git

git fetch caffe

git merge -X theirs caffe/master

然后删除 self_.attr("phase") = static_cast<int>(this->phase_); 从 include/caffe/layers/python_layer.hpp 中,当合并结束后

Build the Cython modules:

cd $FRCN_ROOT/lib

make

修改Makfile.config:

USE_CUDNN := 1 (可选) USE_OPENCV := 1 (可选) OPENCV_VERSION := 3 (如果打开了USE_OPENCV,而且opencv版本为3时) PYTHON_INCLUDE := /usr/include/python2.7 /usr/lib/python2.7/dist-packages/numpy/core/include WITH_PYTHON_LAYER := 1 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 /usr/local/share/OpenCV/3rdparty/lib


修改Makfile:

将下面这一行: NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) 替换为: NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)


Build Caffe and pycaffe:

cd $FRCN_ROOT/caffe-fast-rcnn

make -j8 && make pycaffe

 

4.4下载VOC2007数据集

提供一个百度云地址:http://pan.baidu.com/s/1mhMKKw4

解压,然后,将该数据集放在py-faster-rcnn\data下

4.5载ImageNet数据集下预训练得到的模型参数(用来初始化)

提供一个百度云地址:http://pan.baidu.com/s/1hsxx8OW

解压,然后将该文件放在py-faster-rcnn\data下

4.6开始训练

进入py-faster-rcnn,执行:

./experiments/scripts/faster_rcnn_alt_opt.sh 0 ZF pascal_voc  

4.7测试

将训练得到的py-faster-rcnn\output\faster_rcnn_alt_opt\***_trainval中ZF的caffemodel拷贝至py-faster-rcnn\data\faster_rcnn_models(如果没有这个文件夹,就新建一个)

在py-faster-rcnn下,执行:

./tools/demo.py --net zf  

遇到的问题:

1.TypeError numpy.float64 object cannot be interpreted as an index

在运行py-faster-rcnn的时候碰到了这个问题,结果把numpy的版本由1.12.0降为1.11.0问题得以解决。

sudo pip install -U numpy==1.11.0

要将py-faster-rcnn重新编译

2. Check failed: error == cudaSuccess (2 vs. 0)  out of memory  

将py-faster-rcnn/lib/fast_rcnn config文件中的__C.TRAIN.SCALES = (600,)改成:__C.TRAIN.SCALES = (300,)

3.File "/home/dl-box/wei/py-faster-

        BB = BB[sorted_ind, :]

    IndexError: too many indices for array

参考此微博:http://blog.csdn.net/weinaonao5418/article/details/54234684

 

https://blog.csdn.net/wp1988/article/details/77422468


 


 


 


 

 

 


 

 


 


 


 


 


 


 


 


 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值