class_docstr: Base class for YOLOv2 and YOLOv2Tiny.
  
  A subclass of this class should have :obj:`_extractor`,
  :obj:`_models`, and :obj:`_anchors`.
class_docstr_tok: ["Base","class","for","YOLOv2","and","YOLOv2Tiny",".","A","subclass","of","this","class","should","have",":","obj",":","`","_extractor","`",",",":","obj",":","`","_models","`",",","and",":","obj",":","`","_anchors","`","."]
code: def __init__(self, n_fg_class=None, pretrained_model=None):
      super(YOLOv2Base, self).__init__()
  
      param, path = utils.prepare_pretrained_model(
          {"n_fg_class": n_fg_class}, pretrained_model, self._models
      )
  
      self.n_fg_class = param["n_fg_class"]
      self.use_preset("visualize")
  
      with self.init_scope():
          self.extractor = self._extractor()
          self.subnet = Convolution2D(
              len(self._anchors) * (4 + 1 + self.n_fg_class), 1
          )
  
      default_bbox = []
      for v, u in itertools.product(
          range(self.extractor.grid), repeat=2
      ):
          for h, w in self._anchors:
              default_bbox.append((v, u, h, w))
      self._default_bbox = np.array(default_bbox, dtype=np.float32)
  
      if path:
          chainer.serializers.load_npz(path, self, strict=False)
  
imports: from __future__ import division
  import itertools
  import numpy
  import chainer
  from chainer.backends import cuda
  import chainer.functions
  from chainer.links import Convolution2D
  from chainercv.links import Conv2DBNActiv
  from chainercv import utils
  from chainercv.links.model.yolo.yolo_base import YOLOBase
label_desc: Use image node_id 1 to create a new YOLOv2Base object from inherited base classes: YOLOBase with example: obj = YOLOv2Base(n_fg_class, pretrained_model)