Closed bladesaber closed 2 years ago
Hi, thanks for your interest in DFM!
In lines 313 and 316, we calculate the correlation as you mentioned. Then in line 317, we convert it to the MSE.
Here is the mathematical expression; Sum((x-y)^2) = sum(x^2) – 2sum(xy)+sum(y^2) As x and y are normalized, sum(x^2) = 1, sum(y^2) = 1, then Sum((x-y)^2) = 2 – 2sum(xy) = 2 -2*<x,y>
So we first get the inner product and select the candidates with greatest inner product (correlation score), then we convert from similarity (inner product) to difference (mse).
Dear All: Thanks for great idea of DFM. Although I read paper and check the code, I still confuse about how to refine points.
In python document, DeepFeatureMatcher.py, in line 313 with code
scores[:, i, j] = torch.sum(act_A * act_B, 0)
.I suppose the score here is something similar to correlation(the higher the better). Because I find that DFM use torch.topk to find the best match in line 316 after finish computing the scores. But I find that in line 351, DFM discard the match with higher score in order to limit the num of the output points and the tag show that the score is SSE(Sum of square error).
That make me confused, if the score here is SSE, when we find the best match, shouldn't it use
torch.topk(scores, 2, dim=2, largest=False)
in line 316, lower SSE means better match, right ??Looking forward to your response. ^_^