code: def generate_anchors(
      base_size=16,
      ratios=[0.5, 1, 2],
      scales=2 ** np.arange(3, 6),
      stride=16,
      dense_anchor=False,
  ):
      """
      Generate anchor (reference) windows by enumerating aspect ratios X
      scales wrt a reference (0, 0, 15, 15) window.
      """
  
      base_anchor = np.array([1, 1, base_size, base_size]) - 1
      ratio_anchors = _ratio_enum(base_anchor, ratios)
      anchors = np.vstack(
          [
              _scale_enum(ratio_anchors[i, :], scales)
              for i in range(ratio_anchors.shape[0])
          ]
      )
      if dense_anchor:
          assert stride % 2 == 0
          anchors2 = anchors.copy()
          anchors2[:, :] += int(stride / 2)
          anchors = np.vstack((anchors, anchors2))
      # print('GA',base_anchor.shape, ratio_anchors.shape, anchors.shape)
      return anchors
  
file_path: insightface/detection/retinaface_anticov/rcnn/processing/generate_anchor.py
imports: from __future__ import print_function
  import sys
  from builtins import range
  import numpy
  from ..cython.anchors import anchors_cython
label_desc: Use image node_id 2 for calling a global function with example usage: generate_anchors(base_size, ratios, scales, stride, dense_anchor) and returns: anchors