SuGaR icon indicating copy to clipboard operation
SuGaR copied to clipboard

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

Open DiamondGlassDrill opened this issue 2 years ago • 5 comments

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

DiamondGlassDrill avatar Dec 20 '23 22:12 DiamondGlassDrill

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

kitmallet avatar Dec 20 '23 22:12 kitmallet

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.

Anttwo avatar Dec 20 '23 23:12 Anttwo

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

nehilsood avatar Dec 21 '23 09:12 nehilsood

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

DiamondGlassDrill avatar Dec 21 '23 11:12 DiamondGlassDrill

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

shadowlunaforever avatar Mar 30 '24 06:03 shadowlunaforever