qianguih / RSNet

This is the official implementation of RSNet.
Other
118 stars 42 forks source link

something wrong about train.py #8

Open YukioSama opened 6 years ago

YukioSama commented 6 years ago
  from _ext import slice_pool_layer

ImportError: No module named _ext

YukioSama commented 6 years ago

soory,I did know

YukioSama commented 6 years ago

help!too much problems like this: from _ext import slice_unpool_layer ImportError: cannot import name 'slice_unpool_layer' please ?

Timaces commented 5 years ago

I meet the same question:ImportError: No module named _ext?can you help me ? thank you

longmalongma commented 5 years ago

I meet the same question:ImportError: No module named _ext?can you help me ? thank you

Hi,when I try to run your code,I find I can not compile your slice_pool_layer and slice_unpool_layer,can you send me your files have compiled files?my email is that:1442342449@qq.com.looking forward your reply

zkm98 commented 4 years ago

this means we should learn how to compile the .c file, hope u could see the compile method in pointnet++ which also uses .c and .cuda files.

DChoLee commented 4 years ago

I think this importerror is from circular dependency problem. In this repository, so many modules have same name such as slice_pool_layer. To avoid this issue, I copied slice_pool_layer 'in _ext folder' outside, and changed the slice_pool_layer.py which contains SP class to slice_pool_layer2.py and in net.py, I directly imported layers.slice_unpool_layer2 as import slice_unpool_layer2. Then you can call SP layer as slice_unpool_layer2.SP().

MCemGunes commented 2 years ago

Hi there, Is there anyone who could solve the problem? I followed the instructions in the layers folder. However, I still get the error. : root@6e57005559fd:/app/RSNet# whereis cuda cuda: /usr/local/cuda

root@6e57005559fd:/app/RSNet# python train.py Traceback (most recent call last): File "train.py", line 76, in <module> from net import RSNet File "/app/RSNet/net.py", line 7, in <module> from layers.slice_pool_layer.slice_pool_layer import * File "/app/RSNet/layers/slice_pool_layer/slice_pool_layer.py", line 3, in <module> from _ext import slice_pool_layer ModuleNotFoundError: No module named '_ext'

root@6e57005559fd:/usr/local# ls bin cuda cuda-10.0 etc games include lib man sbin share src root@6e57005559fd:/usr/local# cd cuda-10.0/ root@6e57005559fd:/usr/local/cuda-10.0# ls LICENSE README bin compat doc extras include lib64 nvml nvvm share src targets version.txt root@6e57005559fd:/usr/local/cuda-10.0# cd targets/ root@6e57005559fd:/usr/local/cuda-10.0/targets# ls x86_64-linux root@6e57005559fd:/usr/local/cuda-10.0/targets# cd x86_64-linux/ root@6e57005559fd:/usr/local/cuda-10.0/targets/x86_64-linux# ls include lib root@6e57005559fd:/usr/local/cuda-10.0/targets/x86_64-linux# cd include/ root@6e57005559fd:/usr/local/cuda-10.0/targets/x86_64-linux/include# $CPATH=/usr/local/cuda-10.0/targets/x86_64-linux/include bash: /usr/usc/cuda/10.0/include/=/usr/local/cuda-10.0/targets/x86_64-linux/include: No such file or directory root@6e57005559fd:/usr/local/cuda-10.0/targets/x86_64-linux/include# CPATH=/usr/local/cuda-10.0/targets/x86_64-linux/include root@6e57005559fd:/usr/local/cuda-10.0/targets/x86_64-linux/include# cd /app/RSNet/ root@6e57005559fd:/app/RSNet# cdc layers/slice_pool_layer/src/cuda/ bash: cdc: command not found root@6e57005559fd:/app/RSNet# cd layers/slice_pool_layer/src/cuda/ root@6e57005559fd:/app/RSNet/layers/slice_pool_layer/src/cuda# nvcc -c -o slice_pool_layer_cuda_kernel.cu.o slice_pool_layer_cuda_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_61 root@6e57005559fd:/app/RSNet/layers/slice_pool_layer/src/cuda# cd ../../ root@6e57005559fd:/app/RSNet/layers/slice_pool_layer# python build.py build /app/RSNet/layers/slice_pool_layer Build with GPU mode. running build running build_ext root@6e57005559fd:/app/RSNet/layers/slice_pool_layer# cd ../slice_unpool_layer/s slice_unpool_layer.py src/ root@6e57005559fd:/app/RSNet/layers/slice_pool_layer# cd ../slice_unpool_layer/s slice_unpool_layer.py src/ root@6e57005559fd:/app/RSNet/layers/slice_pool_layer# cd ../slice_unpool_layer/src/cuda/ root@6e57005559fd:/app/RSNet/layers/slice_unpool_layer/src/cuda# nvcc -c -o slice_unpool_layer_cuda_kernel.cu.o slice_unpool_layer_cuda_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_61 root@6e57005559fd:/app/RSNet/layers/slice_unpool_layer/src/cuda# cd ../../ root@6e57005559fd:/app/RSNet/layers/slice_unpool_layer# py pyclean pydoc pydoc3 pygettext pygmentize python2 python3 python3.6 python3.6m pyvenv pyversions pycompile pydoc2.7 pydoc3.6 pygettext2.7 python python2.7 python3-config python3.6-config python3.6m-config pyvenv-3.6 root@6e57005559fd:/app/RSNet/layers/slice_unpool_layer# python build.py build /app/RSNet/layers/slice_unpool_layer Build with GPU mode. running build running build_ext root@6e57005559fd:/app/RSNet/layers/slice_unpool_layer# ls

YukioSama commented 2 years ago

您好,您的来信已收到,祝您有个好心情

MCemGunes commented 2 years ago

I'm not sure if it is the best way to go but I think I've solved the problem.

First of all, you need to define the CPATH properly. In my case it is CPATH=/usr/local/cuda/include You can check it by the whereis cudacommand.

Secondly, You need to be careful about the computing capabilities of your graphic card. Otherwise, you will see Cuda-related errors when you run the train.py file. Such as this one ==> cudaCheckError() failed : no kernel image is available for execution on the device . I attach a website that includes the numbers for the Nvidia GPUs. In my case, it was 52, because I was using GTX 970m mobile GPU.

RSNet/layers/slice_pool_layer/src/cuda nvcc -c -o slice_pool_layer_cuda_kernel.cu.o slice_pool_layer_cuda_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_52 RSNet/layers/slice_unpool_layer/src/cuda nvcc -c -o slice_unpool_layer_cuda_kernel.cu.o slice_unpool_layer_cuda_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_52 Then, we need to run the build.py file in both RSNet/layers/slice_pool_layer/ and RSNet/layers/slice_unpool_layer/ directories by running python build.py build command. It will create a build folder including lib.linux-x86_64-3.6 that involves _ext folder.

I copied the _ext folders to directly RSNet/layers/slice_pool_layer/ RSNet/layers/slice_unpool_layer/ directories. So whenever slice_unpool_layer.py or slice_pool_layer.py looks for its _ext file we can import the _ext with a small update in both codes.

So I updated from _ext import slice_pool_layer line as from ._ext import slice_pool_layer (I did the same for the unpool one too.). I added . to represent the directory that we run the code (RSNet/layers/slice_pool_layer/ or RSNet/layers/slice_unpool_layer/)

And, voila! now you can get yourno module named CV2 error in peace 🦖

I hope it helps someone.

lyz-zz commented 2 years ago

I can't open 'link.exe' file, can you send me your files have compiled files? My email is: liyanzheng_earnest@foxmail.com thank you very much

YukioSama commented 2 years ago

您好,您的来信已收到,祝您有个好心情

Niko85858 commented 2 years ago

您好,我编译文件失败了,出现很多无法解析的符号,能否发一份您已经编译好的文件?我的邮箱:nikohua@163.com,万分感谢!

YukioSama commented 2 years ago

您好,您的来信已收到,祝您有个好心情