class_docstr: Labeler for multiscale anchor boxes.
class_docstr_tok: ["Labeler","for","multiscale","anchor","boxes","."]
docstr: Labels anchors with ground truth inputs.
  
  Args:
    gt_boxes: A float tensor with shape [N, 4] representing groundtruth boxes.
      For each row, it stores [y0, x0, y1, x1] for four corners of a box.
    gt_labels: A integer tensor with shape [N, 1] representing groundtruth
      classes.
  Returns:
    cls_targets_dict: ordered dictionary with keys
      [min_level, min_level+1, ..., max_level]. The values are tensor with
      shape [height_l, width_l, num_anchors]. The height_l and width_l
      represent the dimension of class logits at l-th level.
    box_targets_dict: ordered dictionary with keys
      [min_level, min_level+1, ..., max_level]. The values are tensor with
      shape [height_l, width_l, num_anchors * 4]. The height_l and
      width_l represent the dimension of bounding box regression output at
      l-th level.
    num_positives: scalar tensor storing number of positives in an image.
docstr_tok: ["Labels","anchors","with","ground","truth","inputs",".","Args",":","gt_boxes",":","A","float","tensor","with","shape","[","N",",","4","]","representing","groundtruth","boxes",".","For","each","row",",","it","stores","[","y0",",","x0",",","y1",",","x1","]","for","four","corners","of","a","box",".","gt_labels",":","A","integer","tensor","with","shape","[","N",",","1","]","representing","groundtruth","classes",".","Returns",":","cls_targets_dict",":","ordered","dictionary","with","keys","[","min_level",",","min_level+1",",","...",",","max_level","]",".","The","values","are","tensor","with","shape","[","height_l",",","width_l",",","num_anchors","]",".","The","height_l","and","width_l","represent","the","dimension","of","class","logits","at","l-th","level",".","box_targets_dict",":","ordered","dictionary","with","keys","[","min_level",",","min_level+1",",","...",",","max_level","]",".","The","values","are","tensor","with","shape","[","height_l",",","width_l",",","num_anchors","*","4","]",".","The","height_l","and","width_l","represent","the","dimension","of","bounding","box","regression","output","at","l-th","level",".","num_positives",":","scalar","tensor","storing","number","of","positives","in","an","image","."]
code: def label_anchors(self, gt_boxes, gt_labels):
      """Labels anchors with ground truth inputs.
  
      Args:
        gt_boxes: A float tensor with shape [N, 4] representing groundtruth boxes.
          For each row, it stores [y0, x0, y1, x1] for four corners of a box.
        gt_labels: A integer tensor with shape [N, 1] representing groundtruth
          classes.
      Returns:
        cls_targets_dict: ordered dictionary with keys
          [min_level, min_level+1, ..., max_level]. The values are tensor with
          shape [height_l, width_l, num_anchors]. The height_l and width_l
          represent the dimension of class logits at l-th level.
        box_targets_dict: ordered dictionary with keys
          [min_level, min_level+1, ..., max_level]. The values are tensor with
          shape [height_l, width_l, num_anchors * 4]. The height_l and
          width_l represent the dimension of bounding box regression output at
          l-th level.
        num_positives: scalar tensor storing number of positives in an image.
      """
      gt_box_list = box_list.BoxList(gt_boxes)
      anchor_box_list = box_list.BoxList(self._anchors.boxes)
  
      # cls_weights, box_weights are not used
      (
          cls_targets,
          _,
          box_targets,
          _,
          matches,
      ) = self._target_assigner.assign(
          anchor_box_list, gt_box_list, gt_labels
      )
  
      # class labels start from 1 and the background class = -1
      cls_targets -= 1
      cls_targets = tf.cast(cls_targets, tf.int32)
  
      # Unpack labels.
      cls_targets_dict = self._unpack_labels(cls_targets)
      box_targets_dict = self._unpack_labels(box_targets)
      num_positives = tf.reduce_sum(
          tf.cast(tf.not_equal(matches.match_results, -1), tf.float32)
      )
  
      return cls_targets_dict, box_targets_dict, num_positives
  
imports: import collections
  import numpy
  import tensorflow
  import utils
  from .anchors_utils import argmax_matcher
  from .anchors_utils import box_list
  from .anchors_utils import faster_rcnn_box_coder
  from .anchors_utils import region_similarity_calculator
  from .anchors_utils import target_assigner
label_desc: Use image node_id 3 for calling the AnchorLabeler obj's underlying member method code with example usage: obj.label_anchors(gt_boxes, gt_labels) and returns: cls_targets_dict,  box_targets_dict,  num_positives