简体   繁体   English

最近邻搜索的高效实现

[英]Efficient implementation of the Nearest Neighbour Search

I am trying to implement an efficient algorithm for nearest-neighbour search problem.我正在尝试为最近邻搜索问题实施一种有效的算法。

I have read tutorials about some data structures, which support operations for this kind of problems (for example, R-tree , cover tree , etc.), but all of them are difficult to implement.看了一些数据结构的教程,支持对这类问题的操作(比如R-treecover tree等),但是都很难实现。

Also I cannot find sample source code for these data structures.我也找不到这些数据结构的示例源代码。 I know C++ and I am trying to solve this problem in this language.我知道 C++,我正在尝试用这种语言解决这个问题。

Ideally, I need links that describe how to implement these data structures using source code.理想情况下,我需要描述如何使用源代码实现这些数据结构的链接。

There are several good choices of fast nearest neighbor search libraries.快速最近邻搜索库有几个不错的选择。

  • ANN , which is based on the work of Mount and Arya. ANN ,它基于 Mount 和 Arya 的工作。 This work is documented in a paper by S. Arya and DM Mount.这项工作记录在 S. Arya 和 DM Mount 的论文中。 "Approximate nearest neighbor queries in fixed dimensions" . “固定维度的近似最近邻查询” In Proc.在过程中。 4th ACM-SIAM Sympos.第四届 ACM-SIAM 研讨会。 Discrete Algorithms, pages 271–280, 1993.离散算法,第 271–280 页,1993 年。

  • FLANN , which is based on the work of Marius Muja & Co. There is a paper by Marius Muja and David G. Lowe, "Fast Approximate Nearest Neighbors with Automatic Algorithm Configuration" , in International Conference on Computer Vision Theory and Applications (VISAPP'09), 2009. The code for FLANN is available on github FLANN ,基于 Marius Muja & Co. 的工作。Marius Muja和 David G. Lowe 在国际计算机视觉理论与应用会议 (VISAPP' 09), 2009. FLANN 的代码可在github上获得

FLANN seems to be quicker in some cases, and is a more modern version of the code with solid bindings for a number of other languages, that can incorporate changes rapidly. FLANN 在某些情况下似乎更快,并且是代码的更现代版本,具有针对许多其他语言的可靠绑定,可以快速合并更改。 ANN is probably a good choice if you want a solid well-tested standard library.如果你想要一个经过良好测试的可靠标准库,ANN 可能是一个不错的选择。

Edit in Response to Comment编辑回应评论

Both of these libraries have extensive documentation and examples.这两个库都有大量的文档和示例。

Sample code for ANN is available in the Manual , In section 2.1.4 手册中第 2.1.4 节中提供了 ANN 的示例代码

Sample code for FLANN is available in the FLANN repository examples directory , for example /examples/flann_examples.c FLANN 的示例代码在 FLANN 存储库示例目录中可用,例如 /examples/flann_examples.c

You could try a linesweep algorithm to find the closest pair of points: http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=lineSweep .您可以尝试使用线扫描算法来找到最接近的点对: http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=lineSweep

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM