MNIST 是一个包含各种手写数字（0-9）图片(images)和对应标签(label)的数据集，下面我们将介绍如何利用 Caffe框架对手写数字识别一个完整的流程，本实验代码可以github下载。

## 数据集准备

### 下载数据集

You will first need to download and convert the data format from the MNIST website. To do this, simply run the following commands:

We will assume that you have Caffe successfully compiled. If not, please refer to the Installation page. In this tutorial, we will assume that your Caffe installation is located at CAFFE_ROOT.

### 数据存储格式

There are 4 files:

The training set contains 60000 examples, and the test set 10000 examples.

The first 5000 examples of the test set are taken from the original NIST training set. The last 5000 are taken from the original NIST test set. The first 5000 are cleaner and easier than the last 5000.

### 可视化MNIST 数据集

data/mnist/train/下，我们可以看到刚才将 rain-images-idx3-ubyte 提取出来的训练集图像，可以看到训练集中单个图片是28*28 单通道灰度图像，如下图所示