movienet / movienet-tools

Tools for movie and video research
http://movienet.github.io
271 stars 31 forks source link

IndexError: list index out of range #3

Closed albertaparicio closed 4 years ago

albertaparicio commented 4 years ago

I am trying to extract action features from 10 second clips with the existing code in the repository.

However, some of these videos result in an error. The trace is the following:

  File "/home/username/miniconda3/envs/env_work/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/username/.miniconda3/envs/env_work/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/username/.miniconda3/envs/env_work/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/username/movienet-tools/movienet/tools/action_extractor/src/dataset.py", line 166, in __getitem__
    return self.pipeline(results)
  File "/home/username/.miniconda3/envs/env_work/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 61, in __call__
    img = t(img)
  File "/home/username/movienet-tools/movienet/tools/action_extractor/src/transforms.py", line 120, in __call__
    img_group = [imgs[p] for p in sampled_idxes]
  File "/home/username/movienet-tools/movienet/tools/action_extractor/src/transforms.py", line 120, in <listcomp>
    img_group = [imgs[p] for p in sampled_idxes]
IndexError: list index out of range

An example of the shot_txt file from one of the videos that gives this kind of error is the following:

0 12 3 6 9
13 99 34 55 76
100 213 128 156 184
214 238 220 226 232
239 239 239 239 239

I have checked the video and it does contain 4 shots, the last of them lasting for 1 frame.

Is there anything I should be careful about, when extracting shots and/or features from a video?

ycxioooong commented 4 years ago

This bug is caused by not checking outliers in class action_extractor.src.transforms.Images2FixedLengthGroup. The bug is fixed now and you could try the latest version.

albertaparicio commented 4 years ago

I no longer get this error. Thank you