Skip to content

Implementation of the Chamfer Distance as a module for pyTorch

License

Notifications You must be signed in to change notification settings

tonyromarock/pyTorchChamferDistance

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chamfer Distance for pyTorch

This is an implementation of the Chamfer Distance as a module for pyTorch. It is written as a custom C++/CUDA extension.

As it is using pyTorch's JIT compilation, there are no additional prerequisite steps that have to be taken. Simply import the module as shown below; CUDA and C++ code will be compiled on the first run.

Usage

from chamfer_distance import ChamferDistance
chamfer_dist = ChamferDistance()

#...
# points and points_reconstructed are n_points x 3 matrices

dist1, dist2 = chamfer_dist(points, points_reconstructed)
loss = (torch.mean(dist1)) + (torch.mean(dist2))


#...

About

Implementation of the Chamfer Distance as a module for pyTorch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 44.3%
  • Cuda 35.9%
  • Python 19.8%