sanghoon / pva-faster-rcnn

Demo code for PVANet
https://arxiv.org/abs/1611.08588
Other
651 stars 241 forks source link

why the "box_deltas" does't rescale to the raw images space int the test phase #96

Open chuanxinlan opened 6 years ago

chuanxinlan commented 6 years ago

in the test phase ,you rescale the "rois" result to the raw image space but I can't understand why don't you also rescale the "bbox_pred" to the raw image space before you get final box by combining the two variables("rois","bbox_pred"). thanks for your time the detail is in the following code:

     _t['im_postproc'].tic()
    if cfg.TEST.HAS_RPN:
        assert len(im_scales) == 1, "Only single-image batch implemented"
        rois = net.blobs['rois'].data.copy()
        # unscale back to raw image space
        **boxes = rois[:, 1:5] / im_scales[0]**
    if cfg.TEST.SVM:
        # use the raw scores before softmax under the assumption they
        # were trained as linear SVMs
        scores = net.blobs['cls_score'].data
    else:
        # use softmax estimated probabilities
        scores = blobs_out['cls_prob']

    if cfg.TEST.BBOX_REG:
        # Apply bounding-box regression deltas
        **box_deltas = blobs_out['bbox_pred']
        pred_boxes =bbox_transform_inv(boxes,box_deltas)**
        pred_boxes = clip_boxes(pred_boxes, im.shape)
    else:
        # Simply repeat the boxes, once for each class
        pred_boxes = np.tile(boxes, (1, scores.shape[1]))

    if cfg.DEDUP_BOXES > 0 and not cfg.TEST.HAS_RPN:
        # Map scores and predictions back to the original set of boxes
        scores = scores[inv_index, :]
        pred_boxes = pred_boxes[inv_index, :]
    _t['im_postproc'].toc()