第五周。
本次由于不确定网络类型,本次选用googlenetv2,alexnet,darknet19三种网络模型
由于darknet缺少某些功能,本次识别采用caffe。
caffe的高性能服务器的配置。
配置opencv,boost,leveldb,gflags,glog,numpy,openblas,python,snappy,lmdb,gcc4.9.4,protobuf,cmake,cuda,cudnn
opencv:下载
tar -xvf opencv.tar.gz
mkdir build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/path/to/local ..
make -j24&&make install
boost:下载
tar -zvf boost.tar.gz
./bootstrap.sh
./b2
cp ./lib/* /path/to/local/lib
cp -rf *8 /path/to/local
leveldb下载:
tar -zvf leveldb.tar.gz
make
cp out-shared/* /path/to/local
cp out-static/* /path/to/local
cp -rf include /path/to/local
gflags下载:
tar -zvf gflgs.tar.gz
mkdir build&&cd build
cmake -D CMAKE_BUILD_TYPE_RELEASE -D CMAKE_INSTALL_PREFIX=/path/to/local ..
make&&make install
glog下载:
tar -xvf glog.tz
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE_RELEASE -D CMAKE_INSTALL_PREFIX=/path/to/local ..
make&&make install
python下载:
unzip Python.zip
./configure --prefix=/path/to/local
make&&make install
编辑~/.bashrc
添加
export $PATH=/path/to/local/bin:$PATH
export $LD_LIBRARY_PATH=/path/to/local/include:$LD_LIBRARY_PATH
source ~/.bashrc
python --version
若python为2.7则为正确版本
pip安装:
tar -xvf pip.tar
python setup.py install
numpy下载:
pip install numpy
openblas下载
unzip openblas.zip
mkdir build
cd build
cmake -D BUILD_TYPE_RELEASE -D CMAKE_INSTALL_PREFIX=/path/to/local ..
make&&make install
snappy下载:
tar snappy.tar.gz
mkdir build
cd build
cmake -D BUILD_TYPE_RELEASE -D CMAKE_INSTALL_REFIX=/path/to/local ..
make&&make install
lmdb下载:
make
mv mdb/libraries/liblmdb/*so* /path/to/local/lib
mv mdb/libraries/liblmdb/*.h /path/to/local/include
gcc下载:
./configure --prefix=/path/to/local
make&&make install
protobuf下载:
./configure --prefix=/path/to/local
make&&make install
cmake下载
tar -xvf cmake-3.6.tar.gz
mv bin/* /path/to/local/bin
cudnn下载:
tar -xvf cudnn.bz2
cp include/* /path/to/local/include
cp lib64/* /path/to/local/include
环境变量配置
export PATH=$HOME/cmake-3.6/bin:$PATH
#export PATH=$HOME/gcc-build-4.9.4/bin:$PATH
export PATH=$HOME/cuda-7.5/bin:$PATH
export PATH=$HOME/opencv6/bin:$PATH
export PATH=$HOME/opencv6/include:$PATH
export PATH=$HOME/local/bin:$PATH
export PATH=$HOME/local/include:$PATH
export PATH=$HOME/.local/bin:$PATH
export LD_LIBRARY_PATH=$HOME/cuda-7.5/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/cuda-7.5/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/local/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
#export LD_LIBRARY_PATH=$HOME/cuda/lib64:$LD_LIBRARY_PATH
#export LD_LIBRARY_PATH=$HOME/cuda/include:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/opencv6/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$HOME/opencv6/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=$HOME/local/lib64/pkgconfig:$PKG_CONFIG_PATH
source ~/.bashrc
配置caffe
cp Makefile.config.example Makefile.config
USE_CUDNN := 1前注释去掉
更改CUDA_DIR:
CUDA_DIR := /home/users/zibojia/cuda-7.5
在 -gencode arch=compute_60,code=sm_60 \,
-gencode arch=compute_61,code=sm_61 \,
-gencode arch=compute_61,code=compute_61前面添加注释
更改BLAS
BLAS := open
更改PYTHON_INCLUDE和PYTHON_LIB:
PYTHON_INCLUDE := /home/users/zibojia/local/include/python2.7 \
/home/users/zibojia/.local/lib/python2.7/site-packages/numpy/core/include
PYTHON_LIB := /home/users/zibojia/local/lib
更改INCLUDE_DIRS:
INCLUDE_DIRS := $(PYTHON_INCLUDE) /home/users/zibojia/local/include /home/users/zibojia/opencv6/include /home/users/zibojia/cuda-7.5/include
LIBRARY_DIRS := $(PYTHON_LIB) /home/users/zibojia/local/lib /home/users/zibojia/opencv6/lib /home/users/zibojia/cuda-7.5/lib
编译
make all -j100
make test
make runtest