traveller59 / second.pytorch

SECOND for KITTI/NuScenes object detection
MIT License
1.73k stars 722 forks source link

cannot import name 'non_max_suppression' from 'spconv.utils' even after successfully install spconv #470

Closed curiousboy20 closed 3 years ago

curiousboy20 commented 3 years ago

Hi, I have installed spconv and followed the instruction with details: Python 3.8.11 Pytorch 1.4 spconv 1.2.1 CUDA 11.4 Ubuntu 18.04 Numba 0.53.1

but when I run the script python create_data.py kitti_data_prep --data_path=data/sets/kitti_dataset

it said:

/home/yonas/anaconda3/envs/spconv12/lib/python3.8/site-packages/numba/cuda/envvars.py:17: NumbaWarning: 
Environment variables with the 'NUMBAPRO' prefix are deprecated and consequently ignored, found use of NUMBAPRO_CUDA_DRIVER=/usr/lib/x86_64-linux-gnu/libcuda.so.

For more information about alternatives visit: ('https://numba.pydata.org/numba-doc/latest/cuda/overview.html', '#cudatoolkit-lookup')
  warnings.warn(errors.NumbaWarning(msg))
Traceback (most recent call last):
  File "create_data.py", line 7, in <module>
    import second.data.kitti_dataset as kitti_ds
  File "/home/yonas/second.pytorch/second/data/__init__.py", line 1, in <module>
    from . import kitti_dataset
  File "/home/yonas/second.pytorch/second/data/kitti_dataset.py", line 11, in <module>
    from second.utils.eval import get_coco_eval_result, get_official_eval_result
  File "/home/yonas/second.pytorch/second/utils/eval.py", line 8, in <module>
    from second.core.non_max_suppression.nms_gpu import rotate_iou_gpu_eval
  File "/home/yonas/second.pytorch/second/core/non_max_suppression/__init__.py", line 1, in <module>
    from second.core.non_max_suppression.nms_cpu import nms_jit, soft_nms_jit
  File "/home/yonas/second.pytorch/second/core/non_max_suppression/nms_cpu.py", line 8, in <module>
    from second.core.non_max_suppression.nms_gpu import rotate_iou_gpu
  File "/home/yonas/second.pytorch/second/core/non_max_suppression/nms_gpu.py", line 8, in <module>
    from spconv.utils import non_max_suppression
ImportError: cannot import name 'non_max_suppression' from 'spconv.utils' (/home/yonas/anaconda3/envs/spconv12/lib/python3.8/site-packages/spconv/utils/__init__.py)

I run: python -c 'import spconv'

and there is no error. Reinstalled the spconv also and it said:

Processing ./spconv-1.2.1-cp38-cp38-linux_x86_64.whl
Installing collected packages: spconv
  Attempting uninstall: spconv
    Found existing installation: spconv 1.2.1
    Uninstalling spconv-1.2.1:
      Successfully uninstalled spconv-1.2.1
Successfully installed spconv-1.2.1

Any help appreciated. Thank you

-------------- update ---------------

I have tried with spconv 1.0 but the same error still exists. Please help

Yacovitch commented 3 years ago

Check "torch.cuda.is_available()". If it gives your false, you have to reinstall PyTorch with the correct Cuda.

curiousboy20 commented 3 years ago

Check "torch.cuda.is_available()". If it gives your false, you have to reinstall PyTorch with the correct Cuda.

Hi, thank you for the response. I tried to print "torch.cuda.is_available()" and the result is "True" and the problem still exist

Yacovitch commented 3 years ago

Check "torch.cuda.is_available()". If it gives your false, you have to reinstall PyTorch with the correct Cuda.

Hi, thank you for the response. I tried to print "torch.cuda.is_available()" and the result is "True" and the problem still exist

Might be due to the cuda version. I am running spconv 1.0 with following settings; pytorch == 1.0.0 cudaversion == 10.0

daofeng2007 commented 3 years ago

@curiousboy20 I got the same error. How did you solve the issue?

nuggy875 commented 2 years ago

@curiousboy20 Anyone solved this issue?

ZhuXiyue commented 2 years ago

I got the same error.

Hetali-Vekariya commented 2 years ago

I too got the same error. has anyone solved it?

zhen12079 commented 2 years ago

I too got the same error. and i just change it into : import spconv.utils and then ingore it ,it can run but later training will have problems

zhangzirui1998 commented 2 years ago

so anyone have solved this issue?

Hetali-Vekariya commented 2 years ago

Hi @zhangzirui1998,

Try renaming non_max_suppression with non_max_suppression_cpu. It will work.

groupxiaozyy commented 2 years ago

Hi @zhangzirui1998,

Try renaming non_max_suppression with non_max_suppression_cpu. It will work.

The file is second/core/non_max_suppression/nms_gpu.py. https://github.com/traveller59/spconv/issues/431#issuecomment-1027717472