【问题标题】:RuntimeError: Unable to open shape_predictor_68_face_landmarks.datRuntimeError:无法打开 shape_predictor_68_face_landmarks.dat
【发布时间】:2021-06-08 02:26:13
【问题描述】:

尝试在 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

关于如何解决此问题的任何建议?感谢你的帮助!谢谢!

【问题讨论】:

    标签: python opencv


    【解决方案1】:

    我能够通过在单独的变量中指定文件的完整路径来解决问题:- 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 项目所在的同一文件夹中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-22
      • 2021-05-17
      • 1970-01-01
      • 2017-12-24
      • 2018-02-02
      • 2014-07-26
      • 2017-10-24
      • 2019-01-06
      相关资源
      最近更新 更多