Kaolin is a PyTorch library aiming to accelerate 3D deep learning research. Kaolin provides efficient implementations of differentiable 3D modules for use in deep learning systems. With functionality to load and preprocess several popular 3D datasets, and native functions to manipulate meshes, pointclouds, signed distance functions, and voxel grids, Kaolin mitigates the need to write wasteful boilerplate code. Kaolin packages together several differentiable graphics modules including rendering, lighting, shading, and view warping. Kaolin also supports an array of loss functions and evaluation metrics for seamless evaluation and provides visualization functionality to render the 3D results. Importantly, we curate a comprehensive model zoo comprising many state-of-the-art 3D deep learning architectures, to serve as a starting point for future research endeavours.
Currently, the (beta) release contains several processing functions for 3D deep learning on meshes, voxels, signed distance functions, and pointclouds. Loading of several popular datasets (eg. ShapeNet, ModelNet, SHREC) are supported out-of-the-box. We also implement several 3D conversion and transformation operations (both within and across the aforementioned representations).
Kaolin supports several 3D tasks such as:
- Differentiable renderers (Neural Mesh Renderer, Soft Rasterizer, Differentiable Interpolation-based Renderer, and a modular and extensible abstract DifferentiableRenderer specification).
- Single-image based mesh reconstruction (Pixel2Mesh, GEOMetrics, OccupancyNets, and more...)
- Pointcloud classification and segmentation (PointNet, PoinNet++, DGCNN, ...)
- Mesh classification and segmentation
- 3D superresolution on voxel grids
- Basic graphics utilities (lighting, shading, etc.)
Kaolin curates a large model zoo containing reference implementations of popular 3D DL architectures. Head over here to check them out.
Installation and Usage
NOTE: The API is currently somewhat unstable, as we're making constant changes. (It's a beta release)
Kaolin is officially supported on Linux platforms and has been built and tested on Ubuntu 18. Windows and Mac support should be considered experimental.
We highly recommend installing Kaolin inside of a virtual environment (such as ones created using
virtualenv). Kaolin expects Python 3.6+, and currently needs a CUDA-enabled machine (i.e., with
nvcc installed) for the build.
First create a virtual environment. In this example, we show how to create a
conda virtual environment for installing kaolin.
$ conda create --name kaolin python=3.6 $ conda activate kaolin
Now, install the dependencies (
torch). Note that the setup file does not automatically install these dependencies.
conda install numpy
Install PyTorch, by following instructions from https://pytorch.org/
Now, you can install the library. From the root directory of this repo (i.e., the directory containing this
README file), run
$ python setup.py install
During installation, the packman package manager will
download the nv-usd package to
~/packman-repo/ containing the necessary packages for reading and writing Universal Scene Description (USD) files.
To verify that
kaolin has been installed, fire up your python interpreter, and execute the following commands.
>>> import kaolin as kal >>> print(kal.__version)
Building the Documentation
To delve deeper into the library, build the documentation. From the root directory of the repository (i.e., the directory containing this
README file), execute the following.
$ cd docs $ sphinx-build . _build
To run unittests, from the root directory of the repository (i.e., the directory containing this
README file), execute the following commands.
$ pytest tests/
Subscribe to Python Awesome
Get the latest posts delivered right to your inbox