How to add new classes to tensorflow.js model in transfer learning?

295 views Asked by At

have a pre-trained network that can object detect one class. How do I add more classes to this model without losing the previous knowledge of that original class?

I have read in another post that suggests creating a new model, with the "base model" layers except for the last two layers. (Why the last 2 specifically?). and setting the new model last 2 layers weights to the base model's last 2 layers weights. Link to Post: How to add a new category to a deep learning model

weights_training = base_model.layers[-2].get_weights()
new_model.layers[-2].set_weights(weights_training)

note that the above code is in tensorflow not tfjs.

Would I be able to do the same in tensorflow.js?

0

There are 0 answers