ken2576 / vision-nerf

Official PyTorch Implementation of paper "Vision Transformer for NeRF-Based View Synthesis from a Single Input Image", WACV 2023.
MIT License
107 stars 12 forks source link

index is out of bounds #13

Closed 8Mamba closed 9 months ago

8Mamba commented 1 year ago

Hello, When reading the ynz of the srn_cars dataset, an error of index is out of bounds for dimension with size 0 will appear. The dataset is downloaded from PixelNeRF as you described. How to solve it?

ken2576 commented 1 year ago

I believe some images from that dataset are completely white. Try removing them and that should be solved?

Yancy-lv commented 1 year ago

Hello, I have encountered the same problem. How did you solve it?

ken2576 commented 1 year ago

Sorry for the late reply

https://github.com/ken2576/vision-nerf/blob/main/data/srn.py#L139-L145 But for this part of the code, it's essentially acquiring a bounding box for each image to only include the valid content (e.g. a tight box around the object). If you run into out-of-bound errors, that means the image is possibly all white.

You could either:

  1. Preprocess the image by removing the all whites
  2. Set the bounding box to the full image for such cases. However, this would introduce some useless training data and add extra noises.

I would suggest the first option, and you could implement it by checking object mask and remove any instance that is completely blank. Sorry, my original processing script is gone, so I won't be able to provide it. But it should be very straightforward to implement.

crazy-stycxj commented 1 month ago

cars_train/7edb40d76dff7455c2ff7551a4114669/rgb -blank images

crazy-stycxj commented 1 month ago

/cars_test/876d92ce6a0e4bf399588eee976baae/rgb--blank images