Giter Club home page Giter Club logo

csgnet's Introduction

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 very similar to 2D and is coming soon.

Dependency

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

Data

  • Synthetic Dataset:

    Download the synthetic dataset and CAD Dataset. 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.

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

    Dataset is provided in H5Py format.

    mv cad.h5 data/cad/

Supervised Learning

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

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

    # For top-1 testing
    python test_synthetic.py
    # For beam-search-k testing
    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:

    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:

    # for top-1 decoding
    python test_cad.py
    # beam search decoding
    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:

    # To optmize program expressions from top-1 prediction
    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

    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.

Contact

To ask questions, please email.

csgnet's People

Contributors

hippogriff avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.