def METHOD_NAME(self,
                                   mask_preds: Tuple[Tensor],
                                   results_list: List[Tensor],
                                   batch_img_metas: List[dict],
                                   rcnn_test_cfg: ConfigDict,
                                   rescale: bool = False,
                                   activate_map: bool = False) -> List[Tensor]:
    """Transform a batch of output features extracted from the head into mask
    results.
    Args:
        mask_preds (tuple[Tensor]): Tuple of predicted foreground masks,
            each has shape (n, num_classes, h, w).
        results_list (list[Tensor]): Detection results of
            each image.
        batch_img_metas (list[dict]): List of image information.
        rcnn_test_cfg (obj:`ConfigDict`): `test_cfg` of Bbox Head.
        rescale (bool): If True, return boxes in original image space.
            Defaults to False.
        activate_map (book): Whether get results with augmentations test.
            If True, the `mask_preds` will not process with sigmoid.
            Defaults to False.
    Returns:
        list[Tensor]: Detection results of each image
        after the post process. Each item usually contains following keys.
            - dets (Tensor): Classification scores, has a shape
                (num_instance, 5)
            - labels (Tensor): Labels of bboxes, has a shape
                (num_instances, ).
            - masks (Tensor): Has a shape (num_instances, H, W).
    """
    ctx = FUNCTION_REWRITER.get_context()
    ori_shape = batch_img_metas[0]['img_shape']
    dets, det_labels = results_list
    dets = dets.view(-1, 5)
    det_labels = det_labels.view(-1)
    backend = get_backend(ctx.cfg)
    mask_preds = mask_preds.sigmoid()
    bboxes = dets[:, :4]
    labels = det_labels
    threshold = rcnn_test_cfg.mask_thr_binary
    if not self.class_agnostic:
        box_inds = torch.arange(mask_preds.shape[0], device=bboxes.device)
        mask_pred = mask_preds[box_inds, labels][:, None]
    # grid sample is not supported by most engine
    # so we add a flag to disable it.
    mmdet_params = get_post_processing_params(ctx.cfg)
    export_postprocess_mask = mmdet_params.get('export_postprocess_mask',
                                               False)
    if not export_postprocess_mask:
        return mask_pred
    masks, _ = _do_paste_mask(
        mask_pred, bboxes, ori_shape[0], ori_shape[1], skip_empty=False)
    if backend == Backend.TENSORRT:
        return masks
    if threshold >= 0:
        masks = (masks >= threshold).to(dtype=torch.bool)
    return masks