rcmalli / keras-vggface

VGGFace implementation with Keras Framework
MIT License
928 stars 417 forks source link

Triplet loss for training #50

Closed agusgun closed 5 years ago

agusgun commented 5 years ago

Can I know if you use triplet based loss to train the model or not for the VGG16 and RESNET50 model?

Thank you very much

rcmalli commented 5 years ago

It should be possible since the learning method is not model dependent.

TuanAnhNguyen14111998 commented 5 years ago

@rcmalli Can you guide me fine tuning VGGFace Resnet50 with triplet loss with keras? I'm really having trouble doing this! val_loss remains unchanged, always stays at 1,000, although loss has decreased.

sherlockchou86 commented 4 years ago

1.load pre-trained weights without top layers, as base model 2.add 3 inputs on base model to create a new model, outputs are feature vectors for 3 inputs, which will be used later in loss function 3.define your triplet loss functions Max(d1-d2+margin, 0), d1 is the distance between anchor features and positive features, d2 is the distance between anchor features and negative features 4.train your own datasets on the new model, 3 inputs each time and no labels needed

the inputs is like (anchor, positive, negative), 3 images each time

after training the base model is used for other generic usage such as feature extraction, only 1 input again.