XPixelGroup / BasicSR

Open Source Image and Video Restoration Toolbox for Super-resolution, Denoise, Deblurring, etc. Currently, it includes EDSR, RCAN, SRResNet, SRGAN, ESRGAN, EDVR, BasicVSR, SwinIR, ECBSR, etc. Also support StyleGAN2, DFDNet.
https://basicsr.readthedocs.io/en/latest/
Apache License 2.0
6.66k stars 1.17k forks source link

NameError: name 'deform_conv_ext' is not defined. #480

Open RuijiaoSun opened 2 years ago

RuijiaoSun commented 2 years ago

Hello Xintao,

I have done this: BASICSR_EXT=True python setup.py develop before I started to train. And also confirmed the .so file exists in basicsr/ops. The error is still there.

Thanks for your time.

xinntao commented 2 years ago
  1. If you use BASICSR_EXT=True python setup.py develop, that means, you git clone the repo. In this way, you should not run pip install basicsr. Otherwise, these two ways will conflict with each other.
  2. Recommend to run in PyTorch >=1.8.0, torchvision>=0.9.0. In this env, we use the official torchvision.ops.deform_conv2d instead. In such a way, there is no need to compile
ShaoDingBao commented 2 months ago

I'm having the same problem as you, I'm compiling in a docker container and it shows that it compiles successfully and generates the .so file, but still reports "NameError: name 'deform_conv_ext' is not defined". The final reason was that I didn't have "ninja" installed, which caused me to fall back to using "distutils" when compiling. After installing ninja and compiling again, I was able to run the file without getting the error again. I hope this provides a solution.