/vsl

The implementation of "Learning a Hierarchical Latent-Variable Model of Voxelized 3D Shapes".

Primary LanguagePython

Variational Shape Learner

This repository contains the source codes for the paper: Learning a Hierarchical Latent-Variable Model of Voxelized 3D Shapes, introduced by Shikun Liu, Alexander G. Ororbia II, C. Lee Giles.

Requirements

VSL was written in python 3.6. For running the code, please make sure the following packages have been installed.

  • h5py 2.7
  • matplotlib 1.5
  • mayavi 4.5
  • numpy 1.12
  • scikit-learn 0.18
  • tensorflow 1.0

Most of which can be directly installed using pip command. However, mayavi which is used for 3D voxel visualization is recommended to be installed using conda environment (for simplicity).

Dataset

We use both 3D shapes from ModelNet and PASCAL 3D+ v1.0 aligned with images in PASCAL VOC 2012 for training VSL. ModeNet is used for general 3D shape learning including shape generation, interpolation and classification. PASCAL 3D is only used for image reconstruction.

Please download the dataset here: [link].

The above dataset contains files ModelNet10_res30_raw.mat and ModelNet40_res30_raw.mat representing voxelized version of Modelnet10/40 and PASCAL3D.mat which represents voxelized PASCAL3D+ aligned with images.

Each ModelNet dataset contains train and test split with each entry has 270001 dimension representing [id|voxel] in [30x30x30] resolution.

PASCAL3D contains image_train, model_train, image_test, model_test which were defined in Kar, et al. Each entry of model again is in 270001 dimension which is similar defined in ModelNet and each entry of image is in [100,100,3] dimension representing [100x100] RGB images.

Parameters

We have also included the pre-trained model for parameters can be downloaded here.

Training VSL

Please download dataset and parameters (if using pre-trained parameters) from links in the previous sections and extract them in the same folder of this repository.

Please use vsl_main.py for general 3D shape learning experiments, and vsl_imrec.py for image reconstruction experiment. For correctly using the hyper-parameters in the pre-trained model and consistent with the other experiment settings in the paper, please define hyper-parameters as follows,

ModelNet40 ModelNet10 PASCAL3D (jointly) PASCAL3D (separately)
global_latent_dim 20 10 10 5
local_latent_dim 10 5 5 2
local_latent_num 5 5 5 3
batch_size 200 100 40 5

The source codes are fully commented. For any more details please look over the paper and source code.

Normally, training VSL from scratch requires 2 days on ModelNet in a fast computer, and requires 20-40 minutes on separately-trained image reconstruction experiment.

Citation

If you found this work is useful for your research, please considering cite:

@article{liu2017learning,
  title={Learning a Hierarchical Latent-Variable Model of Voxelized 3D Shapes},
  author={Liu, Shikun and Ororbia, II and Alexander, G and Giles, C Lee},
  journal={arXiv preprint arXiv:1705.05994},
  year={2017}
}

Contact

If you found any questions, please contact sk.lorenmt@gmail.com for more details.