为了安装这个caffe费了好长时间,看博客总有缺漏,看官方指南居然也有问题。特别想吐槽这个OG,但是有不明白的看一下也好
http://caffe.berkeleyvision.org/installation.html
本机环境
环境:OSX El Capitan 显卡:Intel Graphics 6000
python2.7 pip (没有用Anaconda,嫌占地方)
由于没有NVIDIA显卡,就不用单去装CUDA(最开始我被OG骗了)
下载caffe
git clone https://github.com/BVLC/caffe.git
相关依赖包安装
方法一:参见OG: http://caffe.berkeleyvision.org/installation.html,一步步安装依赖库。
方法二:虽说我没试过,但我觉得可以先进入caffe的python文件夹,
for req in $(cat python/requirements.txt); do pip install $req; done
P.S. 如果还有包装不上,可以参见最底下的博客链接
安装caffe
1.Config
cp Makefile.config.example Makefile.config
vim Makefile.config
具体修改位置:
不进行gpu加速:
解决cblas.h报错:
解决Python.h和numpy/arrayobject.h报错:
当然最好看一下自己机器的具体路径是什么
2.具体安装caffe,在caffe路径下
make all
make test
make runtest
3.安装caffe python接口
make pycaffe
如果以上没有有fatal error,那么基本上就安装成功了
运行示例
迫不及待地想运行一个demo了吧,可参考OG:http://caffe.berkeleyvision.org/gathered/examples/mnist.html
在caffe root下:
./data/mnist/get_mnist.sh
./examples/mnist/create_mnist.sh
若果提示没有装wget,就再 brew install wget一下。运行完以上示例后,修改一下运行配置文件:
vim ./examples/mnist/lenet_solver.prototxt
然后 把solver_mode 改成CPU
最后运行
./examples/mnist/train_lenet.sh
最后附一张结果图:
相关链接:http://blog.youkuaiyun.com/ddreaming/article/details/52739893