class_docstr: Faster RCNN box coder.
docstr: Encode a box collection with respect to anchor collection.
  
  Args:
    boxes: BoxList holding N boxes to be encoded.
    anchors: BoxList of anchors.
  
  Returns:
    a tensor representing N anchor-encoded boxes of the format
    [ty, tx, th, tw].
docstr_tok: ["Encode","a","box","collection","with","respect","to","anchor","collection",".","Args",":","boxes",":","BoxList","holding","N","boxes","to","be","encoded",".","anchors",":","BoxList","of","anchors",".","Returns",":","a","tensor","representing","N","anchor-encoded","boxes","of","the","format","[","ty",",","tx",",","th",",","tw","]","."]
code: def _encode(self, boxes, anchors):
      """Encode a box collection with respect to anchor collection.
  
      Args:
        boxes: BoxList holding N boxes to be encoded.
        anchors: BoxList of anchors.
  
      Returns:
        a tensor representing N anchor-encoded boxes of the format
        [ty, tx, th, tw].
      """
      # Convert anchors to the center coordinate representation.
      (
          ycenter_a,
          xcenter_a,
          ha,
          wa,
      ) = anchors.get_center_coordinates_and_sizes()
      ycenter, xcenter, h, w = boxes.get_center_coordinates_and_sizes()
      # Avoid NaN in division and log below.
      ha = tf.maximum(EPSILON, ha)
      wa = tf.maximum(EPSILON, wa)
      h = tf.maximum(EPSILON, h)
      w = tf.maximum(EPSILON, w)
  
      tx = (xcenter - xcenter_a) / wa
      ty = (ycenter - ycenter_a) / ha
      tw = tf.log(w / wa)
      th = tf.log(h / ha)
      # Scales location targets as used in paper for joint training.
      if self._scale_factors:
          ty *= self._scale_factors[0]
          tx *= self._scale_factors[1]
          th *= self._scale_factors[2]
          tw *= self._scale_factors[3]
      return tf.transpose(tf.stack([ty, tx, th, tw]))
  
file_path: DALI/docs/examples/use_cases/tensorflow/efficientdet/pipeline/anchors_utils/faster_rcnn_box_coder.py
imports: import tensorflow.compat.v1
  from .None import box_coder
  from .None import box_list
label_desc: Use image node_id 3 for calling the FasterRcnnBoxCoder obj's underlying member method code with example usage: obj._encode(boxes, anchors) and returns: tf