diff --git a/apps/hrm/services.py b/apps/hrm/services.py index 576e2de8..5f16cf7a 100755 --- a/apps/hrm/services.py +++ b/apps/hrm/services.py @@ -430,7 +430,7 @@ class HrmService: def get_facedata_from_img(cls, img_path): try: from deepface import DeepFace - embedding_objs = DeepFace.represent(img_path=img_path) + embedding_objs = DeepFace.represent(img_path=img_path, model_name='Facenet') return embedding_objs[0]["embedding"], '' except Exception as e: return None, '人脸数据获取失败请重新上传图片' \ No newline at end of file diff --git a/apps/hrm/tasks.py b/apps/hrm/tasks.py index 279310f5..ddcb49ce 100755 --- a/apps/hrm/tasks.py +++ b/apps/hrm/tasks.py @@ -118,7 +118,7 @@ def delete_face_pkl(epId): photo_path = settings.BASE_DIR + ep.photo face_path = os.path.join(settings.FACE_PATH, f'{epId}.jpg') shutil.copy(photo_path, face_path) - file_path = os.path.join(settings.BASE_DIR, 'media/face/representations_vgg_face.pkl') + file_path = os.path.join(settings.BASE_DIR, 'media/face/representations_facenet.pkl') if os.path.exists(file_path): try: os.remove(file_path) diff --git a/apps/utils/face.py b/apps/utils/face.py index 01615a8c..1c1eaaef 100644 --- a/apps/utils/face.py +++ b/apps/utils/face.py @@ -6,7 +6,7 @@ import time def face_find( img_path, global_face: list, - model_name="VGG-Face", + model_name="Facenet", distance_metric="cosine", enforce_detection=True, detector_backend="opencv",