feat: 更改为facenet模型

This commit is contained in:
caoqianming 2023-09-12 09:20:04 +08:00
parent 2d59864f65
commit a763cc00e6
3 changed files with 3 additions and 3 deletions

View File

@ -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, '人脸数据获取失败请重新上传图片'

View File

@ -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)

View File

@ -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",