This article is shared from the Huawei cloud community “MindSpore based ResNet-50 Mushroom” identification application experience “, original author: Dasming.

Abstract: Based on the RESNET-50 network model of Huawei Mindspore framework, the recognition and classification training of 6,714 pictures of 10 kinds of mushrooms was realized.

Backed by a new design concept, Huawei Cloud launched MindSpore Deep Learning Practice Camp to help Xiao Bai get started faster with high-performance deep learning framework, train ResNet-50 quickly, realize your first mobile App development, learn intelligent news classification, basketball detection and “guess what you like” model!

Mindspore Deep Learning Camp is a 21-day course that not only provides an introduction to the current hot mobile deployment, but also provides interesting practices to keep up with current events, as well as in-depth explanation of the bottom level development, so that you can learn everything from framework to algorithm to development at once.

In the third lesson of Mindspore’s 21-day practice, teacher Wang Hui shared the recognition and reasoning model based on Mindspore’s RESNET-50, how to apply it to whether “Mushroom ‘Jun’ is poisonous?” The detection scenario of.

The status before ResNet was:

CNN can extract features at low/mid/high level. The more layers of the network, the richer features at different levels can be extracted. Moreover, the deeper the network, the more abstract the features extracted, the more semantic information. In fact, with the increase of neural network layers, the gradient disappears or explodes, which makes the deep network difficult to train.

The solution to this problem is to regularize the initialization and the middle Batch Normalization layers, which will train tens of layers of networks. Although the above method can be used for training, another problem will appear, that is, the degradation problem. The number of network layers increases, but the accuracy in the training set is saturated or even decreased.

Resnet proposed the residual structure to solve the problem of gradient disappearance, explosion or training degradation. Its classical structure is shown in the figure below:

As shown in the figure below, the normal layer is on the left and the ResNet is on the right;

As shown in the figure below, the normal layer is on the left and the ResNet is on the right;

As the number of network layers increases greatly, the output H(X) of the common layer becomes more and more difficult to learn. ResNet crosses the convolution layer and takes the input X as the final output. F of X is called the residual.

Deep residual network has relatively low complexity and deeper network layer number. He has won the first prize in many competitions.

The 50 in RESNET-50 refers to the number of layers in the network.

The experience operation of this class is based on the RESNET-50 network model of Huawei Mindspore framework to realize the recognition and classification training of 6,714 pictures of 10 kinds of mushrooms. Computing power is based on Huawei Cloud ModelArts, and network storage uses Huawei OBS object storage service. In the process of uploading a large number of pictures to OBS bucket, OBS-BROWSER-PLUS suite tool was used. After setting the OBS login authority and storage directory, the local drag-and-drop directory operation could be performed, and a large number of data files could be queued for automatic uploading.

Based on the computing power of 1* ASCEND910 CPU, the whole training process took 10.04minutes, and the average loss of training precision of the data set was 0.569. The output log is shown in the figure below.

For the model generated by training, Eval is used to test the “Mushroom Superman” image.

The classification results were as follows: “Hornsmannii, Cymophyta, Cymophyta…” , the test log is shown in the following figure. I also checked the pictures of Khodorkovsky pink pleated umbrella. Among other things, the color similarity is quite high.

The whole experience process is simple and smooth, and the combination of examples deepens the understanding of RESNET-50 deep neural network.

Click on the attention, the first time to understand Huawei cloud fresh technology ~