Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't run training command example #77

Open
yfq512 opened this issue Jan 11, 2023 · 3 comments
Open

can't run training command example #77

yfq512 opened this issue Jan 11, 2023 · 3 comments

Comments

@yfq512
Copy link

yfq512 commented Jan 11, 2023

(mvsnerf) root13456544@/work/mvsnerf# python train_mvs_nerf_pl.py --expname mvs-nerf-is-all-your-need --num_epochs 6 --use_viewdirs --dataset_name dtu --datadir dtu
Found ckpts []
GPU available: True, used: True
TPU available: False, using: 0 TPU cores
Traceback (most recent call last):
  File "train_mvs_nerf_pl.py", line 320, in <module>
    trainer.fit(system)
  File "/opt/conda/envs/mvsnerf/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 458, in fit
    self._run(model)
  File "/opt/conda/envs/mvsnerf/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 704, in _run
    self.data_connector.prepare_data(model)
  File "/opt/conda/envs/mvsnerf/lib/python3.8/site-packages/pytorch_lightning/trainer/connectors/data_connector.py", line 57, in prepare_data
    model.prepare_data()
  File "train_mvs_nerf_pl.py", line 80, in prepare_data
    self.train_dataset = dataset(root_dir=train_dir, split='train', max_len=-1 , downSample=args.imgScale_train)
  File "/cmdata/docker/yfq/mvsnerf/data/dtu.py", line 42, in __init__
    self.build_proj_mats()
  File "/cmdata/docker/yfq/mvsnerf/data/dtu.py", line 98, in build_proj_mats
    self.proj_mats, self.intrinsics = np.stack(proj_mats), np.stack(intrinsics)
  File "<__array_function__ internals>", line 200, in stack
  File "/opt/conda/envs/mvsnerf/lib/python3.8/site-packages/numpy/core/shape_base.py", line 458, in stack
    arrays = [asanyarray(arr) for arr in arrays]
  File "/opt/conda/envs/mvsnerf/lib/python3.8/site-packages/numpy/core/shape_base.py", line 458, in <listcomp>
    arrays = [asanyarray(arr) for arr in arrays]
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

can you help me!

@murphyl4
Copy link

I meet the same problem. Have you already solved it?

@Dongjiahua
Copy link

I think it may be a problem with the version of numpy. I solve it by simply modify the stack operation to:

self.proj_mats, self.intrinsics = proj_mats, intrinsics
self.world2cams, self.cam2worlds = world2cams, cam2worlds

Another thing to modify is the c2ws_all assignment in getitem. You can replace it by:

c2ws_all = np.array([self.cam2worlds[self.remap[i]] for i in view_ids_all])

Hope it can help.

@leo-frank
Copy link

I think it may be a problem with the version of numpy. I solve it by simply modify the stack operation to:

self.proj_mats, self.intrinsics = proj_mats, intrinsics
self.world2cams, self.cam2worlds = world2cams, cam2worlds

Another thing to modify is the c2ws_all assignment in getitem. You can replace it by:

c2ws_all = np.array([self.cam2worlds[self.remap[i]] for i in view_ids_all])

Hope it can help.

it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants