Triplet Loss - how does compile() work?

In the Face Recognition assignment, we load a pre-trained FaceNet model implementation and then use it to get the image encodings of faces.

Can someone help me understand how the triplet loss is implemented here?

As far as I understand, unless the pre-trained model is trained after compiling by doing, nothing will change, even if we have run model.compile()?

How does running model.compile() with different losses change the already pre-trained model?


Hi @zzeck ,

Since we won’t retrain the pre-trained model, we don’t need to compile the model.
I guess you’re asking how to apply the triplet loss function to train the model. You can assign the loss function when compiling the model. For instance,

model.compile(loss=triplet_loss, optimizer='Adam')