美文网首页
mac下配置Caffe指南

mac下配置Caffe指南

作者: 神棄丶Aria | 来源:发表于2018-02-12 13:20 被阅读0次

一、简述

caffe的配置本身就不是很方便,网上又是一堆坑,刚好最近有需求所以了解了下,整理一下以备以后使用。

二、配置流程

该安装流程是无GPU版本的安装流程。即可以不安装CUDA。

1、安装HomeBrew

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/intall)”

2、安装CMake

brew install cmake

3、安装protobuf

官方教程链接:https://github.com/google/protobuf/tree/master/src
(1)下载源码包:https://github.com/google/protobuf/releases
(2)解压并进入目录
(3)运行脚本

./configure LDFLAGS=-L$PWD/src/solaris
make
make check
sudo make install

(4)使用 protoc --version 判断是否安装成功

$ protoc --version
libprotoc 3.5.1

4、安装caffe

(1)github上下载源码:https://github.com/BVLC/caffe
(2)依次执行:

mkdir build
cd build/
cmake ..

(3)修改 CMakeCache.txt

//Build Caffe without CUDA support
CPU_ONLY:BOOL=ON

(4)修改CaffeConfig.cmake

# Cuda support variables
set(Caffe_CPU_ONLY ON)

(5)依次执行:

make all
make runtest

最终显示PASSED则表示搭建成功。

三、将caffe导入PyCharm项目

注:因为下载的demo没数据集没法跑起来所以不能肯定方案一定成功,至少编译时不会因为这个出错。
py文件中添加

caffe_root = '../caffe/'  # this file is expected to be in {caffe_root}/examples
sys.path.insert(0, caffe_root + 'python')
import caffe

四、总结

在安装过程中可能会出现找不到各类各样的依赖包,如opencv。我只能说,缺啥装啥吧。
没跑起来不知道效果,但是我还是想说——
这玩意的配置真鸡儿复杂。还是TensorFlow好。

五、参考文章

http://www.cnblogs.com/unclelin/p/6384610.html

相关文章

网友评论

      本文标题:mac下配置Caffe指南

      本文链接:https://www.haomeiwen.com/subject/rburtftx.html