chrysts / dsn_fewshot

MIT License
89 stars 19 forks source link

Question about Equation 2 and its implementation #15

Closed toooooodo closed 2 years ago

toooooodo commented 2 years ago

Hi, thanks for your work, it's very inspiring to me. But I‘m confused about how Equation2 is derived. Could you please give me some promts about how this formula is derived? And I notice that there is an identity matrix I in this formula, but it seems that the code implementation does not have it. I also don't quite understand how it's implemented here. Thanks.

chrysts commented 2 years ago

Hi, Thanks for your interest to our work. Eq. 2 might look confusing but actually if you multiply every element then it can be reformulated as in Line 41-54.

Cheers

toooooodo commented 2 years ago

Thanks for your reply. I understand it now!😁

UniStarry commented 2 years ago

Hi, thanks for your work! I'm also confused about the equation(2). In the paper, (I-Mc)(f(q)-u),while in the code, "projected_query_j = torch.bmm(h_plane_j, torch.bmm(torch.transpose(h_plane_j, 1, 2), target_features_expanded))" seems stands for the Mc(f(q)-mu), besides, "projected_query_j = torch.squeeze(projected_query_j) + mu[j].unsqueeze(0).repeat(batch_size, 1)" adds the class mean mu[j], this is why? thanks very much!

UniStarry commented 2 years ago

I have no questions, thank you very much!