Caffe Sample program test mnist data set

Source: Internet
Author: User

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.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.