(aug_proposals, img_metas, rpn_test_cfg)
return merged_proposals
Merge augmented proposals (multiscale, flip, etc.)

    Args:
        aug_proposals (list[Tensor]): proposals from different testing
            schemes, shape (n, 5). Note that they are not rescaled to the
            original image size.
        img_metas (list[dict]): image info including "shape_scale" and "flip".
        rpn_test_cfg (dict): rpn test config.

    Returns:
        Tensor: shape (n, 4), proposals corresponding to original image scale.
Merge augmented proposals (multiscale, flip, etc.)
Merge augmented proposals ( multiscale flip etc . )
def merge_aug_proposals(aug_proposals, img_metas, rpn_test_cfg):
    """Merge augmented proposals (multiscale, flip, etc.)

    Args:
        aug_proposals (list[Tensor]): proposals from different testing
            schemes, shape (n, 5). Note that they are not rescaled to the
            original image size.
        img_metas (list[dict]): image info including "shape_scale" and "flip".
        rpn_test_cfg (dict): rpn test config.

    Returns:
        Tensor: shape (n, 4), proposals corresponding to original image scale.
    """
    recovered_proposals = []
    for proposals, img_info in zip(aug_proposals, img_metas):
        img_shape = img_info['img_shape']
        scale_factor = img_info['scale_factor']
        flip = img_info['flip']
        _proposals = proposals.clone()
        _proposals[:, :4] = bbox_mapping_back(_proposals[:, :4], img_shape,
                                              scale_factor, flip)
        recovered_proposals.append(_proposals)
    aug_proposals = torch.cat(recovered_proposals, dim=0)
    merged_proposals, _ = nms(aug_proposals, rpn_test_cfg.nms_thr)
    scores = merged_proposals[:, 4]
    _, order = scores.sort(0, descending=True)
    num = min(rpn_test_cfg.max_num, merged_proposals.shape[0])
    order = order[:num]
    merged_proposals = merged_proposals[order, :]
    return merged_proposals
def merge_aug_proposals ( aug_proposals , img_metas , rpn_test_cfg ) : recovered_proposals = [ ] for proposals , img_info in zip ( aug_proposals , img_metas ) : img_shape = img_info [ 'img_shape' ] scale_factor = img_info [ 'scale_factor' ] flip = img_info [ 'flip' ] _proposals = proposals . clone ( ) _proposals [ : , : 4 ] = bbox_mapping_back ( _proposals [ : , : 4 ] , img_shape , scale_factor , flip ) recovered_proposals . append ( _proposals ) aug_proposals = torch . cat ( recovered_proposals , dim = 0 ) merged_proposals , _ = nms ( aug_proposals , rpn_test_cfg . nms_thr ) scores = merged_proposals [ : , 4 ] _ , order = scores . sort ( 0 , descending = True ) num = min ( rpn_test_cfg . max_num , merged_proposals . shape [ 0 ] ) order = order [ : num ] merged_proposals = merged_proposals [ order , : ] return merged_proposals