def proposal_layer(rpn_cls_prob_reshape,
                       rpn_bbox_pred,
                       im_info,
                       cfg,
                       _feat_stride,
                       anchor_scales,
                       gt_boxes=None):

        #convert to  numpy
        rpn_cls_prob_reshape = rpn_cls_prob_reshape.data.cpu().numpy()
        rpn_bbox_pred = rpn_bbox_pred.data.cpu().numpy()

        rois, scores, anchor_inds, labels = proposal_layer_py(
            rpn_cls_prob_reshape,
            rpn_bbox_pred,
            im_info,
            cfg,
            _feat_stride=_feat_stride,
            anchor_scales=anchor_scales,
            gt_boxes=gt_boxes)
        rois = network.np_to_variable(rois, is_cuda=True)
        anchor_inds = network.np_to_variable(anchor_inds,
                                             is_cuda=True,
                                             dtype=torch.LongTensor)
        labels = network.np_to_variable(labels,
                                        is_cuda=True,
                                        dtype=torch.LongTensor)
        #just get fg scores, make bg scores 0
        scores = network.np_to_variable(scores, is_cuda=True)
        return rois, scores, anchor_inds, labels
Exemple #2
0
 def proposal_layer(rpn_cls_prob_reshape, rpn_bbox_pred, im_info, cfg_key,
                    _feat_stride, anchor_scales):
     rpn_cls_prob_reshape = rpn_cls_prob_reshape.data.cpu().numpy()
     rpn_bbox_pred = rpn_bbox_pred.data.cpu().numpy()
     x = proposal_layer_py(rpn_cls_prob_reshape, rpn_bbox_pred, im_info,
                           cfg_key, _feat_stride, anchor_scales)
     x = network.np_to_variable(x, is_cuda=True)
     return x.view(-1, 5)
Exemple #3
0
 def proposal_layer(rpn_cls_prob_reshape, rpn_bbox_pred, im_info, cfg_key, _feat_stride, anchor_scales):
     # if isinstance(rpn_cls_prob_reshape, tuple):
     #     rpn_cls_prob_reshape = rpn_cls_prob_reshape[0]
     rpn_cls_prob_reshape = rpn_cls_prob_reshape.data.cpu().numpy()
     rpn_bbox_pred = rpn_bbox_pred.data.cpu().numpy()
     x = proposal_layer_py(rpn_cls_prob_reshape, rpn_bbox_pred, im_info, cfg_key, _feat_stride, anchor_scales)
     x = torch.from_numpy(x)
     x = Variable(x).cuda()
     return x.view(-1, 5)
Exemple #4
0
 def proposal_layer(rpn_cls_prob_reshape_vec, rpn_bbox_pred_vec, im_info, cfg_key, _feat_stride, anchor_scales):
     x = proposal_layer_py(rpn_cls_prob_reshape_vec, rpn_bbox_pred_vec, im_info, cfg_key, _feat_stride, anchor_scales)
     x = network.np_to_variable(x, is_cuda=True)
     return x.view(-1, 5)