2017-08-30 91 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 爲我解決它。