loolzaaa / faster-rcnn-pytorch

A PyTorch implementation of Faster R-CNN
MIT License
17 stars 5 forks source link

Error in run.py working with colab #4

Closed fernando65535 closed 4 years ago

fernando65535 commented 4 years ago

I've had problems with setup but adding to the header or roi_pool.cpp and roi_pool_kernel.cu has finished the process ok.

Now I'm stuck with run.py

I execute: !python run.py train -h

And this is the result:

/ /content/faster-rcnn-pytorch Traceback (most recent call last): File "run.py", line 9, in from script.train import train File "/content/faster-rcnn-pytorch/script/train.py", line 12, in from model.vgg16 import VGG16 File "/content/faster-rcnn-pytorch/lib/model/vgg16.py", line 1, in import torchvision File "/usr/local/lib/python3.6/dist-packages/torchvision/init.py", line 3, in from torchvision import models File "/usr/local/lib/python3.6/dist-packages/torchvision/models/init.py", line 12, in from . import detection File "/usr/local/lib/python3.6/dist-packages/torchvision/models/detection/init.py", line 1, in from .faster_rcnn import * File "/usr/local/lib/python3.6/dist-packages/torchvision/models/detection/faster_rcnn.py", line 7, in from torchvision.ops import misc as misc_nn_ops File "/usr/local/lib/python3.6/dist-packages/torchvision/ops/init.py", line 13, in _register_custom_op() File "/usr/local/lib/python3.6/dist-packages/torchvision/ops/_register_onnx_ops.py", line 51, in _register_custom_op register_custom_op_symbolic('torchvision::_new_empty_tensor_op', new_empty_tensor_op, _onnx_opset_version) File "/usr/local/lib/python3.6/dist-packages/torch/onnx/init.py", line 195, in register_custom_op_symbolic return utils.register_custom_op_symbolic(symbolic_name, symbolic_fn, opset_version) File "/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py", line 740, in register_custom_op_symbolic .format(symbolic_name)) RuntimeError: Failed to register operator torchvision::_new_empty_tensor_op. The symbolic name must match the format Domain::Name, and sould start with a letter and contain only alphanumerical characters

The messages from the install:

/content /content/faster-rcnn-pytorch/lib running develop running egg_info writing faster_rcnn_utils.egg-info/PKG-INFO writing dependency_links to faster_rcnn_utils.egg-info/dependency_links.txt writing top-level names to faster_rcnn_utils.egg-info/top_level.txt writing manifest file 'faster_rcnn_utils.egg-info/SOURCES.txt' running build_ext building '_C' extension x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.6/dist-packages/torch/include -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.6/dist-packages/torch/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c /content/faster-rcnn-pytorch/lib/csrc/main.cpp -o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/main.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.6/dist-packages/torch/include -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.6/dist-packages/torch/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c /content/faster-rcnn-pytorch/lib/csrc/cpu/roi_pool.cpp -o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cpu/roi_pool.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.6/dist-packages/torch/include -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.6/dist-packages/torch/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c /content/faster-rcnn-pytorch/lib/csrc/cpu/nms.cpp -o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cpu/nms.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_CUDA -I/usr/local/lib/python3.6/dist-packages/torch/include -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.6/dist-packages/torch/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c /content/faster-rcnn-pytorch/lib/csrc/cpu/roi_align.cpp -o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cpu/roi_align.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 /usr/local/cuda/bin/nvcc -DWITH_CUDA -I/usr/local/lib/python3.6/dist-packages/torch/include -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.6/dist-packages/torch/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c /content/faster-rcnn-pytorch/lib/csrc/cuda/nms_cuda_kernel.cu -o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cuda/nms_cuda_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75 -std=c++11 /usr/local/lib/python3.6/dist-packages/torch/include/c10/core/TensorTypeSet.h(44): warning: integer conversion resulted in a change of sign

/usr/local/lib/python3.6/dist-packages/torch/include/c10/core/TensorTypeSet.h(44): warning: integer conversion resulted in a change of sign

/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/usr/local/lib/python3.6/dist-packages/torch/include -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.6/dist-packages/torch/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c /content/faster-rcnn-pytorch/lib/csrc/cuda/roi_pool_kernel.cu -o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cuda/roi_pool_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75 -std=c++11 In file included from /content/faster-rcnn-pytorch/lib/csrc/cuda/roi_pool_kernel.cu:6:0: /content/faster-rcnn-pytorch/lib/csrc/cuda/cuda_helpers.h:3:66: warning: backslash-newline at end of file

define CUDA_1D_KERNEL_LOOP(i, n) \

/usr/local/lib/python3.6/dist-packages/torch/include/c10/core/TensorTypeSet.h(44): warning: integer conversion resulted in a change of sign

/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/autograd/profiler.h(97): warning: attribute "visibility" does not apply here

/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/autograd/profiler.h(112): warning: attribute "visibility" does not apply here

In file included from /content/faster-rcnn-pytorch/lib/csrc/cuda/roi_pool_kernel.cu:6:0: /content/faster-rcnn-pytorch/lib/csrc/cuda/cuda_helpers.h:3:66: warning: backslash-newline at end of file

define CUDA_1D_KERNEL_LOOP(i, n) \

/usr/local/lib/python3.6/dist-packages/torch/include/c10/core/TensorTypeSet.h(44): warning: integer conversion resulted in a change of sign

/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/autograd/profiler.h(97): warning: attribute "visibility" does not apply here

/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/autograd/profiler.h(112): warning: attribute "visibility" does not apply here

/usr/local/cuda/bin/nvcc -DWITH_CUDA -I/usr/local/lib/python3.6/dist-packages/torch/include -I/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.6/dist-packages/torch/include/TH -I/usr/local/lib/python3.6/dist-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.6m -c /content/faster-rcnn-pytorch/lib/csrc/cuda/roi_align_kernel.cu -o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cuda/roi_align_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75 -std=c++11 In file included from /content/faster-rcnn-pytorch/lib/csrc/cuda/roi_align_kernel.cu:4:0: /content/faster-rcnn-pytorch/lib/csrc/cuda/cuda_helpers.h:3:66: warning: backslash-newline at end of file

define CUDA_1D_KERNEL_LOOP(i, n) \

/usr/local/lib/python3.6/dist-packages/torch/include/c10/core/TensorTypeSet.h(44): warning: integer conversion resulted in a change of sign

/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/autograd/profiler.h(97): warning: attribute "visibility" does not apply here

/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/autograd/profiler.h(112): warning: attribute "visibility" does not apply here

In file included from /content/faster-rcnn-pytorch/lib/csrc/cuda/roi_align_kernel.cu:4:0: /content/faster-rcnn-pytorch/lib/csrc/cuda/cuda_helpers.h:3:66: warning: backslash-newline at end of file

define CUDA_1D_KERNEL_LOOP(i, n) \

/usr/local/lib/python3.6/dist-packages/torch/include/c10/core/TensorTypeSet.h(44): warning: integer conversion resulted in a change of sign

/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/autograd/profiler.h(97): warning: attribute "visibility" does not apply here

/usr/local/lib/python3.6/dist-packages/torch/include/torch/csrc/autograd/profiler.h(112): warning: attribute "visibility" does not apply here

creating build/lib.linux-x86_64-3.6 x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/main.o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cpu/roi_pool.o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cpu/nms.o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cpu/roi_align.o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cuda/nms_cuda_kernel.o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cuda/roi_pool_kernel.o build/temp.linux-x86_64-3.6/content/faster-rcnn-pytorch/lib/csrc/cuda/roi_align_kernel.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.linux-x86_64-3.6/_C.cpython-36m-x86_64-linux-gnu.so copying build/lib.linux-x86_64-3.6/_C.cpython-36m-x86_64-linux-gnu.so -> Creating /usr/local/lib/python3.6/dist-packages/faster-rcnn-utils.egg-link (link to .) Adding faster-rcnn-utils 0.3 to easy-install.pth file

Installed /content/faster-rcnn-pytorch/lib Processing dependencies for faster-rcnn-utils==0.3 Finished processing dependencies for faster-rcnn-utils==0.3

As pre requisites I've installed !pip install python3-dev !pip install torch==1.3 !pip install colorama !pip install easydict !pip install pyyaml !pip install matplotlib !pip install numpy

Don't know what to do....

fernando65535 commented 4 years ago

One thing else:

You sai in the other issue : "If you compile process finished without errors, you must find this module in ./lib folder. Name of the module: _C.........pyd."

In the folder /lib of colab there is not any file _C.........pyd.

loolzaaa commented 4 years ago

I've had problems with setup but adding to the header or roi_pool.cpp and roi_pool_kernel.cu has finished the process ok.

Oh, sorry, i don't tested build process on Linux. Yes, need to add #include <float.h> only for roi_pool.cpp file. Test in google colab Change already commited.

I execute: !python run.py train -h

And this is the result:

Very strange output. With -h flag, run.py show only help message, not run train script.

I test library in colab right now, so it works. Create and add colab notebook to repo: https://colab.research.google.com/github/loolzaaa/faster-rcnn-pytorch/blob/master/Faster_RCNN.ipynb

In the folder /lib of colab there is not any file _C.........pyd.

For Linux, it would be _C...........so file, but yes, colab don't show it. You can check file by command !ls in lib folder or:

import os
os.listdir('lib')
fernando65535 commented 4 years ago

I see you are very responsive!! I think that I had problems with prerequisites, I see you have done a great job. Thank you very much!!