CUHK-AIM-Group / LGS

[MICCAI 2024] LGS: A Light-weight 4D Gaussian Splatting for Efficient Surgical Scene Reconstruction
https://lgs-endo.github.io/
Other
45 stars 1 forks source link

IndexError #7

Closed Caizeyu116 closed 2 months ago

Caizeyu116 commented 2 months ago

While running the distillation training using the provided script train.py, I encountered an IndexError related to tensor dimensions in the count_deformation_render function. The specific error message is as follows: Traceback (most recent call last): File "train.py", line 315, in <module> args, File "train.py", line 128, in distill_training gaussian_list, imp_list, opacity_list, delta_scale_list = prune_list(student_gaussians, student_scene, pipe, background, distill_feature=distill_feature) File "/root/autodl-tmp/project/LGS/prune.py", line 64, in prune_list render_pkg = count_deformation_render(viewpoint_cam, gaussians, pipe, background, distill_feature=distill_feature) File "/root/autodl-tmp/project/LGS/gaussian_renderer/__init__.py", line 331, in count_deformation_render means3D_deform, scales_deform, rotations_deform, opacity_deform = pc._deformation(means3D[deformation_point], scales[deformation_point], IndexError: The shape of the mask [33918] at index 0 does not match the shape of the indexed tensor [33935, 3] at index 0 It appears that there is a mismatch in the dimensions of the mask used for indexing and the tensor being indexed. I have noticed a similar issue discussed in another context. I would be immensely grateful if you could provide any insights or guidance on resolving this error. Your expertise would be invaluable in helping me move forward.

LiuHengyu321 commented 2 months ago

Thank you for your interest in our work!

I have notice this problem. It is caused by the saving process in EndoGaussian. EndoGaussian's two saving processs are at different times, one before pruning the Gaussians and the other after pruning, which results in a discrepancy in the number of Gaussians saved. These two process could be seen at train.py of EndoGaussian, particularly at line 212 and line 253. To resolve this issue, please ensure that both saving processes occur either before pruning or after pruning.

Thank you for your reminder and I will also update this to the repo.

HsiehTPE commented 4 weeks ago

``Dear dev,

While training the EndoGaussian Model, I have already set the --save_iterations and the --checkpoint_iterations at 3_000, and set the prune_interval at 2_500. So that I can satisfy the condition of ensuring both saving processes occur either before pruning or after pruning.

However, I still encountered the IndexError: The shape of the mask [33901] at index 0 does not match the shape of the indexed tensor [33958, 3] at index 0.

I wonder what did I miss? Thanks for your attention and kind help!

Here is the complete feedback:

Traceback (most recent call last):
  File "train.py", line 315, in <module>
    args, 
  File "train.py", line 202, in distill_training
    student_render_pkg = render(viewpoint_cam, student_gaussians, pipe, background, distill_feature=distill_feature)
  File "/root/autodl-tmp/LGS/gaussian_renderer/__init__.py", line 93, in render
    means3D_deform, scales_deform, rotations_deform, opacity_deform = pc._deformation(means3D[deformation_point], scales[deformation_point], 
IndexError: The shape of the mask [33901] at index 0 does not match the shape of the indexed tensor [33958, 3] at index 0
Training progress:   0%|                                                                                      | 0/4001 [00:00<?, ?it/s]