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

Question about the crossentropy loss #42

Closed
Shalomash opened this issue Oct 11, 2020 · 2 comments
Closed

Question about the crossentropy loss #42

Shalomash opened this issue Oct 11, 2020 · 2 comments

Comments

@Shalomash
Copy link

Shalomash commented Oct 11, 2020

I had a question in regards to the softmax crossentropy between the logits from f_q and f_k and the value that is y_true. In the pseudo-code, it says that we are measuring the crossentropy between our concatenated logits (the softmax of the positive pair should approach 1, and the 255 negatives should be zeros?). If this is the case, where we maximize the positive logits value (similarity between corresponding spatial locations) and relative to this we make the negative patches dissimilar, so why is it that in the pseudo-code we are minimizing the crossentropy between logits and just zeros? If we were trying to get all values to be zero, wouldn't that just be trying to make the negatives and the positive locations dissimilar? Am I just missing something simple?

Thanks

Edit:
I should clarify, the part of the pseudo-code I am referring to is where we have logits (which are the positive and negative logits concatenated), and we flatten them. The target that is given is torch.zeros(B*S) [0...0]. From my understanding (or misunderstanding), shouldn't the target label be [1, 0...0], where the 1 is the positive similarities and the zeros are the from cosine similarities of the negative pairs?

@xiaosean
Copy link

xiaosean commented Oct 17, 2020

Same question.
(Updated)
I have an explanation for another issue.
#56

@Shalomash
Copy link
Author

I will go ahead and close this as someone else had the same question.

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

2 participants