class_docstr: Bounding box anchor generator for Single-shot Object Detection, corresponding to anchors
  structure used in ssd_mobilenet_v1_coco from TF Object Detection API
  This class inherits SSDAnchorGenerator and uses the same input parameters.
  Main differences:
    - First branch is not added with another anchor with size extracted from
      the geomtric mean of current and next branch sizes.
    - First anchor in the first branch has half the size of the rest of the anchors.
    - Geometric sum anchors are added to all other branches as the last anchor.
class_docstr_tok: ["Bounding","box","anchor","generator","for","Single-shot","Object","Detection",",","corresponding","to","anchors","structure","used","in","ssd_mobilenet_v1_coco","from","TF","Object","Detection","API","This","class","inherits","SSDAnchorGenerator","and","uses","the","same","input","parameters",".","Main","differences",":","-","First","branch","is","not","added","with","another","anchor","with","size","extracted","from","the","geomtric","mean","of","current","and","next","branch","sizes",".","-","First","anchor","in","the","first","branch","has","half","the","size","of","the","rest","of","the","anchors",".","-","Geometric","sum","anchors","are","added","to","all","other","branches","as","the","last","anchor","."]
docstr: Generate anchors for once. Anchors are stored with (center_x, center_y, w, h) format.
docstr_tok: ["Generate","anchors","for","once",".","Anchors","are","stored","with","(","center_x",",","center_y",",","w",",","h",")","format","."]
code: def _generate_anchors(self, sizes, ratios, step, alloc_size, offsets):
      """Generate anchors for once. Anchors are stored with (center_x, center_y, w, h) format."""
      assert (
          len(sizes) == 2
      ), "SSD requires sizes to be (size_min, size_max)"
      anchors = []
      for i in range(alloc_size[0]):
          for j in range(alloc_size[1]):
              cy = (i + offsets[0]) * step
              cx = (j + offsets[1]) * step
              # ratio = ratios[0], size = size_min or sqrt(size_min * size_max)
              r = ratios[0]
              anchors.append([cx, cy, sizes[0] / 2, sizes[0] / 2])
              # size = sizes[0], ratio = ...
              for r in ratios[1:]:
                  sr = np.sqrt(r)
                  w = sizes[0] * sr
                  h = sizes[0] / sr
                  anchors.append([cx, cy, w, h])
              if self._index > 0:
                  anchors.append([cx, cy, sizes[1], sizes[1]])
      return np.array(anchors).reshape(
          1, 1, alloc_size[0], alloc_size[1], -1
      )
  
file_path: gluon-cv/gluoncv/model_zoo/ssd/anchor.py
imports: from __future__ import absolute_import
  import numpy
  from mxnet import gluon
label_desc: Use image node_id 1 for calling the LiteAnchorGenerator obj's underlying member method code with example usage: obj._generate_anchors(sizes, ratios, step, alloc_size, offsets) and returns: np