marcoamonteiro / pi-GAN

416 stars 76 forks source link

3D shape extraction #3

Closed athenas-lab closed 3 years ago

athenas-lab commented 3 years ago

Hi, According to the Readme, the command for shape extraction is:

python3 shape_extraction.py path/to/generator.pth --curriculum CelebA --seed 0

However, there is no shape_extraction.py file. Instead, please correct this as follows:

python extract_shapes.py --seeds 0 --output_dir path/to/output path/to/generator.pth

Also, the generator extracts the shape as a voxel in .mrc format. Could you please provide some guidance on how we can extract the 3D shape as a mesh in .obj format?

thanks

ericryanchan commented 3 years ago

Hello,

Thanks for pointing that out, we'll fix the readme! You can load the .mrc file as a numpy array of voxels. Once you have your voxels, you can extract it as a mesh by running marching cubes (scikit-image has a good implementation). Note that the choice of levelset will determine how good your mesh looks (somewhere around 30 usually looks good but it might vary). However, if you just want to visualize meshes, a far easier way is to download ChimeraX and load the .mrc directly! Chimera has options that let you adjust the levelset in real-time.

Hope this helps!

athenas-lab commented 3 years ago

Hi, Thanks for your response. As for the correction you have made to the readme, it is not just the file name that needs to be changed. extract_shapes.py does not allow curriculum as an option and the option is --seeds (not --seed). The command I have provided above works. thanks