class_docstr: Estimator implementation for YOLOv3.
  
  Parameters
  ----------
  config : dict
      Config in nested dict.
  logger : logging.Logger, default is None
      Optional logger for this estimator, can be `None` when default setting is used.
  reporter : callable, default is None
      If set, use reporter callback to report the metrics of the current estimator.
  
  Attributes
  ----------
  _logger : logging.Logger
      The customized/default logger for this estimator.
  _logdir : str
      The temporary dir for logs.
  _cfg : autocfg.dataclass
      The configurations.
class_docstr_tok: ["Estimator","implementation","for","YOLOv3",".","Parameters","--","--","--","--","--","config",":","dict","Config","in","nested","dict",".","logger",":","logging.Logger",",","default","is","None","Optional","logger","for","this","estimator",",","can","be","`","None","`","when","default","setting","is","used",".","reporter",":","callable",",","default","is","None","If","set",",","use","reporter","callback","to","report","the","metrics","of","the","current","estimator",".","Attributes","--","--","--","--","--","_logger",":","logging.Logger","The","customized\/default","logger","for","this","estimator",".","_logdir",":","str","The","temporary","dir","for","logs",".","_cfg",":","autocfg.dataclass","The","configurations","."]
code: def _init_network(self, **kwargs):
      load_only = kwargs.get("load_only", False)
      if not self.num_class:
          raise ValueError(
              "Unable to create network when `num_class` is unknown. \
                  It should be inferred from dataset or resumed from saved states."
          )
      assert len(self.classes) == self.num_class
  
      # training contexts
      if self._cfg.horovod:
          self.ctx = [mx.gpu(hvd.local_rank())]
      else:
          valid_gpus = []
          if self._cfg.gpus:
              valid_gpus = self._validate_gpus(self._cfg.gpus)
              if not valid_gpus:
                  self._logger.warning(
                      "No gpu detected, fallback to cpu. You can ignore this warning if this is intended."
                  )
              elif len(valid_gpus) != len(self._cfg.gpus):
                  self._logger.warning(
                      f"Loaded on gpu({valid_gpus}), different from gpu({self._cfg.gpus})."
                  )
          ctx = [mx.gpu(int(i)) for i in valid_gpus]
          self.ctx = ctx if ctx else [mx.cpu()]
  
      if self._cfg.yolo3.transfer is None:
          # use sync bn if specified
          if self._cfg.yolo3.syncbn and len(self.ctx) > 1:
              self.net = custom_yolov3(
                  base_network_name=self._cfg.yolo3.base_network,
                  filters=self._cfg.yolo3.filters,
                  anchors=self._cfg.yolo3.anchors,
                  strides=self._cfg.yolo3.strides,
                  classes=self.classes,
                  dataset=self._cfg.dataset,
                  pretrained_base=(not load_only),
                  norm_layer=gluon.contrib.nn.SyncBatchNorm,
                  norm_kwargs={"num_devices": len(self.ctx)},
              )
              self.async_net = custom_yolov3(
                  base_network_name=self._cfg.yolo3.base_network,
                  filters=self._cfg.yolo3.filters,
                  anchors=self._cfg.yolo3.anchors,
                  strides=self._cfg.yolo3.strides,
                  classes=self.classes,
                  dataset=self._cfg.dataset,
                  pretrained_base=False,
              )
          else:
              self.net = custom_yolov3(
                  base_network_name=self._cfg.yolo3.base_network,
                  filters=self._cfg.yolo3.filters,
                  anchors=self._cfg.yolo3.anchors,
                  strides=self._cfg.yolo3.strides,
                  classes=self.classes,
                  dataset=self._cfg.dataset,
                  pretrained_base=(not load_only),
              )
              self.async_net = self.net
      else:
          assert isinstance(self._cfg.yolo3.transfer, str)
          self._logger.info(
              f"Using transfer learning from {self._cfg.yolo3.transfer}, the other network parameters are ignored."
          )
          # use sync bn if specified
          if self._cfg.yolo3.syncbn and len(self.ctx) > 1:
              self.net = get_model(
                  self._cfg.yolo3.transfer,
                  pretrained=(not load_only),
                  norm_layer=gluon.contrib.nn.SyncBatchNorm,
                  norm_kwargs={"num_devices": len(self.ctx)},
              )
              self.async_net = get_model(
                  self._cfg.yolo3.transfer, pretrained=(not load_only)
              )  # used by cpu worker
          else:
              self.net = get_model(
                  self._cfg.yolo3.transfer, pretrained=(not load_only)
              )
              self.async_net = self.net
          if load_only:
              with warnings.catch_warnings(record=True) as w:
                  warnings.simplefilter("always")
                  self.net.initialize()
              self.net.set_nms(nms_thresh=0)
              self.net(
                  mx.nd.zeros(
                      (
                          1,
                          3,
                          self._cfg.yolo3.data_shape,
                          self._cfg.yolo3.data_shape,
                      )
                  )
              )
              self.net.set_nms(
                  nms_thresh=self._cfg.yolo3.nms_thresh,
                  nms_topk=self._cfg.yolo3.nms_topk,
              )
          self.net.reset_class(
              self.classes,
              reuse_weights=[
                  cname
                  for cname in self.classes
                  if cname in self.net.classes
              ],
          )
  
      with warnings.catch_warnings(record=True) as _:
          warnings.simplefilter("always")
          self.net.initialize()
          self.async_net.initialize()
      self.net.collect_params().reset_ctx(self.ctx)
  
imports: import os
  import math
  import time
  import warnings
  from PIL import Image
  import pandas
  import numpy
  import mxnet
  from mxnet import gluon
  from mxnet import autograd
  from mxnet.contrib import amp
  from ....None import utils
  from ....data.batchify import Tuple, Stack, Pad
  from ....data.transforms.presets.yolo import YOLO3DefaultValTransform
  from ....data.transforms.presets.yolo import load_test, transform_test
  from ....model_zoo import get_model
  from ....model_zoo import custom_yolov3
  from ....utils.metrics.voc_detection import VOC07MApMetric, VOCMApMetric
  from ....utils import LRScheduler, LRSequential
  from ..base_estimator import BaseEstimator, set_default
  from .utils import _get_dataloader
  from ...data.dataset import ObjectDetectionDataset
  from ..conf import _BEST_CHECKPOINT_FILE
  from ..utils import EarlyStopperOnPlateau
  from .default import YOLOv3Cfg
label_desc: Use image node_id 7 for calling the YOLOv3Estimator obj's underlying member method code with example usage: obj._init_network() without return types