csiro-robotics / locus

[ICRA 2021] This repository contains the code for "Locus: LiDAR-based Place Recognition using Spatiotemporal Higher-Order Pooling".
https://arxiv.org/abs/2011.14497
Other
118 stars 15 forks source link

Regarding the question of how to choose between cosine distance and Euclidean distance #7

Closed shenhai911 closed 1 month ago

shenhai911 commented 1 month ago

Thank you for your reply, the problem has been solved, but I have another question to consult. At https://github.com/csiro-robotics/locus/blob/781c1ba340db4bad6ac2760fc8f1920998f56230/evaluation/place_recognition.py#L36C1-L36C110 and https://github.com/csiro-robotics/locus/blob/f16839f802e29f297c79fbe6f4d3b311969c89fc/evaluation/place_recognition.py#L105C1-L105C9 you use cosine distance to calculate the distance between two feature descriptors, and the threshold range is set to [0.1, 0.5], while in LoGG3D-Net, the threshold range is set to [0.001, 1.0] (at https://github.com/csiro-robotics/LoGG3D-Net/blob/cfbe064e36a4c39ef1bf6bb2d0304c6f9c7a0905/config/eval_config.py#L37). I would like to consult, what would be the difference if Euclidean distance is used to calculate the distance between featrue descriptors? And what should the threshold range be set to in this case?

Furthermore, I would like to ask about the selection principle of cosine distance and Euclidean distance?

kavisha725 commented 1 month ago

For the purpose of retrieval using high-dimensional descriptors, cosine distance and Euclidean distance should behave similarly in terms of the retrieved results. The main difference is that cosine distance is limited to the range [0,1] while Euclidean distance is not. For the purpose of plotting the PR curves, we need to define thresholds on the distance and thus using cosine distance is preferred as we can simply threshold within the range [0,1].

Adjusting the threshold range should also give identical results if using an infinite number of thresholds. For efficiency, I used a lower number of thresholds in Locus.

shenhai911 commented 1 month ago

OK,thank you very much for your prompt reply, clear explanation, and excellent work.