SSD: Single Shot MultiBox Detector 编译方法总结

SSD是一个基于单网络的目标检测框架,它是基于caffe实现的,所以下面的教程是基于已经编译好的caffe进行编译的。 caffe的编译可以参考官网 caffe Installation

Installation

1.Get the code.

git clone https://github.com/weiliu89/caffe.git    (这里会得到一个caffe目录,为了和我们之前的caffe区分,我们下面对其重命名)
mv caffe caffe-ssd
cd caffe-ssd
git checkout ssd

2.Build the code.

从之前编译好的caffe目录中(我安装在/下),拷贝Makefile.config到caffe-ssd(我安装在/)中:

cp ~/caffe/Makefile.config ~/caffe-ssd/

编译之前需要修改配置文件:

1.首先添加caffe中的python到python环境变量中(PYTHONPATH),在.bash_profile里添加:

export PYTHONPATH=$PYTHONPATH:~/caffe/python

2.在.bash_profile 下面 添加共享blas库的路径(我安装在~/下),以及共享cuda的路径

export LD_LIBRARY_PATH=~/OpenBLAS/lib/
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
export CUDA_HOME=/usr/local/cuda

3.使修改文件生效

source  .bash_profile

4.在caffe-ssd下编译

make -j8
make py
make test -j8
make runtest -j8

说明

如果编译之前,不做第2步的话,可能出现一下错误:

.build_release/tools/caffe
.build_release/tools/caffe: error while loading shared libraries: libcudart.so.7.5: cannot open shared object file: No such file or directory
make: *** [runtest] Error 127

.build_release/tools/caffe
.build_release/tools/caffe: error while loading shared libraries: libopenblas.so.0: cannot open shared object file: No such file or directory
make: *** [runtest] Error 127

参考

SSD: Single Shot MultiBox Detector Installation

原文地址:https://www.cnblogs.com/zhonghuasong/p/7236887.html