Commit f3af225a authored by 赵威's avatar 赵威

get result

parent 2280a7c3
......@@ -129,7 +129,7 @@ def get_similar_diary_ids_by_face_features(feature, index, face_to_vec_f, limit=
res = []
for (id, score) in tmp:
if score >= limit:
res.append((id, score))
res.append((str(id), float(score)))
res.sort(key=lambda x: x[1], reverse=True)
return res
......@@ -143,19 +143,19 @@ def save_diary_similarity(load_file, index_path, face_to_vec_f):
for line in lines:
count += 1
tmp = line.split("\t")
id = str(tmp[0])
id = tmp[0]
feature = np.array(json.loads(tmp[1]))
print("{} {}".format(count, id))
tup_res = get_similar_diary_ids_by_face_features(feature, index_path, face_to_vec_f)
if tup_res:
res_dict[id] = json.dumps(tup_res)
res_dict[id] = tup_res
print("done: " + str(len(res_dict)))
key = random.choice(list(res_dict.keys()))
print(res_dict[key])
redis_key = "doris:diary:face_similary"
redis_client3.hmset(redis_key, res_dict)
# redis_key = "doris:diary:face_similary"
# redis_client3.hmset(redis_key, res_dict)
def main():
......
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