docstr: Decode the bbox and do NMS if needed.
  
  Args:
      head_out (tuple): bbox_pred and cls_prob of bbox_head output.
      rois (tuple): roi and rois_num of rpn_head output.
      im_shape (Tensor): The shape of the input image.
      scale_factor (Tensor): The scale factor of the input image.
      export_onnx (bool): whether export model to onnx
  Returns:
      bbox_pred (Tensor): The output prediction with shape [N, 6], including
          labels, scores and bboxes. The size of bboxes are corresponding
          to the input image, the bboxes may be used in other branch.
      bbox_num (Tensor): The number of prediction boxes of each batch with
          shape [1], and is N.
code: def __call__(self, head_out, rois, im_shape, scale_factor):
      """
      Decode the bbox and do NMS if needed.
  
      Args:
          head_out (tuple): bbox_pred and cls_prob of bbox_head output.
          rois (tuple): roi and rois_num of rpn_head output.
          im_shape (Tensor): The shape of the input image.
          scale_factor (Tensor): The scale factor of the input image.
          export_onnx (bool): whether export model to onnx
      Returns:
          bbox_pred (Tensor): The output prediction with shape [N, 6], including
              labels, scores and bboxes. The size of bboxes are corresponding
              to the input image, the bboxes may be used in other branch.
          bbox_num (Tensor): The number of prediction boxes of each batch with
              shape [1], and is N.
      """
      if self.nms is not None:
          bboxes, score = self.decode(
              head_out, rois, im_shape, scale_factor
          )
          bbox_pred, bbox_num, before_nms_indexes = self.nms(
              bboxes, score, self.num_classes
          )
  
      else:
          bbox_pred, bbox_num = self.decode(
              head_out, rois, im_shape, scale_factor
          )
  
      if self.export_onnx:
          # add fake box after postprocess when exporting onnx
          fake_bboxes = paddle.to_tensor(
              np.array(
                  [[0.0, 0.0, 0.0, 0.0, 1.0, 1.0]], dtype="float32"
              )
          )
  
          bbox_pred = paddle.concat([bbox_pred, fake_bboxes])
          bbox_num = bbox_num + 1
  
      if self.nms is not None:
          return bbox_pred, bbox_num, before_nms_indexes
      else:
          return bbox_pred, bbox_num
  
imports: import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register
  from ppdet.modeling.bbox_utils import nonempty_bbox
  from .transformers import bbox_cxcywh_to_xyxy
label_desc: Use image node_id 2 for calling the BBoxPostProcess obj's underlying member method code with example usage: obj.__call__(head_out, rois, im_shape, scale_factor) and returns: bbox_pred,  bbox_num,  before_nms_indexes, bbox_pred,  bbox_num