princeton-computational-imaging / Diffusion-SDF

Official code repository for the paper: “Diffusion-SDF: Conditional Generative Modeling of Signed Distance Functions”
MIT License
225 stars 17 forks source link

About "grid_gt.csv"&"sdf_data.csv" #22

Closed bojin-nwafu closed 4 months ago

bojin-nwafu commented 5 months ago

Thans for your excellent work! But there are two question about data: 1、"grid_gt.csv"and"sdf_data.csv" are all from mesh to SDF , what the difference in these two ".csv" files? 2、Which kind of point cloud could be completation,such as ".ply",".pcd" or ".txt"?What can I load them? Looking forward your reply!

Bathsheba commented 5 months ago

Examples of these datafiles are given here in the data/ directory, they're .csv files with point locations and SDF values. The sdf_data files contain points on and near the mesh. The grid_gt files contain SDF values for points distributed on a grid, and are intended to sample empty areas. The paper supplement describes them, but the example datafiles do not exactly match the description so you have to figure it out.

I did that by loading the example files into CAD software and examining them , then created my own files by adapting a script in https://github.com/Sin3DM/Sin3DM/tree/main/data, mesh_sampler.py . It computes SDF values and can also make watertight versions of meshes.

dqj5182 commented 4 months ago

If the grid_gt contains points equally distributed within on a grid, should the number of SDF values have cube root as integer? The length of grid_gt provided in the sample seems to be 468000 and its cube root is 77.63 which is not an integer. Meaning that these are not points equally distributed on a 3-dimensional grid I guess.

Bathsheba commented 4 months ago

It's actually two grids. One is in the [-1,1] cube with 50^3 points, the other in the [-.5,.5] cube with 70^3 points, add them up and you get 468000. I suppose this is to better resolve the volume actually occupied by the model. I learned this by looking at the points with my hu-man eyes.

dqj5182 commented 4 months ago

I see! I have tried visualizing the grid_gt and it does seem to be not perfectly equally distributed. Thanks!

Bathsheba commented 4 months ago

I don't think it's necessary to copy this distribution exactly, and indeed I didn't for my dataset -- as long as the points are fairly evenly distributed in the cube, and dense enough to resolve your data meshes, it should be fine.

gene-chou commented 4 months ago

Our grid coordinates were not sampled uniformly. As @Bathsheba mentioned, we sampled more heavily toward the center. We didn't observe any particular requirements for grid sampling.

To answer @bojin-nwafu's question, "grid_gt.csv" is sampled throughout the grid (to prevent artifacts in empty space) and "sdf_data.csv" is sampled near the surface. These .csv files can also be replaced by any suitable data format, such as .npy or .npz (which would be faster to load anyway). The point cloud file doesn't matter as long as you can read them into the required format for the dataloader. You would modify the dataloader paths.