-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
33 lines (23 loc) · 958 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
from rtree_query_manager import RTreeQueryManager
from sequential_query_manager import *
from highd_query_manager import *
import pickle
def print_result(result):
for i in result:
for j in i:
print(j)
print("")
print("\n")
def main() -> None:
with open("out.embeds", mode="rb") as collection_file:
collection = pickle.load(collection_file)
sequential_query_manager = SequentialQueryManager(collection=collection)
rtree_query_manager = RTreeQueryManager(collection=collection, m=3)
high_d_query_manager = HighDQueryManager(collection=collection, num_bits=2000)
query = os.path.join(os.getcwd(), "lfw/Abdullatif_Sener/Abdullatif_Sener_0002.jpg")
print_result(sequential_query_manager.knn_query(q=query, k=4))
print_result(rtree_query_manager.knn_query(q=query, k=4))
print_result(high_d_query_manager.knn_query(q=query, k=4))
if __name__ == "__main__":
main()