Note: tested with Ubuntu 16.04.1 using /root, for newer Ubuntu version (>= 17.04), check here.

Installation & Self-Tests

Download the installation script here.
//(Sunny only added USE_CUDNN=1, the rest is the same as: ref. You may wanna set USE_CUDNN to 0).

Hello World (Mnist)

prepare data:

./data/mnist/get_mnist.sh        # will download into ./data/mnist/
./examples/mnist/create_mnist.sh # will create lmdb, compute image mean

train

./build/tools/caffe train -solver examples/mnist/lenet_solver.prototxt -gpu 0

updatedb && \
locate lenet_iter

//by default, -gpu device index is -1 (no gpu)
//The training can start from any training snapshot:
caffe train -solver=lenet_solver.prototxt -snapshot=lenet_iter_350.solverstate
(see the end of this article)

test

cd
git clone [email protected]:SunnyBingoMe/caffe-mnist-test.git
cd caffe-mnist-test
python2 mnist_test.py 2.png


ref

Build-in Default Examples

ref

CAFFE_ROOT=/root/caffe
echo 'CAFFE_ROOT=/root/caffe' >> ~/.bashrc
cd $CAFFE_ROOT

mnist

Hand-writing digits.

prepare data:

./data/mnist/get_mnist.sh        # will download into ./data/mnist/
./examples/mnist/create_mnist.sh # will create lmdb, compute image mean

timing:

# for cpu:
./build/tools/caffe time --model=examples/mnist/lenet_train_test.prototxt

# for gpu (just add the gpu param at the end):
./build/tools/caffe time --model=examples/mnist/lenet_train_test.prototxt --gpu 0

cifar10

ref: The CIFAR-10 dataset (<200MB) consists of 60000 32x32 colour images in 10 classes (animals), with 6000 images per class. There are 50000 training images and 10000 test images.

prepare data:

./data/cifar10/get_cifar10.sh
./examples/cifar10/create_cifar10.sh

timing/benchmarking:

# cpu:
./build/tools/caffe time --model=examples/cifar10/cifar10_full_train_test.prototxt

# gpu (just add the gpu param at the end):
./build/tools/caffe time --model=examples/cifar10/cifar10_full_train_test.prototxt --gpu 0

ilsvrc12

Hello World 2 (Start from Image )

(Cats vs. Dogs)
blog
code