xinntao / EDVR

Winning Solution in NTIRE19 Challenges on Video Restoration and Enhancement (CVPR19 Workshops) - Video Restoration with Enhanced Deformable Convolutional Networks. EDVR has been merged into BasicSR and this repo is a mirror of BasicSR.
https://github.com/xinntao/BasicSR
1.48k stars 320 forks source link

ImportError: cannot import name 'deform_conv_cuda' #96

Closed dongxijia closed 4 years ago

dongxijia commented 4 years ago

When I run the test_Vid4_REDS4_with_GT.py, I got the importError.

`Traceback (most recent call last): File "/home/EDVR/codes/models/archs/EDVR_arch.py", line 8, in from models.archs.dcn.deform_conv import ModulatedDeformConvPack as DCN File "/home/EDVR/codes/models/archs/dcn/init.py", line 1, in from .deform_conv import (DeformConv, DeformConvPack, ModulatedDeformConv, ModulatedDeformConvPack, File "/home/EDVR/codes/models/archs/dcn/deform_conv.py", line 10, in from . import deform_conv_cuda ImportError: cannot import name 'deform_conv_cuda'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/EDVR/codes/test_EDVR_REDS_SR_L.py", line 16, in import models.archs.EDVR_arch as EDVR_arch File "/home/EDVR/codes/models/archs/EDVR_arch.py", line 10, in raise ImportError('Failed to import DCNv2 module.') ImportError: Failed to import DCNv2 module.`

My configuration as below: python 3.5 Pytorch 1.0 GCC 5.4.0 CUDA 8.0

what should I do to handle the error? thanks in advance.

xinntao commented 4 years ago

Did you compile the dcn model before running?

dongxijia commented 4 years ago

Did you compile the dcn model before running?

Thanks for your reply. I can only find the make.sh in the DCN_v2 code, is there any other pre-steps?

jkoubele commented 4 years ago

I have the same problem. The issue is that the file codes/models/archs/dcn/deform_conv_cuda is missing. I run setup.py in codes/models/archs/dcn (both install and build) that maybe should create it, but it didnt help.

xinntao commented 4 years ago
cd ./codes/models/archs/dcn
python setup.py develop

Does this command not create the deform_conv_cuda.xxxxx.so file?

jkoubele commented 4 years ago
cd ./codes/models/archs/dcn
python setup.py develop

Does this command not create the deform_conv_cuda.xxxxx.so file?

That helped, thanks! (I was running only setup.py install and build, which seemed to be the option after I run setup.py --help, didnt know I can / should run setup.py develop)

dongxijia commented 4 years ago

Thanks a lot! The command python setup.py develop helps !

xmengli commented 4 years ago
cd ./codes/models/archs/dcn
python setup.py develop

Does this command not create the deform_conv_cuda.xxxxx.so file?

This helps!

Atom-Jinny commented 3 years ago

when I run thepython setup.py develop I found a new error RuntimeError: Error compiling objects for extension torch/utils/cpp_extension.py", line 1436, in _run_ninja_build raise RuntimeError(message) RuntimeError: Error compiling objects for extension