code: def im_detect(rois, scores, bbox_deltas, im_info,
                bbox_stds, nms_thresh, conf_thresh):
      
      rois = rois.asnumpy()
      scores = scores.asnumpy()
      bbox_deltas = bbox_deltas.asnumpy()
  
      im_info = im_info.asnumpy()
      height, width, scale = im_info
  
      # post processing
      pred_boxes = bbox_pred(rois, bbox_deltas, bbox_stds)
      pred_boxes = clip_boxes(pred_boxes, (height, width))
  
      # we used scaled image & roi to train, so it is necessary to transform them back
      pred_boxes = pred_boxes / scale
  
      # convert to per class detection results
      det = []
      for j in range(1, scores.shape[-1]):
          indexes = np.where(scores[:, j] > conf_thresh)[0]
          cls_scores = scores[indexes, j, np.newaxis]
          cls_boxes = pred_boxes[indexes, j * 4:(j + 1) * 4]
          cls_dets = np.hstack((cls_boxes, cls_scores))
          keep = nms(cls_dets, thresh=nms_thresh)
  
          cls_id = np.ones_like(cls_scores) * j
          det.append(np.hstack((cls_id, cls_scores, cls_boxes))[keep, :])
  
      # assemble all classes
      det = np.concatenate(det, axis=0)
      return det
docs: rois (nroi, 4), scores (nrois, nclasses), bbox_deltas (nrois, 4 * nclasses), im_info (3)