ruoqianguo / FPN_Pytorch

Base jwyang/fpn.pytorch, train FPN on Pascal VOC get 80.5 mAP
MIT License
103 stars 19 forks source link

RuntimeError: reciprocal is not implemented for type torch.cuda.LongTensor #3

Open liveway6 opened 6 years ago

liveway6 commented 6 years ago

Hi, Im a new hand, when I use python3 to run your code and jwyang/fpn.pytorch meeting the same problem, as follow: Preparing training data... done before filtering, there are 10022 images... after filtering, there are 10022 images... 10022 roidb entries Loading pretrained weights from data/pretrained_model/resnet101_caffe.pth /home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/nn/functional.py:1749: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details. "See the documentation of nn.Upsample for details.".format(mode)) /home/wangshaoju/jwyang/FPN_Pytorch/lib/model/rpn/rpn_fpn.py:79: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument. rpn_cls_prob_reshape = F.softmax(rpn_cls_score_reshape) Traceback (most recent call last): File "trainval_net.py", line 366, in roi_labels = FPN(im_data, im_info, gt_boxes, num_boxes) File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, kwargs) File "/home/wangshaoju/jwyang/FPN_Pytorch/lib/model/fpn/fpn.py", line 191, in forward rois, rpn_loss_cls, rpn_loss_bbox = self.RCNN_rpn(rpn_feature_maps, im_info, gt_boxes, num_boxes) File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, *kwargs) File "/home/wangshaoju/jwyang/FPN_Pytorch/lib/model/rpn/rpn_fpn.py", line 109, in forward rpn_data = self.RPN_anchor_target((rpn_cls_score_alls.data, gt_boxes, im_info, num_boxes, rpn_shapes)) File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(input, kwargs) File "/home/wangshaoju/jwyang/FPN_Pytorch/lib/model/rpn/anchor_target_layer_fpn.py", line 141, in forward positive_weights = 1.0 / num_examples File "/home/wangshaoju/.conda/envs/ycy/lib/python3.6/site-packages/torch/tensor.py", line 320, in rdiv return self.reciprocal() * other RuntimeError: reciprocal is not implemented for type torch.cuda.LongTensor

This virtual environment can run the jwyang/faster-rcnn.pytorch. I have no idea, can you help me? Thanks very much!

szrlee commented 6 years ago

this code might be based on pytorch 0.3.0

jacco09 commented 6 years ago

I met the same problem.Have you solved it?could you show your solution?thanks