class_docstr: Multi-scale anchors class.
class_docstr_tok: ["Multi-scale","anchors","class","."]
docstr: Generates multiscale anchor boxes.
docstr_tok: ["Generates","multiscale","anchor","boxes","."]
code: def _generate_boxes(self):
      """Generates multiscale anchor boxes."""
      boxes_all = []
      for _, configs in self.config.items():
          boxes_level = []
          for config in configs:
              stride, octave_scale, aspect, anchor_scale = config
              base_anchor_size_x = (
                  anchor_scale * stride[1] * 2**octave_scale
              )
              base_anchor_size_y = (
                  anchor_scale * stride[0] * 2**octave_scale
              )
              if isinstance(aspect, list):
                  aspect_x, aspect_y = aspect
              else:
                  aspect_x = np.sqrt(aspect)
                  aspect_y = 1.0 / aspect_x
              anchor_size_x_2 = base_anchor_size_x * aspect_x / 2.0
              anchor_size_y_2 = base_anchor_size_y * aspect_y / 2.0
  
              x = np.arange(
                  stride[1] / 2, self.image_size[1], stride[1]
              )
              y = np.arange(
                  stride[0] / 2, self.image_size[0], stride[0]
              )
              xv, yv = np.meshgrid(x, y)
              xv = xv.reshape(-1)
              yv = yv.reshape(-1)
  
              boxes = np.vstack(
                  (
                      yv - anchor_size_y_2,
                      xv - anchor_size_x_2,
                      yv + anchor_size_y_2,
                      xv + anchor_size_x_2,
                  )
              )
              boxes = np.swapaxes(boxes, 0, 1)
              boxes_level.append(np.expand_dims(boxes, axis=1))
          # concat anchors on the same level to the reshape NxAx4
          boxes_level = np.concatenate(boxes_level, axis=1)
          boxes_all.append(boxes_level.reshape([-1, 4]))
  
      anchor_boxes = np.vstack(boxes_all)
      anchor_boxes = tf.convert_to_tensor(
          anchor_boxes, dtype=tf.float32
      )
      return anchor_boxes
  
file_path: DALI/docs/examples/use_cases/tensorflow/efficientdet/pipeline/anchors.py
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 Anchors obj's underlying member method code with example usage: obj._generate_boxes() and returns: anchor_boxes