Closed whxhngns200 closed 5 years ago
can you list the parameters of flann or the code ? thanks!
Does knn graph means to get μNNs in the paper? If not, how can I get the top μ node in the origin entire collection? Using L2 distance between feature- feature pair to decide? Thx.
you can use this code below:
import faiss
d = 512
index = faiss.IndexFlatL2(d)
index.add(features)
k = 200
D, I = index.search(features, k)
and I is the knn_graph
KNN graph is calculated from face features. If in your application the accuracy is the most important, you can generate KNN graph by brute force, which requires to compute all pairwise similarity and the complexity is O(n^2). If you want it fast, please use approximate nearest neighbor algorithms. For instance, I use FLANN in this work. You can also check faiss(https://github.com/facebookresearch/faiss). The best complexity of ANN is O(nlogn).