项目作者: Hippogriff

项目描述 :
CSGNet for voxel based input
高级语言: Python
项目地址: git://github.com/Hippogriff/3DCSGNet.git
创建时间: 2018-06-09T17:33:26Z
项目社区:https://github.com/Hippogriff/3DCSGNet

开源协议:

下载


CSGNet: Neural Shape Parser for Constructive Solid Geometry

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

This code base contains model architecture and dataset for 3D-CSGNet. For 2D-CSGNet, look at this repository.

Dependency

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

Data

  • Synthetic Dataset:

    Download the synthetic dataset and un-tar it in the root. Pre-trained model is available here, untar it in the directory trained_models/. 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 data.tar.gz
  • How to create Voxels from program expressions?

    Start by loading some program expression from data/x_ops/expressions.txt files. You can get voxels in the form of Numpy array using the following:

    1. import deepdish as dd
    2. from src.Utils.train_utils import voxels_from_expressions
    3. # pre-rendered shape primitives in the form of voxels for better performance
    4. primitives = dd.io.load("data/primitives.h5")
    5. expressions = ["cy(48,48,32,8,12)cu(24,24,40,28)+", "sp(48,32,32,8,12)cu(24,24,40,28)+"]
    6. voxels = voxels_from_expressions(expressions, primitives, max_len=7)
    7. print(voxels.shape)
    8. (2, 64, 64, 64)

    In case of key error in the above, or if you want to execute programs of higher length or arbitary positions and scales, then change the max_len=len_of_program and primitives=None in the above method. However, this will render primitives on-the-fly and will be slow.

Supervised Learning

  • To train, update config.yml with required arguments. Also make sure to fill up the config.yml file with proportion of the dataset that you want to train on (default is 1 percent, can go up to 100 percent which is used in the paper). Then run:

    1. python train.py
  • To test, update config.yml with required arguments. Specify the path of pre-trained model in the config file on the field pretrain_model_path=trained_models/models.pth, preload_model=True and proportion=100. Then run:

    1. # For top-1 testing
    2. python test.py
    1. # For beam-search-k testing
    2. python test_beam_search.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.