SPTAG
SPTAG copied to clipboard
About the performance in my test.
Hey, thanks for this great project.
I wanna use this algorithm in face feature search, I tried another algorithm called hnswlib, this is also fast, but static, cannot delete.
So I compare three methods: SPTAG.AnnIndex("BKT"), hnswlib and brutoforce search (np.argmax).
Following table is each method's cost time. All are querying 1000 features' 3 most similar features in 26458 fetures.
| algorithm | SPTAG.AnnIndex("BKT") | hnswlib | brutoforce search |
|---|---|---|---|
| cost time(ms) | 3837.684 | 177.665 | 3636.569 |
As the table shows, SPTAG.AnnIndex("BKT") is not faster than brutoforce search, don't get spped up.
This is my SPTAG.AnnIndex("BKT") test code:
@calc_time
def testSearch(index, q, k):
j = SPTAG.AnnIndex.Load(index)
_t0 = datetime.now()
for t in range(q.shape[0]):
result = j.Search(q[t].tobytes(), k)
_t1 = datetime.now()
print("Search time is {} ms".format(1000*(_t1-_t0).total_seconds()))
I don't know if this is normal, or my test code is wrong? Thank you.
This is my test result,I also think that the query takes a long time.