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

IndexError: list index out of range #7

Open
Lwy-1998 opened this issue Jul 9, 2023 · 6 comments
Open

IndexError: list index out of range #7

Lwy-1998 opened this issue Jul 9, 2023 · 6 comments

Comments

@Lwy-1998
Copy link

Lwy-1998 commented Jul 9, 2023

I try to run generate_dynamic_masks.py
and it looks like the segment fileis missing
seg = self.__class__.segment_read(segments_list[i])

我装了好久的环境,环境已经能在droid-slam上正常运行,也配置了panopticapi-0.1这个包。
我debug了一下,这里越界好像是因为没有加载到segment的数据,但是我并没有找这个数据在哪里。。。
请问一下这里segment应该在哪里生成呢?

(droidslam) lwy@lwy-WS:~/research/PVO/tools/datasets$ python generate_dynamic_masks.py 
['Scene18', 'Scene20', 'Scene06', 'Scene02', 'Scene01']
cache_path:  /home/lwy/research/PVO/VO_Module/droid_slam/data_readers/cache/VKitti2.pickle
Building VKitti2 dataset
  0%|                                                                                                               | 0/5 [00:00<?, ?it/s]True
True
True
True
True
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 122.42it/s]
Reserving /home/lwy/research/PVO/datasets/Virtual_KITTI2/Scene02 for validation
Reserving /home/lwy/research/PVO/datasets/Virtual_KITTI2/Scene06 for validation
Reserving /home/lwy/research/PVO/datasets/Virtual_KITTI2/Scene18 for validation
Reserving /home/lwy/research/PVO/datasets/Virtual_KITTI2/Scene20 for validation
Dataset vkitti2 has 445 images
Traceback (most recent call last):
  File "generate_dynamic_masks.py", line 28, in <module>
    for i_batch, item in enumerate(train_loader):
  File "/home/lwy/miniconda3/envs/droidslam/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
    data = self._next_data()
  File "/home/lwy/miniconda3/envs/droidslam/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
    return self._process_data(data)
  File "/home/lwy/miniconda3/envs/droidslam/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
    data.reraise()
  File "/home/lwy/miniconda3/envs/droidslam/lib/python3.8/site-packages/torch/_utils.py", line 434, in reraise
    raise exception
IndexError: Caught IndexError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/lwy/miniconda3/envs/droidslam/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/lwy/miniconda3/envs/droidslam/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/lwy/miniconda3/envs/droidslam/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/lwy/miniconda3/envs/droidslam/lib/python3.8/site-packages/torch/utils/data/dataset.py", line 308, in __getitem__
    return self.datasets[dataset_idx][sample_idx]
  File "../../VO_Module/droid_slam/data_readers/base.py", line 185, in __getitem__
    seg = self.__class__.segment_read(segments_list[i])
IndexError: list index out of range
@a541203686
Copy link

我是用1_generate_image_info.py这个代码里生成的panoptic_gt_id文件夹下的文件,需要修改一下路径

@ForLoveandPeace
Copy link

@a541203686 Hi,你好,我目前遇到题主这个问题,虽然明白是路径上的问题,但还不太清楚该怎么改,可以给一些详细修改信息吗,感谢

@DavidYan2001
Copy link

请问题主解决了吗

@Pranjal-g083
Copy link

Go to the following file:
VO_Module/droid_slam/data_readers/vkitti2.py
At lines 91-92, you need to change the path for panoptic_gt_id folder.
The exact replacement is:
segments = sorted( glob.glob(osp.join("datasets/Virtual_KITTI2/ALL_15-deg-left", 'panoptic_gt_id/*.png')))

Hope this helps

@byronsit
Copy link

Go to the following file: VO_Module/droid_slam/data_readers/vkitti2.py At lines 91-92, you need to change the path for panoptic_gt_id folder. The exact replacement is: segments = sorted( glob.glob(osp.join("datasets/Virtual_KITTI2/ALL_15-deg-left", 'panoptic_gt_id/*.png')))

Hope this helps

好像不work,我替换掉了还是一样的错误

@byronsit
Copy link

byronsit commented Dec 14, 2023

经过实验,因为我kitti数据没下载全。
下载全后,额外加上

segments = sorted( glob.glob(osp.join("datasets/Virtual_KITTI2/ALL_15-deg-left", 'panoptic_gt_id/*.png')))

就work了。 起码他跑起来了……

然后又再其他地方报了out of range错误hhh

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

6 participants