Skip to content

Instantly share code, notes, and snippets.

@ancat
Last active March 23, 2018 21:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ancat/d3235bdb12b7ed1c0138 to your computer and use it in GitHub Desktop.
Save ancat/d3235bdb12b7ed1c0138 to your computer and use it in GitHub Desktop.
instructions for setting up caffe

Setting up Caffe for Running Deepdream on OS X

Dependencies

Use Brew

Install brew and pip (sudo easy_install pip)

brew update
brew install homebrew/science/openblas
brew install boost
# caffe doesn't work with 1.58.0
brew switch boost 1.56.0
brew install opencv
brew install --build-from-source --with-python --fresh -vd protobuf
brew install glog
brew install gflags
brew install hdf5
brew install leveldb
brew install lmdb
brew install --build-from-source --fresh -vd boost-python

sudo pip install pillow
sudo pip install ipython
sudo pip install scikit-image

Download Caffe and Set Up the Makefile

  • git clone https://github.com/BVLC/caffe.git
  • cd caffe
  • cp Makefile.config.example Makefile.config

Edit Makefile.config

  • BLAS := open
  • BLAS_INCLUDE := /usr/local/opt/openblas/include
  • BLAS_LIB = /usr/local/opt/openblas/lib
  • Add /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 to PYTHON_INCLUDE
  • Add /usr/local/opt/opencv to INCLUDE_DIRS
  • Uncomment the PYTHON_INCLUDE and PYTHON_LIB
  • Uncomment USE_PKG_CONFIG line

Build and Run

  • Run make pycaffe -j8 (adjust for # of cores on your system)
  • cd python
  • Run DYLD_FALLBACK_LIBRARY_PATH=/usr/local/cuda/lib python -c "import caffe" to verify things worked (will take a few minutes to complete the first time or so)

Downloading Google's Model for Testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment