2017-08-30 733 views
0

我试图使用DLIB(v19.6)的Python API使用代码来创建一个CNN的脸检测:DLIB cnn_face_detection_model_v1 Python的错误

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> >) 

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

回答

0

这适用于我,使用这个新版本和您的使用是正确的!

这可能意味着,您:

  • 做了一些错误的过程中安装
    • 通过python setup.py install安装?那是对的!
  • 或:你的Python解释器是使用其它DLIB版本不知情的情况下
+0

我用'python setup.py install --yes USE_AVX_INSTRUCTIONS'来安装。我检查了python解释器使用的是相同的dlib版本。我将通过做一个干净的安装再次尝试。 – chronosynclastic

0

我使用DLIB的旧版本从/opt/conda/lib/python3.6/site-packages/dlib.sopython setup.py install后simmilar问题,由于蟒蛇。

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