fix: update_global_face_pd bug

This commit is contained in:
caoqianming 2023-09-11 17:28:48 +08:00
parent 300433547e
commit 81d53ce6b1
2 changed files with 2 additions and 2 deletions

View File

@ -73,7 +73,7 @@ class EmployeeCreateUpdateSerializer(CustomModelSerializer):
if old_photo != instance.photo: # 如果照片有变动,需要更新人脸库
face_data, msg = HrmService.get_facedata_from_img(settings.BASE_DIR + instance.photo)
if face_data:
instance.facenet512_data = face_data
instance.facenet_data = face_data
instance.save()
else:
raise ParseError(msg)

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_facenet512.pkl')
file_path = os.path.join(settings.BASE_DIR, 'media/face/representations_vgg_face.pkl')
if os.path.exists(file_path):
try:
os.remove(file_path)