ramdrop / autoplace

Implementation for the paper: AutoPlace: Robust Place Recognition with Single-chip Automotive Radar
104 stars 23 forks source link

The difference between `faiss` and `sklearn` #9

Closed whu-lyh closed 6 months ago

whu-lyh commented 9 months ago

Thanks for your codes @ramdrop . I noticed some manner in common.py, when doing the knn search. The corresponding code is as followings:

def cal_recall_feat(gt, qFeat, dbFeat):
    # --------------------------------- use faiss to do NN search -------------------------------- #
    # faiss_index = faiss.IndexFlatL2(qFeat.shape[1])
    # faiss_index.add(dbFeat)
    # dists, predictions = faiss_index.search(qFeat, 20)   # the results is sorted
    # -------------------------------- use sklearn to do NN search ------------------------------- #
    knn = NearestNeighbors(n_jobs=1)
    knn.fit(dbFeat)
    dists, predictions = knn.kneighbors(qFeat, 20)
    recalls = cal_recall_pred(gt, predictions)
    return recalls, dists, predictions

Can you share me some advice about how to use them? Thanks!

whu-lyh commented 6 months ago

I figure it out..