Fix a small issue when updating the memory#4
Open
LiUzHiAn wants to merge 3 commits intocvlab-yonsei:masterfrom
Open
Fix a small issue when updating the memory#4LiUzHiAn wants to merge 3 commits intocvlab-yonsei:masterfrom
LiUzHiAn wants to merge 3 commits intocvlab-yonsei:masterfrom
Conversation
|
I have taken a review at the official code and thought about this issue. I think it is hard to say that score[:,i] should be replaced with score[idx,i], because score is normalized (softmax, dim=0) over all patches instead of the chosen idx patches. In that case, use score[idx, i] / torch.max(score[idx, i]) to normalize sounds more reasonable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@hyunjp Hi,
Thanks for your nice work! As I dived into the source code, I just noticed a small issue when we updating the memory as the operations you provided in your paper. To be more concrete, that's formula (5) in the
Updatepart of section 3.1.1. And the corresponding code you wrote is >>here<<.I noticed that the
score[:,i]just represents the similarities between i-th memory item and all the queries. But what we really want to get is the part of queries, whose closet memory item are exact the i-th memory item. So,score[:,i]should be modified intoscore[idx,i]. You can refer to$\max {k^{\prime} \in U{t}^{m}} v_{t}^{k^{\prime}, n}$ in formula (5).
And I clean up the code about the memory updating part. To be short, here are what I've done:
update_indicesand unneeded paramtrainin functionget_update_query()and clean the implementation;Evaluate.pycorrespondingly.If I was wrong, please correct me. Thanks in advance. 😸