Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CenterNet works ok on Pytorch 1.1 + Cuda10.1 + Win10 #7

Closed
ausk opened this issue Apr 18, 2019 · 82 comments
Closed

CenterNet works ok on Pytorch 1.1 + Cuda10.1 + Win10 #7

ausk opened this issue Apr 18, 2019 · 82 comments
Labels
good first issue Good for newcomers

Comments

@ausk
Copy link

ausk commented Apr 18, 2019

First thanks for authors' great work.

This is not an issue. But I just want to say that CenterNet works ok on Pytorch 1.1 + Cuda10.1 + Win10:.

Just clone CenterNet, compile the nms and DCNv2, download the models, and run the demo.


1. build nms

cd CenterNet\src\lib\external
#python setup.py install
python setup.py build_ext --inplace

just comment the parameter in setup.py when building 'nms' extension to solve invalid numeric argument '/Wno-cpp' :

#extra_compile_args=["-Wno-cpp", "-Wno-unused-function"]

2. clone and build original DCN2

You may fail to compile DCNv2 when using Pytorch 1.x, because torch.utils.ffi is deprecated. Then replace DCNv2 using the original repo and [Solved] dcn_v2_cuda.obj : error LNK2001: unresolved external symbol state caused by extern THCState *state; by modifing the line DCNv2/blob/master/src/cuda/dcn_v2_cuda.cu#L11:

//extern THCState *state;                           
THCState *state = at::globalContext().lazyInitCUDA();   // Modified
cd CenterNet\src\lib\models\networks
rm -rf DCNv2
git clone https://github.com/CharlesShang/DCNv2
cd DCNv2

vim cuda/dcn_va_cuda.cu
"""
# extern THCState *state;
THCState *state = at::globalContext().lazyInitCUDA();
"""

python setup.py build develop

3. test

cd CenterNet/src
python demo.py ctdet --demo ../images/17790319373_bd19b24cfc_k.jpg --load_model ../models/ctdet_coco_dla_2x.pth --debug 2
python demo.py multi_pose --demo ../images/17790319373_bd19b24cfc_k.jpg --load_model ../models/multi_pose_dla_3x.pth --debug 2

image

image

@wyp1990
Copy link

wyp1990 commented Apr 18, 2019

非常感谢!

@xingyizhou
Copy link
Owner

Thanks!

@lbq779660843
Copy link

lbq779660843 commented Apr 24, 2019

Why I got the message when I ran nms :
ModuleNotFoundError: No module named '_ext'

@xingyizhou
Copy link
Owner

Have you compiled nms? cd src/lib/external, make

@mk123qwe
Copy link

how to compile in windows and run sh
git bash?
Can you elaborate on GIT and GCC versions?

@ausk
Copy link
Author

ausk commented Apr 25, 2019

I have Git for Windows, make.exe、VS2017、 Cuda10.1、torch 1.0.1 on my PC. And I also set paths for cl.exe bash.exe make.exe and cuda.

@mk123qwe
Copy link

external is failed
(CenterNet) D:\research\CenterNet-master\src\lib\external>python setup.py install
running install
running build
running build_ext
building 'nms' extension
D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\Anaconda3\envs\CenterNet\lib\site-packages\numpy\core\include -ID:\Anaconda3\envs\CenterNet\include -ID:\Anaconda3\envs\CenterNet\include "-ID:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcnms.c /Fobuild\temp.win-amd64-3.6\Release\nms.obj -Wno-cpp -Wno-unused-function
cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
error: command 'D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

@mk123qwe
Copy link

Pytorch 1.0.1 + Cuda9.0 + Win10
Another problem

(CenterNet) D:\research\CenterNet-master\src>python demo.py ctdet --demo D:\research\CenterNet-master\images\17790319373_bd19b24cfc_k.jpg --load_model D:\research\CenterNet-master\models\ctdet_coco_dla_1x.pth
Fix size testing.
training chunk_sizes: [32]
The output will be saved to D:\research\CenterNet-master\src\lib....\exp\ctdet\default
heads {'hm': 80, 'wh': 2, 'reg': 2}
Creating model...
Traceback (most recent call last):
File "demo.py", line 56, in
demo(opt)
File "demo.py", line 21, in demo
detector = Detector(opt)
File "D:\research\CenterNet-master\src\lib\detectors\ctdet.py", line 22, in init
super(CtdetDetector, self).init(opt)
File "D:\research\CenterNet-master\src\lib\detectors\base_detector.py", line 24, in init
self.model = create_model(opt.arch, opt.heads, opt.head_conv)
File "D:\research\CenterNet-master\src\lib\models\model.py", line 28, in create_model
model = get_model(num_layers, head, head_conv)
File "D:\research\CenterNet-master\src\lib\models\networks\pose_dla_dcn.py", line 491, in get_pose_net
head_conv=head_conv)
File "D:\research\CenterNet-master\src\lib\models\networks\pose_dla_dcn.py", line 434, in init
self.base = globals()base_name
File "D:\research\CenterNet-master\src\lib\models\networks\pose_dla_dcn.py", line 314, in dla34
model.load_pretrained_model(data='imagenet', name='dla34', hash='ba72cf86')
File "D:\research\CenterNet-master\src\lib\models\networks\pose_dla_dcn.py", line 305, in load_pretrained_model
self.load_state_dict(model_weights)
File "D:\Anaconda3\envs\CenterNet\lib\site-packages\torch\nn\modules\module.py", line 769, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for DLA:
Missing key(s) in state_dict: "base_layer.0.weight", "base_layer.1.weight", "base_layer.1.bias", "base_layer.1.running_mean", "base_layer.1.running_var", "level0.0.weight", "level0.1.weight", "level0.1.bias", "level0.1.running_mean", "level0.1.running_var", "level1.0.weight", "level1.1.weight", "level1.1.bias", "level1.1.running_mean", "level1.1.running_var", "level2.tree1.conv1.weight", "level2.tree1.bn1.weight", "level2.tree1.bn1.bias", "level2.tree1.bn1.running_mean", "level2.tree1.bn1.running_var", "level2.tree1.conv2.weight", "level2.tree1.bn2.weight", "level2.tree1.bn2.bias", "level2.tree1.bn2.running_mean", "level2.tree1.bn2.running_var", "level2.tree2.conv1.weight", "level2.tree2.bn1.weight", "level2.tree2.bn1.bias", "level2.tree2.bn1.running_mean", "level2.tree2.bn1.running_var", "level2.tree2.conv2.weight", "level2.tree2.bn2.weight", "level2.tree2.bn2.bias", "level2.tree2.bn2.running_mean", "level2.tree2.bn2.running_var", "level2.root.conv.weight", "level2.root.bn.weight", "level2.root.bn.bias", "level2.root.bn.running_mean", "level2.root.bn.running_var", "level2.project.0.weight", "level2.project.1.weight", "level2.project.1.bias", "level2.project.1.running_mean", "level2.project.1.running_var", "level3.tree1.tree1.conv1.weight", "level3.tree1.tree1.bn1.weight", "level3.tree1.tree1.bn1.bias", "level3.tree1.tree1.bn1.running_mean", "level3.tree1.tree1.bn1.running_var", "level3.tree1.tree1.conv2.weight", "level3.tree1.tree1.bn2.weight", "level3.tree1.tree1.bn2.bias", "level3.tree1.tree1.bn2.running_mean", "level3.tree1.tree1.bn2.running_var", "level3.tree1.tree2.conv1.weight", "level3.tree1.tree2.bn1.weight", "level3.tree1.tree2.bn1.bias", "level3.tree1.tree2.bn1.running_mean", "level3.tree1.tree2.bn1.running_var", "level3.tree1.tree2.conv2.weight", "level3.tree1.tree2.bn2.weight", "level3.tree1.tree2.bn2.bias", "level3.tree1.tree2.bn2.running_mean", "level3.tree1.tree2.bn2.running_var", "level3.tree1.root.conv.weight", "level3.tree1.root.bn.weight", "level3.tree1.root.bn.bias", "level3.tree1.root.bn.running_mean", "level3.tree1.root.bn.running_var", "level3.tree1.project.0.weight", "level3.tree1.project.1.weight", "level3.tree1.project.1.bias", "level3.tree1.project.1.running_mean", "level3.tree1.project.1.running_var", "level3.tree2.tree1.conv1.weight", "level3.tree2.tree1.bn1.weight", "level3.tree2.tree1.bn1.bias", "level3.tree2.tree1.bn1.running_mean", "level3.tree2.tree1.bn1.running_var", "level3.tree2.tree1.conv2.weight", "level3.tree2.tree1.bn2.weight", "level3.tree2.tree1.bn2.bias", "level3.tree2.tree1.bn2.running_mean", "level3.tree2.tree1.bn2.running_var", "level3.tree2.tree2.conv1.weight", "level3.tree2.tree2.bn1.weight", "level3.tree2.tree2.bn1.bias", "level3.tree2.tree2.bn1.running_mean", "level3.tree2.tree2.bn1.running_var", "level3.tree2.tree2.conv2.weight", "level3.tree2.tree2.bn2.weight", "level3.tree2.tree2.bn2.bias", "level3.tree2.tree2.bn2.running_mean", "level3.tree2.tree2.bn2.running_var", "level3.tree2.root.conv.weight", "level3.tree2.root.bn.weight", "level3.tree2.root.bn.bias", "level3.tree2.root.bn.running_mean", "level3.tree2.root.bn.running_var", "level3.project.0.weight", "level3.project.1.weight", "level3.project.1.bias", "level3.project.1.running_mean", "level3.project.1.running_var", "level4.tree1.tree1.conv1.weight", "level4.tree1.tree1.bn1.weight", "level4.tree1.tree1.bn1.bias", "level4.tree1.tree1.bn1.running_mean", "level4.tree1.tree1.bn1.running_var", "level4.tree1.tree1.conv2.weight", "level4.tree1.tree1.bn2.weight", "level4.tree1.tree1.bn2.bias", "level4.tree1.tree1.bn2.running_mean", "level4.tree1.tree1.bn2.running_var", "level4.tree1.tree2.conv1.weight", "level4.tree1.tree2.bn1.weight", "level4.tree1.tree2.bn1.bias", "level4.tree1.tree2.bn1.running_mean", "level4.tree1.tree2.bn1.running_var", "level4.tree1.tree2.conv2.weight", "level4.tree1.tree2.bn2.weight", "level4.tree1.tree2.bn2.bias", "level4.tree1.tree2.bn2.running_mean", "level4.tree1.tree2.bn2.running_var", "level4.tree1.root.conv.weight", "level4.tree1.root.bn.weight", "level4.tree1.root.bn.bias", "level4.tree1.root.bn.running_mean", "level4.tree1.root.bn.running_var", "level4.tree1.project.0.weight", "level4.tree1.project.1.weight", "level4.tree1.project.1.bias", "level4.tree1.project.1.running_mean", "level4.tree1.project.1.running_var", "level4.tree2.tree1.conv1.weight", "level4.tree2.tree1.bn1.weight", "level4.tree2.tree1.bn1.bias", "level4.tree2.tree1.bn1.running_mean", "level4.tree2.tree1.bn1.running_var", "level4.tree2.tree1.conv2.weight", "level4.tree2.tree1.bn2.weight", "level4.tree2.tree1.bn2.bias", "level4.tree2.tree1.bn2.running_mean", "level4.tree2.tree1.bn2.running_var", "level4.tree2.tree2.conv1.weight", "level4.tree2.tree2.bn1.weight", "level4.tree2.tree2.bn1.bias", "level4.tree2.tree2.bn1.running_mean", "level4.tree2.tree2.bn1.running_var", "level4.tree2.tree2.conv2.weight", "level4.tree2.tree2.bn2.weight", "level4.tree2.tree2.bn2.bias", "level4.tree2.tree2.bn2.running_mean", "level4.tree2.tree2.bn2.running_var", "level4.tree2.root.conv.weight", "level4.tree2.root.bn.weight", "level4.tree2.root.bn.bias", "level4.tree2.root.bn.running_mean", "level4.tree2.root.bn.running_var", "level4.project.0.weight", "level4.project.1.weight", "level4.project.1.bias", "level4.project.1.running_mean", "level4.project.1.running_var", "level5.tree1.conv1.weight", "level5.tree1.bn1.weight", "level5.tree1.bn1.bias", "level5.tree1.bn1.running_mean", "level5.tree1.bn1.running_var", "level5.tree1.conv2.weight", "level5.tree1.bn2.weight", "level5.tree1.bn2.bias", "level5.tree1.bn2.running_mean", "level5.tree1.bn2.running_var", "level5.tree2.conv1.weight", "level5.tree2.bn1.weight", "level5.tree2.bn1.bias", "level5.tree2.bn1.running_mean", "level5.tree2.bn1.running_var", "level5.tree2.conv2.weight", "level5.tree2.bn2.weight", "level5.tree2.bn2.bias", "level5.tree2.bn2.running_mean", "level5.tree2.bn2.running_var", "level5.root.conv.weight", "level5.root.bn.weight", "level5.root.bn.bias", "level5.root.bn.running_mean", "level5.root.bn.running_var", "level5.project.0.weight", "level5.project.1.weight", "level5.project.1.bias", "level5.project.1.running_mean", "level5.project.1.running_var", "fc.weight", "fc.bias".
Unexpected key(s) in state_dict: "epoch", "state_dict".

@zxhr2793
Copy link

@mk123qwe I think you should load model in this way:
checkpoint = torch.load(model_weights) state_dict = checkpoint['state_dict'] self.load_state_dict(state_dict)

@mk123qwe
Copy link

@mk123qwe I think you should load model in this way:
checkpoint = torch.load(model_weights) state_dict = checkpoint['state_dict'] self.load_state_dict(state_dict)

The demo provided by the author is correct and I can't modify it.

@Markusgami
Copy link

@ausk Hi, you mentioned replace DCNv2 using the original repo. Could you tell me detail? Just can't get DCNV2 compile done correctly...

@jnulzl
Copy link

jnulzl commented May 25, 2019

Why I got the message when I ran nms :
ModuleNotFoundError: No module named '_ext'

maybe you install using python2, but run using python3

@GreenTeaHua
Copy link

3q

@mingx9527
Copy link

@ausk 非常感谢 我跑成功了

@heartInsert
Copy link

@ausk Hi, Gentle, I just follow by your suggestion , but I get a import error in dcn_v2.py 'import _ext as _backend' , 'No module named _ext' ,what's this _ext package really about?

@heartInsert
Copy link

Why I got the message when I ran nms :
ModuleNotFoundError: No module named '_ext'

I think I have met the same problem ,but the _ext import error is in dcnv2.py , and the '_ext' is a CUDAExtension name , but how to solve it ? LOL

@heartInsert
Copy link

@ausk 非常感谢 我跑成功了
兄弟 你Pytorch哪个版本的

@mingx9527
Copy link

@heartInsert 我的环境:win10+cuda10+torch1.1.0+python36

关于:
Why I got the message when I ran nms :
ModuleNotFoundError: No module named '_ext'

我这边是这样解决的:
设置环境变量:PYTHONHOME = 你自己的python.exe所在路径 (重启下)

@heartInsert
Copy link

@heartInsert 我的环境:win10+cuda10+torch1.1.0+python36

关于:
Why I got the message when I ran nms :
ModuleNotFoundError: No module named '_ext'

我这边是这样解决的:
设置环境变量:PYTHONHOME = 你自己的python.exe所在路径 (重启下)

Okay,我跑起来啦

@heartInsert
Copy link

external is failed
(CenterNet) D:\research\CenterNet-master\src\lib\external>python setup.py install
running install
running build
running build_ext
building 'nms' extension
D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\Anaconda3\envs\CenterNet\lib\site-packages\numpy\core\include -ID:\Anaconda3\envs\CenterNet\include -ID:\Anaconda3\envs\CenterNet\include "-ID:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcnms.c /Fobuild\temp.win-amd64-3.6\Release\nms.obj -Wno-cpp -Wno-unused-function
cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
error: command 'D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

How do you solve this propblem ,I have the same question with you

@ausk
Copy link
Author

ausk commented Jun 18, 2019

CenterNet-master\src\lib\external>python setup.py install

just comment the parameter in setup.py when building 'nms' extension to solve invalid numeric argument '/Wno-cpp' :

#extra_compile_args=["-Wno-cpp", "-Wno-unused-function"]

@heartInsert
Copy link

CenterNet-master\src\lib\external>python setup.py install

just comment the parameter in setup.py when building 'nms' extension to solve invalid numeric argument '/Wno-cpp' :

#extra_compile_args=["-Wno-cpp", "-Wno-unused-function"]

If you are a girl , I think I will say 'I love you '

@ausk ausk changed the title CenterNet works ok on Pytorch 1.0.1 + Cuda10.1 + Win10 CenterNet works ok on Pytorch 1.1 + Cuda10.1 + Win10 Jun 18, 2019
@azhaoaigaga
Copy link

@ausk I compiled the NMS, but it didn't work ,a warning Extension name 'nms' does not match fully qualified name 'external.nms' of 'nms.pyx',What should I do ,Thanks

@azhaoaigaga
Copy link

@ausk cuda 9 doesn't your method work? i compiled DCNv2 error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2?

@wangminj
Copy link

wangminj commented Jun 22, 2020

我在跑demo.py时,遇到了错误cuda runtime error(46): all cuda-capable devices are busy or unavailable at [/opt/cuda/conda-bld/pytorch_1544199946412/work/aten/src/thc/generatic/thc/tensormath.cu:14,大家知道如何解决吗?谢谢
微信图片_20200622211333

@zhang295498
Copy link

First thanks for authors' great work.

This is not an issue. But I just want to say that CenterNet works ok on Pytorch 1.1 + Cuda10.1 + Win10:.

Just clone CenterNet, compile the nms and DCNv2, download the models, and run the demo.

1. build nms

cd CenterNet\src\lib\external
#python setup.py install
python setup.py build_ext --inplace

just comment the parameter in setup.py when building 'nms' extension to solve invalid numeric argument '/Wno-cpp' :

#extra_compile_args=["-Wno-cpp", "-Wno-unused-function"]

2. clone and build original DCN2

You may fail to compile DCNv2 when using Pytorch 1.x, because torch.utils.ffi is deprecated. Then replace DCNv2 using the original repo and [Solved] dcn_v2_cuda.obj : error LNK2001: unresolved external symbol state caused by extern THCState *state; by modifing the line DCNv2/blob/master/src/cuda/dcn_v2_cuda.cu#L11:

//extern THCState *state;                           
THCState *state = at::globalContext().lazyInitCUDA();   // Modified
cd CenterNet\src\lib\models\networks
rm -rf DCNv2
git clone https://github.com/CharlesShang/DCNv2
cd DCNv2

vim cuda/dcn_va_cuda.cu
"""
# extern THCState *state;
THCState *state = at::globalContext().lazyInitCUDA();
"""

python setup.py build develop

3. test

cd CenterNet/src
python demo.py ctdet --demo ../images/17790319373_bd19b24cfc_k.jpg --load_model ../models/ctdet_coco_dla_2x.pth --debug 2
python demo.py multi_pose --demo ../images/17790319373_bd19b24cfc_k.jpg --load_model ../models/multi_pose_dla_3x.pth --debug 2

image

image

I get this Error. how to solve it? thx
error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\nvcc.exe' failed with exit status 2

@zhang295498
Copy link

I ran into this problem following your steps. What should I do to fix it?If possible, can you share the DCNv2 that you had compiled?Thank you!
D:/Python_project/DCNv2-master/src/cuda/dcn_v2_cuda.cu(11): fatal error C1021: 无效的预处理器命令“extern” error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin\\nvcc.exe' failed with exit status 2

have you solve it? I get the same error

@shivareddy37
Copy link

follwing the instruction when running 'python setup.py build develp' ran into error
" error: identifier "THCState_getCurrentStream" is undefined"

@urbaneman
Copy link

@shivareddy37 (Sorry for the confusing format)
I get the same error with you.
My env is Ubuntu16.04+python3.5+CUDA10.2+cuDNN8.0.3+pytorch1.5.1.
The error is following:

/media/*/Data/PythonProject/CenterNet_My/CenterNet/src/lib/models/networks/DCNv2/src/cuda/dcn_v2_cuda.cu(107): error: identifier "THCState_getCurrentStream" is undefined

/media/*/Data/PythonProject/CenterNet_My/CenterNet/src/lib/models/networks/DCNv2/src/cuda/dcn_v2_cuda.cu(279): error: identifier "THCState_getCurrentStream" is undefined

2 errors detected in the compilation of "/tmp/tmpxft_00005d61_00000000-6_dcn_v2_cuda.cpp1.ii".
error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1

I sloved by change the DCNv2 from DCNv2_latest.

(BTY, changingTHCState_getCurrentStreamtoc10::cuda::getCurrentCUDAStream` may be useful, maybe not, you can try).

Thanks.

@urbaneman
Copy link

@shivareddy37 (Sorry for the confusing format)
I get the same error with you.
My env is Ubuntu16.04+python3.5+CUDA10.2+cuDNN8.0.3+pytorch1.5.1.
The error is following:

/media/*/Data/PythonProject/CenterNet_My/CenterNet/src/lib/models/networks/DCNv2/src/cuda/dcn_v2_cuda.cu(107): error: identifier "THCState_getCurrentStream" is undefined

/media/*/Data/PythonProject/CenterNet_My/CenterNet/src/lib/models/networks/DCNv2/src/cuda/dcn_v2_cuda.cu(279): error: identifier "THCState_getCurrentStream" is undefined

2 errors detected in the compilation of "/tmp/tmpxft_00005d61_00000000-6_dcn_v2_cuda.cpp1.ii".
error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1

I sloved by change the DCNv2 from DCNv2_latest.

(BTY, changingTHCState_getCurrentStreamtoc10::cuda::getCurrentCUDAStream` may be useful, maybe not, you can try).

Thanks.

(BTY, changing THCState_getCurrentStream to c10::cuda::getCurrentCUDAStream in DCNv2/src/cuda/dcn_v2_cuda.cu may be useful, maybe not, you can try)
Thanks.

@priteshgohil
Copy link

@xingyizhou please update INSTALL.md according to this

@xingyizhou xingyizhou mentioned this issue Nov 2, 2020
@tangning9495
Copy link

@ausk Excuse me. I try to run CenterNet code on env( Pytorch 1.6 + Cuda10.1 + Win10). I can't run the demo.py directly. So I find your issue. I follow your steps,
cd CenterNet\src\lib\external #python setup.py install python setup.py build_ext --inplace
but in first step I have some problems. such as :
running build_ext building 'nms' extension cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\ProgramData\Anaconda3\lib\site-packages\numpy\core\include -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include /Tcnms.c /Fobuild\temp.win-amd64-3.7\Release\nms.obj error: command 'cl.exe' failed: No such file or directory

I try to address the problem by installing the visual studio 2017, and set the path of cl. Meanwhile I open the Visual C++ 2015 x64 Native Build Tools Command Prompt. In this tool, input cl can find the cl.exe, I do the step 1 also, but it's the same problem:
error:command 'cl.exe' failed: No such file or directory
so I mess up. Could you explain it? Would you like to help me,please. Thanks so much.

@shairoz-deci
Copy link

@ausk Thank you for sharing the installation recipe, I am trying to run CenterNet on pytorch 1.6, I followed your steps and I'm failing on the second stage, building the DCNv2 from the original repo.

python setup.py build develop

outputs:
Traceback (most recent call last):
File "setup.py", line 70, in
cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension},
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/site-packages/setuptools/init.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 649, in build_extensions
build_ext.build_extensions(self)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 205, in build_extension
_build_ext.build_extension(self, ext)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 478, in unix_wrap_ninja_compile
with_cuda=with_cuda)
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1233, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "/apps/conda/anaconda/envs/deci-development/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1529, in _run_ninja_build
raise RuntimeError(message)
RuntimeError: Error compiling objects for extension

Any idea how to overcome and build for pytorch 1.6?
other envs:
torchvision 0.7.0
CUDA 10.2

Thanks in advance

@allezsyh
Copy link

After 3 days of trying, I work it out.
No matter which of the following errors occur:
'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe' failed with exit status 2
error: command 'D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

VS2015 and VS2019 don't work!
solution:
Just uninstall VS2019 and install VS2017!
Only VS2017 works!

@tangning9495
Copy link

After 3 days of trying, I work it out.
No matter which of the following errors occur:
'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe' failed with exit status 2
error: command 'D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

VS2015 and VS2019 don't work!
solution:
Just uninstall VS2019 and install VS2017!
Only VS2017 works!
OK, I will try VS2017 later

@howdidthatwork
Copy link

Have you compiled nms? cd src/lib/external, make

I got this error when I ran it:

C:\Users\sopul\CenterNet\src\lib\external>make
python setup.py build_ext --inplace
running build_ext
rm -rf build
process_begin: CreateProcess(NULL, rm -rf build, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:3: all] Error 2

@Passenger12138
Copy link

Passenger12138 commented Sep 9, 2021

hello,I would like to run this modify in my Pytorch 1.9 + Cuda10.2 + Win10 , so I try this mode this suggestion .but when I build nms, I follow the guide run

cd CenterNet\src\lib\external
#python setup.py install
python setup.py build_ext --inplace

but I meet a bug ValueError: 'nms.pyx' doesn't match any files
this is the delatied error

(pytorchtest) D:\CenterNet-master>python src/lib/external/setup.py build_ext --inplace
Traceback (most recent call last):
  File "src/lib/external/setup.py", line 16, in <module>
    ext_modules=cythonize(extensions),
  File "C:\Users\11427\anaconda3\envs\pytorchtest\lib\site-packages\Cython\Build\Dependencies.py", line 972, in cython
ize
    aliases=aliases)
  File "C:\Users\11427\anaconda3\envs\pytorchtest\lib\site-packages\Cython\Build\Dependencies.py", line 815, in create
_extension_list
    for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
  File "C:\Users\11427\anaconda3\envs\pytorchtest\lib\site-packages\Cython\Build\Dependencies.py", line 114, in nonemp
ty
    raise ValueError(error_msg)
ValueError: 'nms.pyx' doesn't match any files

image
I google this bug,but I can't resolve it .so could you help me settle this bug

@melaniihariono
Copy link

I got this error when I am running this code
python setup.py build develop

Error:
/content/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:227:51: warning: ‘T* at::Tensor::data() const [with T = float]’ is deprecated: Tensor.data<T>() is deprecated. Please use Tensor.data_ptr<T>() instead. [-Wdeprecated-declarations] grad_bias.data<scalar_t>(), 1); ^ In file included from /usr/local/lib/python3.7/dist-packages/torch/include/ATen/Tensor.h:3:0, from /usr/local/lib/python3.7/dist-packages/torch/include/ATen/Context.h:4, from /usr/local/lib/python3.7/dist-packages/torch/include/ATen/ATen.h:9, from /content/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:4: /usr/local/lib/python3.7/dist-packages/torch/include/ATen/core/TensorBody.h:216:7: note: declared here T * data() const { ^~~~ /content/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:224:9: error: ‘THFloatBlas_gemv’ was not declared in this scope THFloatBlas_gemv('t', k_, m_, 1.0f, ^~~~~~~~~~~~~~~~ /content/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:224:9: note: suggested alternative: ‘THFloatStorage’ THFloatBlas_gemv('t', k_, m_, 1.0f, ^~~~~~~~~~~~~~~~ THFloatStorage error: command 'g++' failed with exit status 1

Anyone knows how to solve this?

@Fansgithub2019
Copy link

external is failed (CenterNet) D:\research\CenterNet-master\src\lib\external>python setup.py install running install running build running build_ext building 'nms' extension D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:\Anaconda3\envs\CenterNet\lib\site-packages\numpy\core\include -ID:\Anaconda3\envs\CenterNet\include -ID:\Anaconda3\envs\CenterNet\include "-ID:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcnms.c /Fobuild\temp.win-amd64-3.6\Release\nms.obj -Wno-cpp -Wno-unused-function cl : Command line error D8021 : invalid numeric argument '/Wno-cpp' error: command 'D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

I'm also get this problem,so have you resolved the problems?

@MuseumMage
Copy link

MuseumMage commented Dec 14, 2021 via email

@AmieeZhou
Copy link

AmieeZhou commented Dec 14, 2021 via email

@Fansgithub2019
Copy link

After 3 days of trying, I work it out. No matter which of the following errors occur: 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe' failed with exit status 2 error: command 'D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

VS2015 and VS2019 don't work! solution: Just uninstall VS2019 and install VS2017! Only VS2017 works!

I have installed vs2017 but still report this error, how to solve it

@engrjav
Copy link

engrjav commented Dec 25, 2021

Thanks a Lot. After effort of one week i successfully ran demo with windows 10, pytorch 1.1.0. I wish i had read this issue
before

@baoga1124
Copy link

Can you make tutorial to do this, please!

@MuseumMage
Copy link

MuseumMage commented May 15, 2022 via email

@youyi-jia
Copy link

youyi-jia commented May 15, 2022 via email

@XZLeo
Copy link

XZLeo commented Aug 2, 2023

Has anyone managed with torch 2.0.1?
I replaced DCNv2 using the original repo and then got this while compiling using ./make.sh:

RuntimeError: 
The detected CUDA version (9.1) mismatches the version that was used to compile
PyTorch (11.7). Please make sure to use the same CUDA versions.

@youyi-jia
Copy link

youyi-jia commented Aug 2, 2023 via email

@AmieeZhou
Copy link

AmieeZhou commented Aug 2, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests