修改人脸识别容忍度

This commit is contained in:
caoqianming 2022-04-22 08:38:24 +08:00
parent c70702bec8
commit 33bc475c51
1 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ class HRMService:
f.write(base64_data) f.write(base64_data)
try: try:
unknown_picture = face_recognition.load_image_file(filepath) unknown_picture = face_recognition.load_image_file(filepath)
unknown_face_encoding = face_recognition.face_encodings(unknown_picture, num_jitters=2)[0] unknown_face_encoding = face_recognition.face_encodings(unknown_picture)[0]
os.remove(filepath) os.remove(filepath)
except: except:
os.remove(filepath) os.remove(filepath)
@ -30,7 +30,7 @@ class HRMService:
face_datas = cache.get('face_datas') face_datas = cache.get('face_datas')
face_users = cache.get('face_users') face_users = cache.get('face_users')
results = face_recognition.compare_faces(face_datas, results = face_recognition.compare_faces(face_datas,
unknown_face_encoding, tolerance=0.42) unknown_face_encoding, tolerance=0.38)
for index, value in enumerate(results): for index, value in enumerate(results):
if value: if value:
# 识别成功 # 识别成功