Coder Social home page Coder Social logo

chamfer_distance's People

Contributors

chrdiller avatar liangpan99 avatar otaheri avatar purvaten 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  avatar  avatar

chamfer_distance's Issues

Unable to build on Windows and Ubuntu

Unfortunately I am not able to build the chamfer_distance.cuda on neither Windows 11 and Ubuntu 22.04 (same machine) when calling cd = load(name="cv" ...) for the first time. Both report similar error messages.

I use Python 3.10, PyTorch 1.11.0 with CUDA toolkit 11.6 on both Windows and Ubuntu.
I run this in a conda virtual environment.

I already tried this but it did not help.

Here is the Traceback from Ubuntu:

Traceback (most recent call last):
  File "/home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1740, in _run_ninja_build
    subprocess.run(
  File "/home/sktis/anaconda3/envs/GrabNet/lib/python3.10/subprocess.py", line 524, 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 "/home/sktis/dev/python/GrabNet/grabnet/tests/grab_new_objects.py", line 24, in <module>
    from grabnet.tools.vis_tools import points_to_spheres
  File "/home/sktis/dev/python/GrabNet/./grabnet/tools/vis_tools.py", line 21, in <module>
    from grabnet.tools.train_tools import point2point_signed
  File "/home/sktis/dev/python/GrabNet/./grabnet/tools/train_tools.py", line 18, in <module>
    import chamfer_distance as chd
  File "/home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/chamfer_distance/__init__.py", line 1, in <module>
    from .chamfer_distance import ChamferDistance
  File "/home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/chamfer_distance/chamfer_distance.py", line 8, in <module>
    cd = load(name="cd",
  File "/home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1144, in load
    return _jit_compile(
  File "/home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1357, in _jit_compile
    _write_ninja_file_and_build_library(
  File "/home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1469, in _write_ninja_file_and_build_library
    _run_ninja_build(
  File "/home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1756, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension 'cd': [1/2] /usr/bin/nvcc  -DTORCH_EXTENSION_NAME=cd -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/include -isystem /home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/include/TH -isystem /home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/include/THC -isystem /home/sktis/anaconda3/envs/GrabNet/include/python3.10 -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_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/chamfer_distance/chamfer_distance.cu -o chamfer_distance.cuda.o 
FAILED: chamfer_distance.cuda.o 
/usr/bin/nvcc  -DTORCH_EXTENSION_NAME=cd -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -isystem /home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/include -isystem /home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/include/TH -isystem /home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/torch/include/THC -isystem /home/sktis/anaconda3/envs/GrabNet/include/python3.10 -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_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /home/sktis/anaconda3/envs/GrabNet/lib/python3.10/site-packages/chamfer_distance/chamfer_distance.cu -o chamfer_distance.cuda.o 
/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
  435 |         function(_Functor&& __f)
      |                                                                                                                                                 ^ 
/usr/include/c++/11/bits/std_function.h:435:145: note:         ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’:
  530 |         operator=(_Functor&& __f)
      |                                                                                                                                                  ^ 
/usr/include/c++/11/bits/std_function.h:530:146: note:         ‘_ArgTypes’
ninja: build stopped: subcommand failed.

Usage example is incorrect?

I found that I need to call the method in a different way, first I needed to initialize the class and only then call it, so this works:

dist1, dist2, idx1, idx2 = chamfer_dist()(p1,p2)

while the example in the readme does not work and produces an error ... = chamfer_dist(p1,p2) (without the class parenthesis)

Is it just me?

Thank you for this package in any case.

ImportError: No module named 'cd'

I install pytorch and chamfer_distance, but when I run the Usage, the error is ' ImportError: No module named 'cd' ', my python is 3.6 and pytorch is 1.7 .

backward doesn't work

Hello, trying to use in an optimization procedure. Trying out the demo code

import torch
from chamfer_distance import ChamferDistance
import time

chamfer_dist = ChamferDistance()

p1 = torch.rand([10,25,3], requires_grad=True)
p2 = torch.rand([10,15,3], requires_grad=True)

dist1, dist2, idx1, idx2 = chamfer_dist(p1,p2)
loss = (torch.mean(dist1)) + (torch.mean(dist2))

then adding
loss.backwad()

I get : "TypeError: backward( takes 4 positional argument but 5 were given"
using torch version 1.9.1 on a linux system.

Eran

ImportError: DLL load failed while importing cd:

module = importlib.util.module_from_spec(spec)

ImportError: DLL load failed while importing cd: The specified module could not be found.

After fixing many previous bugs, I get a new bug....it is quite annoying~~~is it due to the difference of pytorch/python/cuda version?

ImportError: cannot import name 'Volumes' from 'pytorch3d.structures'

ImportError: cannot import name 'Volumes' from 'pytorch3d.structures' (/home/dennisushi/.local/lib/python3.8/site-packages/pytorch3d/structures/__init__.py)

When running

import torch
from chamfer_distance import ChamferDistance as chamfer_dist
import time

p1 = torch.rand([10,25,3])
p2 = torch.rand([10,15,3])

s = time.time()
chd = chamfer_dist()
dist1, dist2, idx1, idx2 = chd(p1,p2)
loss = (torch.mean(dist1)) + (torch.mean(dist2))

torch.cuda.synchronize()
print(f"Time: {time.time() - s} seconds")
print(f"Loss: {loss}")

Seems like the recommended version of pytorch3d might be too new. (0.7.2 from git+https://github.com/facebookresearch/pytorch3d.git@stable )

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.