Reputation: 1034
I have two different model, one is only hidden layer and another model is only dense layer.
I can load those model like
model_HL = load_model('model_hl.hdf5')
model_DL = load_model('model_dl.hdf5')
and can use it as
output_HL = model_HL.predict (input)
output_HL_flatten = features.reshape((output_HL.shape[0],np.prod(self.outputShape)))
output_DL = model_DL.predict (output_HL_flatten)
But now my requirement has changed. I want to add those model in such a way that I can use it like
output_DL = model.predict (input)
Please help me to do the same.
Upvotes: 1
Views: 1492
Reputation: 2378
You can easily define new model in Keras using the fact that models can be composed like layers:
from keras.models import Model
composed_model = Model(
inputs=[model_HL.input],
outputs=[model_DL(model_HL.output)]
)
Upvotes: 1