Skip to content

Torch layer for NURBS evaluation for a given control points and parametrization

License

Notifications You must be signed in to change notification settings

orthly/NURBSDiff

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

114 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NURBS_Diff : A Differentiable NURBS Layer for Machine Learning CAD Applications

NURBS-diff is a differentiable layer that can be run as a standalone layer for CAD applications like curve fitting, surface fitting, surface offseting, and other applications that rely on Non-uniform rational B-splines (NURBS) for representation. NURBS are the current standard for representing CAD geometries, and this work seeks to bridge the gap that currently exists between Deep Learning and Computer-Aided design.
The NURBS-diff layer can also be integrated with other DL frameworks for surface reconstruction to produce accurate rational B-spline surfaces as the output. NURBS_Diff layer

Requirements and Install dependencies

Dependencies

  1. Pytorch: Installation command can be generated from here.
  2. Pytorch 3D:
    • For CPU only install pip install pytorch3d should do
    • For macOS running on Apple Silicon MACOSX_DEPLOYMENT_TARGET=10.14 CC=clang CXX=clang++ pip install "git+https://github.com/facebookresearch/pytorch3d.git"
    • For GPU support, we would need to install pytorch3d using the following process TBD pip install "git+https://github.com/facebookresearch/pytorch3d.git"
    • Or use pip install pipablepytorch3d

Examples

Each of the examples can be run using either the CPU version of the code, or the GPU version of the code (available as 'cuda' or 'tc'). \n To run each of the examples, first carry out the build using setup.py.

Curve Fitting

  • Code can be found under examples/curve_fitting_on_point_clouds.py
  • The layer can be used to fit generic 2D and 3D curves, and point clouds obtained from images.
  • To run curve_fitting_on_point_clouds.py, provide a random initialization of input control points, input point cloud and set the number of evaluation points.
  • Parameters to vary: degree, number of control points, number of evaluation points.
  • Dataset used : Pixel dataset provided under Skelneton challenge.

Surface Fitting

  • Code can be found under examples/{surface_fitting.py, nurbs_surface_fitting.py}
  • The layer can fit rational and NURBS surfaces.
  • Provide input control point grid, number of evaluation points in u, v direction, degree.

Surface Offseting

  • Code found under examples for different cases.

Surface reconstruction using Deep Learning

Non-rational B-splines

\n

Rational B-splines

Will be added soon:

  • Support for trimmed NURBS surfaces
  • Support for automatically learning number of control points
  • Dataset for NURBS and trimmed NURBS surfaces

About

Torch layer for NURBS evaluation for a given control points and parametrization

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 52.5%
  • Cuda 25.5%
  • C++ 21.7%
  • C 0.3%