Mnist is a handwritten digital library and is now a Starter practice library for DL. The special model for mnist recognition is lenet, the first CNN model.
Mnist Data Training sample is 60000, the test sample is 10000, each sample is 28*28 size black and white picture, handwritten number is 0-9, so divided into 10 categories. (PS: Run All programs in Caffe, must be in the root directory, or error)
First download the mnist data, assuming the current path is the Caffe root directory
./data/mnist/get_mnist.sh
Contains two training sets and two test sets, namely pictures and labels
The original data set downloaded to is a binary file that needs to be converted to LEVELDB or Lmdb to be used by Caffe. This is because data types are too diverse to handle all types of input data in a single set of code, which simplifies data reading and, on the other hand, uses leveldb or lmdb to improve disk IO utilization
As we all know, the more difficult point in deep neural networks is the parameter tuning, which requires a bit of work and experience, so here is the default. Take a look at the parameter settings
./examples/mnist/train_lenet.sh
Start training, Caffe now seems to support single-card, my machine is equipped with 4 K80 (a card has two chips), but only a chip
The training takes 4 minutes.
./build/tools/caffe.bin Test-model Examples/mnist/lenet_train_test.prototxt-weights Examples/mnist/lenet_iter_ 10000.caffemodel-iterations 100
Test the well-trained model and end it quickly, with an accuracy rate of 99% and a time of about 30 seconds.