Train multi-class image classifier in Keras

后端 未结 1 1716
-上瘾入骨i
-上瘾入骨i 2021-01-31 21:52

I was following a tutorial to learn train a classifier using Keras

https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 22:24

    1. Use softmax as activation function of the output layer, it is a generalization of the logistic function for a multi class case. Read more about it here.

    2. If validation error is much greater than the training one, as in your case, it is an indicator of overfitting. You should do some regularization, which is defined as any changes of the learning algorithm, that are intended to reduce the test error but not the training one. You can try things like data augmentation, early stopping, noise injection, more aggressive dropout, etc.

    3. If you have the same set-up as in the linked tutorial, change the class_modeof the train_generatorand validation_generator to categorical and it will one-hot encode your classes.

    0 讨论(0)
提交回复
热议问题