【问题标题】:Boost.Python.ArgumentError during landmarks detection using Dlib使用 Dlib 进行地标检测期间的 Boost.Python.ArgumentError
【发布时间】:2016-12-25 01:49:45
【问题描述】:

我在使用shape_predictor 使用Dlib 进行面部标志检测时遇到问题。

我根据these issuethis one编译了dlib并验证了boost lib路径,但还是报同样的错误:

 Traceback (most recent call last):
  File "face_landmark_detection.py", line 66, in <module>
    predictor = dlib.shape_predictor(predictor_path)
Boost.Python.ArgumentError: Python argument types in
    shape_predictor.__init__(shape_predictor, str)
did not match C++ signature:
    __init__(boost::python::api::object, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
    __init__(_object*)

有什么想法吗?

【问题讨论】:

    标签: python-2.7 boost-python dlib


    【解决方案1】:

    我能想到的一件事是您的 predictor_path 无法转换为 std::string。它可以是Unicode吗?您使用的是 Python 3.* 吗?

    【讨论】:

    • 我使用 python 2.7 和 anaconda。 OpenCV 3
    • 我用 Unicode 格式的硬编码字符串替换了 predictor_path,但仍然遇到同样的问题
    • 我的建议有点相反:尝试将您的字符串显式转换为 ascii。该提议基于这样一个假设,因为 boost.python 不支持 Unicode 字符串(开箱即用),并且您的路径可能是 Unicode,参数的转换可能会失败。
    【解决方案2】:

    给定两个完全相同的 Ubuntu 16 版本,我遇到了同样的问题。 诀窍是用 g++-5.4 而不是 g++-4.9 编译。

    sudo apt-get install g++-5
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 60
    

    我猜你也可能只是更改 CMake-Flags。

    【讨论】:

      猜你喜欢
      • 2016-07-18
      • 2016-07-09
      • 2021-03-22
      • 2016-10-27
      • 2019-04-20
      • 2017-10-02
      • 2015-07-31
      • 2016-07-16
      • 2019-03-14
      相关资源
      最近更新 更多