项目作者: Hippogriff

项目描述 :
CSGNet: Neural Shape parser for Constructive Solid Geometry
高级语言: Python
项目地址: git://github.com/Hippogriff/CSGNet.git
创建时间: 2018-02-21T00:02:54Z
项目社区:https://github.com/Hippogriff/CSGNet

开源协议:MIT License

下载


CSGNet: Neural Shape Parser for Constructive Solid Geometry

This repository contains code accompaning the paper: CSGNet: Neural Shape Parser for Constructive Solid Geometry, CVPR 2018.

Here we only include the code for 2D CSGNet. Code for 3D is available on this repository.

Dependency

  • Python 3.*
  • Please use conda env using environment.yml file.
    1. conda env create -f environment.yml -n CSGNet
    2. source activate CSGNet

Data

  • Synthetic Dataset:

    Download the synthetic dataset and CAD Dataset. Pre-trained model is available here. Synthetic dataset is provided in the form of program expressions, instead of rendered images. Images for training, validation and testing are rendered on the fly. The dataset is split in different program lengths.

    1. tar -zxvf synthetic.tar.gz -C data/
  • CAD Dataset

    Dataset is provided in H5Py format.

    1. mv cad.h5 data/cad/

Supervised Learning

  • To train, update config_synthetic.yml with required arguments. Default arguments are already filled. Then run:

    1. python train_synthetic.py
  • To test, update config_synthetic.yml with required arguments. Default arguments are already filled. Then run:

    1. # For top-1 testing
    2. python test_synthetic.py
    1. # For beam-search-k testing
    2. python test_synthetic_beamsearch.py

RL fintuning

  • To train a network using RL, fill up configuration in config_cad.yml or keep the default values and then run:

    1. python train_cad.py

    Make sure that you have trained a network used Supervised setting first.

  • To test the network trained using RL, fill up configuration in config_cad.yml or keep the default values and then run:

    1. # for top-1 decoding
    2. python test_cad.py
    1. # beam search decoding
    2. python test_cad_beamsearch.py

    For post processing optmization of program expressions (visually guided search), set the flag REFINE=True in the script test_cad_beam_search.py, although it is little slow. For saving visualization of beam search use SAVE_VIZ=True

  • To optmize some expressions for cad dataset:

    1. # To optmize program expressions from top-1 prediction
    2. python refine_cad.py path/to/exp/to/optmize/exp.txt path/to/directory/to/save/exp/

    Note that the expression files here should only have 3k expressions corresponding to the 3k test examples from the CAD dataset.

  • To optmize program expressions from top-1 prediction

    1. python refine_cad_beamsearch.py path/to/exp/to/optmize/exp.txt path/to/directory/to/save/exp/

    Note that the expression files here should only have 3k x beam_width expressions corresponding to the 3k test examples from the CAD dataset.

  • To visualize generated expressions (programs), look at the script visualize_expressions.py

Cite:

  1. @InProceedings{Sharma_2018_CVPR,
  2. author = {Sharma, Gopal and Goyal, Rishabh and Liu, Difan and Kalogerakis, Evangelos and Maji, Subhransu},
  3. title = {CSGNet: Neural Shape Parser for Constructive Solid Geometry},
  4. booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  5. month = {June},
  6. year = {2018}
  7. }

Contact

To ask questions, please email.