chenhsuanlin / signed-distance-SRN

SDF-SRN: Learning Signed Distance 3D Object Reconstruction from Static Images 🎯 (NeurIPS 2020)
MIT License
125 stars 17 forks source link

SDF-SRN: Learning Signed Distance 3D Object Reconstruction from Static Images

Chen-Hsuan Lin, Chaoyang Wang, and Simon Lucey
Advances in Neural Information Processing Systems (NeurIPS), 2020

Project page: https://chenhsuanlin.bitbucket.io/signed-distance-SRN
Paper: https://chenhsuanlin.bitbucket.io/signed-distance-SRN/paper.pdf
arXiv preprint: https://arxiv.org/abs/2010.10505

We provide PyTorch code for both the ShapeNet and PASCAL3D+ experiments.


Prerequisites

This code is developed with Python3 (python3). PyTorch 1.4+ is required.
It is recommended to install the dependencies with conda by running

conda env create --file requirements.yaml python=3

This creates a conda environment named sdfsrn-env. Activate it with

conda activate sdfsrn-env

You may want to install with virtualenv; however, this repository depends on VIGRA to compute the distance transforms, which does not seem to be pip installable. Some workarounds would include (a) installing VIGRA from source, or (b) replacing the VIGRA distance transform function with scipy.ndimage.distance_transform_edt (significantly slower).


Dataset


Pretrained models

First, create a directory to store the pretrained models:

mkdir -p pretrained

Then under pretrained, download the pretrained model(s) by running the commands

# ShapeNet (trained on multi-view renderings, 615MB each)
wget https://cmu.box.com/shared/static/cgrzlaudm2ojs5l3nmmbbr7ovsvbqhtv.ckpt -O shapenet_airplane.ckpt  # airplane
wget https://cmu.box.com/shared/static/lclrhwae5xu6z7f2fc3qnkeon3q5ljfg.ckpt -O shapenet_car.ckpt  # car
wget https://cmu.box.com/shared/static/58dsppp8hq0yqj216tqm573or9porq2m.ckpt -O shapenet_chair.ckpt  # chair
# PASCAL3D+ (197MB each)
wget https://cmu.box.com/shared/static/gvslqtye7p0pzgaspmwvq7pggnmxsu3x.ckpt -O pascal3d_airplane.ckpt # airplane
wget https://cmu.box.com/shared/static/kh8mrrufol3u1mm6duaym5sygfd42d5p.ckpt -O pascal3d_car.ckpt # car
wget https://cmu.box.com/shared/static/ty0ywyeud1n1n9uu169xoag9m35me267.ckpt -O pascal3d_chair.ckpt # chair

Compiling the CUDA libraries

The Chamfer distance function can be compiled by running python3 setup.py install under external/chamfer3D. The source code is taken/modified from the AtlasNet repository.
When compiling CUDA code, you may need to modify CUDA_PATH accordingly.


Running the code


If you find our code useful for your research, please cite

@inproceedings{lin2020sdfsrn,
  title={SDF-SRN: Learning Signed Distance 3D Object Reconstruction from Static Images},
  author={Lin, Chen-Hsuan and Wang, Chaoyang and Lucey, Simon},
  booktitle={Advances in Neural Information Processing Systems ({NeurIPS})},
  year={2020}
}

Please contact me (chlin@cmu.edu) if you have any questions!