Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loss function is not LMCL #5

Open
petrLorenc opened this issue Dec 15, 2020 · 1 comment
Open

Loss function is not LMCL #5

petrLorenc opened this issue Dec 15, 2020 · 1 comment

Comments

@petrLorenc
Copy link

How is this loss function:

def large_margin_cosine_loss(y_true, y_pred, scale=30, margin=0.35):
    y_pred = y_true * (y_pred - margin) + (1 - y_true) * y_pred
    y_pred *= scale
    return K.categorical_crossentropy(y_true, y_pred, from_logits=True)

related to 2.2 Large Margin Cosine Loss (LMCL) in the reference paper

It seems totally different, right?

@petrLorenc
Copy link
Author

According to the original idea of the paper, the softmax layer should be applied after the margin/scale. In this case, it was applied beforehand so it seems not the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant