Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question for changing df_voxel to .obj #30

Open
LV0913 opened this issue Mar 30, 2020 · 2 comments
Open

Question for changing df_voxel to .obj #30

LV0913 opened this issue Mar 30, 2020 · 2 comments

Comments

@LV0913
Copy link

LV0913 commented Mar 30, 2020

In test.py, save_vox_to_obj(model.voxel.data.cpu().numpy(), 0.5 if not use_df else 0.85, obj_name). Why th parameter 'th' is 0.85 instead of 0.01 for default of ios_th.
def save_vox_to_obj(voxel, th, save_path): if len(voxel.shape) == 5: voxel_iso = voxel[0, 0, :, :, :] verts, faces, normals, values = measure.marching_cubes_lewiner(voxel_iso, th, spacing=(1 / 128, 1 / 128, 1 / 128),) save_obj(verts - 0.5, faces, save_path)
In the above usage, why verts - 0.5?
Beacuse in test_shape.py,
v, f, n, _ = measure.marching_cubes_lewiner(output, opt.ios_th, spacing=(space, space, space)) save_obj(v, f, join(shape_dir, '%04d' % idx))
I wonder the difference for two cases. Thanks!

@ztzhang
Copy link
Collaborator

ztzhang commented Mar 30, 2020

  1. the thresholding level is different since the data stored is distance function, which is stored as the distance between the voxel grid's center to the nearest surface. We convert the distances into probabilities using a zero-mean gaussian. Therefore, 0.85 indicates a small region around the GT surface. We didn't really use the 0.01 as a threshold for df_voxels.
  2. The shifting in vertices is just for the convenience of visualization. Shifting by 0.5 makes the mesh centered around zero. This should not affect the final output though; if you use mesh lab to visualize the output, the mesh is always zero-centered.

@LV0913
Copy link
Author

LV0913 commented Mar 31, 2020

Thanks for your reply. So in the train of the net, you convert the distances into probabilities using a zero-mean gaussian. That is why in test.py you use 0.85 for model.voxel.data.cpu().numpy() because it's probabilities. And when in test_shape.py, output is in distance function. So 0.012 is used in test_shape.sh.Is that right?
How can I Corresponde the th for distance function and probabilities?
I have figure out the second problem thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants