retinaface windows

本文解决了在RCNN/Cython中执行pysetup.py build_ext --inplace时遇到的两个常见错误。第一个错误是“AttributeError: 'MSVCCompiler' object has no attribute 'compiler_so'”,解决方案涉及修改setup.py文件并编译*.pyx文件为Windows二进制文件(*.pyd)。第二个错误是“ValueError: buffer dtype mismatch, expected 'int_t' but got 'longlong'”,通过更改cpu_nms.pyx文件中的特定行可以解决。

坑1:在 rcnn/cython 中执行 py setup.py build_ext --inplace,

出现错误 “AttributeError: 'MSVCCompiler' object has no attribute 'compiler_so'” 

修改方法:

https://github.com/deepinsight/insightface/issues/679#issuecomment-495870070   ( 感谢 loscheris )

Instead of using python implementation, you can try to compile *.pyx files into windows binaries (*.pyd) :

  1. Replace setup.py in RetinaFace/rcnn/cython dir to:
    # setup.py
    from distutils.core import setup, Extension
    from Cython.Build import cythonize
    import numpy
    
    setup(
        ext_modules=cythonize(["bbox.pyx", "anchors.pyx", "cpu_nms.pyx"]),
        include_dirs=[numpy.get_include()]
    )

     

  2. Use cmd to run python setup.py build_ext --inplace in RetinaFace/rcnn/cython dir

  3. Copy the three windows binaries (*.pyd) generated in RetinaFace/rcnn/cython/rcnn/cpython to RetinaFace/rcnn/cython

  4. Run the test code : )

坑2:ValueError: buffer dtype mismatch, expected 'int_t' but got 'long long'

解决方法:https://github.com/CharlesShang/FastMaskRCNN/issues/163#issuecomment-338623985 (感谢 mengcz13)

Fixed by changing line 25 of cpu_num.pyx from

cdef np.ndarray[np.int_t, ndim=1] order = scores.argsort()[::-1]

to

cdef np.ndarray[np.intp_t, ndim=1] order = scores.argsort()[::-1]

I am having some problems when compiling gpu_nms.pyx on Windows Server, and I am using cpu_nms. Still I don't know what will happen if you use gpu_nms...

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值