1. Download and install anaconda
2. Download protobuf 3.5.1 source and compile, install.
3. Install Dependencies with homebrew
brew install -vd snappy leveldb gflags glog szip lmdbhdf5 opencv brew install boost@1.59 boost-python@1.59 brew link boost@1.59 --force brew link boost-python@1.59 --force 4.git clone https://github.com/BVLC/caffe.git 5.cp Makefile.config.example Makefile.config
5.1.
USE_CUDNN := 1
OPENCV_VERSION: = 3
CUDA_DIR := /usr/local/cuda CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \ -gencode arch=compute_35,code=sm_35 \ -gencode arch=compute_50,code=sm_50 \ -gencode arch=compute_52,code=sm_52 \ -gencode arch=compute_60,code=sm_60 \ -gencode arch=compute_61,code=sm_61 \ -gencode arch=compute_61,code=compute_61 ANACONDA_HOME := $(HOME)/anaconda PYTHON_INCLUDE := $(ANACONDA_HOME)/include \ $(ANACONDA_HOME)/include/python2.7 \ $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include PYTHON_LIB := $(ANACONDA_HOME)/lib 6.change below in makefile ifeq ($(OSX), 1) CXX := /usr/bin/clang++ to ifeq ($(OSX), 1) CXX := /usr/bin/clang++ -std=c++11 7.export CAFFE_ROOT="$HOME/caffe" 8. make all -j4 9. make runtest 10.
install_name_tool -change “@rpath/libhdf5_hl.10.dylib” “/Users/<UserName>/anaconda/lib/libhdf5_hl.10.dylib” .build_release/tools/caffe
install_name_tool -change “@rpath/libhdf5.10.dylib” “/Users/<UserName>/anaconda/lib/libhdf5.10.dylib” .build_release/tools/caffe
install_name_tool -change “@rpath/libcudnn.5.dylib” “/usr/local/cuda/libcudnn.dylib” .build_release/tools/caffe
install_name_tool -change “@rpath/libhdf5_hl.10.dylib” “/Users/<UserName>/anaconda/lib/libhdf5_hl.10.dylib” .build_release/test/test_all.testbin
install_name_tool -change “@rpath/libhdf5.10.dylib” “/Users/<UserName>/anaconda/lib/libhdf5.10.dylib” .build_release/test/test_all.testbin
install_name_tool -change “@rpath/libcudnn.5.dylib” “/usr/local/cuda/libcudnn.dylib” .build_release/test/test_all.testbin
11. make pycaffe
12. make pytest
install_name_tool -change “@rpath/libhdf5_hl.10.dylib” “/Users/<UserName>/anaconda/lib/libhdf5_hl.10.dylib” python/caffe/_caffe.so
install_name_tool -change “@rpath/libhdf5.10.dylib” “/Users/<UserName>/anaconda/lib/libhdf5.10.dylib” python/caffe/_caffe.so
install_name_tool -change “@rpath/libcudnn.5.dylib” “/usr/local/cuda/libcudnn.dylib” python/caffe/_caffe.so
13. to use Matcaffe,
modify makefile.config (the order is matter)!
MATLAB_DIR := /Applications/MATLAB_R2017b.app
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib $(MATLAB_DIR)/bin/maci64 /usr/lib
install_name_tool -change "@rpath/libhdf5_hl.10.dylib" "/Users/<UserName>/anaconda/lib/libhdf5_hl.10.dylib" matlab/+caffe/private/caffe_.mexmaci64 install_name_tool -change "@rpath/libhdf5.10.dylib" "/Users/<UserName>/anaconda/lib/libhdf5.10.dylib" matlab/+caffe/private/caffe_.mexmaci64