sanghoon / pva-faster-rcnn

Demo code for PVANet
https://arxiv.org/abs/1611.08588
Other
651 stars 241 forks source link

IndexError: too many indices for array #30

Closed theuy closed 7 years ago

theuy commented 7 years ago

I follow the original step in https://github.com/sanghoon/pva-faster-rcnn and run the demo(PVANET+ on PASCAL VOC 2007), then i got the error: Traceback (most recent call last): File "./tools/test_net.py", line 90, in test_net(net, imdb, max_per_image=args.max_per_image, vis=args.vis) File "../lib/fast_rcnn/test.py", line 319, in test_net imdb.evaluate_detections(all_boxes, output_dir) File "../lib/datasets/pascal_voc.py", line 322, in evaluate_detections self._do_python_eval(output_dir) File "../lib/datasets/pascal_voc.py", line 285, in _do_python_eval use_07_metric=use_07_metric) File "../lib/datasets/voc_eval.py", line 148, in voc_eval BB = BB[sorted_ind, :] IndexError: too many indices for array i have try the solution in #8 ,but it does not work ,Anyones faced this error? Could you please give me the solution? Thank you,

catsdogone commented 7 years ago

@theuy There may be not detection results, so the eval can not work. You should check your model.

theuy commented 7 years ago

@catsdogone The BB is always empty, It's very strange as the error comes when i try to run the demo. I'm still trying to locate the bugs. Thank you for help!

lvchigo commented 7 years ago

add if (len(sorted_ind)<1): rec = 0 prec = 0 ap = 0 return rec, prec, ap print 'sorted_ind_len:{}'.format(len(sorted_ind)) print 'BB_len:{}'.format(len(BB))

BB = BB[sorted_ind, :]
theuy commented 7 years ago

@catsdogone@lvchigo The reason for the problem is that I shift to a new dataset and forgot to delete the cache file. thank you very much for helping.

haochen-rye commented 7 years ago

@theuy I came across the same error,but even after i delete the cache file in data/cache, this error still exist s.So would you kindly explain which file should be deleted ? thank you.

rremani commented 7 years ago

Hi, I experimented with this error. Took one 20 iteration snapshot vs 60000 iteration snapshot. First thing to check if previous cached annotations are deleted or not before testing the new one. With 20 iterations I was getting the same error as everyone had and the reason is correctly pointed out by @catsdogone , but with 60000 iteration model it has predictions to make so it works.

theuy commented 7 years ago

@Cassie94 I deleted the /data/VOCdevkit2007/annotations_cache/annots.pkl. If you use a mini dataset to test, make sure your mini dataset includes all the categories.

Po-Hsuan-Huang commented 7 years ago

Agree with @theuy. For me, the reason is that there is no label for some specific classes. Therefore no bounding box (BB) for that class. Check you have data for each class. Use the solution provide by @lvchigo to handle condition with empty category.