chenjun2hao/FOTS.pytorch

训练的时候报错和loss出现nan如何解决

Opened this issue · 0 comments

Traceback (most recent call last):
File "train.py", line 111, in main
ctcl, gt_target , gt_proc = process_boxes(images, im_data, seg_pred[0], roi_pred[0], angle_pred[0], score_maps, gt_idxs, gtso, lbso, features, net, ctc_loss, opts, converter, debug=opts.debug)
File "/home/zhangjunyi/ocr/FOTS.pytorch/src/ocr_process.py", line 261, in process_boxes
maxratio = rois[:, 4] / rois[:, 3]
IndexError: too many indices for tensor of dimension 1
epoch 5[2800], loss: 27.478, bbox_loss: nan, seg_loss: -0.098, ang_loss: 0.111, ctc_loss: 24.140, time 0.156
Traceback (most recent call last):
File "train.py", line 111, in main
ctcl, gt_target , gt_proc = process_boxes(images, im_data, seg_pred[0], roi_pred[0], angle_pred[0], score_maps, gt_idxs, gtso, lbso, features, net, ctc_loss, opts, converter, debug=opts.debug)
File "/home/zhangjunyi/ocr/FOTS.pytorch/src/ocr_process.py", line 261, in process_boxes
maxratio = rois[:, 4] / rois[:, 3]
IndexError: too many indices for tensor of dimension 1
epoch 5[2805], loss: 27.473, bbox_loss: nan, seg_loss: -0.098, ang_loss: 0.111, ctc_loss: 24.136, time 0.172
epoch 5[2810], loss: 27.467, bbox_loss: nan, seg_loss: -0.098, ang_loss: 0.111, ctc_loss: 24.131, time 0.172
epoch 5[2815], loss: 27.455, bbox_loss: nan, seg_loss: -0.098, ang_loss: 0.111, ctc_loss: 24.121, time 0.148
epoch 5[2820], loss: 27.449, bbox_loss: nan, seg_loss: -0.098, ang_loss: 0.111, ctc_loss: 24.115, time 0.155
epoch 5[2825], loss: 27.446, bbox_loss: nan, seg_loss: -0.098, ang_loss: 0.111, ctc_loss: 24.111, time 0.187
epoch 5[2830], loss: 27.447, bbox_loss: nan, seg_loss: -0.098, ang_loss: 0.111, ctc_loss: 24.112, time 0.166