facebookresearch / localrf

An algorithm for reconstructing the radiance field of a large-scale scene from a single casually captured video.
MIT License
956 stars 62 forks source link

I have encountered a problem that has been bothering me for a long time. #29

Closed meng-f21 closed 8 months ago

meng-f21 commented 11 months ago
Traceback (most recent call last):
  File "localTensoRF/train.py", line 638, in <module>
    reconstruction(args)
  File "localTensoRF/train.py", line 286, in reconstruction
    local_tensorfs = LocalTensorfs(
  File "/raid/lzyt_21/00/localrf/localTensoRF/local_tensorfs.py", line 114, in __init__
    self.append_rf()
  File "/raid/lzyt_21/00/localrf/localTensoRF/local_tensorfs.py", line 137, in append_rf
    self.tensorfs.append(TensorVMSplit(device=self.device, **self.tensorf_args))
  File "/raid/lzyt_21/miniconda3/envs/localrf/lib/python3.8/site-packages/torch/nn/modules/container.py", line 487, in append
    self.register_parameter(str(len(self)), parameter)
  File "/raid/lzyt_21/miniconda3/envs/localrf/lib/python3.8/site-packages/torch/nn/modules/module.py", line 349, in register_parameter
    raise TypeError("cannot assign '{}' object to parameter '{}' "
TypeError: cannot assign 'models.tensoRF.TensorVMSplit' object to parameter '0' (torch.nn.Parameter or None required)

This error is occurring in the train.py file at line 638, while calling the reconstruction function. The error seems to be related to the LocalTensorfs class in the local_tensorfs.py file. In the LocalTensorfs class, when trying to append a TensorVMSplit object to self.tensorfs, a type mismatch error is raised, indicating that a torch.nn.Parameter or None is required.

It appears that the code is trying to add a TensorVMSplit instance directly to a torch.nn.ParameterList, which is causing the type mismatch error. To resolve this, the TensorVMSplit instance should be added as a regular element to the list, without using the torch.nn.Parameter constructor.

ameuleman commented 11 months ago

What pytorch version are you using? It can be queried with torch.__version__ in python or the pip list command.