i have trained my deep learning model initially with 5 classes now i want to add another class without training the whole model over again for those 5 classes. How can I do that?
-
$\begingroup$ How would you just freeze the original 5 outputs (neurons) without freezing the whole layer? $\endgroup$– SkierCommented Aug 5, 2019 at 16:31
-
$\begingroup$ We just need to freeze the output dense layer with softmax activation. $\endgroup$– Subham TiwariCommented Aug 6, 2019 at 11:40
-
$\begingroup$ Did you find any solution to it? $\endgroup$– Verma AshishCommented Sep 25, 2019 at 6:23
2 Answers
You cannot do that without re-training at least part of the model.
You will have to replace the existing output layer with a new output layer that has the desired number of neurons. That, of course, means that you will have to retrain at least the last layer or the last few layers. But you can freeze the weights of all the other layers.
In keras you can freeze the weights of a specific layer by setting its trainable
property to False
.
How to add more class to trained model without complete training for other classes:
- Transfer Learning Twice
- Continual learning approaches
- Regularization
- Expansion
- Rehearsal