class_docstr: Args:
      input_shape (int): network input image size
      scale_factor (float): scale factor of ori image
code: def _non_max_suppression(self, prediction, scale_factor):
      batch_size = prediction.shape[0]
      out_boxes_list = []
      box_num_list = []
      for batch_id in range(batch_size):
          bboxes, confidences = (
              prediction[batch_id][..., :4],
              prediction[batch_id][..., 4:],
          )
          # nms
          picked_box_probs = []
          picked_labels = []
          for class_index in range(0, confidences.shape[1]):
              probs = confidences[:, class_index]
              mask = probs > self.score_threshold
              probs = probs[mask]
              if probs.shape[0] == 0:
                  continue
              subset_boxes = bboxes[mask, :]
              box_probs = np.concatenate(
                  [subset_boxes, probs.reshape(-1, 1)], axis=1
              )
              box_probs = hard_nms(
                  box_probs,
                  iou_threshold=self.nms_threshold,
                  top_k=self.nms_top_k,
              )
              picked_box_probs.append(box_probs)
              picked_labels.extend([class_index] * box_probs.shape[0])
  
          if len(picked_box_probs) == 0:
              out_boxes_list.append(np.empty((0, 4)))
  
          else:
              picked_box_probs = np.concatenate(picked_box_probs)
              # resize output boxes
              picked_box_probs[:, 0] /= scale_factor[batch_id][1]
              picked_box_probs[:, 2] /= scale_factor[batch_id][1]
              picked_box_probs[:, 1] /= scale_factor[batch_id][0]
              picked_box_probs[:, 3] /= scale_factor[batch_id][0]
  
              # clas score box
              out_box = np.concatenate(
                  [
                      np.expand_dims(np.array(picked_labels), axis=-1),
                      np.expand_dims(picked_box_probs[:, 4], axis=-1),
                      picked_box_probs[:, :4],
                  ],
                  axis=1,
              )
              if out_box.shape[0] > self.keep_top_k:
                  out_box = out_box[
                      out_box[:, 1].argsort()[::-1][: self.keep_top_k]
                  ]
              out_boxes_list.append(out_box)
              box_num_list.append(out_box.shape[0])
  
      out_boxes_list = np.concatenate(out_boxes_list, axis=0)
      box_num_list = np.array(box_num_list)
      return out_boxes_list, box_num_list
  
file_path: PaddleDetection/deploy/auto_compression/post_process.py
imports: import numpy
  import cv2
label_desc: Use image node_id 2 for calling the PPYOLOEPostProcess obj's underlying member method code with example usage: obj._non_max_suppression(prediction, scale_factor) and returns: out_boxes_list,  box_num_list