【SSD-Caffe】安装使用教程

1、下载镜像

    参考我的另一篇博客:docker使用教程

    我下载的是:docker pull bvlc/caffe:gpu  这个镜像

2、安装ssd-caffe

下载之后这并不是ssd-caffe 的环境,是较为原始版本的环境。

所以还需要安装caffe-master版本的新版本的caffe,否则不支持_caffe等模块,下载路径:ssd-caffe下载  

也可以使用git进行下载,命令如下。下载后解压进入caffe目录,输入以下命令:git checkout ssd是将版本切换为ssd版本,因为caffe有多个分支

$ git clone https://github.com/weiliu89/caffe.git
$ cd caffe
$ git checkout ssd

修改MakeFile.config编译文件名称

$ cp Makefile.config.example Makefile.config

在编译文件中修改是否使用cpu、HDF5路径、cudn的路径等,修改完成后执行以下编译命令

$ make clean -j8
$ make all -j8 
$ make runtest -j8

如果出现Pass之后说明成功编译,在命令行输入python,进入命令后输入import cacaffe查看是否成功

最后还需要编译pycaffe

make pycaffe

 


                                                                               分隔符


这部分就是自己遇到的困难了,将错误一一整理,防止出现类似问题。

1、错误  /include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory

/include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory 

解决:在Makefile.config文件中找到以下属性,加入后面两段内容,后面的内容是通用的加入即可

  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

2、错误

/usr/bin/ld: cannot find -lopencv_imgcodecs
/usr/bin/ld: cannot find -lopenblas

/usr/bin/ld: cannot find -lopencv_imgcodecs
/usr/bin/ld: cannot find -lopenblas
collect2: error: ld returned 1 exit status
Makefile:572: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1

首先opencv是因为自己没有装,因为我用不到,所以在Makefile.config文件中注释掉opencv的属性哪一行就可以

3、错误

./include/caffe/util/device_alternate.hpp:34:23: fatal error: cublas_v2.h: No such file or directory

./include/caffe/util/device_alternate.hpp:34:23: fatal error: cublas_v2.h: No such file or directory

 

解决:添加软连接

sudo ln -s /usr/local/cuda/lib64/libcudart.so /usr/lib/libcudart.so

4、错误 

fatal error: cublas_v2.h: No such file or directory

解决在之前那个include_dir后面添加cuda路径

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include  /usr/include/hdf5/serial /usr/local/cuda-8.0/targets/x86_64-linux/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial /usr/lib/x86_64-linux-gnu /usr/local/cuda-8.0/targets/x86_64-linux/lib

5、错误 make: /bin/nvcc: Command not found

make: /bin/nvcc: Command not found
Makefile:588: recipe for target '.build_release/cuda/src/caffe/solvers/rmsprop_solver.o' failed

解决,将nvcc路径加入环境变量中

root@6a830671ad1d:/usr/local/cuda-8.0/bin# export PATH=$PATH:/usr/local/cuda-8.0/bin/
#检查是否输入成功
root@6a830671ad1d:/usr/local/cuda-8.0/bin# echo $PATH

 

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值