abrilcf / mednerf

MIT License
139 stars 30 forks source link

IndexError: index -1 is out of bounds for axis 0 with size 0 #8

Closed Ikhadija-5 closed 1 year ago

Ikhadija-5 commented 1 year ago

Hi, I am trying to run the code and I keep getting this error below in graf-main/graf/utils.py

File "/home/sourav-insight/mednerf/graf-main/graf/utils.py", line 45, in InfiniteSampler yield order[i] IndexError: index -1 is out of bounds for axis 0 with size 0

Can someone help me with this? This is the full error code below.

Traceback (most recent call last): File "train.py", line 139, in <module> x_real = get_nsamples(train_loader, ntest) File "/home/sourav-insight/mednerf/graf-main/graf/utils.py", line 67, in get_nsamples x_next = next(data_loader) File "/home/sourav-insight/.local/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in __next__ data = self._next_data() File "/home/sourav-insight/.local/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 560, in _next_data index = self._next_index() # may raise StopIteration File "/home/sourav-insight/.local/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 512, in _next_index return next(self._sampler_iter) # may raise StopIteration File "/home/sourav-insight/.local/lib/python3.8/site-packages/torch/utils/data/sampler.py", line 226, in __iter__ for idx in self.sampler: File "/home/sourav-insight/mednerf/graf-main/graf/utils.py", line 45, in InfiniteSampler yield order[i] IndexError: index -1 is out of bounds for axis 0 with size 0

baibai-c commented 4 months ago

I also encountered this problem when I was running the code. May I ask if you finally solved this problem Thank you very much@Ikhadija-5