首页 > 解决方案 > 如何使用opencv和flask打开相机进行人脸检测

问题描述

我正在处理我的一个项目,但在运行该项目时出现错误。

错误

请帮助解决此错误

在此处输入图像描述

标签: pythonargparseface-detection

解决方案


UsageError表明你必须用参数来运行它——比如

drowsiness_detection.py -p path_to_dlib_facial_landmark_predictor

或者

drowsiness_detection.py --shape-predictor path_to_dlib_facial_landmark_predictor

你必须用正确的路径代替path_to_dlib_facial_landmark_predictor.
我不使用dlib所以我不知道它应该是什么路径。


如果您的代码中不需要dlib's shape predictor,请不要使用required=True,并且在开始时不需要它。


编辑:

我在教程Facial landmarks with dlib, OpenCV, and Python中找到了类似的代码,
本教程展示了如何运行它

python facial_landmarks.py --shape-predictor shape_predictor_68_face_landmarks.dat \
--image images/example_01.jpg

但首先它需要下载shape_predictor_68_face_landmarks.dat.bz2并解压缩。


推荐阅读