py-faster-rcnn icon indicating copy to clipboard operation
py-faster-rcnn copied to clipboard

prepare_roidb() fails on very small overlaps

Open Seanmatthews opened this issue 8 years ago • 6 comments

Some background, in case I imposed the problem on myself through some improper setup: I'm training a very small dataset of 11 classes over 62 images. I used labelImg to annotate several objects per image (but not every object in every image). I follow the instructions for training here, using the same data for training and testing. Instead of the suggested training command, I altered faster_rcnn_alt_opt.sh to accommodate my dataset. The training progresses through "Stage 1 RPN, init from ImageNet model" and "Stage 1 RPN, generate proposals" to "Stage 1 Fast R-CNN using RPN proposals, init from ImageNet model", where it throws the following error:

Process Process-3: Traceback (most recent call last): File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run self._target(*self._args, **self._kwargs) File "./tools/train_faster_rcnn_alt_opt.py", line 189, in train_fast_rcnn roidb, imdb = get_roidb(imdb_name, rpn_file=rpn_file) File "./tools/train_faster_rcnn_alt_opt.py", line 67, in get_roidb roidb = get_training_roidb(imdb) File "/home/dev/src/ariel/deep/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 122, in get_training_roidb rdl_roidb.prepare_roidb(imdb) File "/home/dev/src/ariel/deep/py-faster-rcnn/tools/../lib/roi_data_layer/roidb.py", line 51, in prepare_roidb assert all(max_classes[nonzero_inds] != 0) AssertionError

Looking into the function, I noticed that at this step through prepare_roidb, my max_overlaps array contained a number of close-to-zero values that numpy groups into the nonzero_inds array (as it should). However, those values in the max_classes array are indeed zero.

Is this an error on my part? If so, how did I cause it? If not, the solution is clearly to set negligible numbers to zero, but I'm reluctant to make that assumption without your input.

Seanmatthews avatar Dec 20 '16 16:12 Seanmatthews

As an example, he are the list of max_overlaps which coincide with a max_classes value of 0:

[  6.77344190e-07   4.42691453e-06   4.88126204e-07   4.04364187e-07
   2.71648588e-07   9.20962691e-07   6.82705547e-07   9.97144866e-07
   7.92740821e-07   1.30538729e-06   2.19987305e-06   7.94905247e-07
   1.43210104e-06   5.10457312e-07   3.52238385e-06   1.53103429e-06
   2.77859908e-06   1.86146201e-06   5.83908729e-07   4.26315722e-07
   1.38307896e-05   4.33050900e-06   9.02547413e-07   9.53889298e-07
   5.21114907e-06   1.65058395e-06   7.25464179e-06   6.62295361e-06
   1.75827870e-06   4.18398413e-05   2.70081387e-06   4.92181562e-06
   8.22064612e-06   1.44625517e-06   2.23241477e-06   1.47799483e-06
   3.38878613e-06   8.17282944e-06   3.55347788e-06   1.38796704e-05
   8.31836860e-06   2.11551614e-05   4.84880138e-06   2.27672831e-06
   1.75890018e-05   6.81285201e-06   8.14911346e-06   1.18152111e-05]

Seanmatthews avatar Dec 20 '16 21:12 Seanmatthews

@Seanmatthews I also have this problem. I just train the 'person' class of the voc2007 dataset.

micros-uav avatar Dec 21 '16 03:12 micros-uav

I'm also interested in this question. What happens if you have regions in your training set that overlaps completely or partially, is this valid input and training.

Neppord avatar Jan 04 '17 12:01 Neppord

@Seanmatthews What did you end up doing?

alchu8 avatar Jan 19 '18 03:01 alchu8

@Seanmatthews hi,i am training my data with faster-rcnn but got the same error assert all(max_classes[nonzero_inds] != 0) AssertionError,Please let me know if you have any solution to this problem.

FelixZhang7 avatar Jun 13 '18 14:06 FelixZhang7

I am also having the same issue. Does anyone solve it?

PoonamRajput avatar Jun 25 '19 14:06 PoonamRajput