perrying / ssn-pytorch Goto Github PK
View Code? Open in Web Editor NEWPyTorch implementation of Superpixel Sampling Networks
License: MIT License
PyTorch implementation of Superpixel Sampling Networks
License: MIT License
Lines 49 to 53 in 25c69d3
I have a question with line 53 in lib/utils/loss.py. According the paper 'superpixel sampling networks', the reconstructed pixel features are , and means the row-normalized association matrix Q. however, the code in line 53 seems not using row-normalized Q but the Q itself to compute the reconstructed label.
why compile cuda source
something wrong in the "from lib.ssn.ssb import sparse_ssn_iter"?why?
should i compile the ssn firstly?
First of all, thank you very much for sharing the code. After many days of debugging your code, I still cannot run it successfully. My operating environment is cuda10.1 + torch 1.4.0, and my current debugging error is as follows:
RecursionError: maximum recursion depth exceeded in comparison
This is a problem that I cannot solve.
Could you please write a detailed operating instruction and provide a detailed operating environment?
If you are willing to email me, I will be very grateful to you!
email: [email protected]
Hello, I wonder how to set the number of superpixels in the results.
pair_wise_distance_cuda = load_inline(
"pair_wise_distance", cpp_sources='', cuda_sources=source
)
Do you or anyone else have pre trained weights for this?
Traceback (most recent call last):
File "/home/ppavia/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1740, in _run_ninja_build
subprocess.run(
File "/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "train.py", line 9, in <module>
from model import SSNModel
File "/data3/ppavia/ssn-pytorch/model.py", line 4, in <module>
from lib.ssn.ssn import ssn_iter, sparse_ssn_iter
File "/data3/ppavia/ssn-pytorch/lib/ssn/ssn.py", line 4, in <module>
from .pair_wise_distance import PairwiseDistFunction
File "/data3/ppavia/ssn-pytorch/lib/ssn/pair_wise_distance.py", line 8, in <module>
pair_wise_distance_cuda = load_inline(
File "/home/ppavia/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1293, in load_inline
return _jit_compile(
File "/home/ppavia/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1357, in _jit_compile
_write_ninja_file_and_build_library(
File "/home/ppavia/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1469, in _write_ninja_file_and_build_library
_run_ninja_build(
File "/home/ppavia/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1756, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error building extension 'pair_wise_distance': [1/3] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=pair_wise_distance -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include/TH -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /usr/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_70,code=compute_70 -gencode=arch=compute_70,code=sm_70 --compiler-options '-fPIC' -std=c++14 -c /home/ppavia/.cache/torch_extensions/py38_cu102/pair_wise_distance/cuda.cu -o cuda.cuda.o
FAILED: cuda.cuda.o
/usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=pair_wise_distance -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include/TH -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /usr/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_70,code=compute_70 -gencode=arch=compute_70,code=sm_70 --compiler-options '-fPIC' -std=c++14 -c /home/ppavia/.cache/torch_extensions/py38_cu102/pair_wise_distance/cuda.cu -o cuda.cuda.o
/home/ppavia/.cache/torch_extensions/py38_cu102/pair_wise_distance/cuda.cu:17:10: fatal error: THC/THC.h: Aucun fichier ou dossier de ce type
17 | #include <THC/THC.h>
| ^~~~~~~~~~~
compilation terminated.
[2/3] c++ -MMD -MF main.o.d -DTORCH_EXTENSION_NAME=pair_wise_distance -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include/TH -isystem /home/ppavia/.local/lib/python3.8/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /usr/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -c /home/ppavia/.cache/torch_extensions/py38_cu102/pair_wise_distance/main.cpp -o main.o
ninja: build stopped: subcommand failed.
Is there a way to run the the pair_wise_distance without gpu or cuda? Thanks!
RuntimeError: CUDA out of memory. Tried to allocate 7.74 GiB (GPU 0; 23.69 GiB total capacity; 18.60 GiB already allocated; 2.78 GiB free; 19.05 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
Thanks very much from your work, and I need some assistance to train my own dataset, I change dimension 50 to 3 in convert_label
function, but when starting training, it still reports CUDA out of memory
error, I don't kown how to fix it
there is a runtimen error of cuda when runs the following line code with pytorch 1.6 and cudatoolkit 10.2
Line 151 in 25c69d3
Connected to pydev debugger (build 202.6397.98)
compile cuda source of 'pair_wise_distance' function...
NOTE: if you avoid this process, you make .cu file and compile it following https://pytorch.org/tutorials/advanced/cpp_extension.html
done
Traceback (most recent call last):
File "/home/vge/pycharm-community-2020.2/plugins/python-ce/helpers/pydev/pydevd.py", line 1448, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/vge/pycharm-community-2020.2/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/vge/yhj/projects/ssn-pytorch/train.py", line 156, in
train(args)
File "/home/vge/yhj/projects/ssn-pytorch/train.py", line 117, in train
metric = update_param(data, model, optimizer, cfg.compactness, cfg.color_scale, cfg.pos_scale, device)
File "/home/vge/yhj/projects/ssn-pytorch/train.py", line 79, in update_param
Q, H, feat = model(inputs)
File "/home/vge/anaconda3/envs/pytorch_yhj/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/vge/yhj/projects/ssn-pytorch/model.py", line 51, in forward
return ssn_iter(pixel_f, self.nspix, self.n_iter)
File "/home/vge/yhj/projects/ssn-pytorch/lib/ssn/ssn.py", line 151, in ssn_iter
sparse_abs_affinity = torch.sparse_coo_tensor(abs_indices[:, mask], reshaped_affinity_matrix[mask])
RuntimeError: CUDA error: an illegal memory access was encountered
python-BaseException
Backend TkAgg is interactive backend. Turning interactive mode on.
THCudaCheck FAIL file=/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/THC/THCCachingHostAllocator.cpp line=278 error=700 : an illegal memory access was encountered
Process finished with exit code 130 (interrupted by signal 2: SIGINT)
This requires the ninja
package, with unspecified version requirements, and that's missing from the readme.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.