Open catubc opened 3 years ago
You are correct that the repos have a slightly different layout - one with DCN code in its own folder and one without. To fix this you must change the import DCN calls in a few files, note that the error message is just a print statement and doesn't actually give you a detailed error.
in centertrack/src/lib/model/networks you must the import on "dla.py", "resdcn.py", and the two necks "dlaup.py" and "msraup.py".
original:
try: from ..DCNv2.dcn_v2 import DCN except: print('import DCN failed') DCN = None
new:
from DCN.dcn_v2 import DCN
This should also mean that if there are problems with DCN the appropriate errors to solve will be given.
Possible alternate solution:
(1) Added an empty __init__.py
in src/lib
.
(2) Changed the from .DCNv2 ...
to from model.networks.DCNv2.dcn_v2 import DCN
in the four files: dla.py
, resdcn.py
, dlaup.py
, and msraup.py
I had the same error. I first thought I compiled DCNv2 correctly and in my case it was not. so I ran python setup.py build develop
command manually inside my DCNv2 folder and it compiled DCNv2 successfully. It solved the problem and I got rid of the error. hope this helps.
Using DCNv2_newest instead of given DCNv2 worked for me. You don't need to change any codes in CenterTrack with this way.
cd CenterTrack/src/lib/model/networks/
git clone https://codechina.csdn.net/mirrors/jinfagang/DCNv2_latest.git
cd DCNv2_latest
vim make.sh
sudo
to prevent install out of current environment.sudo python3 setup.py build develop
-> python3 setup.py build develop
./make.sh
python setup.py build develop ============> RuntimeError: Error compiling objects for extension
Also having similar compilation problems: I followed the instructions above to use dcnv2_latest. I run the setup.py build develop manually since I can't run bash on windows. After some time compiling I see an error:
ninja: build stopped: subcommand failed. Traceback (most recent call last): File "G:\anaconda\envs\centertrack\lib\site-packages\torch\utils\cpp_extension.py", line 1722, in _run_ninja_build subprocess.run( File "G:\anaconda\envs\centertrack\lib\subprocess.py", line 528, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
Full dump:
`(centertrack) D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest>python setup.py build develop
running build
running build_ext
building '_ext' extension
creating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build
creating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9
creating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release
creating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\py
creating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\py\CenterTrack
creating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\py\CenterTrack\src
creating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\py\CenterTrack\src\lib
creating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\py\CenterTrack\src\lib\modelcreating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\py\CenterTrack\src\lib\model\networks
creating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\py\CenterTrack\src\lib\model\networks\DCNv2_latest
creating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\py\CenterTrack\src\lib\model\networks\DCNv2_latest\src
creating D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\py\CenterTrack\src\lib\model\networks\DCNv2_latest\src\cpu
Emitting ninja build file D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/4] cl /showIncludes /nologo /O2 /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -ID:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\src -IG:\anaconda\envs\centertrack\lib\site-packages\torch\include -IG:\anaconda\envs\centertrack\lib\site-packages\torch\include\torch\csrc\api\include -IG:\anaconda\envs\centertrack\lib\site-packages\torch\include\TH -IG:\anaconda\envs\centertrack\lib\site-packages\torch\include\THC -IG:\anaconda\envs\centertrack\include -IG:\anaconda\envs\centertrack\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" -c D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\src\cpu\dcn_v2_cpu.cpp /FoD:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\py\CenterTrack\src\lib\model\networks\DCNv2_latest\src\cpu\dcn_v2_cpu.obj -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0 /std:gnu++14
FAILED: D:/py/CenterTrack/src/lib/model/networks/DCNv2_latest/build/temp.win32-3.9/Release/py/CenterTrack/src/lib/model/networks/DCNv2_latest/src/cpu/dcn_v2_cpu.obj
cl /showIncludes /nologo /O2 /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -ID:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\src -IG:\anaconda\envs\centertrack\lib\site-packages\torch\include -IG:\anaconda\envs\centertrack\lib\site-packages\torch\include\torch\csrc\api\include -IG:\anaconda\envs\centertrack\lib\site-packages\torch\include\TH -IG:\anaconda\envs\centertrack\lib\site-packages\torch\include\THC -IG:\anaconda\envs\centertrack\include -IG:\anaconda\envs\centertrack\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" -c D:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\src\cpu\dcn_v2_cpu.cpp /FoD:\py\CenterTrack\src\lib\model\networks\DCNv2_latest\build\temp.win32-3.9\Release\py\CenterTrack\src\lib\model\networks\DCNv2_latest\src\cpu\dcn_v2_cpu.obj -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0 /std:gnu++14
cl : Command line warning D9002 : ignoring unknown option '/std:gnu++14'
G:\anaconda\envs\centertrack\lib\site-packages\torch\include\c10/util/Optional.h(184): warning C4624: 'c10::constexpr_storage_t
Hello
This version of DCN wouldn't compile for me (errors right away): https://github.com/CharlesShang/DCNv2
But this did compile: https://github.com/MatthewHowe/DCNv2.git, and I can run "import DCN".
However, the demo won't import DCN correctly, my guess is the 2 versions of DCN use different syntax.