profile
viewpoint

Ask questionsCenterNet works ok on Pytorch 1.1 + Cuda10.1 + Win10

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

xingyizhou/CenterNet

Answer questions 18608003987

<To who may mix-installation with vs2015/vs2017 , conda python virtual envs 3.55/3.65/3.7> [My original installation is 64bit Win10 +cuda 10.0.130 /cudnn 7.6.0 installed by Anaconda3 ,NVIDIA driver is 10.1.120 maintained by NVDIA auto-update, I like py37 most and it's based on vs2015 and pytorch 1.0]

I failed may times to build DCNv2 in my very complex environment but fillally get it's passed compile just now so I put it here and hope it's usefully to someone who need it.

I download and installed cudatoolkit 10.1.120 and installed somewhere (not the default directory )

I use the bat file below to let my py37 environment can use vs2017 instead of vs2015.

set DevEnvDir=D:\VS2017\Common7\IDE
set INCLUDE=D:\VS2017\VC\Tools\MSVC\14.16.27023\include;C:\Windows Kits\10\include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um;C:\Windows Kits\10\include\10.0.17763.0\shared;C:\Windows Kits\10\include\10.0.17763.0\um;C:\Windows Kits\10\include\10.0.17763.0\winrt;

set LIB=D:\VS2017\VC\Tools\MSVC\14.16.27023\lib\x64;;C:\Windows Kits\10\lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64;C:\Windows Kits\10\lib\10.0.17763.0\um\x64;

set LIBPATH=D:\VS2017\VC\Tools\MSVC\14.16.27023\lib\x64;D:\VS2017\VC\Tools\MSVC\14.16.27023\lib\x86\store\references;C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319;C:\Windows Kits\10\UnionMetadata;C:\Windows Kits\10\References;C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.VCLibs\14.0\References\CommonConfiguration\neutral;

set Path=D:\VS2017\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64;D:\VS2017\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64;D:\VS2017\Common7\IDE\VC\VCPackages;D:\VS2017\Common7\IDE\CommonExtensions\Microsoft\TestWindow;D:\VS2017\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;D:\VS2017\MSBuild\15.0\bin\Roslyn;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64;C:\Windows Kits\10\bin\10.0.17763.0\x64;C:\Windows Kits\10\bin\x64;D:\VS2017\MSBuild\15.0\bin;C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319;D:\VS2017\Common7\IDE;D:\VS2017\Common7\Tools;F:\CUDA10013\Dev\bin;F:\CUDA10013\Dev\libnvvp;C:\Windows Kits\10\bin\x64;C:\Windows Kits\10\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64;D:\ANCD3\envs\py37;D:\ANCD3\envs\py37\Library\mingw-w64\bin;D:\ANCD3\envs\py37\Library\usr\bin;D:\ANCD3\envs\py37\Library\bin;D:\ANCD3\envs\py37\Scripts;D:\ANCD3\envs\py37\bin;D:\ANCD3\condabin;F:\CUDA10013\Dev\bin;F:\CUDA10013\Dev\libnvvp;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\PuTTY;C:\Users\onesh.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\OpenVPN\bin;C:\Program Files (x86)\QuickTime\QTSystem;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\onesh\AppData\Local\Microsoft\WindowsApps;;D:\PyCharm\bin;;C:\Program Files (x86)\Windows Kits\8.1\bin\x86

set VCIDEInstallDir=D:\VS2017\Common7\IDE\VC
set VCINSTALLDIR=D:\VS2017\VC
set VCToolsInstallDir=D:\VS2017\VC\Tools\MSVC\14.16.27023
set VCToolsRedistDir=D:\VS2017\VC\Redist\MSVC\14.16.27012
set VCToolsVersion=14.16.27023 set VisualStudioVersion=15.0 set VS150COMNTOOLS=D:\VS2017\Common7\Tools
set VSCMD_ARG_app_plat=Desktop set VSCMD_ARG_HOST_ARCH=x64 set VSCMD_ARG_TGT_ARCH=x64 set VSCMD_VER=15.9.13 set VSINSTALLDIR=D:\VS2017\

set MSSdk=1 set MSYS2_ARG_CONV_EXCL=/AI;/AL;/OUT;/out set MSYS2_ENV_CONV_EXCL=CL

set VS_MAJOR= set VS_VERSION= set VS_YEAR= set VSREGKEY= set VS140COMNTOOLS= set VCINSTALLDIR= set PY_VCRUNTIME_REDIST=\vcruntime140.dll set CMAKE_GENERATOR=Visual Studio 15 2017 Win64

set __VSCMD_PREINIT_PATH=F:\CUDA10013\Dev\bin;F:\CUDA10013\Dev\libnvvp;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\PuTTY;C:\Users\onesh.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\OpenVPN\bin;C:\Program Files (x86)\QuickTime\QTSystem;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\Git\cmd;C:\Users\onesh\AppData\Local\Microsoft\WindowsApps;;D:\PyCharm\bin;

after that I recompiled the nms and DVNv2 and followed some suggestions from internet and finally compile DCNv2 successfully . Cheers!

useful!
source:https://uonfu.com/
Github User Rank List