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
# 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},
)

 

©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页