def __call__(self, box_cls, box_pred, scale_factor_wh, img_whwh):
    '\n        Arguments:\n            box_cls (Tensor): tensor of shape (batch_size, num_proposals, K).\n                The tensor predicts the classification probability for each proposal.\n            box_pred (Tensor): tensors of shape (batch_size, num_proposals, 4).\n                The tensor predicts 4-vector (x,y,w,h) box\n                regression values for every proposal\n            scale_factor_wh (Tensor): tensors of shape [batch_size, 2] the scalor of  per img\n            img_whwh (Tensor): tensors of shape [batch_size, 4]\n        Returns:\n            bbox_pred (Tensor): tensors of shape [num_boxes, 6] Each row has 6 values:\n            [label, confidence, xmin, ymin, xmax, ymax]\n            bbox_num (Tensor): tensors of shape [batch_size] the number of RoIs in each image.\n        '
    assert (len(box_cls) == len(scale_factor_wh) == len(img_whwh))
    img_wh = img_whwh[:, :2]
    scores = F.sigmoid(box_cls)
    labels = paddle.arange(0, self.num_classes).unsqueeze(0).tile([self.num_proposals, 1]).flatten(start_axis=0, stop_axis=1)
    classes_all = []
    scores_all = []
    boxes_all = []
    for (i, (scores_per_image, box_pred_per_image)) in enumerate(zip(scores, box_pred)):
        (scores_per_image, topk_indices) = scores_per_image.flatten(0, 1).topk(self.num_proposals, sorted=False)
        labels_per_image = paddle.gather(labels, topk_indices, axis=0)
        box_pred_per_image = box_pred_per_image.reshape([(- 1), 1, 4]).tile([1, self.num_classes, 1]).reshape([(- 1), 4])
        box_pred_per_image = paddle.gather(box_pred_per_image, topk_indices, axis=0)
        classes_all.append(labels_per_image)
        scores_all.append(scores_per_image)
        boxes_all.append(box_pred_per_image)
    bbox_num = paddle.zeros([len(scale_factor_wh)], dtype='int32')
    boxes_final = []
    for i in range(len(scale_factor_wh)):
        classes = classes_all[i]
        boxes = boxes_all[i]
        scores = scores_all[i]
        boxes[:, 0::2] = (paddle.clip(boxes[:, 0::2], min=0, max=img_wh[i][0]) / scale_factor_wh[i][0])
        boxes[:, 1::2] = (paddle.clip(boxes[:, 1::2], min=0, max=img_wh[i][1]) / scale_factor_wh[i][1])
        (boxes_w, boxes_h) = ((boxes[:, 2] - boxes[:, 0]).numpy(), (boxes[:, 3] - boxes[:, 1]).numpy())
        keep = ((boxes_w > 1.0) & (boxes_h > 1.0))
        if (keep.sum() == 0):
            bboxes = paddle.zeros([1, 6]).astype('float32')
        else:
            boxes = paddle.to_tensor(boxes.numpy()[keep]).astype('float32')
            classes = paddle.to_tensor(classes.numpy()[keep]).astype('float32').unsqueeze((- 1))
            scores = paddle.to_tensor(scores.numpy()[keep]).astype('float32').unsqueeze((- 1))
            bboxes = paddle.concat([classes, scores, boxes], axis=(- 1))
        boxes_final.append(bboxes)
        bbox_num[i] = bboxes.shape[0]
    bbox_pred = paddle.concat(boxes_final)
    return (bbox_pred, bbox_num)
Arguments:
    box_cls (Tensor): tensor of shape (batch_size, num_proposals, K).
        The tensor predicts the classification probability for each proposal.
    box_pred (Tensor): tensors of shape (batch_size, num_proposals, 4).
        The tensor predicts 4-vector (x,y,w,h) box
        regression values for every proposal
    scale_factor_wh (Tensor): tensors of shape [batch_size, 2] the scalor of  per img
    img_whwh (Tensor): tensors of shape [batch_size, 4]
Returns:
    bbox_pred (Tensor): tensors of shape [num_boxes, 6] Each row has 6 values:
    [label, confidence, xmin, ymin, xmax, ymax]
    bbox_num (Tensor): tensors of shape [batch_size] the number of RoIs in each image.
def __call__(self, box_cls, box_pred, scale_factor_wh, img_whwh):
    '\n        Arguments:\n            box_cls (Tensor): tensor of shape (batch_size, num_proposals, K).\n                The tensor predicts the classification probability for each proposal.\n            box_pred (Tensor): tensors of shape (batch_size, num_proposals, 4).\n                The tensor predicts 4-vector (x,y,w,h) box\n                regression values for every proposal\n            scale_factor_wh (Tensor): tensors of shape [batch_size, 2] the scalor of  per img\n            img_whwh (Tensor): tensors of shape [batch_size, 4]\n        Returns:\n            bbox_pred (Tensor): tensors of shape [num_boxes, 6] Each row has 6 values:\n            [label, confidence, xmin, ymin, xmax, ymax]\n            bbox_num (Tensor): tensors of shape [batch_size] the number of RoIs in each image.\n        '
    assert (len(box_cls) == len(scale_factor_wh) == len(img_whwh))
    img_wh = img_whwh[:, :2]
    scores = F.sigmoid(box_cls)
    labels = paddle.arange(0, self.num_classes).unsqueeze(0).tile([self.num_proposals, 1]).flatten(start_axis=0, stop_axis=1)
    classes_all = []
    scores_all = []
    boxes_all = []
    for (i, (scores_per_image, box_pred_per_image)) in enumerate(zip(scores, box_pred)):
        (scores_per_image, topk_indices) = scores_per_image.flatten(0, 1).topk(self.num_proposals, sorted=False)
        labels_per_image = paddle.gather(labels, topk_indices, axis=0)
        box_pred_per_image = box_pred_per_image.reshape([(- 1), 1, 4]).tile([1, self.num_classes, 1]).reshape([(- 1), 4])
        box_pred_per_image = paddle.gather(box_pred_per_image, topk_indices, axis=0)
        classes_all.append(labels_per_image)
        scores_all.append(scores_per_image)
        boxes_all.append(box_pred_per_image)
    bbox_num = paddle.zeros([len(scale_factor_wh)], dtype='int32')
    boxes_final = []
    for i in range(len(scale_factor_wh)):
        classes = classes_all[i]
        boxes = boxes_all[i]
        scores = scores_all[i]
        boxes[:, 0::2] = (paddle.clip(boxes[:, 0::2], min=0, max=img_wh[i][0]) / scale_factor_wh[i][0])
        boxes[:, 1::2] = (paddle.clip(boxes[:, 1::2], min=0, max=img_wh[i][1]) / scale_factor_wh[i][1])
        (boxes_w, boxes_h) = ((boxes[:, 2] - boxes[:, 0]).numpy(), (boxes[:, 3] - boxes[:, 1]).numpy())
        keep = ((boxes_w > 1.0) & (boxes_h > 1.0))
        if (keep.sum() == 0):
            bboxes = paddle.zeros([1, 6]).astype('float32')
        else:
            boxes = paddle.to_tensor(boxes.numpy()[keep]).astype('float32')
            classes = paddle.to_tensor(classes.numpy()[keep]).astype('float32').unsqueeze((- 1))
            scores = paddle.to_tensor(scores.numpy()[keep]).astype('float32').unsqueeze((- 1))
            bboxes = paddle.concat([classes, scores, boxes], axis=(- 1))
        boxes_final.append(bboxes)
        bbox_num[i] = bboxes.shape[0]
    bbox_pred = paddle.concat(boxes_final)
    return (bbox_pred, bbox_num)