caffee 安装教程

来源:互联网 发布:淘宝主图无缝拼接 编辑:程序博客网 时间:2024/06/10 10:42
参考网站:http://www.th7.cn/system/lin/201508/123485.shtml




安装依赖库
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev


安装BLAS
sudo apt-get install libatlas-base-dev


安装依赖库
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev


下载CAFFE


cd ~
git clone git://github.com/BVLC/caffe.git


编译caffe
cd ~/caffe
cp Makefile.config.example Makefile.config
修改Makefile.config文件:去掉CPU_ONLY:= 1的注释
make all
make test
make runtest


配置pycaffe
a、安装依赖库:
sudo apt-get install python-numpy python-scipy python-matplotlib python-sklearn python-skimage python-h5py python-protobuf python-leveldb python-networkx python-nose python-pandas python-gflags Cython ipython
sudo apt-get install protobuf-c-compiler protobuf-compiler


b、编译:
$ cd ~/caffe$ make pycaffe


c、添加~/caffe/python到$PYTHONPATH:
$ sudo gedit /etc/profile # 末尾添加: export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH# 用完整路径,不要用~
$ source /etc/profile # 使之生效
$ sudo reboot # 永久生效


d、测试是否可以引用:
$ pythonPython 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import caffe>>> 
0 0