Machine-Learning-Toolbox icon indicating copy to clipboard operation
Machine-Learning-Toolbox copied to clipboard

Question on the implementation of ArcFace loss

Open TMaysGGS opened this issue 5 years ago • 0 comments

Hi @ewrfcas ,

Thanks for sharing your code about the Keras implementation of ArcFace loss. I recently use this loss to train my model but found something that really confuses me.

In the code below, y_mask =+ K.epsilon() will make y_mask always be equal to K.epsilon(), which is default to 1e-7. This makes the whole loss be equivalent to Softmax since the term cos_tm_temp * y_mask has been almost eliminated.

On the other side, I tried deleting this line to make y_mask become the one-hot form true label, but then the loss become a constant so that the weights & biases do not updates anymore.

So I wonder if you have some advice on this. BTW, do you know how to print out the intermediate values in a custom loss layer? I debugged the loss function line by line and it seems right, while the outcomes when training is not. :(

https://github.com/ewrfcas/Machine-Learning-Toolbox/blob/127d6e5d336614d1efb21e78865501435cdb7b8b/loss_function/ArcFace_loss.py#L55-L58

TMaysGGS avatar Dec 23 '19 12:12 TMaysGGS