mirror of
https://github.com/facebookresearch/faiss.git
synced 2025-06-03 21:54:02 +08:00
Summary: As discussed in https://github.com/facebookresearch/faiss/issues/685, I'm going to add an NSG index to faiss. This PR which adds an NNDescent index is the first step as I commented [here ](https://github.com/facebookresearch/faiss/issues/685#issuecomment-760608431). **Changes:** 1. Add an `IndexNNDescent` and an `IndexNNDescentFlat` which allow users to construct a KNN graph on a million scale dataset using CPU and search NN on it. The implementation part is put under `faiss/impl`. 2. Add compilation entries to `CMakeLists.txt` for C++ and `swigfaiss.swig` for Python. `IndexNNDescentFlat` could be directly called by users in C++ and Python. 3. `VisitedTable` struct in `HNSW.h` is moved into `AuxIndexStructures.h`. 3. Add a demo `demo_nndescent.cpp` to demonstrate the effectiveness. **TODO** 1. Support index factor. 2. Implement `IndexNNDescentPQ` and `IndexNNDescentSQ` 3. More comments in the code. Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1654 Test Plan: buck test //faiss/tests/:test_index_accuracy -- TestNNDescent buck test //faiss/tests/:test_build_blocks -- TestNNDescentKNNG Reviewed By: wickedfoo Differential Revision: D26309716 Pulled By: mdouze fbshipit-source-id: 2abade9708d29023f8bccbf77143e8eea14f66c4
24 lines
938 B
CMake
24 lines
938 B
CMake
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the BSD-style license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
add_executable(demo_imi_flat EXCLUDE_FROM_ALL demo_imi_flat.cpp)
|
|
target_link_libraries(demo_imi_flat PRIVATE faiss)
|
|
|
|
add_executable(demo_imi_pq EXCLUDE_FROM_ALL demo_imi_pq.cpp)
|
|
target_link_libraries(demo_imi_pq PRIVATE faiss)
|
|
|
|
add_executable(demo_ivfpq_indexing EXCLUDE_FROM_ALL demo_ivfpq_indexing.cpp)
|
|
target_link_libraries(demo_ivfpq_indexing PRIVATE faiss)
|
|
|
|
add_executable(demo_nndescent EXCLUDE_FROM_ALL demo_nndescent.cpp)
|
|
target_link_libraries(demo_nndescent PRIVATE faiss)
|
|
|
|
add_executable(demo_sift1M EXCLUDE_FROM_ALL demo_sift1M.cpp)
|
|
target_link_libraries(demo_sift1M PRIVATE faiss)
|
|
|
|
add_executable(demo_weighted_kmeans EXCLUDE_FROM_ALL demo_weighted_kmeans.cpp)
|
|
target_link_libraries(demo_weighted_kmeans PRIVATE faiss)
|