mep*_*mba 0 python error-handling face-detection deepface
img=cv2.imread(face.jpg)
predictions= DeepFace.analyze(img)
Run Code Online (Sandbox Code Playgroud)
Error: Face could not be detected. Please confirm that the picture is a face photo or consider to set enforce_detection param to False.
设置enforce_detection为False会导致即使图像中没有面部,它也会读取情绪
我们如何处理这个错误,让它告诉我们没有人脸?
解决此问题的最佳方法是读取错误,其中显示:“考虑将 enforce_detection 参数设置为 False。”
所以你可以通过不强制进行面部检测来简单地解决这个问题。
return DeepFace.verify(img1, img2 , enforce_detection=False)['verified']
Run Code Online (Sandbox Code Playgroud)
我的代码有错误,您的代码可能是
DeepFace.analyze(img1 , enforce_detection=False)
Run Code Online (Sandbox Code Playgroud)
编辑回复:
这是一个不同的问题,您可以首先尝试使用以下方法检测照片上是否有脸部:
只分析情绪,知道有一张脸!
| 归档时间: |
|
| 查看次数: |
10161 次 |
| 最近记录: |