Code Monkey home page Code Monkey logo

ssn-pytorch's People

Contributors

perrying avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ssn-pytorch's Issues

the reconstructed features may have been calculated incorrectly

if hard_assignment is None:
# (B, n_spixels, n_pixels) -> (B, n_pixels, n_spixels)
permuted_assignment = assignment.permute(0, 2, 1).contiguous()
# matrix product between (n_pixels, n_spixels) and (n_spixels, channels)
reconstructed_labels = torch.bmm(permuted_assignment, spixel_mean)

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

why compile cuda source
something wrong in the "from lib.ssn.ssb import sparse_ssn_iter"?why?
should i compile the ssn firstly?

I cannot debug your code successfully

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]

THC.h : no such file or directory

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.

Run without GPU

Is there a way to run the the pair_wise_distance without gpu or cuda? Thanks!

CUDA out of memory

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

RuntimeError: CUDA error: an illegal memory access was encountered

there is a runtimen error of cuda when runs the following line code with pytorch 1.6 and cudatoolkit 10.2

sparse_abs_affinity = torch.sparse_coo_tensor(abs_indices[:, mask], reshaped_affinity_matrix[mask])

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)

Missing dependency

This requires the ninja package, with unspecified version requirements, and that's missing from the readme.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.