code: def libra_label_box(
      anchors,
      gt_boxes,
      gt_classes,
      positive_overlap,
      negative_overlap,
      num_classes,
  ):
      # TODO: use paddle API to speed up
      gt_classes = gt_classes.numpy()
      gt_overlaps = np.zeros((anchors.shape[0], num_classes))
      matches = np.zeros((anchors.shape[0]), dtype=np.int32)
      if len(gt_boxes) > 0:
          proposal_to_gt_overlaps = bbox_overlaps(
              anchors, gt_boxes
          ).numpy()
          overlaps_argmax = proposal_to_gt_overlaps.argmax(axis=1)
          overlaps_max = proposal_to_gt_overlaps.max(axis=1)
          # Boxes which with non-zero overlap with gt boxes
          overlapped_boxes_ind = np.where(overlaps_max > 0)[0]
          overlapped_boxes_gt_classes = gt_classes[
              overlaps_argmax[overlapped_boxes_ind]
          ]
  
          for idx in range(len(overlapped_boxes_ind)):
              gt_overlaps[
                  overlapped_boxes_ind[idx],
                  overlapped_boxes_gt_classes[idx],
              ] = overlaps_max[overlapped_boxes_ind[idx]]
              matches[overlapped_boxes_ind[idx]] = overlaps_argmax[
                  overlapped_boxes_ind[idx]
              ]
  
      gt_overlaps = paddle.to_tensor(gt_overlaps)
      matches = paddle.to_tensor(matches)
  
      matched_vals = paddle.max(gt_overlaps, axis=1)
      match_labels = paddle.full(matches.shape, -1, dtype="int32")
      match_labels = paddle.where(
          matched_vals < negative_overlap,
          paddle.zeros_like(match_labels),
          match_labels,
      )
      match_labels = paddle.where(
          matched_vals >= positive_overlap,
          paddle.ones_like(match_labels),
          match_labels,
      )
  
      return matches, match_labels, matched_vals
  
file_path: PaddleDetection/ppdet/modeling/proposal_generator/target.py
imports: import numpy
  import paddle
  from ..bbox_utils import bbox2delta, bbox_overlaps
label_desc: Use image node_id 12 for calling a global function with example usage: libra_label_box(anchors, gt_boxes, gt_classes, positive_overlap, negative_overlap, num_classes) and returns: matches,  match_labels,  matched_vals