[PYTHON] Notes on installing Caffe in CPU mode on Mac OSX 10.11 (El Captain)

** (People with Docker knowledge are overwhelmingly easier to import and use Docker Image! (Here mac_OS_X% E3% 81% AB% E3% 80% 81caffe% 2Bjupyter_notebook% E7% 92% B0% E5% A2% 83% E6% A7% 8B% E7% AF% 89% E3% 83% A1% E3% 83% A2))) **

environment

Machine, OS: MacBookPro 10.11.4 CPU : 2.2 GHz Intel Core i7 Memory: 16 GB

procedure

** 1. Install dependent packages with homebrew **

brew install -vd snappy leveldb gflags glog szip lmdb
brew tap homebrew/science
brew install hdf5 opencv
brew install --build-from-source --with-python -vd protobuf
brew install --build-from-source -vd boost boost-python

The bottom two (protobuf and boost) take quite some time.

** 2. Download Caffe ** It seems that cloning from Github is a good way. git clone https://github.com/BVLC/caffe.git

** 3. Rewrite Makefile.config ** -First, do the following (make a copy) cp Makefile.config.example Makefile.config

-Rewrite the following in Makefile.config.

Makefile.config


# CPU-only switch (uncomment to build without GPU support).
CPU_ONLY := 1 #Uncomment.

...

# Homebrew puts openblas in a directory that is not on the standard search path
#Enter the path where you installed openblas.
BLAS_INCLUDE := /usr/local/cellar/openblas/0.2.18_2/include
BLAS_LIB := /usr/local/cellar/openblas/0.2.18_2/lib

...

#It seems better to add it.
LIBRARIES += cblas
LDFLAGS += -framework Accelerate

** 4. Compile ** Use : star: CMake (Linker Error will occur with normal Make) Go to caffe / and do the following:

mkdir build
cd build
cmake ..
make all
make install
make runtest

You can probably build it now. Check by running the sample program to see if it can be used. (For Mnist, it is described in detail in this article.) It is already available in C ++. (Basically, run ./build/tools/caffe train --solver = **. Prototxt. Please see the official page for details)

** 5. Build for Python ** Just go to caffe / build and do the following:

make Pycaffe

Don't forget to add Path. (I am .zshrc)

export PYTHONPATH=(path to caffe)/caffe/python:$PYTHONPATH

Now you can use ʻimport caffe`.

Reference article (Thank you for your help!)

Official page of Caffe -I installed Caffe so that I can do deep learning on MAC OS X El Capitan -Until running the sample of Deep Learning framework Caffe on Mac OSX 10.11

Recommended Posts

Notes on installing Caffe in CPU mode on Mac OSX 10.11 (El Captain)
How to install Deep Learning framework Caffe on Mac in CPU mode
Notes on installing dlib on mac
Notes on installing Python on Mac
Notes on installing pipenv on Mac
Install Caffe on Ubuntu 14.04 (CPU mode)
Steps to get Caffe into Mac OS X 10.10 in CPU Mode
Instructions for installing CUDA 7.5 on Mac (El Capitan) + Homebrew
Install Caffe on Mac
Pyenv on Mac OSX Mavericks
Install pillow on Mac OSX 10.9
Notes on installing Anaconda 3 on Windows
Notes on imshow () in OpenCV
Notes on installing Python on CentOS
Install python3 on Mac (El Capitan)
Notes on installing Python using PyEnv
Notes on installing Ubuntu 18.04 on the XPS 15 7590
(Beginner) Notes on using pyenv on Mac