IndexError: list index out of range
See original GitHub issue🐛 Bug
Traceback (most recent call last): File “/home/lucifer/LibSrcs/pycharm-community-2018.3.2/helpers/pydev/pydevd.py”, line 1741, in <module> main() File “/home/lucifer/LibSrcs/pycharm-community-2018.3.2/helpers/pydev/pydevd.py”, line 1735, in main globals = debugger.run(setup[‘file’], None, None, is_module) File “/home/lucifer/LibSrcs/pycharm-community-2018.3.2/helpers/pydev/pydevd.py”, line 1135, in run pydev_imports.execfile(file, globals, locals) # execute the script File “/home/lucifer/LibSrcs/pycharm-community-2018.3.2/helpers/pydev/_pydev_imps/_pydev_execfile.py”, line 18, in execfile exec(compile(contents+“\n”, file, ‘exec’), glob, loc) File “/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/my_run/run_local/e2e_faster_rcnn_R_50_C4_1x/train_net_e2e_faster_rcnn_R_50_C4_1x.py”, line 201, in <module> main() File “/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/my_run/run_local/e2e_faster_rcnn_R_50_C4_1x/train_net_e2e_faster_rcnn_R_50_C4_1x.py”, line 194, in main model = train(cfg, args.local_rank, args.distributed) File “/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/my_run/run_local/e2e_faster_rcnn_R_50_C4_1x/train_net_e2e_faster_rcnn_R_50_C4_1x.py”, line 94, in train arguments, File “/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/engine/trainer.py”, line 72, in do_train for iteration, (images, targets, _) in enumerate(data_loader, start_iter): File “/home/lucifer/.virtualenvs/maskrcnn-benchmark/lib/python3.6/site-packages/torch/utils/data/dataloader.py”, line 537, in next return self._process_next_batch(batch) File “/home/lucifer/.virtualenvs/maskrcnn-benchmark/lib/python3.6/site-packages/torch/utils/data/dataloader.py”, line 577, in _process_next_batch raise batch.exc_type(batch.exc_msg) IndexError: Traceback (most recent call last): File “/home/lucifer/.virtualenvs/maskrcnn-benchmark/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py”, line 99, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File “/home/lucifer/.virtualenvs/maskrcnn-benchmark/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py”, line 99, in <listcomp> samples = collate_fn([dataset[i] for i in batch_indices]) File “/home/lucifer/.virtualenvs/maskrcnn-benchmark/lib/python3.6/site-packages/torch/utils/data/dataset.py”, line 85, in getitem return self.datasets[dataset_idx][sample_idx] File “/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/coco.py”, line 94, in getitem target = target.clip_to_image(remove_empty=True) File “/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/structures/bounding_box.py”, line 223, in clip_to_image return self[keep] File “/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/structures/bounding_box.py”, line 208, in getitem bbox.add_field(k, v[item]) File “/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/structures/segmentation_mask.py”, line 555, in getitem selected_instances = self.instances.getitem(item) File “/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/structures/segmentation_mask.py”, line 464, in getitem selected_polygons.append(self.polygons[i]) IndexError: list index out of range
To Reproduce
reproducible code:
from maskrcnn_benchmark.config import cfg
from maskrcnn_benchmark.data.build import make_data_loader
config_path = '/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/my_run/run_local/' \
'e2e_faster_rcnn_R_50_C4_1x/e2e_faster_rcnn_R_50_C4_1x.yaml'
cfg.merge_from_file(config_path)
dl = make_data_loader(cfg)
for iteration, (images, targets) in enumerate(dl):
print(iteration)
Dataset [ConcatDataset] has no categories attribute, labels.json file won't be created
Traceback (most recent call last):
File "/home/lucifer/.virtualenvs/maskrcnn-benchmark/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-173e8ccc2b92>", line 1, in <module>
runfile('/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/my_code/dev/02_debugs/debug_dataloader.py', wdir='/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/my_code/dev/02_debugs')
File "/home/lucifer/LibSrcs/pycharm-community-2018.3.2/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/home/lucifer/LibSrcs/pycharm-community-2018.3.2/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/my_code/dev/02_debugs/debug_dataloader.py", line 8, in <module>
for iteration, (images, targets, _) in enumerate(dl, 0):
File "/home/lucifer/.virtualenvs/maskrcnn-benchmark/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 551, in __next__
return self._process_next_batch(batch)
File "/home/lucifer/.virtualenvs/maskrcnn-benchmark/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 577, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
IndexError: Traceback (most recent call last):
File "/home/lucifer/.virtualenvs/maskrcnn-benchmark/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/lucifer/.virtualenvs/maskrcnn-benchmark/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in <listcomp>
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/lucifer/.virtualenvs/maskrcnn-benchmark/lib/python3.6/site-packages/torch/utils/data/dataset.py", line 85, in __getitem__
return self.datasets[dataset_idx][sample_idx]
File "/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/coco.py", line 94, in __getitem__
target = target.clip_to_image(remove_empty=True)
File "/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/structures/bounding_box.py", line 223, in clip_to_image
return self[keep]
File "/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/structures/bounding_box.py", line 208, in __getitem__
bbox.add_field(k, v[item])
File "/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/structures/segmentation_mask.py", line 555, in __getitem__
selected_instances = self.instances.__getitem__(item)
File "/home/lucifer/Projects/05_maskrcnn-benchmark/maskrcnn-benchmark/maskrcnn_benchmark/structures/segmentation_mask.py", line 464, in __getitem__
selected_polygons.append(self.polygons[i])
IndexError: list index out of range
Expected behavior
I have tried follow by #881,#1053,#725 and so on. But they seems not work for my situation.
any help is appreciated
Environment
Collecting environment information… PyTorch version: 1.0.0.dev20190409 Is debug build: No CUDA used to build PyTorch: 9.0.176 OS: Ubuntu 16.04.5 LTS GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 CMake version: version 3.5.1 Python version: 3.6 Is CUDA available: Yes CUDA runtime version: Could not collect GPU models and configuration: GPU 0: GeForce GTX 1070 Nvidia driver version: 384.130 cuDNN version: Could not collect Versions of relevant libraries: [pip3] numpy==1.17.4 [pip3] torch-nightly==1.0.0.dev20190409 [pip3] torchvision-nightly==0.2.3 [conda] Could not collect:
Additional context
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top GitHub Comments
Inspired by #1053, #1181 and #1182 had ben fixed.
Modify the followed file.py: maskrcnn_benchmark/structures/segmentation_mask.py maskrcnn_benchmark/modeling/balanced_positive_negative_sampler.py
substitue for all
torch.bool
withtorch.uint8
@maximilian-durner yeh sure is. Sorry to confuse you, this PR (https://github.com/Jinksi/maskrcnn-benchmark/pull/4) was on my own fork of the project, not aimed to be a PR for this official repo.