zeng-yifei / STAG4D

Official Implementation for STAG4D: Spatial-Temporal Anchored Generative 4D Gaussians
111 stars 5 forks source link

GaussianModel' object has no attribute 'max_radii_plusD #3

Closed sam-motamed closed 1 month ago

sam-motamed commented 1 month ago

Thanks for releasing the code. I am trying to run the minion example and face the following error;

[INFO] loaded zero123!
 12%|████████████▏                                                                                         | 1199/10001 [08:30<1:02:28,  2.35it/s]
Traceback (most recent call last):
  File "main.py", line 1012, in <module>
    gui.train(opt.save_step+1)
  File "main.py", line 984, in train
    self.train_step()
  File "main.py", line 407, in train_step
    self.renderer.gaussians.max_radii_plusD[visibility_filter] = torch.max(self.renderer.gaussians.max_radii_plusD[visibility_filter], radii[visibility_filter])
AttributeError: 'GaussianModel' object has no attribute 'max_radii_plusD'

any idea on what the issue is here?

sam-motamed commented 1 month ago

Assuming, it is gaussians.max_radii2D and not gaussians.max_radii_plusD, it leads to the following error:

File "main.py", line 407, in train_step
    self.renderer.gaussians.max_radii2D[visibility_filter] = torch.max(self.renderer.gaussians.max_radii2D[visibility_filter], radii[visibility_filter])
IndexError: too many indices for tensor of dimension 1
zeng-yifei commented 1 month ago

Sorry, that is a small bug that happens after I arrange the code. I have fixed it now.

Thank you very much for reporting it. Feel free to ask me if you have other problems.

sam-motamed commented 1 month ago

Thanks for the quick response. There is now a size mismatch error:

  File "main.py", line 406, in train_step
    radii = torch.cat(radii_list,0).max(dim=0).values
RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 512 but got size 128 for tensor number 1 in the list.

I am digging to see how render_resolution in main.py should be set but your feedback is much appreciated.

Thanks

zeng-yifei commented 1 month ago

How many steps do you run into this error? I have tried running it, but no error occurs like this.

render_resolution is ok with 512/768/1024. For gaussian, it doesn't slow down the process with the improvement of rendering resolution. Actually, you can set this value as you wish. However, as the supervision resolution of diffusion model doesn't achieve such a high value like 1024, it won't be very useful to improve render_resolution after 512/768.

sam-motamed commented 1 month ago

Hi @zeng-yifei, so running the code as is with python main.py --config configs/stag4d.yaml path=./dataset/minions/ save_path=./, I get the following right at the first iteration:

Screenshot 2024-05-13 at 08 11 03

If I change line 295 so that the render_resolution is always 512 render_resolution = 512 then it runs for 1200 iterations and then it throws the following error:

Screenshot 2024-05-13 at 08 10 15
zeng-yifei commented 1 month ago

Are you using the /slothfulxtx/diff-gaussian-rasterization as the readme suggests? Or you have changed the Gaussian differentiable rasterizer which you installed in another repo?

I have tried using another diff_gaussian_rasterizer and got an error the same as the first image you presented. Maybe you can check it out.

sam-motamed commented 1 month ago

I re-installed diff-gaussian-rasterization and same issue remains. If I comment out the following lines:

if self.step >= self.opt.density_start_iter and self.step <= self.opt.density_end_iter:
    self.renderer.gaussians.max_radii2D[visibility_filter] = torch.max(self.renderer.gaussians.max_radii2D[visibility_filter], radii[visibility_filter])
    self.renderer.gaussians.add_densification_stats(viewspace_point_tensor_grad, visibility_filter)
    if self.step % self.opt.densification_interval == 1 :
        self.renderer.gaussians.densify_and_prune(self.opt.densify_grad_threshold, min_opacity=0.01, extent=1, max_screen_size=2)

then I am able to run and get model.ply

zeng-yifei commented 1 month ago

Yes, there is certainly something wrong with densification.

I still hope you to check carefully if you installed the slothfulxtx's diff_gauss instead of others'. Because when I switch to dreamgaussian's gs rasterizer, I met the same two errors as you mentioned above. And can you see if the line 10 of gs_renderer_4d.py is from **diff_gauss** import xxx.

sam-motamed commented 1 month ago

Thanks alot @zeng-yifei , the issue was indeed from **diff_gauss** import xxx! Now I have one hopefully last question; settung gui=True does not do anything for me. After running main.py, I am left with :

Screenshot 2024-05-14 at 11 09 51

From here, how do i go about generating the 4D scene?

zeng-yifei commented 1 month ago

Are you using gui=True in your personal computer or a server? It can only turn on the GUI when using your PC.

Remember not to add -- before gui=True. And the results are saved in the ply and pth files under logs/xxx when using save_path=xxx, so please try not to use save_path=./

sam-motamed commented 1 month ago

The issue is indeed that I am running via ssh and can't seem to get X11 forwarding to work. That's why I was wondering if I can run without gui and then render results after

zeng-yifei commented 1 month ago

OK, I will update a visualize code in the weekend.

Thank you for your feedback.

sam-motamed commented 1 month ago

I appreciate your help. Also, you might want to make a comment regarding size in configs/stag4d.yaml which is currently set for the minions dataset size and wont work for custom datasets

zeng-yifei commented 1 month ago

I have updated the visualize script. You can now check it out. Or maybe you want to personalize your own rendering scheme, then you can just modify the save_rendering function in main.py and visualize.py.