graph-rcnn.pytorch icon indicating copy to clipboard operation
graph-rcnn.pytorch copied to clipboard

Error: index 0 is out of bounds for dimension 0 with size 0

Open SkyOL5 opened this issue 5 years ago • 1 comments

When I test with full VG dataset, one error appears:

Traceback (most recent call last): File "main.py", line 129, in main() File "main.py", line 126, in main test(cfg, args) File "main.py", line 81, in test model.test(visualize=args.visualize) File "/home/skyol/graph-rcnn.pytorch/lib/model.py", line 232, in test output = self.scene_parser(imgs) File "/home/skyol/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(*input, **kwargs) File "/home/skyol/graph-rcnn.pytorch/lib/scene_parser/parser.py", line 133, in forward x_pairs, detection_pairs, rel_heads_loss = self.rel_heads(relation_features, detections, targets) File "/home/skyol/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(*input, **kwargs) File "/home/skyol/graph-rcnn.pytorch/lib/scene_parser/rcnn/modeling/relation_heads/relation_heads.py", line 132, in forward rel_inds = _get_rel_inds(im_inds, im_inds_pairs, proposal_idx_pairs) File "/home/skyol/graph-rcnn.pytorch/lib/scene_parser/rcnn/modeling/relation_heads/sparse_targets.py", line 97, in _get_rel_inds rel_ind_offset_im[:num_rels_im[0]] = 0 # first image needs no offset IndexError: index 0 is out of bounds for dimension 0 with size 0

It seems that for some images, list 'num_rels_im' is empty...

Could you please teach me how to figure out this issue? Thanks!

SkyOL5 avatar Dec 24 '19 05:12 SkyOL5

I had the the same issue. Turned out my custom dataset had 0 region proposal pairs. That is because all the non overlapping boxes were filtered by def _get_proposal_pairs(self, proposals) possibily for performance reasons. However my use case has relationships among objects that don't overlap. Hope that helps.

aayushP avatar Jan 20 '20 20:01 aayushP