Caffe is a deep learning framework made with expression, speed, and modularity in mind. It is developed by Berkeley AI Research (BAIR)/The Berkeley Vision and Learning Center (BVLC) and community contributors.
Check out the project site for all the details like
- DIY Deep Learning for Vision with Caffe
- Tutorial Documentation
- BAIR reference models and the community model zoo
- Installation instructions
and step-by-step examples.
- Intel Caffe (Optimized for CPU and support for multi-node), in particular Intel® Xeon processors.
- OpenCL Caffe e.g. for AMD or Intel devices.
- Windows Caffe
Please join the caffe-users group or gitter chat to ask questions and talk about methods and models. Framework development discussions and thorough bug reports are collected on Issues.
Happy brewing!
Caffe is released under the BSD 2-Clause license. The BAIR/BVLC reference models are released for unrestricted use.
Please cite Caffe in your publications if it helps your research:
@article{jia2014caffe,
Author = {Jia, Yangqing and Shelhamer, Evan and Donahue, Jeff and Karayev, Sergey and Long, Jonathan and Girshick, Ross and Guadarrama, Sergio and Darrell, Trevor},
Journal = {arXiv preprint arXiv:1408.5093},
Title = {Caffe: Convolutional Architecture for Fast Feature Embedding},
Year = {2014}
}
If you just want to use the officially-compiled caffe bins instead of modifying caffe code, using a docker is a better option. Currently there are two very-well maintained caffe docker.
- bvlc/caffe:cpu
- ufoym/deepo:cpu
Detailed description of how to use bvlc/caffe:cpu
is located Here.
Steps to build caffe on a Ubuntu 16.04 machine.
Prerequisites: Install the dependent packages
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
for req in $(cat ./python/requirements.txt); do pip install $req; done
Fix 3 installation errors due to using Python 2.x version. Matplotlib error was ignored.
pip install 'scikit-image<0.15'
pip install 'networkx==2.2'
pip install IPython==5.0 --user
As you will see when you run the classification of an image, an skimage.io
will occur as flowing. ImportError: No module named skimage.io
Run the following command to install skimage.
sudo apt-get install python-skimage
For reference, if you meet new errors regarding of python packages, you can use the following command instead of using pip install
sudo apt-get install python-matplotlib python-numpy python-pil python-scipy
sudo apt-get install build-essential cython
Prepare the Makefile.config
cp Makefile.config.example Makfile.config
Uncommend CPU_ONLY := 1 in Makefile.config and save the file
Build the project
cd build
make clean
cmake ..
make all
Install the bins
make install
Test the installation
make runtest
If you follow the make
method on BVLC/caffe you will run into two errors, so this way is not recommended. If you insist to use make
, fixes are listed below.
Error 2: libcaffe.so.1.0.0 error issue
Before running classification, we need to download the models first. Run the following command to download the model file.
scripts/download_model_binary.py models/bvlc_reference_caffenet
Classification command example
python python/classify.py examples/images/cat.jpg foo
Note that the results are saved into foo.npy
, which is a numpy data file. Use the following command to see the results in python.
import numpy as np
np.load('foo.npy')