class_docstr: assigner of rbox
  Args:
      pos_iou_thr (float): threshold of pos samples
      neg_iou_thr (float): threshold of neg samples
      min_iou_thr (float): the min threshold of samples
      ignore_iof_thr (int): the ignored threshold
class_docstr_tok: ["assigner","of","rbox","Args",":","pos_iou_thr","(","float",")",":","threshold","of","pos","samples","neg_iou_thr","(","float",")",":","threshold","of","neg","samples","min_iou_thr","(","float",")",":","the","min","threshold","of","samples","ignore_iof_thr","(","int",")",":","the","ignored","threshold"]
code: def assign_anchor(
      self,
      anchors,
      gt_bboxes,
      gt_labels,
      pos_iou_thr,
      neg_iou_thr,
      min_iou_thr=0.0,
      ignore_iof_thr=-2,
  ):
      assert anchors.shape[1] == 4 or anchors.shape[1] == 5
      assert gt_bboxes.shape[1] == 4 or gt_bboxes.shape[1] == 5
      anchors_xc_yc = anchors
      gt_bboxes_xc_yc = gt_bboxes
  
      # calc rbox iou
      anchors_xc_yc = anchors_xc_yc.astype(np.float32)
      gt_bboxes_xc_yc = gt_bboxes_xc_yc.astype(np.float32)
      anchors_xc_yc = paddle.to_tensor(anchors_xc_yc)
      gt_bboxes_xc_yc = paddle.to_tensor(gt_bboxes_xc_yc)
  
      try:
          from ext_op import rbox_iou
      except Exception as e:
          print(
              "import custom_ops error, try install ext_op "
              "following ppdet/ext_op/README.md",
              e,
          )
          sys.stdout.flush()
          sys.exit(-1)
  
      iou = rbox_iou(gt_bboxes_xc_yc, anchors_xc_yc)
      iou = iou.numpy()
      iou = iou.T
  
      # every gt's anchor's index
      gt_bbox_anchor_inds = iou.argmax(axis=0)
      gt_bbox_anchor_iou = iou[
          gt_bbox_anchor_inds, np.arange(iou.shape[1])
      ]
      gt_bbox_anchor_iou_inds = np.where(iou == gt_bbox_anchor_iou)[0]
  
      # every anchor's gt bbox's index
      anchor_gt_bbox_inds = iou.argmax(axis=1)
      anchor_gt_bbox_iou = iou[
          np.arange(iou.shape[0]), anchor_gt_bbox_inds
      ]
  
      # (1) set labels=-2 as default
      labels = np.ones((iou.shape[0],), dtype=np.int32) * ignore_iof_thr
  
      # (2) assign ignore
      labels[anchor_gt_bbox_iou < min_iou_thr] = ignore_iof_thr
  
      # (3) assign neg_ids -1
      assign_neg_ids1 = anchor_gt_bbox_iou >= min_iou_thr
      assign_neg_ids2 = anchor_gt_bbox_iou < neg_iou_thr
      assign_neg_ids = np.logical_and(assign_neg_ids1, assign_neg_ids2)
      labels[assign_neg_ids] = -1
  
      # anchor_gt_bbox_iou_inds
      # (4) assign max_iou as pos_ids >=0
      anchor_gt_bbox_iou_inds = anchor_gt_bbox_inds[
          gt_bbox_anchor_iou_inds
      ]
      # gt_bbox_anchor_iou_inds = np.logical_and(gt_bbox_anchor_iou_inds, anchor_gt_bbox_iou >= min_iou_thr)
      labels[gt_bbox_anchor_iou_inds] = gt_labels[
          anchor_gt_bbox_iou_inds
      ]
  
      # (5) assign >= pos_iou_thr as pos_ids
      iou_pos_iou_thr_ids = anchor_gt_bbox_iou >= pos_iou_thr
      iou_pos_iou_thr_ids_box_inds = anchor_gt_bbox_inds[
          iou_pos_iou_thr_ids
      ]
      labels[iou_pos_iou_thr_ids] = gt_labels[
          iou_pos_iou_thr_ids_box_inds
      ]
      return anchor_gt_bbox_inds, anchor_gt_bbox_iou, labels
  
imports: import sys
  import paddle
  from ppdet.core.workspace import register, serializable
  from .target import rpn_anchor_target, generate_proposal_target, generate_mask_target, libra_generate_proposal_target
  import numpy
label_desc: Use image node_id 4 for calling the RBoxAssigner obj's underlying member method code with example usage: obj.assign_anchor(anchors, gt_bboxes, gt_labels, pos_iou_thr, neg_iou_thr, min_iou_thr, ignore_iof_thr) and returns: anchor_gt_bbox_inds,  anchor_gt_bbox_iou,  labels