Vgg-Face-Fine-tune
Vgg-Face-Fine-tune copied to clipboard
loss qusetion?
is it loss = positive_distance - negative_distance?and you useloss = negative_distance - positive_distance
in the triplet framework, a batch of training data consists of 3 parts: (anchor, pos, neg) positive_distance means the l2 distances between anchor and pos. anchor and pos are embeddings that belogs to the same person, so we hope them to be as small as possible. similarly, we want negative_distance to be as large as possible
loss = max( 0, positive_distance - negative_distance + 1). this is a svm-like loss that what we want is L2_distance(emb(anchor), emb(pos)) is greater than L2_distance(emb(anchor), emb(pos)) by a safe margin of 1, where anchor, pos, neg are images, and emb function means the neural network that transfer images into a high-dimentional embeddings
Hi, I have changed margin to 0.3. As shown in the figure, there are always some validation losss = 0.3. Do you know why?
if all the layers is learnable, try a smaller learning rate. For the first time, I usually froze all the layers except the last layer, train the last layer with a big learning rate until converged, then unfreze all the layers and set the learning rate to a small value
@antipink try to use the model to predict somthing, if the prediction looks wierd (for example, the network predicts the same vector no matter what input is), then the learning rate might be too high
@Ao-Lee Yeah, I have frozen all the layers except last 2 layer. But no matter what the learning rate is, it is still weird that few epochs have their validation loss equal to the margin that we chose. In my case, when validation loss = 0.3 means that positive_distance - negative_distance = 0 for each triplet, the change of this is just too low. How could it happen?
this should be a fine-tuning process, it assumes that a pre-trained face network (vgg-face) was loaded before training. I dont think initializing an empty vgg or image-net vgg would work here. (vgg is very hard to train from scratch, since there are more params in vgg and vgg doesn't have BN or residual-like structure)
this project try to solve the issue that pre-trained model doesn't work well on asian faces.
@antipink, I also have the same problem, when changing the margin value, val_loss value will only decrease to the value of margin, then val_loss will not change. Did you solve this problem, can you guide me to solve this problem? I use VGGFace Resnet50. Thank you very much!
@Ao-Lee, thank you very much, your repo gives me a lot of inspiration!
@antipink, I also have the same problem, when changing the margin value, val_loss value will only decrease to the value of margin, then val_loss will not change. Did you solve this problem, can you guide me to solve this problem? I use VGGFace Resnet50. Thank you very much!
It has been a long time, I can't remember. I am currently using https://github.com/ageitgey/face_recognition