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.31k stars 175 forks source link

RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1, 1] because the unspecified dimension size -1 #37

Open DiamondGlassDrill opened 11 months ago

DiamondGlassDrill commented 11 months ago

Almost finished :) the long refinement, but it unfortunately crashed. Do you know what might be the error? Do I need to run now all again? or just from where it crashed is enough?

Thanks in advance.

Loading mesh to bind to:
./output/coarse_mesh\playroom\sugarmesh_coarse\playroom\3Dgs7000_sdfestim02_sdfnorm02_level03_decim1000000.ply...
RPly: Unable to open file
[Open3D WARNING] Read PLY failed: unable to open file: ./output/coarse_mesh\playroom\sugarmesh_coarse\playroom\3Dgs7000_sdfestim02_sdfnorm02_level03_decim1000000.ply
Mesh to bind to loaded.
Binding radiance cloud to surface mesh...
Traceback (most recent call last):
  File "...\SuGaR\train.py", line 162, in <module>
    refined_sugar_path = refined_training(refined_args)
  File "...\SuGaR\sugar_trainers\refine.py", line 393, in refined_training
    sugar = SuGaR(
  File "...\SuGaR\sugar_scene\sugar_model.py", line 323, in __init__
    scales = scales.clamp_min(0.0000001).reshape(len(faces_verts), -1, 1).expand(-1, self.n_gaussians_per_surface_triangle, 2).clone().reshape(-1, 2)
RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1, 1] because the unspecified dimension size -1 can be any value and is ambiguous
kitmallet commented 11 months ago

Hey Diamond, I had the same issue last night and got this reply.... use Gaussian-Splatting to train and save out checkpoint. use SuGaR to train. example:

cd gaussian_splatting python -Bu train.py -s ../../data/image/wizard/ -m ../output/gauss/ --iterations 30000 --save_iterations 7000 30000 --checkpoint_iterations 7000 30000 cd ..

python -Bu train_coarse_density.py --s ../data/image/wizard/ --c ./output/gauss/

However, in the script above, I changed --s to -s... I am sure everyone is in a hurry to get this sorted and small things like this are typed. Good luck, Kit

Anttwo commented 11 months ago

Hello @DiamondGlassDrill,

It looks like python fails to load the mesh file because of a wrong path. It tries to load the path ./output/coarse_mesh\playroom\sugarmesh_coarse\playroom\3Dgs7000_sdfestim02_sdfnorm02_level03_decim1000000.ply

But it should be ./output/coarse_mesh/playroom/sugarmesh_3Dgs7000_sdfestim02_sdfnorm02_level03_decim1000000.ply

It may be due to how the path is handled/written on your computer. May I ask what is your OS?

Indeed, / is the path separator on Unix and Unix-like systems, and the code expects this separator to compute some paths. On the contrary, modern Windows can generally use both \ and / interchangeably for filepaths, but \ is preferred on Windows. This may be the reason why it fails on your computer. I should change the code to handle both separators.

nehilsood commented 11 months ago

well I faced same issue @Anttwo in windows and might be because of "/" or "\"

DiamondGlassDrill commented 11 months ago

Yeah the windows issue :) I do have OS = W11 Thx @Anttwo already for adopting change.

shadowlunaforever commented 7 months ago

I have the same problem and I'm running it, having no idea if I can solve it.