Commit 20ac613f authored by 赵威's avatar 赵威

get result

parent df29b9ba
......@@ -95,13 +95,13 @@ def save_faiss_index(load_file, save_path):
faiss.write_index(index2, save_path)
def get_similar_diary_ids_by_url(url, index, face_to_vec_f):
def get_similar_diary_ids_by_url(url, index, face_to_vec_f, limit=0):
img = url_to_ndarray(url)
if img.any():
faces = face_to_vec_f(img)
for face in faces:
face_feature = np.array(json.loads(face["feature"])).astype("float32")
_scores, _ids = index.search(np.array[face_feature], 10)
_scores, _ids = index.search(np.array([face_feature]), 10)
ids = _ids.flat
scores = _scores.flat
res = list(zip(ids, scores))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment