How can we join/combine two models in Transfer Leaning in KERAS?
I have two models: model 1 = My Model model 2 = Trained Model
I can combine these models by putting the model 2 as input and then passed its output to the model 1, which is the conventional way.
However, I am doing it in other way. I want to put the model 1 as input and then passed its output to the model 2 (i.e. trained model one).
It's exactly the same procedure, just make sure that your model's output has the same shape as the other model's input.
Make sure (if that's what you want), to make all layers from model 2 have
trainable=False
before compiling, so the training will not change the already trained model.Test code:
Output: