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

Error when Evaluate on COCO test set #176

Closed
cfhyxxj opened this issue Mar 21, 2020 · 6 comments
Closed

Error when Evaluate on COCO test set #176

cfhyxxj opened this issue Mar 21, 2020 · 6 comments

Comments

@cfhyxxj
Copy link

cfhyxxj commented Mar 21, 2020

when I write this order,something wrong with it.
DataLoader loading json file: data/cocotest.json
vocab size is 9487
DataLoader loading h5 file: data/cocotest_bu_fc data/cocotest_bu_att data/cocotalk_box none
read 40775 image features
assigned 0 images to split train
assigned 0 images to split val
assigned 40775 images to split test
Traceback (most recent call last):
File "eval.py", line 100, in
loader = DataLoader(opt)
File "/content/gdrive/Shared drives/cfhyxxj798577670/1/dataloader.py", line 303, in init
self.iters[split] = iter(self.loaders[split])
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 279, in iter
return _MultiProcessingDataLoaderIter(self)
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 746, in init
self._try_put_index()
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 861, in _try_put_index
index = self._next_index()
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 339, in _next_index
return next(self._sampler_iter) # may raise StopIteration
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/sampler.py", line 200, in iter
for idx in self.sampler:
File "/content/gdrive/Shared drives/cfhyxxj798577670/1/dataloader.py", line 370, in next
elem = (self.index_list[self.iter_counter], self.iter_counter+1, wrapped)
IndexError: list index out of range

@WilsonAir
Copy link

Got the same issue too!

@ruotianluo
Copy link
Owner

Weird:


        if self.iter_counter == len(self._index_list):
            self._reset_iter()
            if self.wrap:
                wrapped = True
            else:
                raise StopIteration()
        elem = (self._index_list[self.iter_counter], self.iter_counter+1, wrapped)

In principle the if statement above should assure that the iter_coutner is within range.

@sssilence
Copy link

Got the same issue too!

Excuse me.I encountered the same problem as you. How do you slove it?Thanks!

@kaelsunkiller
Copy link

kaelsunkiller commented Jun 30, 2020

Weird:


        if self.iter_counter == len(self._index_list):
            self._reset_iter()
            if self.wrap:
                wrapped = True
            else:
                raise StopIteration()
        elem = (self._index_list[self.iter_counter], self.iter_counter+1, wrapped)

In principle the if statement above should assure that the iter_coutner is within range.

I encountered the same problem.The cause is the number of images in val split is 0, which leads to an empty self._index_list. So the index 0 overflowed. You may give a check before this statement.

@kaelsunkiller
Copy link

kaelsunkiller commented Jun 30, 2020

And btw, the key name in the npz file in cocotest_bu_att(preprocessed, download from your link) is 'z' but not 'feat', this will lead to another error at
dataloader.py, line 35:
self.loader = lambda x: np.load(x)['feat']
may be you can give a hint to the people who are willing to use your preprocessed npz files.

@ruotianluo
Copy link
Owner

Thanks. I will fix it.

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

5 participants