Recently, I was trying to network such as CenterFace.pytorch/ CenterNet, and reported an error
ModuleNotFoundError: No module named 'lib.external.nms'
Under linux, the general solution is
cd src/lib/external
make
But under windows, I found a setup.py, too lazy to set the environment or something. However, in this setup.py, name="coco", I really don’t like it, because there are already a lot of extensions in the coco system, so I Changed to external, of course you can change it to any name,
import numpy
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
extensions = [
Extension(
"nms",
["nms.pyx"],
extra_compile_args=[] #["-Wno-cpp", "-Wno-unused-function"]
)
]
setup(
name="external",
ext_modules=cythonize(extensions),
include_dirs=[numpy.get_include()]
)
python setup.py install
The report said it was installed here,
copying build\lib.win-amd64-3.7\nms.cp37-win_amd64.pyd -> d:\Anaconda3\envs\tch37\Lib\site-packages
running install_egg_info
Writing d:\Anaconda3\envs\tch37\Lib\site-packages\external-0.0.0-py3.7.egg-info
I took a closer look, and actually installed another file in the same directory called
nms.cp37-win_amd64.pyd
This is easier to handle, just put
#from external.nms import soft_nms
Change to
from nms import soft_nms
Then it can be run.