diff --git a/apps/hrm/services.py b/apps/hrm/services.py index 5f16cf7a..fb720aef 100755 --- a/apps/hrm/services.py +++ b/apps/hrm/services.py @@ -416,9 +416,13 @@ class HrmService: from apps.hrm.tasks import update_global_face global_face = update_global_face() global_face = cache.get('global_face') - dfs = face_find(img_path=img_path, global_face=global_face) + try: + dfs = face_find(img_path=img_path, global_face=global_face) + os.remove(img_path) + except ValueError: + os.remove(img_path) + return None, '人脸未匹配,请调整位置' # dfs = DeepFace.find(img_path=img_path, db_path=db_path) - os.remove(img_path) df = dfs[0] if not df.empty: matched = df.iloc[0].identity