class_docstr: Bounding box anchor generator for Single-shot Object Detection.
  
  Parameters
  ----------
  index : int
      Index of this generator in SSD models, this is required for naming.
  sizes : iterable of floats
      Sizes of anchor boxes.
  ratios : iterable of floats
      Aspect ratios of anchor boxes.
  step : int or float
      Step size of anchor boxes.
  alloc_size : tuple of int
      Allocate size for the anchor boxes as (H, W).
      Usually we generate enough anchors for large feature map, e.g. 128x128.
      Later in inference we can have variable input sizes,
      at which time we can crop corresponding anchors from this large
      anchor map so we can skip re-generating anchors for each input.
  offsets : tuple of float
      Center offsets of anchor boxes as (h, w) in range(0, 1).
class_docstr_tok: ["Bounding","box","anchor","generator","for","Single-shot","Object","Detection",".","Parameters","--","--","--","--","--","index",":","int","Index","of","this","generator","in","SSD","models",",","this","is","required","for","naming",".","sizes",":","iterable","of","floats","Sizes","of","anchor","boxes",".","ratios",":","iterable","of","floats","Aspect","ratios","of","anchor","boxes",".","step",":","int","or","float","Step","size","of","anchor","boxes",".","alloc_size",":","tuple","of","int","Allocate","size","for","the","anchor","boxes","as","(","H",",","W",")",".","Usually","we","generate","enough","anchors","for","large","feature","map",",","e.g",".","128x128",".","Later","in","inference","we","can","have","variable","input","sizes",",","at","which","time","we","can","crop","corresponding","anchors","from","this","large","anchor","map","so","we","can","skip","re-generating","anchors","for","each","input",".","offsets",":","tuple","of","float","Center","offsets","of","anchor","boxes","as","(","h",",","w",")","in","range","(","0",",","1",")","."]
code: def __init__(
      self,
      index,
      im_size,
      sizes,
      ratios,
      step,
      alloc_size=(128, 128),
      offsets=(0.5, 0.5),
      clip=False,
      **kwargs,
  ):
      super(SSDAnchorGenerator, self).__init__(**kwargs)
      assert len(im_size) == 2
      self._im_size = im_size
      self._clip = clip
      self._sizes = (sizes[0], np.sqrt(sizes[0] * sizes[1]))
      self._ratios = ratios
      self._index = index
      anchors = self._generate_anchors(
          self._sizes, self._ratios, step, alloc_size, offsets
      )
      self.anchors = self.params.get_constant(
          "anchor_%d" % (self._index), anchors
      )
  
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 to create a new SSDAnchorGenerator object from inherited base classes: gluon with example: obj = SSDAnchorGenerator(index, im_size, sizes, ratios, step, alloc_size, offsets, clip)