尝试在 Python 中的 OpenCV 文件中运行以下代码后,出现错误:
predictor = dlib.shape_predictor('shape_predictor_68_face_landmarks.dat')
错误:
RuntimeError: Unable to open shape_predictor_68_face_landmarks.dat
我已经按照这个 stackOverflow 回答下载了 shape_predictor_68_face_landmarks.dat:
https://stackoverflow.com/a/66202687/13218692
有关如何解决此问题的任何建议?感谢您的帮助!谢谢!
答案 0 :(得分:0)
我能够通过在单独的变量中指定文件的完整路径来解决问题:- shape_predictor_68_face_landmarks.dat。这是供您参考的代码:
path = '/Users/name/OpenCV_Python/EyeGazeDetection/shape_predictor_68_face_landmarks.dat'
predictor = dlib.shape_predictor(path)
注意:- 确保将 .dat 文件包含在您的 Python 项目所在的同一文件夹中。