class_docstr: Postprocess the model outputs to get final prediction:
      1. Do NMS for heatmap to get top `max_per_img` bboxes.
      2. Decode bboxes using center offset and box size.
      3. Rescale decoded bboxes reference to the origin image shape.
  Args:
      max_per_img(int): the maximum number of predicted objects in a image,
          500 by default.
      down_ratio(int): the down ratio from images to heatmap, 4 by default.
      regress_ltrb (bool): whether to regress left/top/right/bottom or
          width/height for a box, true by default.
class_docstr_tok: ["Postprocess","the","model","outputs","to","get","final","prediction",":","1",".","Do","NMS","for","heatmap","to","get","top","`","max_per_img","`","bboxes",".","2",".","Decode","bboxes","using","center","offset","and","box","size",".","3",".","Rescale","decoded","bboxes","reference","to","the","origin","image","shape",".","Args",":","max_per_img","(","int",")",":","the","maximum","number","of","predicted","objects","in","a","image",",","500","by","default",".","down_ratio","(","int",")",":","the","down","ratio","from","images","to","heatmap",",","4","by","default",".","regress_ltrb","(","bool",")",":","whether","to","regress","left\/top\/right\/bottom","or","width\/height","for","a","box",",","true","by","default","."]
code: def __call__(self, hm, wh, reg, im_shape, scale_factor):
      # 1.get clses and scores, note that hm had been done sigmoid
      heat = self._simple_nms(hm)
      scores, inds, topk_clses, ys, xs = self._topk(heat)
      clses = topk_clses.unsqueeze(1)
      scores = scores.unsqueeze(1)
  
      # 2.get bboxes, note only support batch_size=1 now
      reg_t = paddle.transpose(reg, [0, 2, 3, 1])
      reg = paddle.reshape(reg_t, [-1, reg_t.shape[-1]])
      reg = paddle.gather(reg, inds)
      xs = paddle.cast(xs, "float32")
      ys = paddle.cast(ys, "float32")
      xs = xs + reg[:, 0:1]
      ys = ys + reg[:, 1:2]
      wh_t = paddle.transpose(wh, [0, 2, 3, 1])
      wh = paddle.reshape(wh_t, [-1, wh_t.shape[-1]])
      wh = paddle.gather(wh, inds)
      if self.regress_ltrb:
          x1 = xs - wh[:, 0:1]
          y1 = ys - wh[:, 1:2]
          x2 = xs + wh[:, 2:3]
          y2 = ys + wh[:, 3:4]
      else:
          x1 = xs - wh[:, 0:1] / 2
          y1 = ys - wh[:, 1:2] / 2
          x2 = xs + wh[:, 0:1] / 2
          y2 = ys + wh[:, 1:2] / 2
      n, c, feat_h, feat_w = paddle.shape(hm)
      padw = (feat_w * self.down_ratio - im_shape[0, 1]) / 2
      padh = (feat_h * self.down_ratio - im_shape[0, 0]) / 2
      x1 = x1 * self.down_ratio
      y1 = y1 * self.down_ratio
      x2 = x2 * self.down_ratio
      y2 = y2 * self.down_ratio
      x1 = x1 - padw
      y1 = y1 - padh
      x2 = x2 - padw
      y2 = y2 - padh
      bboxes = paddle.concat([x1, y1, x2, y2], axis=1)
      scale_y = scale_factor[:, 0:1]
      scale_x = scale_factor[:, 1:2]
      scale_expand = paddle.concat(
          [scale_x, scale_y, scale_x, scale_y], axis=1
      )
      boxes_shape = bboxes.shape[:]
      scale_expand = paddle.expand(scale_expand, shape=boxes_shape)
      bboxes = paddle.divide(bboxes, scale_expand)
  
      results = paddle.concat([clses, scores, bboxes], axis=1)
      return (
          results,
          paddle.shape(results)[0:1],
          inds,
          topk_clses,
          ys,
          xs,
      )
  
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 4 for calling the CenterNetPostProcess obj's underlying member method code with example usage: obj.__call__(hm, wh, reg, im_shape, scale_factor) and returns: results,  paddle,  inds,  topk_clses,  ys,  xs