fix: 人脸识别时捕获错误
This commit is contained in:
parent
a763cc00e6
commit
c9d8a1e22f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue