Solutions
As a whole, transfer learning is used to train the neural network, the InceptionV3 structure is used, and the framework uses keras.
Specific ideas:
- Read the picture data and save it in a
.npy
format to facilitate subsequent loading - The label is in one-hot format. Since the label is hidden in the folder naming, you need to add the label yourself and save it to the
.npy
file for subsequent loading - Divide data into training set, validation set, and test set
- Use keras to build the basic model of InceptionV3, excluding the top layer, use pre-training weights, customize several layers of neural networks on the basis of the basic model, get the final model, and train the model
- Optimize the model, adjust hyperparameters, and improve accuracy
- Evaluate the model on the test set, using precision and recall
- Make predictions on a single picture and output the probability of each category
Summary of knowledge points
- How to load the actual data, how to save it as an npy file, how to scramble the data, how to divide the data, how to cross-validate
- How to use keras for transfer learning
- The use of data enhancement and callback function in keras. The callback function involves: learning rate adjustment, saving the best model, tensorboard visualization
- How to use sklearn to calculate accuracy, precision, recall, F1_score
- How to predict a single picture and print the classification probability
- How to specify specific GPU training and how to specify the memory usage of GPU