Strictly Conservative Neural Implicits is a method to convert 3D shapes into neural implicit form such that the shape is approximated in a guaranteed conservative manner. This means the input shape is strictly contained inside the neural implicit or, alternatively, vice versa. Such conservative approximations are of interest in a variety of applications, including collision detection, occlusion culling, or intersection testing.
Strictly Conservative Neural Implicits is described in more detail in the below publication.
If you find this code useful, please consider citing our paper
@article{StrictlyConservativeNeuralImplicits,
author = {Ludwig, I. and Campen, M.},
title = {Strictly Conservative Neural Implicits},
journal = {Computer Graphics Forum},
volume = {43},
number = {7},
year = {2024}
}
- Create a new Anaconda environment with python 3.11:
conda create --name conservative_neural_implicits python=3.11- Switch to the new environment:
conda activate conservative_neural_implicits - Install Pytorch using the right command for your system found on https://pytorch.org/get-started/locally/
- Install jupyter using:
conda install jupyter- Install Matplotlib:
conda install matplotlibDepending on the system, the installation of additional packages might be necessary.
For creating a strictly conservative neural implicit from a tetrahedral mesh, follow these steps:
- Place your input mesh in the tet_meshes directory. Currently only the vtk format is supported. Not neccessary if you use the provided bunny tetrahedral mesh.
- Create a directory for your run.
- Copy training_template.ipynb from the template directory into your folder.
- In training_template.ipynb in your folder, at "Data Settings" give the name of your vtk file (without postfix) and set type to "tet".
- If you would like to use pretraining, set use_pretraining = True.
- Run the notebook.
At the beginning of the first run the dataset might be constructed and stored in the point_cache directory. Depending on the input shape this might take a while. The best and final neural implicit is saved in the form name_day-month-year_hh-mm-ss.npz, for example bunny_13-09-2024_14-59-53.npz. The intermediate neural implicits are saved as bunny_pretrained.npz, etc..
For creating a strictly conservative neural implicit from a voxel set, follow these steps:
- Place your input voxel set in the binvox directory. Currently only the binvox format is supported. The binvox files used in our paper can be found accompanying the software for the paper "Neural Bounding" by Liu et al., found under https://github.com/wenxin-liu/neural_bounding.
- Create a directory for your run.
- Copy training_template.ipynb from the template directory into your folder.
- In training_template.ipynb in your folder, at "Data Settings" give the name of your binvox file (without postfix) and set type to "voxel".
- If you would like to use pretraining, set use_pretraining = True.
- Run the notebook.
Depending on the input shape this might take a while. The best and final neural implicit is saved in the form name_day-month-year_hh-mm-ss.npz, for example bunny_13-09-2024_14-59-53.npz. The intermediate neural implicits are saved as bunny_pretrained.npz, etc..
The Settings can be changed in the "Data Settings" section and in the local setting blocks in the individual sections (at "Create Randomly Initialized Model", "Pretraining", "Create Affine Dataloader", "Optimization" and "Lambda Reduction").
The authors thank Nicholas Sharp for publishing code that has in multiple ways been helpful for this work.
