【问题标题】:dlib cnn_face_detection_model_v1 Python errordlib cnn_face_detection_model_v1 Python 错误
【发布时间】:2018-02-08 10:45:54
【问题描述】:

我正在尝试使用 dlib (v19.6) Python API 使用以下代码创建 CNN 人脸检测器:

cnn_face_detector = dlib.cnn_face_detection_model_v1('mmod_human_face_detector.dat')

但是,我得到一个ArgumentError 如下:

---------------------------------------------------------------------------
ArgumentError                             Traceback (most recent call last)
<ipython-input-16-c2ca0a6e8dff> in <module>()
----> 1 cnn_face_detector = dlib.cnn_face_detection_model_v1('mmod_human_face_detector.dat')

ArgumentError: Python argument types in
    cnn_face_detection_model_v1.__init__(cnn_face_detection_model_v1, str)
did not match C++ signature:
    __init__(_object*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

我可能做错了什么?我可以不将模型文件的文件名简单地作为字符串传递吗?

【问题讨论】:

    标签: python face-detection dlib


    【解决方案1】:

    这对我有用,使用这个新版本,你的用法是正确的!

    这可能意味着,你要么:

    • 在安装过程中出错了
      • python setup.py install 安装?那是正确的!
    • 或者:您的 python 解释器在您不知情的情况下使用了其他 dlib 版本

    【讨论】:

    • 我使用python setup.py install --yes USE_AVX_INSTRUCTIONS 进行安装。我检查了 python 解释器使用的是相同的 dlib 版本。我将通过全新安装再试一次。
    【解决方案2】:

    python setup.py install 之后我遇到了一个类似的问题,因为 python 使用了来自/opt/conda/lib/python3.6/site-packages/dlib.so 的旧版本的 dlib。

    做一个简单的 mv /opt/conda/lib/python3.6/site-packages/dlib.so /opt/conda/lib/python3.6/site-packages/dlib_old.so 帮我解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-04
      • 2016-07-11
      • 2020-05-27
      • 1970-01-01
      • 2018-09-01
      • 2020-04-08
      • 2016-02-23
      • 2017-09-30
      相关资源
      最近更新 更多