编译NMS出现问题ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead

使用yhenon的pytorch版RetinaNet https://github.com/yhenon/pytorch-retinanet

build NMS时出现问题

ImportError: torch.utils.ffi is deprecated. Please use cpp extensions instead

参考的解决方法为https://github.com/yhenon/pytorch-retinanet/issues/66

即使用https://github.com/huaifeng1993/NMS编译的NMS,具体如下

1. cd nms ,rm -rf /build, rm *.so
2. cd ..,python setup3.py build_ext --inplace
3. modify code in model.py:
   change
        from lib.nms.pth_nms import pth_nms
   to
        from lib.nms.gpu_nms import gpu_nms

and in the function nms(dets, thresh):
   add
        dets = dets.numpy()#to change the dets to numpy:

   change 
        return pth_nms(dets, thresh)
   to 
        return gpu_nms(dets, thresh)

改完后可能涉及到其它问题,比如要将得到的结果放到CPU中才能继续计算,看情况修改自己代码。

你可能感兴趣的:(tools,深度学习,pytorch)