py-faster-rcnn
py-faster-rcnn copied to clipboard
ZeroDivisionError: integer division or modulo by zero
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
Thanks a lot!

I have the same error and then I find that my trainval.txt is empty and you should use trainval.txt in the dataset.
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