longcw/faster_rcnn_pytorch

RuntimeError in faster_rcnn.py

manyuyuya opened this issue · 3 comments

when I train on my own data,I meet an error when run the faster_rcnn.py,line 100,'rpn_loss_box = F.smooth_l1_loss(rpn_bbox_pred, rpn_bbox_targets, size_average=False) / (fg_cnt + 1e-4)'. It shows that "RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.cuda.LongTensor for argument #2 'other'“
And then, I try to train on VOC 2007,meeting the same error
What's maybe the reason?

I meet the same error two days ago , and I have not solve it . Have you solved the problem now ? I use python 2.7, pytorch 0.4.0

J911 commented

this system running torch 0.3.1

this is because the type of argument is wrong. you can change the type of argument by 'argument = argument.type(torch.FloatTensor)'