RSNet icon indicating copy to clipboard operation
RSNet copied to clipboard

something wrong about train.py

Open YukioSama opened this issue 6 years ago • 13 comments

  from _ext import slice_pool_layer

ImportError: No module named _ext

YukioSama avatar Oct 16 '18 09:10 YukioSama

soory,I did know

YukioSama avatar Oct 16 '18 09:10 YukioSama

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

YukioSama avatar Oct 16 '18 14:10 YukioSama

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

Timaces avatar Jun 19 '19 02:06 Timaces

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:[email protected] forward your reply

longmalongma avatar Oct 08 '19 04:10 longmalongma

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.

zkm98 avatar May 25 '20 02:05 zkm98

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().

DChoLee avatar Sep 22 '20 13:09 DChoLee

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

MCemGunes avatar Jan 31 '22 22:01 MCemGunes

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

YukioSama avatar Jan 31 '22 22:01 YukioSama

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 cuda command.

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.

MCemGunes avatar Feb 01 '22 16:02 MCemGunes

I can't open 'link.exe' file, can you send me your files have compiled files? My email is: [email protected] thank you very much

lyz-zz avatar Mar 31 '22 03:03 lyz-zz

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

YukioSama avatar Mar 31 '22 03:03 YukioSama

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

Niko85858 avatar Apr 29 '22 07:04 Niko85858

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

YukioSama avatar Apr 29 '22 07:04 YukioSama