Anttwo / SuGaR

[CVPR 2024] Official PyTorch implementation of SuGaR: Surface-Aligned Gaussian Splatting for Efficient 3D Mesh Reconstruction and High-Quality Mesh Rendering
https://anttwo.github.io/sugar/
Other
2.36k stars 182 forks source link

I got a problem when generating the output mesh #109

Open citystrawman opened 10 months ago

citystrawman commented 10 months ago

Hi, I am studying SuGar and I got a problem when generating the output mesh.
When I execute the command python train.py -s <path to COLMAP dataset> -c <path to the Gaussian Splatting checkpoint> -r <"density" or "sdf">, at first everything goes well, but when the code executes at line 172, Extract mesh and texture from refined SuGaR, it pops out error messages: image it seems that the mesh_path property in refined_args is not properly created(I use print(refined_args) to print the args out ): image I have checked the issues and some of the answers said that it may be caused by the operating system separator (\ or /), I tried using double quotes for all my path: image but using double qoutes or not pops out the same error messages.

I appreciate if anyone could help me solve this issue. Thanks!

mohit-choithwani commented 10 months ago

Hi there, I've encountered the same error. Has anyone found a solution?

silkmeloni commented 10 months ago

I've encountered the same error. Have you solved it?

silkmeloni commented 10 months ago

I guess the code is written for Linux, but I run in win10. you can see the filename is "sugarmesh_D:" but “:” is not allowed in windows file system. But I don't know how to correct it.

kitmallet commented 10 months ago

You are able to run the whole process step by step. Starting with: Python Gaussian_splatting/convert.py Python gaussian_splatting/train.py Python train_coarse_density.py Python extract_mesh.py Python train_refined.py And finally: Python extract_refined_mesh_with_texture.py It should work and you can verify as the steps get done by checking the ply after extract_mesh which produces a .ply file. Goodluck! Kit

citystrawman commented 10 months ago

I guess the code is written for Linux, but I run in win10. you can see the filename is "sugarmesh_D:" but “:” is not allowed in windows file system. But I don't know how to correct it.

Hi, I use windows and I tried to use pycharm and in pycharm I open a terminal and put the command in terminal. I tried many ways and one way that work is to use double backslash like this: image but somehow it is weired that in some of the command you need to specify double quote (as for me, the .\gaussian_splatting\train.py)to the directory, but some of the command(as for me, the .\train.py) you should not specify double quote.

citystrawman commented 10 months ago

Hi there, I've encountered the same error. Has anyone found a solution?

see my above answer.

citystrawman commented 10 months ago

You are able to run the whole process step by step. Starting with: Python Gaussian_splatting/convert.py Python gaussian_splatting/train.py Python train_coarse_density.py Python extract_mesh.py Python train_refined.py And finally: Python extract_refined_mesh_with_texture.py It should work and you can verify as the steps get done by checking the ply after extract_mesh which produces a .ply file. Goodluck! Kit

Thanks Kit. I've encountered another issue that when running the last step, refined_mesh_path = extract_mesh_and_texture_from_refined_sugar(refined_mesh_args), I got a error saying that Read PLY failed: unable to open file .\output\coarse_mesh\sugarmesh_xxxxxxxx.ply, I can see that this directory is sugar_mesh_path in refined_mesh.py, but from refined_mesh.py I could only see that sugar_mesh_path string is created, but the ply is not created, then the code starts to read from sugar_mesh_path : o3d_mesh = o3d.io.read_triangle_mesh(sugar_mesh_path) I dont quite understand the logic here and is it a bug?

kitmallet commented 10 months ago

Hey @citystrawman , in the second last step as it seems to not be creating an output folder. Try adding "-m mesh" to give it a destination folder. After make sure it is created and make sure when you run the last step that the model (-m) correstonds to this path: python train_refined.py -s data/gun -c output/gun/ -m output/coarse_mesh/gun/sugarmesh_3Dgs7000_sdfestim1_sdfnorm1_level05_decim4000000.ply -o mesh

mohit-choithwani commented 10 months ago

You are able to run the whole process step by step. Starting with: Python Gaussian_splatting/convert.py Python gaussian_splatting/train.py Python train_coarse_density.py Python extract_mesh.py Python train_refined.py And finally: Python extract_refined_mesh_with_texture.py It should work and you can verify as the steps get done by checking the ply after extract_mesh which produces a .ply file. Goodluck! Kit

Thanks Kit!!! it is working now.

kitmallet commented 10 months ago

@mohit-choithwani you are welcome. you may need to add an output path for train_refined.py. Here is an example: python train_refined.py -s data/"name" -c output/"name"/ -m output/coarse_mesh/"name"/sugarmesh_3Dgs7000_sdfestim1_sdfnorm1_level05_decim4000000.ply -o mesh If you notice I added "-o mesh". Otherwise, it won't work. I don't have time to make changes myself in the python scripts but it is a simple resolution. Also a very good reason why I do this step by step is that I can edit the ply files throughout the process. I edit out gaussian splates just before running train_coarse_density.py. I do this in Blender with the gaussian splatting add on. I also edit the ply file just before doing train_refined.py in Meshlab. This will help create a much better final result!! Good luck, Kit