rbgirshick / py-faster-rcnn

Faster R-CNN (Python implementation) -- see https://github.com/ShaoqingRen/faster_rcnn for the official MATLAB version
Other
8.13k stars 4.11k forks source link

ZeroDivisionError: integer division or modulo by zero #784

Open JaylinZheng opened 6 years ago

JaylinZheng commented 6 years ago

Any ideas to solve it ? Process Process-1: 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 "train_faster_rcnn_alt_opt.py", line 129, in train_rpn max_iters=max_iters) File "/home/jaylin/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 160, in train_net model_paths = sw.train_model(max_iters) File "/home/jaylin/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 101, in train_model self.solver.step(1) File "/home/jaylin/py-faster-rcnn/tools/../lib/roi_data_layer/layer.py", line 144, in forward blobs = self._get_next_minibatch() File "/home/jaylin/py-faster-rcnn/tools/../lib/roi_data_layer/layer.py", line 63, in _get_next_minibatch return get_minibatch(minibatch_db, self._num_classes) File "/home/jaylin/py-faster-rcnn/tools/../lib/roi_data_layer/minibatch.py", line 22, in get_minibatch assert(cfg.TRAIN.BATCH_SIZE % num_images == 0), \ ZeroDivisionError: integer division or modulo by zero

After training the network with VGG16 using the dataset of ILSVRC 2012, Zero Division Error occured. Any ideas? I delete .pkl file, but the same error occured. May be something wrong in my .xml file

<?xml version="1.0" encoding="utf-8"?>

VOC2007 000007 ILSVRC_2012 500 401 3 0 bicycle Unspecified 0 1 44 161 446 371

Thanks a lot!

JaylinZheng commented 6 years ago

image

Hill-Gu commented 6 years ago

I have the same error and then I find that my trainval.txt is empty and you should use trainval.txt in the dataset.

riqsebastian commented 5 years ago

I have solved the problem by comment the 'use_diff' in the pascal_voc.py or your_database.py. If your dataset are not using difficult samples , you have to comment these lines, otherwise your dataset will be filtered to zero. It will cause your num_images become zero. FYI, If you need some ADAS dataset, please download creda open dataset on https://www.aicreda.com/ Thank you.

        #if not self.config['use_diff']:
        #    # Exclude the samples labeled as difficult
        #    non_diff_objs = [
        #        obj for obj in objs if int(obj.find('difficult').text) == 0]
        #     if len(non_diff_objs) != len(objs):
        #         print 'Removed {} difficult objects'.format(
        #             len(objs) - len(non_diff_objs))
        #    objs = non_diff_objs