From c9d8a1e22f4a277a6e1191f6d048af26bb38073e Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 13 Sep 2023 17:34:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BA=BA=E8=84=B8=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E6=97=B6=E6=8D=95=E8=8E=B7=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/hrm/services.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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