将终端定位到Caffe根目录;
下载MNIST数据库并解压缩:$ ./data/mnist/get_mnist.sh
将其转换成Lmdb数据库格式:$ ./examples/mnist/create_mnist.sh
执行完此shell脚本后,会在./examples/mnist下增加两个新目录,mnist_test_lmdb和mnist_train_lmdb
train model:$ ./examples/mnist/train_lenet.sh
(1) 使用LeNet网络(《Gradient-BasedLearning Applied to Document Recognition》);
(2) 使用./examples/mnist/lenet_train_test.prototxtmodel;
(3) 使用./examples/mnist/lenet_solver.prototxtmodel;
(4) 执行train_lenet.sh脚本,会调用./build/tools目录下的caffe执行文件,此执行文件的实现是./tools目录下的caffe.cpp文件;
(5)执行此脚本后,会生成几个文件,其中./examples/mnist/lenet_iter_10000.caffemodel则是最终训练生成的model文件;
(6) 以上默认的是在GPU模式下运行,如果想让其在CPU模式下运行,只需将lenet_solver.prototxt文件中的solver_mode字段值由原来的GPU改为CPU即可;
refer to