Abstract: If you want to understand deep learning but don’t know how to start, it is better to start with handwritten number recognition model training.

As a branch of machine learning, deep learning has been widely used. Voice recognition, automatic machine translation, instant visual translation, face payment, face attendance… Unconsciously, deep learning has infiltrated into every corner of our life, bringing great convenience to our life. Even so, there are still a lot of people feel deep learning and profound, distant and, indeed, it has a deep, amateurs difficult to achieve, but also a sense of affinity full, let no foundation of small white can also pick up, feel the charm of deep learning, connect down to want introduction of handwritten numeral recognition model training.

Preliminary study on handwritten digit recognition

Handwritten numeral recognition is a relatively simple task in computer vision, and is also one of the earlier development direction in the field of computer vision, is mainly used for bank remittance, number recognition, early post letters, parcels of handwritten, zip code to identify scenarios, such as the handwritten numeral recognition has achieved higher accuracy, large-scale popularization and application. Although the field of handwritten digit recognition itself is relatively narrow and its practicability is limited, the convolutional neural network and other computer vision technologies developed on its basis have been applied to more complex tasks for a long time. Therefore, handwritten digit recognition has become a benchmark task to measure algorithm performance in the field of computer vision. Therefore, this is the best practical scenario to learn about neural network development and training. How to use Deep learning framework MindSpore for model development and training? How do you train a model that can be used to recognize handwritten numbers in ModelArts? Let’s find out.

Data set selection and preparation

Both traditional machine learning and deep learning in machine learning are data-driven research fields. It is necessary to train models based on a large amount of historical data, and then use models to make inferences and predictions on new data. Therefore, data is one of the key elements in machine learning.

MNIST data set is the most widely used public data set in the field of handwritten digit recognition, and most recognition algorithms are trained and verified based on it. MNIST data set contains 10 kinds of digits from 0 to 9, each of which contains a large number of handwritten digital image training sets of different forms, which can be divided into training sets and test sets. The training set covers 60,000 handwritten digital images, and the test level covers 10,000 handwritten digital images. Each image is a black and white image with a standardized size. It is a binary image of 28 x 28 pixels with a pixel value of 0 or 1. The original image of the MNIST dataset is black and white, but better training effect can be obtained by using the enhanced image of the data in actual training.

Data enhanced images used in this training

Recognition method based on deep learning

Different from traditional machine learning that uses simple models to perform tasks such as classification, this training uses deep neural network as the training model, namely, deep learning. Deep learning uses artificial neural network to extract features. Outputs of different layers are often regarded as features of different scales extracted by neural network. Outputs of the upper layer serve as inputs of the next layer, and layers are connected to form a deep neural network.

How deep learning works

In 1994, Yann LeCun released LeNet, a convolutional neural network combined with back propagation, whose effect in the field of handwritten number recognition was far superior to other models. In 1998, Lenet-5, a convolutional neural network constructed by Yann LeCun et al., succeeded in handwritten number recognition and was known as the “Hello Word” of convolutional neural network. Lenet-5 and its subsequent variants define the basic structure of modern convolutional neural networks, which can be described as an entry-level neural network model. The model used in this practice is LenET-5.

LeNet – 5 structure

Lenet-5 consists of input layer, convolution layer, pooling layer and full connection layer. The input layer is used to input data; The convolution layer extracts local features of input through convolution operation. In the pooling layer, the resolution of the feature map is reduced by down-sampling, so that the sensitivity of the output to position and deformation is reduced, and the parameters and computation amount in the network are also reduced. The full connection layer assemes local features into complete images by weight matrix, completes the mapping from feature space to real category space, and finally completes image classification by the full connection layer. After we have such a neural network, we need to train it with a large number of data sets, so as to have more accurate prediction results for the input data. This process relies on The deep learning framework developed by Huawei, MindSpore.

MindSpore’s “learning” process

MindSpore has been deployed in the development environment and training environment of ModelArts, and threshold algorithm is provided for developers to use directly. Its learning process is shown in the figure below, which can be summarized briefly:

  1. Frontline web development using the basic modules provided by MindSpore

  2. Data is processed and enhanced for better data entry

  3. The frontier network is used to construct the training model, and the model is saved and reasoned

It may sound obvious, but you need to do it yourself to realize how much fun it is.

See here, you must have a little background knowledge and principle, if you are eager to try, then quickly come to Huawei Cloud Institute to learn the micro certification course “Using MindSpore training Handwritten number Recognition model”. By the way, quietly tell you, this experiment is now free yo, come to Huawei Cloud Academy sandbox laboratory can experience immediately. From principle to practice, we will bring you an all-round understanding of the whole process of handwritten digital model training.

→ Click direct to Huawei Cloud Institute to get more new skills

This article is shared from huawei cloud community “The first experience of MindSpore Handwritten number Recognition, Deep learning is not so mysterious”, the original author: Xiao Zhu of the college.

Click to follow, the first time to learn about Huawei cloud fresh technology ~