Coder Social home page Coder Social logo

3dcsgnet's Introduction

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.
    conda env create -f environment.yml -n 3DCSGNet
    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.

    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:

    import deepdish as dd
    from src.Utils.train_utils import voxels_from_expressions
    
    # pre-rendered shape primitives in the form of voxels for better performance
    primitives = dd.io.load("data/primitives.h5")
    expressions = ["cy(48,48,32,8,12)cu(24,24,40,28)+", "sp(48,32,32,8,12)cu(24,24,40,28)+"]
    
    voxels = voxels_from_expressions(expressions, primitives, max_len=7)
    print(voxels.shape)
    
    (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:

    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:

    # For top-1 testing
    python test.py
    # For beam-search-k testing
    python test_beam_search.py

Cite:

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

Contact

To ask questions, please email.

3dcsgnet's People

Contributors

hippogriff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

3dcsgnet's Issues

iou is zero forever

when i run test.py, the script print
“IOU for 3 len program: iou 0”“IOU for 5 len program: iou 0”“IOU for 7 len program: iou 0”
besides,the pred.txt of the three results is empty.
so,what should i focus on to fix this ?
thanks for any response

when input is simple, the result is also not good

when i run test.py, the script print
when i sent just a 'p(32,40,24,20)' to the model, the model return p(32,40,24,20)u(24,40,32,16)+u(32,16,32,28)
so,what should i focus on to fix this ?
thanks for any response

Version conflicts while making the virtual environment using environment.yml file.

Hi,
I am trying to implement the repository on my personal laptop for a project. However, while creating the new virtual environment using the requirements.yml file, I face lots of version conflicts among the different libraries. At first, using the command and directly using the requirements.yml file, I get the following error:
Annotation 2021-06-25 171221

After removing PyTorch from the channels and the packages causing the error from the yml file, I get lots of version conflicts in the other libraries.
Annotation 2021-06-25 171454

What should I do to create the venv now?
Thank You.

Test/Validation Loss doesn't converge?

Hello,

I tried training 3DCSGNet with the default parameters. The training loss appears to converge to zero and overall decreases with each epoch, but the validation loss doesn't decrease and seems to flatline around a some positive value (in my case 16 or 17). Is this normal? Are there any parameters from the default yml that I should change to improve this?

Thanks

Dimensions of cube voxel off by 1

For example, for the cube 'cu(16,16,16,8)', the output voxel (in both the .h5 and the draw_cube function) is 7 by 7 by 7, not 8 by 8 by 8.
Upon further inspection, draw_cube only gives the true dimensions for a cube if the side length is odd, presumably because only odd-sided cubes can have a true center in voxel space (but technically speaking even-sided cubes can be made). Was this intentional? Any suggestions for fixing this?

Thanks

KeyError

Hi,

I am getting a KeyError: 'p(48,32,32,8,12)'
I tried to change the length and expression=None but it did not solve the issue.

Any clue?
Regards,

Test the trained model

Hi,

I want to test the pre-trained model on some surface meshes I have, could I first convert the file into voxel representation, then send it to the network? Or do you have a function, like voxel_from_surface ?

Thanks : )

visualize the result

Hi,

After running the test.py with the pretrained model, I got some output with three files:
pred.txt results.org target.txt

Is there a way to visualize the results, e.g., in voxel format?

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.