stevewongv / InstanceShadowDetection

Instance Shadow Detection (CVPR 2020)
Apache License 2.0
161 stars 24 forks source link

ImportError with matchor and combine_association while running the demo #7

Closed guist closed 2 years ago

guist commented 3 years ago

Hi,

I am working under Windows Subsytem for Linux (Ubuntu 18.04. LTS). As required, I have installed LISA and pysobatools, and downloaded the model from Google Drive.

I am trying to run demo.py on the image web-shadow0573.jpg but I get the following ImportError:

Traceback (most recent call last):
  File "demo.py", line 16, in <module>
    from predictor import VisualizationDemo
  File "/home/guillaume/InstanceShadowDetection/projects/LISA/predictor.py", line 14, in <module>
    from LISA import add_lisa_config
  File "/home/guillaume/InstanceShadowDetection/projects/LISA/LISA/__init__.py", line 3, in <module>
    from .LISA_meta_arch import LISARCNN
  File "/home/guillaume/InstanceShadowDetection/projects/LISA/LISA/LISA_meta_arch.py", line 10, in <module>
    from detectron2.modeling.postprocessing import detector_postprocess, matchor, combine_association
ImportError: cannot import name 'matchor' from 'detectron2.modeling.postprocessing' (/home/guillaume/miniconda3/envs/detectron2/lib/python3.7/site-packages/detectron2/modeling/postprocessing.py)

I checked the LISA_meta_arch.py and indeed matchor and combine_association are missing.

Any idea how to solve this issue? Thanks!

Guillaume

stevewongv commented 3 years ago

Please follow the installation guide in the README and reinstall the detectron2.

guist commented 3 years ago

I re-installed detectron2 but I am still getting the same error.

Could the problem come from the fact that I am working with a CPU (I do not have a GPU)?

kyang-06 commented 3 years ago

Hi, I encounter the same error as you posted here and in detectron2 repo

I finally solve it under pytorch=1.9.0, cuda=10.2. I think it does not matter with CPU/GPU version.

The official detectron2 is in fact incompatible with InstanceShadowDetection(ISD). Unfortunately, The package that ISD requires torch=1.3.0 cuda=10.0 is somehow hard to obtain. If using new version of pytorch and cuda, directly compiling with python setup.py install would raise error:

running install running bdist_egg running egg_info writing detectron2.egg-info/PKG-INFO writing dependency_links to detectron2.egg-info/dependency_links.txt writing requirements to detectron2.egg-info/requires.txt writing top-level names to detectron2.egg-info/top_level.txt reading manifest file 'detectron2.egg-info/SOURCES.txt' writing manifest file 'detectron2.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py running build_ext building 'detectron2._C' extension Emitting ninja build file /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/build/temp.linux-x86_64-3.7/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/2] /usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc -I/home/kyang/anaconda3/envs/shadow/lib/python3.7/site-packages/torch/include -I/home/kyang/anaconda3/envs/shadow/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/kyang/anaconda3/envs/shadow/lib/python3.7/site-packages/torch/include/TH -I/home/kyang/anaconda3/envs/shadow/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/kyang/anaconda3/envs/shadow/include/python3.7m -c -c /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.cu -o /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/build/temp.linux-x86_64-3.7/home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DCUDA_HAS_FP16=1 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=compute_61 -gencode=arch=compute_61,code=sm_61 -std=c++14 FAILED: /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/build/temp.linux-x86_64-3.7/home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.o /usr/local/cuda/bin/nvcc -DWITH_CUDA -I/home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc -I/home/kyang/anaconda3/envs/shadow/lib/python3.7/site-packages/torch/include -I/home/kyang/anaconda3/envs/shadow/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/kyang/anaconda3/envs/shadow/lib/python3.7/site-packages/torch/include/TH -I/home/kyang/anaconda3/envs/shadow/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/kyang/anaconda3/envs/shadow/include/python3.7m -c -c /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.cu -o /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/build/temp.linux-x86_64-3.7/home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DCUDA_HAS_FP16=1 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=compute_61 -gencode=arch=compute_61,code=sm_61 -std=c++14 /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv.h(134): error: identifier "AT_CHECK" is undefined /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv.h(182): error: identifier "AT_CHECK" is undefined /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv.h(232): error: identifier "AT_CHECK" is undefined /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv.h(282): error: identifier "AT_CHECK" is undefined /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv.h(339): error: identifier "AT_CHECK" is undefined /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.cu(153): error: identifier "AT_CHECK" is undefined /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.cu(336): error: identifier "AT_CHECK" is undefined /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.cu(501): error: identifier "AT_CHECK" is undefined /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.cu(694): error: identifier "AT_CHECK" is undefined /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.cu(821): error: identifier "AT_CHECK" is undefined /home/kyang/hdd/Dataset/projects/InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.cu(951): error: identifier "AT_CHECK" is undefined 11 errors detected in the compilation of "/tmp/tmpxft_00005934_00000000-6_deform_conv_cuda.cpp1.ii". ^Cninja: build stopped: interrupted by user. interrupted

The critical error is .../InstanceShadowDetection/detectron2/layers/csrc/deformable/deform_conv_cuda.cu(951): error: identifier "AT_CHECK" is undefined Following this issue, modify deform_conv_cuda.cu and deform_conv.h.

Then recompile with all passed