Bug while returning matching score
tcourat opened this issue · 1 comments
tcourat commented
Hi,
I was using LoFTR but I was unable to obtain the confidence score. Instead it always returned [1 1 1 1 ...].
I believe there is an issue there, and maybe it is the same for sparse detectors too :
https://github.com/Vincentqyw/image-matching-webui/blob/f87ed7aad49842ab0c542c220356dbeb12d717d1/hloc/match_dense.py#L373C1-L376C67
Indeed, loftr prediction function does not return score under the key "mconf", but under the key "scores", hence I modified the piece of code by taking into account the "scores" key :
if "mconf" in pred.keys():
ret["mconf"] = pred["mconf"].cpu().numpy()
elif "scores" in pred.keys() :
ret["mconf"] = pred["scores"].cpu().numpy()
else:
ret["mconf"] = np.ones_like(kpts0.cpu().numpy()[:,0])
And now I can retrieve the confidence score.
"Scores" works for LoFTR but I dit not try other detectors.
Vincentqyw commented
Thanks! Fixed in commit: 3283537