class_docstr: Estimator implementation for Image Classification.
  
  Parameters
  ----------
  config : dict
      Config in nested dict.
  logger : logging.Logger
      Optional logger for this estimator, can be `None` when default setting is used.
  reporter : callable
      The reporter for metric checkpointing.
  net : mx.gluon.Block
      The custom network. If defined, the model name in config will be ignored so your
      custom network will be used for training rather than pulling it from model zoo.
class_docstr_tok: ["Estimator","implementation","for","Image","Classification",".","Parameters","--","--","--","--","--","config",":","dict","Config","in","nested","dict",".","logger",":","logging.Logger","Optional","logger","for","this","estimator",",","can","be","`","None","`","when","default","setting","is","used",".","reporter",":","callable","The","reporter","for","metric","checkpointing",".","net",":","mx.gluon.Block","The","custom","network",".","If","defined",",","the","model","name","in","config","will","be","ignored","so","your","custom","network","will","be","used","for","training","rather","than","pulling","it","from","model","zoo","."]
code: def _init_trainer(self):
      if self.last_train is None:
          raise RuntimeError(
              "Cannot init trainer without knowing the size of training data"
          )
      if isinstance(self.last_train, pd.DataFrame):
          train_size = len(self.last_train)
      elif isinstance(self.last_train, int):
          train_size = self.last_train
      else:
          raise ValueError(
              "Unknown type of self.last_train: {}".format(
                  type(self.last_train)
              )
          )
  
      num_gpus = len(self.ctx)
      batch_size = self._cfg.train.batch_size
      self.batch_size = batch_size
      lr_decay = self._cfg.train.lr_decay
      lr_decay_period = self._cfg.train.lr_decay_period
      if self._cfg.train.lr_decay_period > 0:
          lr_decay_epoch = list(
              range(
                  lr_decay_period,
                  self._cfg.train.epochs,
                  lr_decay_period,
              )
          )
      else:
          lr_decay_epoch = [
              int(i) for i in self._cfg.train.lr_decay_epoch.split(",")
          ]
      lr_decay_epoch = [
          e - self._cfg.train.warmup_epochs for e in lr_decay_epoch
      ]
      num_batches = train_size // batch_size
  
      lr_scheduler = LRSequential(
          [
              LRScheduler(
                  "linear",
                  base_lr=0,
                  target_lr=self._cfg.train.lr,
                  nepochs=self._cfg.train.warmup_epochs,
                  iters_per_epoch=num_batches,
              ),
              LRScheduler(
                  self._cfg.train.lr_mode,
                  base_lr=self._cfg.train.lr,
                  target_lr=0,
                  nepochs=self._cfg.train.epochs
                  - self._cfg.train.warmup_epochs,
                  iters_per_epoch=num_batches,
                  step_epoch=lr_decay_epoch,
                  step_factor=lr_decay,
                  power=2,
              ),
          ]
      )
  
      if self._optimizer is None:
          optimizer = "nag"
          optimizer_params = {
              "wd": self._cfg.train.wd,
              "momentum": self._cfg.train.momentum,
              "lr_scheduler": lr_scheduler,
          }
          if self._cfg.train.dtype != "float32":
              optimizer_params["multi_precision"] = True
          self.trainer = gluon.Trainer(
              self.net.collect_params(), optimizer, optimizer_params
          )
      else:
          optimizer = self._optimizer
          if isinstance(optimizer, str):
              try:
                  optimizer = mx.optimizer.create(
                      optimizer, learning_rate=self._cfg.train.lr
                  )
              except TypeError:
                  optimizer = mx.optimizer.create(optimizer)
          self.trainer = gluon.Trainer(
              self.net.collect_params(), optimizer
          )
  
imports: import time
  import os
  import math
  import copy
  from PIL import Image
  import pandas
  import numpy
  import mxnet
  from mxnet import gluon, nd
  from mxnet.optimizer import Optimizer
  from mxnet import autograd
  from mxnet.gluon.data.vision import transforms
  from ....data.transforms.presets.imagenet import transform_eval
  from ....model_zoo import get_model
  from ....utils import LRSequential, LRScheduler
  from ....None import nn
  from ....None import loss
  from ..base_estimator import BaseEstimator, set_default
  from ..constants import BINARY, MULTICLASS, REGRESSION
  from .utils import get_data_loader, get_data_rec, smooth, mixup_transform
  from .default import ImageClassificationCfg
  from ...data.dataset import ImageClassificationDataset
  from ..conf import _BEST_CHECKPOINT_FILE
  from ..utils import EarlyStopperOnPlateau
label_desc: Use image node_id 6 for calling the ImageClassificationEstimator obj's underlying member method code with example usage: obj._init_trainer() without return types