kuangliu / pytorch-retinanet

RetinaNet in PyTorch
992 stars 250 forks source link

How to solve 'ZeroDivisionError: float division by zero' problem? #33

Open b2220333 opened 6 years ago

b2220333 commented 6 years ago

My GPU memory is 2G. Therefore, I use batch=1 to run this program. However, I meet the error force me to stop. What should I do to get similar result of this paper in my configuration? Thank you~

Error: Traceback (most recent call last): File "./t.py", line 1098, in train(epoch) File "./t.py", line 1059, in train loss = criterion(loc_preds, loc_targets, cls_preds, cls_targets) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 325, in call result = self.forward(*input, **kwargs) File "./t.py", line 984, in forward print('loc_loss: %.3f | cls_loss: %.3f' % (loc_loss.data[0]/num_pos, cls_loss.data[0]/num_pos), end=' | ') ZeroDivisionError: float division by zero