D3Dnet icon indicating copy to clipboard operation
D3Dnet copied to clipboard

Error on building DCN

Open shijianjian opened this issue 4 years ago • 4 comments

Hi, Thanks for the repo.

I can build the DCN with torch==1.5.1, but I got an error when I run python test.py

 "test.py", line 5, in <module>
    from model import *
  File "/home/D3Dnet/code/model.py", line 3, in <module>
    from dcn.modules.deform_conv import *
  File "/home/ovs-dl/D3Dnet/code/dcn/modules/__init__.py", line 1, in <module>
    from .deform_conv import DeformConv, _DeformConv, DeformConvPack
  File "/home/D3Dnet/code/dcn/modules/deform_conv.py", line 12, in <module>
    from dcn.functions.deform_conv_func import DeformConvFunction
  File "/home/D3Dnet/code/dcn/functions/__init__.py", line 1, in <module>
    from .deform_conv_func import DeformConvFunction
  File "/home/D3Dnet/code/dcn/functions/deform_conv_func.py", line 13, in <module>
    import DCN
ImportError: /home/anaconda3/envs/torch/lib/python3.7/site-packages/DCN-1.0-py3.7-linux-x86_64.egg/DCN.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe26detail37_typeMetaDataInstance_preallocated_32E

I thought it might be an environment error. While when I tried to use your provided envs (torch1.2), I got a build error.

In file included from /home/ovs-dl/git/EyeBrain/ADOCT/deformable-3d-convnets/model/D3Dnet/code/dcn/src/cpu/deform_cpu.cpp:4:0:
/home/ovs-dl/anaconda3/envs/torch1.2/lib/python3.7/site-packages/torch/include/ATen/cuda/CUDAContext.h:13:10: fatal error: cublas_v2.h: No such file or directory
 #include <cublas_v2.h>
          ^~~~~~~~~~~~~
compilation terminated.
error: command '/home/ovs-dl/anaconda3/envs/torch1.2/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1

I am a bit confused about what should I do to resolve this. Thanks for your help.

My envs:

GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
cmake version 3.17.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

shijianjian avatar Jun 23 '20 09:06 shijianjian

Sorry for reply late. Thanks for using our code. We build D3D on windows 10 so we have not met the same problems as you. Here we briefly introduce the process of building D3D and we hope this will help you.

When we run cmd make.bat, we get the following response:

Installed \home\appdata\local\continuum\anaconda3\lib\site-packages\d3d-1.0-py3.7-win-amd64.egg
Processing dependencies for D3D==1.0
Finished processing dependencies for D3D==1.0

We show the files in the folder d3d-1.0-py3.7-win-amd64.egg as follows:

  __pycache__
           └── DCN.cpython-37.pyc
  EGG-INFO
           ├── dependency_links.txt
           ├── native_libs.txt
           ├── not-zip-safe
           ├── PKG-INFO
           ├── SOURCES.txt
           └── top_level.txt
  functions
           └── __pycache__
                           ├── __init__.cpython-37.pyc
                           ├── deform_conv_func.cpython-37.pyc
                           └── deform_conv_func_seperate.cpython-37.pyc
           ├── __init__.py
           ├── deform_conv_func.py
           └── deform_conv_func_seperate.py
  modules
           └── __pycache__
                           ├── __init__.cpython-37.pyc
                           ├── deform_conv_func.cpython-37.pyc
                           └── deform_conv_func_seperate.cpython-37.pyc
           ├── __init__.py
           ├── deform_conv_func.py
           └── deform_conv_func_seperate.py
  DCN.cp37-win_amd64.pyd
  DCN.py

Our code is based on ''Deformable Convolution V2'' (https://github.com/chengdazhi/Deformable-Convolution-V2-PyTorch). You may find some advices there.

XinyiYing avatar Jun 28 '20 13:06 XinyiYing

@shijianjian Hi, I can build DCN and test D3DNet with Pytorch 1.0.0, you may try to use a lower version of Pytorch.

minygd avatar Jul 06 '20 13:07 minygd

Hello, can I ask your gcc version for win10? I install Mingw, but still it request me to install GCC 4.9 or above when run make.bat. thanks!

pearlie317 avatar Aug 10 '20 04:08 pearlie317

@pearlie317 To compile D3D, "nvcc" and "cpp_extension" of pytorch 1.0.0 are needed. We do not find "gcc" in our PC. Our code is based on ''Deformable Convolution V2'' (https://github.com/chengdazhi/Deformable-Convolution-V2-PyTorch). You may find some advices there.

XinyiYing avatar Aug 12 '20 12:08 XinyiYing