kaolin-wisp icon indicating copy to clipboard operation
kaolin-wisp copied to clipboard

load_nerf_standard_data() assertion error for standard nerf dataset

Open idaho777 opened this issue 3 years ago • 2 comments

I tried to run the fox example under the Training NGP for forward facing scenes section and I'm getting the following error:

2022-08-18 15:41:18,934|    INFO| EPOCH 47/50 | total loss: 2.888E-02 | rgb loss: 2.888E-02
2022-08-18 15:41:31,912|    INFO| EPOCH 48/50 | total loss: 2.786E-02 | rgb loss: 2.786E-02
2022-08-18 15:41:44,976|    INFO| EPOCH 49/50 | total loss: 2.824E-02 | rgb loss: 2.824E-02
2022-08-18 15:41:58,006|    INFO| EPOCH 50/50 | total loss: 2.846E-02 | rgb loss: 2.846E-02
2022-08-18 15:42:03,052|    INFO| Saving model checkpoint to: _results/logs/runs/test-ngp-nerf/20220818-153021/model.pth
2022-08-18 15:42:03,516|    INFO| Beginning validation...
Traceback (most recent call last):
  File "/home/joonho/workspace/repos/kaolin-wisp/wisp/trainers/base_trainer.py", line 314, in iterate
    data = self.next_batch()
  File "/home/joonho/workspace/repos/kaolin-wisp/wisp/trainers/base_trainer.py", line 304, in next_batch
    return next(self.train_data_loader_iter)
  File "/home/joonho/miniconda3/envs/kaolin/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 530, in __next__
    data = self._next_data()
  File "/home/joonho/miniconda3/envs/kaolin/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 569, in _next_data
    index = self._next_index()  # may raise StopIteration
  File "/home/joonho/miniconda3/envs/kaolin/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in _next_index
    return next(self._sampler_iter)  # may raise StopIteration
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "app/main.py", line 35, in <module>
    trainer.train()
  File "/home/joonho/workspace/repos/kaolin-wisp/wisp/trainers/base_trainer.py", line 449, in train
    self.iterate()
  File "/home/joonho/workspace/repos/kaolin-wisp/wisp/trainers/base_trainer.py", line 317, in iterate
    self.end_epoch()
  File "/home/joonho/workspace/repos/kaolin-wisp/wisp/trainers/base_trainer.py", line 287, in end_epoch
    self.validate(self.epoch)
  File "/home/joonho/workspace/repos/kaolin-wisp/wisp/trainers/multiview_trainer.py", line 162, in validate
    data = self.dataset.get_images(split="val", mip=2)
  File "/home/joonho/workspace/repos/kaolin-wisp/wisp/datasets/multiview_dataset.py", line 92, in get_images
    data = load_nerf_standard_data(self.root, split,
  File "/home/joonho/workspace/repos/kaolin-wisp/wisp/datasets/formats/nerf_standard.py", line 127, in load_nerf_standard_data
    assert False and f"Split type ['{split}'] unsupported in the dataset provided"
AssertionError

Steps to reproduce:

  1. Clone instant-ngp repo to obtain fox dataset
  2. run python3 app/main.py --config configs/ngp_nerf.yaml --multiview-dataset-format standard --mip 0 --dataset-path /path/to/fox

Possible Cause: load_nerf_standard_data has an if-statement block that checks len(transforms) to determine what keys to insert into transform_dict. https://github.com/NVIDIAGameWorks/kaolin-wisp/blob/729608ab1e3bbb2f0ed6ba9d00ce11cf6efc9433/wisp/datasets/formats/nerf_standard.py#L103-L127 The fox standard nerf dataset provided by instant-ngp has only 1 transform.json so the transforms list has one value (transform.json). This causes the first if-statement to be true and inserts transforms_dict['train'] = transforms[0]. The next if-statement on line 126 checks if transforms_dict has the split key, but because this is all being called under the self.validate(self.epoch) function (from the stacktrace), split = val and the assertion fails since we hard-coded to insert the key train.

idaho777 avatar Aug 18 '22 21:08 idaho777

Hi @idaho777 thanks for your interest in our library!!!

Which version / commit hash of kaolin-wisp are you using?

tovacinni avatar Aug 22 '22 15:08 tovacinni

I cloned the main branch. I changed line 113 from transform_dict['train'] = transforms[0] to transform_dict[split] = transforms[0] and it seemed to work but it might just be a bandaid fix. Sorry accidentally closed issue

idaho777 avatar Aug 22 '22 15:08 idaho777

Addressed by https://github.com/NVIDIAGameWorks/kaolin-wisp/pull/67

tovacinni avatar Nov 03 '22 16:11 tovacinni