jwyang / fpn.pytorch

Pytorch implementation of Feature Pyramid Network (FPN) for Object Detection
MIT License
952 stars 221 forks source link

When I set the pooling mode as 'pool', an error arise #33

Closed duwangzhe closed 5 years ago

duwangzhe commented 5 years ago

/home/zhuyuhe/.conda/envs/dwzpy/lib/python3.5/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/zhuyuhe/duwangzhe/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 332, in roi_labels = FPN(im_data, im_info, gt_boxes, num_boxes) File "/home/zhuyuhe/.conda/envs/dwzpy/lib/python3.5/site-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, kwargs) File "/home/zhuyuhe/duwangzhe/fpn_pytorch/lib/model/fpn/fpn.py", line 246, in forward roi_pool_feat = self._PyramidRoI_Feat(mrcnn_feature_maps, rois, im_info) File "/home/zhuyuhe/duwangzhe/fpn_pytorch/lib/model/fpn/fpn.py", line 160, in _PyramidRoI_Feat feat = self.RCNN_roi_pool(feat_maps[i], rois[idx_l], scale) File "/home/zhuyuhe/.conda/envs/dwzpy/lib/python3.5/site-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, *kwargs) File "/home/zhuyuhe/duwangzhe/fpn_pytorch/lib/model/roi_pooling/modules/roi_pool.py", line 14, in forward return RoIPoolFunction(self.pooled_height, self.pooled_width, scale)(features, rois) File "/home/zhuyuhe/duwangzhe/fpn_pytorch/lib/model/roi_pooling/functions/roi_pool.py", line 26, in forward features, rois, output, ctx.argmax) File "/home/zhuyuhe/.conda/envs/dwzpy/lib/python3.5/site-packages/torch/utils/ffi/init.py", line 197, in safe_call result = torch._C._safe_call(args, kwargs) TypeError: float() not supported on cdata 'void *' Anyone can help me? Thx!

duwangzhe commented 5 years ago

I think I have fixed this bug. just modify lib/model/roi_pooling/functions/roi_pooling.py line 9-11 self.aligned_width = int(aligned_width) self.aligned_height = int(aligned_height) self.spatial_scale = float(spatial_scale) and then the bug can be eliminated