fix: update_global_face_pd bug
This commit is contained in:
parent
300433547e
commit
81d53ce6b1
|
@ -73,7 +73,7 @@ class EmployeeCreateUpdateSerializer(CustomModelSerializer):
|
||||||
if old_photo != instance.photo: # 如果照片有变动,需要更新人脸库
|
if old_photo != instance.photo: # 如果照片有变动,需要更新人脸库
|
||||||
face_data, msg = HrmService.get_facedata_from_img(settings.BASE_DIR + instance.photo)
|
face_data, msg = HrmService.get_facedata_from_img(settings.BASE_DIR + instance.photo)
|
||||||
if face_data:
|
if face_data:
|
||||||
instance.facenet512_data = face_data
|
instance.facenet_data = face_data
|
||||||
instance.save()
|
instance.save()
|
||||||
else:
|
else:
|
||||||
raise ParseError(msg)
|
raise ParseError(msg)
|
||||||
|
|
|
@ -118,7 +118,7 @@ def delete_face_pkl(epId):
|
||||||
photo_path = settings.BASE_DIR + ep.photo
|
photo_path = settings.BASE_DIR + ep.photo
|
||||||
face_path = os.path.join(settings.FACE_PATH, f'{epId}.jpg')
|
face_path = os.path.join(settings.FACE_PATH, f'{epId}.jpg')
|
||||||
shutil.copy(photo_path, face_path)
|
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):
|
if os.path.exists(file_path):
|
||||||
try:
|
try:
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
|
|
Loading…
Reference in New Issue