hzxie/Pix2Vox

Saving output to .binvox file

adarsh-knn opened this issue · 6 comments

Warm greetings,
I was trying to save the generated 3D volume in a binvox file. I followed your suggestions provided in issue #11 and have following questions :

  1. Can you please tell me the exact code line for pred_volume?
  2. Where exactly in test.py file do we need to add the code mentioned in #11?

Please help me figure this out.
Thanks in advance!

hzxie commented

The pred_volume can be found here

generated_volume = refiner(generated_volume)

Thank you!
But I am facing an issue wherein all the .binvox files are of 310 bytes and the following is the visualization of the binvox file for all categories (aeroplane, bench, cabinet, etc..).
image

This is the code I had used:

             `pred_volume = generated_volume.squeeze()
            threshold = 0.4
            pred_volume = pred_volume > threshold`

            `with open('/home/adarsh/Pix2Vox/output/%s.binvox' % taxonomy_id, 'wb') as f:
                vox = utils.binvox_rw.Voxels(pred_volume.cpu().numpy(), (32,) * 3, (0,) * 3, 1, 'xyz')
                vox.write(f)`

Can you please me to fix this?

hzxie commented

Currently, pred_volume contains:
image
So it's all 1.

hzxie commented

Okay, thanks a lot!