Windows 编译cython nms
【摘要】
https://github.com/pjl1995/CTracker/blob/master/model.py
调用:
from lib.cython_nms.cpu_nms import soft_nms as cython_soft_nms_wrapper
demo:
import numpy as np import cpu_nms# fro...
https://github.com/pjl1995/CTracker/blob/master/model.py
调用:
from lib.cython_nms.cpu_nms import soft_nms as cython_soft_nms_wrapper
demo:
-
import numpy as np
-
-
import cpu_nms
-
# from lib.cython_nms import cpu_nms import cython_soft_nms_wrapper
-
x = np.ones([11,10], dtype =np.float32)
-
-
aa= cpu_nms.soft_nms(x,0.7)
-
-
print(aa)
python setup_cpu.py build_ext --inplace
-
from setuptools import setup, Extension
-
-
import numpy as np
-
from Cython.Build import cythonize
-
from Cython.Distutils import build_ext
-
-
-
# Obtain the numpy include directory. This logic works across numpy versions.
-
try:
-
numpy_include = np.get_include()
-
except AttributeError:
-
numpy_include = np.get_numpy_include()
-
-
# extensions
-
ext_args = dict(
-
include_dirs=[numpy_include],
-
language='c++',
-
)
-
ext_modules = [
-
-
Extension(
-
"bbox",
-
["bbox.pyx"],
-
**ext_args
-
),
-
Extension(
-
"cpu_nms",
-
["cpu_nms.pyx"],
-
**ext_args
-
),
-
]
-
-
setup(
-
name='frcnn_cython',
-
ext_modules=cythonize(ext_modules),
-
# inject our custom trigger
-
cmdclass={'build_ext': build_ext},
-
)
文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/108807015
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)