Skip to content

Instantly share code, notes, and snippets.

@jakelodwick
Forked from ancat/caffe.md
Created July 6, 2015 07:49
Show Gist options
  • Save jakelodwick/2b2bc49c32af837dc9b2 to your computer and use it in GitHub Desktop.
Save jakelodwick/2b2bc49c32af837dc9b2 to your computer and use it in GitHub Desktop.

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_PKFG_CONFIG line # could not find this 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

@ancat
Copy link

ancat commented Jul 8, 2015

I don't know how to merge your changes into my copy of the gist, but I manually added it in. I fat-fingered USE_PKFG_CONFIG, it should just be USE_PKG_CONFIG. Thanks!

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