I am implementing a Siamese neural network with triplet loss.
The model, trained_model
, is fit on three inputs: anchor, positive, and negative.
However, my SNN aims to determine similarity between two texts. So I want to feed 2 inputs into the model and get a 0 if the documents are similar, and a 1 otherwise.
I know that I should save my weights from trained_model
and load them onto a new model. However, how do I actually do this?
I asked about this in another post, but am approaching this question from another angle (tensorflow weights).
Is there a way to load weights from the three input model to a two input model?
EDIT**:
I have seen this done:
eval_model = Model(inputs=anchor_input, outputs=encoded_anchor)
eval_model.load_weights('weights.hdf5')
But not sure how to use this to test the similarity between two inputs