kuangliu / pytorch-retinanet

RetinaNet in PyTorch
996 stars 249 forks source link

value cannot be converted to type double without overflow: #28

Open coldgemini opened 6 years ago

coldgemini commented 6 years ago

Is it required to install specific pytorch or do some trick to get rid of this?

==> Preparing data..

Epoch: 0 loc_loss: 0.116 | cls_loss: 3791.763 | train_loss: 3791.878 | avg_loss: 3791.878 loc_loss: 0.088 | cls_loss: 1283.638 | train_loss: 1283.725 | avg_loss: 2537.802 loc_loss: 0.093 | cls_loss: 8380.014 | train_loss: 8380.107 | avg_loss: 4485.237 loc_loss: 0.095 | cls_loss: 2.312 | train_loss: 2.407 | avg_loss: 3364.530 Traceback (most recent call last): File "train.py", line 114, in train(epoch) File "train.py", line 75, in train loss = criterion(loc_preds, loc_targets, cls_preds, cls_targets) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 325, in call result = self.forward(*input, **kwargs) File "/home/xiangyong/Workbench/pytorch-retinanet-kuangliu/loss.py", line 92, in forward cls_loss = self.focal_loss_alt(masked_cls_preds, cls_targets[pos_neg]) File "/home/xiangyong/Workbench/pytorch-retinanet-kuangliu/loss.py", line 60, in focal_loss_alt return loss.sum() RuntimeError: value cannot be converted to type double without overflow: inf

ghost commented 6 years ago

@coldgemini Try reducing the learning rate. I changed the default learning rate to lr = 1e-10. It works

Thanks