class_docstr: YOLO output layer V3.
  Parameters
  ----------
  index : int
      Index of the yolo output layer, to avoid naming conflicts only.
  num_class : int
      Number of foreground objects.
  anchors : iterable
      The anchor setting. Reference: https://arxiv.org/pdf/1804.02767.pdf.
  stride : int
      Stride of feature map.
  alloc_size : tuple of int, default is (128, 128)
      For advanced users. Define `alloc_size` to generate large enough anchor
      maps, which will later saved in parameters. During inference, we support arbitrary
      input image by cropping corresponding area of the anchor map. This allow us
      to export to symbol so we can run it in c++, Scalar, etc.
class_docstr_tok: ["YOLO","output","layer","V3",".","Parameters","--","--","--","--","--","index",":","int","Index","of","the","yolo","output","layer",",","to","avoid","naming","conflicts","only",".","num_class",":","int","Number","of","foreground","objects",".","anchors",":","iterable","The","anchor","setting",".","Reference",":","https",":","\/\/arxiv.org\/pdf\/1804.02767.pdf",".","stride",":","int","Stride","of","feature","map",".","alloc_size",":","tuple","of","int",",","default","is","(","128",",","128",")","For","advanced","users",".","Define","`","alloc_size","`","to","generate","large","enough","anchor","maps",",","which","will","later","saved","in","parameters",".","During","inference",",","we","support","arbitrary","input","image","by","cropping","corresponding","area","of","the","anchor","map",".","This","allow","us","to","export","to","symbol","so","we","can","run","it","in","c++",",","Scalar",",","etc","."]
docstr: Reset class prediction.
  Parameters
  ----------
  classes : type
      Description of parameter `classes`.
  reuse_weights : dict
      A {new_integer : old_integer} mapping dict that allows the new predictor to reuse the
      previously trained weights specified by the integer index.
  Returns
  -------
  type
      Description of returned object.
code: def reset_class(self, classes, reuse_weights=None):
      """Reset class prediction.
      Parameters
      ----------
      classes : type
          Description of parameter `classes`.
      reuse_weights : dict
          A {new_integer : old_integer} mapping dict that allows the new predictor to reuse the
          previously trained weights specified by the integer index.
      Returns
      -------
      type
          Description of returned object.
      """
      self._clear_cached_op()
      # keep old records
      old_classes = self._classes
      old_pred = self.prediction
      old_num_pred = self._num_pred
      ctx = list(old_pred.params.values())[0].list_ctx()
      self._classes = len(classes)
      self._num_pred = 1 + 4 + len(classes)
      all_pred = self._num_pred * self._num_anchors
      # to avoid deferred init, number of in_channels must be defined
      in_channels = list(old_pred.params.values())[0].shape[1]
      self.prediction = nn.Conv2D(
          all_pred,
          kernel_size=1,
          padding=0,
          strides=1,
          in_channels=in_channels,
          prefix=old_pred.prefix,
      )
      self.prediction.initialize(ctx=ctx)
      if reuse_weights:
          new_pred = self.prediction
          assert isinstance(reuse_weights, dict)
          for old_params, new_params in zip(
              old_pred.params.values(), new_pred.params.values()
          ):
              old_data = old_params.data()
              new_data = new_params.data()
              for k, v in reuse_weights.items():
                  if k >= self._classes or v >= old_classes:
                      warnings.warn(
                          "reuse mapping {}/{} -> {}/{} out of range".format(
                              k, self._classes, v, old_classes
                          )
                      )
                      continue
                  for i in range(self._num_anchors):
                      off_new = i * self._num_pred
                      off_old = i * old_num_pred
                      # copy along the first dimension
                      new_data[1 + 4 + k + off_new] = old_data[
                          1 + 4 + v + off_old
                      ]
                      # copy non-class weights as well
                      new_data[off_new : 1 + 4 + off_new] = old_data[
                          off_old : 1 + 4 + off_old
                      ]
              # set data to new conv layers
              new_params.set_data(new_data)
  
imports: from __future__ import absolute_import
  from __future__ import division
  import os
  import warnings
  import numpy
  import mxnet
  from mxnet import gluon
  from mxnet import autograd
  from mxnet.gluon import nn
  from mxnet.gluon.nn import BatchNorm
  from .darknet import _conv2d, darknet53
  from ..mobilenet import get_mobilenet
  from .yolo_target import YOLOV3TargetMerger
  from ...loss import YOLOV3Loss
label_desc: Use image node_id 2 for calling the YOLOOutputV3 obj's underlying member method code with example usage: obj.reset_class(classes, reuse_weights) without return types