Yuanchu/YOLO3D

IndexError: index 309 is out of bounds for axis 1 with size 309

Closed this issue · 2 comments

$ python main.py
/home1/ll/object_detect/YOLO3D_pytorch/region_loss.py:216: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
loss = loss_x + loss_y + loss_w + loss_l + loss_conf + loss_cls + loss_Euler + torch.tensor(loss_iou).cuda()

Traceback (most recent call last):
File "main.py", line 69, in
loss = region_loss(output,target, loss_history, epoch, batch_idx)
File "/home/ll/workspace/tensorflow_env/pytorch-py2.7/local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home1/ll/object_detect/YOLO3D_pytorch/region_loss.py", line 217, in forward
loss_history[epoch, batch_idx, :] = [loss_x, loss_y, loss_w, loss_l, loss_conf, loss_cls, loss_Euler, loss_iou]
IndexError: index 309 is out of bounds for axis 1 with size 309

@deepmeng Check your int(len(data_loader.dataset) / batch_size) when defining loss_history. It made a wrong assumption there which would throw later. Make sure loss_history is initialized correctly. Understand the code rather than blindly run it.

@deepmeng That being said. The current quality of this code base is close to rubbish. I'll spend some time cleaning it up in the next few days. Thanks for flagging errors.