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

关于权重ω #6

Open
WriteCodee opened this issue Mar 2, 2024 · 2 comments
Open

关于权重ω #6

WriteCodee opened this issue Mar 2, 2024 · 2 comments

Comments

@WriteCodee
Copy link

您好,请问“将z中的m个局部相似度值进行线性加权,得到查询图像与类别之间的全局相似度Z”,请问这个权重是如何计算的呢?

@WenbinLee
Copy link
Owner

您好,这个问题问的非常好,我们其实是采用了一个比较巧妙的方式来实现这个可学习权重w,

我们在计算查询图像Q与某个类别的相似度的时候,假设Q有m个局部相似度,我们直接把这m个相似度存下来,放在mea_sim里,它的维度是"类别数量*m",然后在self.classifier里我们采用了一个Conv1d来,使得Kernel size和stride都等于m,即论文中的441,通过这种方式就自动学习了w

nn.Conv1d(1, 1, kernel_size=441, stride=441, bias=use_bias)

@WriteCodee
Copy link
Author

您好,这个问题问的非常好,我们其实是采用了一个比较巧妙的方式来实现这个可学习权重w,

我们在计算查询图像Q与某个类别的相似度的时候,假设Q有m个局部相似度,我们直接把这m个相似度存下来,放在mea_sim里,它的维度是"类别数量*m",然后在self.classifier里我们采用了一个Conv1d来,使得Kernel size和stride都等于m,即论文中的441,通过这种方式就自动学习了w

nn.Conv1d(1, 1, kernel_size=441, stride=441, bias=use_bias)

好的明白了,谢谢您!

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