voxel-dcgan icon indicating copy to clipboard operation
voxel-dcgan copied to clipboard

binvox dependency

Open ikegwukc opened this issue 7 years ago • 15 comments

I run into an issue when trying to run your code:

Traceback (most recent call last): File "train.py", line 3, in <module> import model File "/home/jarvis/GoogleDrive/UIUC_Grad/coursework/CS_598-RK/project/voxel-dcgan/model.py", line 3, in <module> import util File "/home/jarvis/GoogleDrive/UIUC_Grad/coursework/CS_598-RK/project/voxel-dcgan/util.py", line 3, in <module> import binvox ImportError: No module named binvox

Is binvox a module that you need to install through pip (I can't seem to find it online)? Or is it a module you wrote that you left out?

ikegwukc avatar Apr 08 '17 18:04 ikegwukc

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.

maxorange avatar Apr 09 '17 08:04 maxorange

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

ikegwukc avatar Apr 09 '17 21:04 ikegwukc

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?

maxorange avatar Apr 10 '17 17:04 maxorange

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.

ikegwukc avatar Apr 10 '17 17:04 ikegwukc

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.

maxorange avatar Apr 10 '17 19:04 maxorange

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

ikegwukc avatar Apr 24 '17 20:04 ikegwukc

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.

X10m0ra avatar Apr 25 '17 09:04 X10m0ra

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

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.

xhygh avatar Apr 27 '17 09:04 xhygh

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

ikegwukc avatar Apr 27 '17 19:04 ikegwukc

@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
...

maxorange avatar Apr 29 '17 08:04 maxorange

@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

maxorange avatar Apr 29 '17 08:04 maxorange

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

ikegwukc avatar Apr 29 '17 13:04 ikegwukc

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

maxorange avatar May 02 '17 18:05 maxorange

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.

anandbhattad avatar Jun 28 '17 20:06 anandbhattad

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

maxorange avatar Jun 29 '17 19:06 maxorange