Closed a2bc closed 5 years ago
I think coz of l2 normalized weights you can also use euclidean distance metric.
Can someone explain weight normalisation?
Thank you
I think it's a very simple mathematical transformation with em1 and em2 are both l2 normalized. (em1 - em2)^2 = em1^2 + em2^2 - 2 dot_product(em1, em2) = 2 - 2 ||em1|| ||em2||*cos(theta)=2-2cos(theta) So euclidean distance has the same meaning with cos distance after normalizing your feature @a2bc
Hello, In your ReadMe.md, in the section "Pretrained Models", you say that "You can use $INSIGHTFACE/src/eval/verification.py to test all the pre-trained models."
When I look inside this verification.py, it uses this code to compute the score: diff = np.subtract(embeddings1, embeddings2) dist = np.sum(np.square(diff),1)
This score is not adapted to SphereFace, CosineFace, ArcFace. For these loss functions, we must use embeddings1.dot_product(embeddings2).
Looking at the header of the verification.py, I see that it is written by David Sandberg - the author of facenet (https://github.com/davidsandberg/facenet). In facenet, I remember that they use TripletLoss and then the score = sum_of_square_of_difference makes sense..
In one of pre-trained model (https://pan.baidu.com/s/1ENjcACInLfBGHZ8e7Fc-XA), I see that the file name is arcface50-caffe (the term "arcface" rings me a bell :) ). Then I guess if I use this trained model, I have to use dot_product to compute the distance between 2 embeddings.
Am I wrong ?
Thanks !