weify627 / 4D-Rotor-Gaussians

Apache License 2.0
79 stars 5 forks source link

camera_extent Variable Undefined Error #11

Closed SHIBOYA closed 1 week ago

SHIBOYA commented 2 months ago

Dear Fangyin,

I have encountered an issue. Below is the error message I received:

(viser) Connection opened (0, 1 total), 886 persistent messages
Exception in thread Thread-6:
Traceback (most recent call last):
  File "/root/miniconda3/envs/4drotorgs/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/root/4D-Rotor-Gaussians-main/nerfstudio/viewer/render_state_machine.py", line 222, in run
    outputs = self._render_img(action.camera_state)
  File "/root/4D-Rotor-Gaussians-main/nerfstudio/viewer/render_state_machine.py", line 136, in _render_img
    camera = get_camera(camera_state, image_height, image_width)
  File "/root/4D-Rotor-Gaussians-main/nerfstudio/viewer/utils.py", line 72, in get_camera
    camera = Cameras(
  File "/root/4D-Rotor-Gaussians-main/nerfstudio/cameras/cameras.py", line 161, in __init__
    self.batch_size = self._init_get_batch_size(batch_size)
  File "/root/4D-Rotor-Gaussians-main/nerfstudio/cameras/cameras.py", line 290, in _init_get_batch_size
    raise ValueError(f"camera_extent must be None or a tensor, got {type(camera_extent)}")
NameError: name 'camera_extent' is not defined

It appears that the camera_extent variable is not defined. Could you please provide guidance on how to resolve this issue or how to properly initialize the camera_extent variable?

Thank you very much for your assistance.

Best regards!

Vgr20 commented 3 weeks ago

I resolved this error. Go to line 290 in "/root/4D-Rotor-Gaussians-main/nerfstudio/cameras/cameras.py" There should be line like, raise ValueError(f"camera_extent must be None or a tensor, got {type(camera_extent)}")

change that line to raise ValueError(f"batch_size must be None or a tensor, got {type(batch_size)}") This should fix your issue.

If you cannot visualize this even after fixing this issue.

in the same file please change lines 123, 124 into the following lines,

  camera_extent : Optional[Float[Tensor, "num_cameras"]] = torch.tensor(1.0), 
  batch_size:Optional[Int[Tensor, "num_cameras 1"]] = None  

And this should work.

SHIBOYA commented 3 weeks ago

Cool!

weify627 commented 1 week ago

Thank you for your discussion! The suggested changes on L123, 124, 290 of nerfstudio/cameras/cameras.py have been committed.