Deep Learning Practical Chapter (9) -- TensorFlow Learning Road (6)

popular science

PaddlePaddle is based on Baidu's years of deep learning technology research and business applications. It is China's first self-developed, fully functional, open source and open industrial deep learning platform. It integrates deep learning core training and reasoning frameworks, and basic model libraries. , end-to-end development kit and rich tool components in one. Currently, Flying Paddle has a total of 2.65 million developers and 100,000 service companies. Based on Flying Paddle's open source deep learning platform, 340,000 models have been generated. Paddle helps developers quickly realize AI ideas and quickly launch AI services. Help more and more industries complete AI empowerment and realize industrial intelligence upgrade.

In the previous article, we shared the weight initialization, loss function construction and model accuracy evaluation during the model training process. Such a basic process has been completed, and the next step is how to import data into the network and how to output the network results Pass it to the loss function and backpropagation, let's take a look at it together.                                                   

Network Specific Training

step:

1. Data declaration and import

2. The network output is passed to the loss function

3. Gradient update

4. Training log printing

1. Data declaration and import:

The import of data can be imported during run

2-3. The network output is passed to the loss function:

Define the operation of the network, and pass the output to the loss function Pass the loss to the optimizer update

# run can perform all operations

4. Training log printing

You can clearly see how many batches (steps) have been trained, how many eopochs (the entire training set is iteratively counted once), and the test accuracy of the training set and the accuracy of the test set during training.

Training result display: 

It can be seen from the figure that the training effect is very good, reaching more than 90%, which means that our network construction is very good, and the model can learn the difference between cats and dogs very well.

The total training code that integrates all operations is divided into multiple files to store the code, and all the file codes will be released below. As long as the veterans are consistent with my data set directory, this code can be run.

1. First release img_train.py which is also the main code

2. Data reading  

3. Model code:

epilogue

Today's sharing is over. It is mainly an integration and call of the previous code, and finally directly executes the main code to realize the training process. Model training is generally better and faster on the GPU. I sincerely hope that the veterans will follow my instructions. A code for actual training, so as to experience the fun of deep learning. In the next article, we will share how to use our trained and saved model for actual testing. The trained model can be used in multiple places instead of every Trained every time.

Have a great weekend and see you next time!

Editor: Layman Yueyi|Review: Layman Xiaoquanquan

Wonderful review of the past

Deep Learning Practical Chapter (8) -- TensorFlow Learning Road (5)

Deep Learning Practical Chapter (7) -- TensorFlow Learning Road (4)

Deep Learning Practical Chapter (6) -- TensorFlow Learning Road (3)

What have we done in the past time:

[Year-end summary] 2021, bid farewell to the old and welcome the new

[Year-end Summary] Saying goodbye to the old and welcoming the new, 2020, let's start again

-Scan the code to follow-

Advanced IT Tour

I knew you were "watching"

Guess you like

Origin blog.csdn.net/xyl666666/article/details/117639340