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