Code Monkey home page Code Monkey logo

Comments (15)

maxorange avatar maxorange commented on May 29, 2024 2

@xhygh, this code may be useful to convert obj to binvox.

import glob
import os
import subprocess
import sys

voxsize = 32
paths = glob.glob("path/to/dataset/*.obj")
print "number of data:", len(paths)

with open(os.devnull, 'w') as devnull:
    for i, path in enumerate(paths):
        cmd = "binvox -d {0} -cb -e {1}".format(voxsize, path)
        ret = subprocess.check_call(cmd.split(' '), stdout=devnull, stderr=devnull)
        if ret != 0:
            print "error", i, path
        else:
            print i, path

from voxel-dcgan.

ikegwukc avatar ikegwukc commented on May 29, 2024 1

@xhygh , the approach I followed was to use binvox (http://www.patrickmin.com/binvox/). Let me know if you have any issues.

from voxel-dcgan.

maxorange avatar maxorange commented on May 29, 2024 1

@ikegwukc, I used ShapNetCore_v1.

Did you have an issue with floating squares?

Yes, I did. I coped with this issue by increasing the number of training examples. In my case, I increased examples using 3D binary dilation. In addition, the hyperparameter tuning (learning rate, mini-batch size, the number of filters, etc.) is also important.

Also to use parms from a previous model, do you just put that into the config.py?

When I use a previous model, I put model path into the config.py

params_path = "path/to/model"

and write a code to restore a previous model in train.py.

...
with tf.Session(config=config_proto) as sess:
    sess.run(tf.initialize_all_variables())
    saver.restore(sess, config.params_path) # restore model
...

from voxel-dcgan.

maxorange avatar maxorange commented on May 29, 2024 1

Hi,

binvox can do solid voxelization, but I did it with flood filling algorithm (because it takes some time for solid voxelization on my computer). First I created surface voxels using binvox, and then I filled the inside of surface voxels using the following code.

https://gist.github.com/maxorange/788264e3ba23cb6f1b6151f03c43de7f

from voxel-dcgan.

maxorange avatar maxorange commented on May 29, 2024

Hi,
binvox is a module that you need to install.
Github repository is here: https://github.com/dimatura/binvox-rw-py.
You can install this module by putting binvox_rw.py to your project folder or copying it to site-packages directory.

from voxel-dcgan.

ikegwukc avatar ikegwukc commented on May 29, 2024

Thanks that solved it.

How long did it take you to receive good results back? I'm trying to generate mugs and so far the generator is producing cube's with a few voxel squares removed from the surface of the cub.

Did you run into this issue?

here's and example:
image

from voxel-dcgan.

maxorange avatar maxorange commented on May 29, 2024

It took about 6 hours to get good results on NVIDIA GeForce GTX TITAN X.

I run into that issue when I trained the networks with few examples. How many examples did you use for training?

from voxel-dcgan.

ikegwukc avatar ikegwukc commented on May 29, 2024

I guess that is the issue, I'm not using a GPU, don't have access to one right now. I went through 9 iterations (Took 7 hours using all CPUs) on 214 examples. Did you train on all of shapenet, how many examples did you use?

The loss for the generator seems to increase after each iteration though. I fear that I'm not transforming the .obj files correctly in shapenet to .binvox files. When I try using the .binvox files provided in shapenet the network complains about the shape of the data. However it's most likely just not enough examples.

Also does it make a difference if it's solid or surface voxel file (you mentioned that you used solid in #1 )?

Thanks for all of your help, btw.

from voxel-dcgan.

maxorange avatar maxorange commented on May 29, 2024

I used all of ShapeNetCore dataset (57,449 examples) and went through 50 iterations. Is the number of filters the same as my code? I think reducing the number of filters can solve the issue. Computation time also becomes faster.

When I use surface models, the generator makes holes like this:

untitled
while the generator trained on solid dataset does not make such holes. So I used solid one.

from voxel-dcgan.

ikegwukc avatar ikegwukc commented on May 29, 2024

Whenever I try and change the size of the filters I keep running into errors when reshaping the data, so I just convert to 32x32x32.

My models aren't as clean as the ones you generated did you use Shapnetv1 or v2?

Did you have an issue with floating squares? After 1000 iterations I end up with with floating squares. The image below is for a table.
Also to use parms from a previous model, do you just put that into the config.py (https://github.com/maxorange/voxel-dcgan/blob/master/config.py#L2)?

image

from voxel-dcgan.

X10m0ra avatar X10m0ra commented on May 29, 2024

Hi Takumi Moriya,

My name is Judith van der Heiden and I am a graphic design student at the Art Academy in the Netherlands. For my thesis I am exploring the theme machine learning. Particularly 'Deep Convolutional Generative Adversarial Networks'. For this project I would love to use your code but because I'm still a bit oblivious when it comes to this new coding language I can't really figure out how to run your code. There are so many tutorials online that I really don't know which one I should watch to really understand how to make it work. Do you have any tips on to which tutorial I should watch? Or could you maybe give me a small tutorial regarding your code? I hope to hear from you!

Kind Regards,
Judith

[email protected]

p.s. Couldn't find an email adres so this why I'm contacting you here.

from voxel-dcgan.

xhygh avatar xhygh commented on May 29, 2024

Hi,
The official website of binvox says that the input format can be .obj , but I run into an issue 👍

IOError: Not a binvox file

I want to know how to convert .obj to .binvox. Could you tell me ? I have no idea about it.

from voxel-dcgan.

ikegwukc avatar ikegwukc commented on May 29, 2024

@maxorange do you have models that are trained that I can take a look at?

from voxel-dcgan.

maxorange avatar maxorange commented on May 29, 2024

I uploaded trained parameters here: https://github.com/maxorange/voxel-dcgan/tree/master/params. You can test it from visualize.py.

from voxel-dcgan.

anandbhattad avatar anandbhattad commented on May 29, 2024

Hi @maxorange

I do get broken results with surface models. How do you generate solid voxels? Is binvox doing that for you? Please let me know if my understanding is correct with your approach. Thank you.

from voxel-dcgan.

Related Issues (9)

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.