MCPcopy Index your code
hub / github.com/cvlab-epfl/MeshSDF

github.com/cvlab-epfl/MeshSDF @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
106 symbols 278 edges 12 files 6 documented · 6%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

MeshSDF

This is a PyTorch implementation of the NeurIPS'20 SpotLight paper "MeshSDF: Differentiable Iso-Surface Extraction". You can find the paper here.

Installation

To get started, simply clone the repo and run the setup bash script, which will take care of installing all packages and dependencies.

git clone https://github.com/cvlab-epfl/MeshSDF.git
cd MeshSDF
./setup.sh

Data

In our project, we store data according to the following structure:

data/
  <dataset_name>/
      samples/
          <instance_name>.npz
      meshes/
          <instance_name>.obj
      renders/
          <instance_name>/
              00.png
              ...
              rendering_metadata.txt

We provide pre-processed and subsampled ShapeNet data for cars and chairs to get you started. Simply download it and unzip it in the data/ folder to get going.

In case you are interested in using different data, below we detail how to obtain and pre-process the ShapeNet data we used in our project. Do not forget to cite the authors of the respective papers if you find this data useful for your research.

Mesh data

We use data from ShapeNetCore.v1. Specifically, we use cleaned surface meshes from here. Please refer to their repo to download ShapeNetCore.v1 clean models.

SDF data

Once you have downloaded cleaned ShapeNetCore.v1 models, we generate SDF training data using the pre-processing script from DeepSDF. Please refer to their repo for more info on how to generate SDF samples.

Image data

We use rendered ShapeNetCore.v1 models from DISN. Please refer to their repo for more info on how to generate synthetic renders.

Differentiable iso-surface extraction

We show how to backpropagate gradient information from mesh vertices to latent vector while modifying surface mesh topology through a simple toy-experiment.

As an example of a loss function defined on an explicit surface mesh, we consider silhouette distance, obtained through differentiable rasterization. For this experiment, we consider a dataset consisting of two shapes, bob, a genus-1 rubber duck, and spot, a genus-0 cow.

To get started, first learn a deep signed distance function representation for this dataset by running

python train_deep_sdf.py -e experiments/bob_and_spot

You can then exploit our differentiability result to minimize silhouette distance between spot and bob

python demo_optimizer.py -e experiments/bob_and_spot/

In our paper, we also propose an heuristic to accelerate iso-surface extraction when performing optimization in an iterative fashion, which results in a noticeable speed-up. You can use our heuristic by running

python demo_optimizer.py -e experiments/bob_and_spot/ --fast

Single-view reconstruction

You can train a SVR model for cars by running

python train_svr.py -e experiments/cars_svr/

Once the model is trained, you can run silhouette based refinement, as presented in our work, by running

python reconstruct_svr.py -e experiments/cars_svr/

Finally, to gather results and compute metrics, run

python metrics_svr.py -e experiments/cars_svr/

Cite us

If you find MeshSDF useful for your research, please cite our paper:

@inproceedings{remelli2020meshsdf,
 author = {Remelli, Edoardo and Lukoianov, Artem and Richter, Stephan and Guillard, Benoit and Bagautdinov, Timur and Baque, Pierre and Fua, Pascal},
 booktitle = {Advances in Neural Information Processing Systems},
 editor = {H. Larochelle and M. Ranzato and R. Hadsell and M. F. Balcan and H. Lin},
 pages = {22468--22478},
 publisher = {Curran Associates, Inc.},
 title = {MeshSDF: Differentiable Iso-Surface Extraction},
 url = {https://proceedings.neurips.cc/paper/2020/file/fe40fb944ee700392ed51bfe84dd4e3d-Paper.pdf},
 volume = {33},
 year = {2020}
}

Core symbols most depended-on inside this repo

get_spec_with_default
called by 12
lib/utils.py
get_learning_rate
called by 6
lib/utils.py
save_model
called by 5
lib/utils.py
_make_layer
called by 4
lib/models/encoder.py
save_optimizer
called by 3
lib/utils.py
save_logs
called by 2
train_svr.py
compute_normal_consistency
called by 2
lib/utils.py
process_image
called by 2
lib/utils.py

Shape

Function 62
Method 30
Class 14

Languages

Python100%

Modules by API surface

lib/utils.py42 symbols
lib/models/encoder.py18 symbols
lib/workspace.py15 symbols
train_svr.py8 symbols
lib/data.py8 symbols
lib/mesh.py5 symbols
train_deep_sdf.py4 symbols
lib/models/decoder.py4 symbols
reconstruct_svr.py1 symbols
metrics_svr.py1 symbols

For agents

$ claude mcp add MeshSDF \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact