code: def config_to_nested_v0(config):
      """Convert config to nested version"""
      if "meta_arch" not in config:
          if config["estimator"] == SSDEstimator:
              config["meta_arch"] = "ssd"
          elif config["estimator"] == FasterRCNNEstimator:
              config["meta_arch"] = "faster_rcnn"
          elif config["estimator"] == YOLOv3Estimator:
              config["meta_arch"] = "yolo3"
          elif config["estimator"] == CenterNetEstimator:
              config["meta_arch"] = "center_net"
          elif config["estimator"] == ImageClassificationEstimator:
              config["meta_arch"] = "img_cls"
          else:
              config["meta_arch"] = None
      else:
          pass
  
      if config["meta_arch"] == "ssd":
          config_mapping = {
              "ssd": [
                  "backbone",
                  "data_shape",
                  "filters",
                  "sizes",
                  "ratios",
                  "steps",
                  "syncbn",
                  "amp",
                  "custom_model",
              ],
              "train": [
                  "batch_size",
                  "start_epoch",
                  "epochs",
                  "lr",
                  "lr_decay",
                  "lr_decay_epoch",
                  "momentum",
                  "wd",
                  "log_interval",
                  "seed",
                  "dali",
              ],
              "validation": ["val_interval"],
          }
      elif config["meta_arch"] == "faster_rcnn":
          config_mapping = {
              "faster_rcnn": [
                  "backbone",
                  "nms_thresh",
                  "nms_topk",
                  "roi_mode",
                  "roi_size",
                  "strides",
                  "clip",
                  "anchor_base_size",
                  "anchor_aspect_ratio",
                  "anchor_scales",
                  "anchor_alloc_size",
                  "rpn_channel",
                  "rpn_nms_thresh",
                  "max_num_gt",
                  "norm_layer",
                  "use_fpn",
                  "num_fpn_filters",
                  "num_box_head_conv",
                  "num_box_head_conv_filters",
                  "num_box_head_dense_filters",
                  "image_short",
                  "image_max_size",
                  "custom_model",
                  "amp",
                  "static_alloc",
                  "disable_hybridization",
              ],
              "train": [
                  "pretrained_base",
                  "batch_size",
                  "start_epoch",
                  "epochs",
                  "lr",
                  "lr_decay",
                  "lr_decay_epoch",
                  "lr_mode",
                  "lr_warmup",
                  "lr_warmup_factor",
                  "momentum",
                  "wd",
                  "rpn_train_pre_nms",
                  "rpn_train_post_nms",
                  "rpn_smoothl1_rho",
                  "rpn_min_size",
                  "rcnn_num_samples",
                  "rcnn_pos_iou_thresh",
                  "rcnn_pos_ratio",
                  "rcnn_smoothl1_rho",
                  "log_interval",
                  "seed",
                  "verbose",
                  "mixup",
                  "no_mixup_epochs",
                  "executor_threads",
              ],
              "validation": [
                  "rpn_test_pre_nms",
                  "rpn_test_post_nms",
                  "val_interval",
              ],
          }
      elif config["meta_arch"] == "yolo3":
          config_mapping = {
              "yolo3": [
                  "backbone",
                  "filters",
                  "anchors",
                  "strides",
                  "data_shape",
                  "syncbn",
                  "no_random_shape",
                  "amp",
                  "custom_model",
              ],
              "train": [
                  "batch_size",
                  "epochs",
                  "start_epoch",
                  "lr",
                  "lr_mode",
                  "lr_decay",
                  "lr_decay_period",
                  "lr_decay_epoch",
                  "warmup_lr",
                  "warmup_epochs",
                  "momentum",
                  "wd",
                  "log_interval",
                  "seed",
                  "num_samples",
                  "no_wd",
                  "mixup",
                  "no_mixup_epochs",
                  "label_smooth",
              ],
              "validation": ["val_interval"],
          }
      elif config["meta_arch"] == "center_net":
          config_mapping = {
              "center_net": [
                  "base_network",
                  "heads",
                  "scale",
                  "topk",
                  "root",
                  "wh_weight",
                  "center_reg_weight",
                  "data_shape",
              ],
              "train": [
                  "gpus",
                  "pretrained_base",
                  "batch_size",
                  "epochs",
                  "lr",
                  "lr_decay",
                  "lr_decay_epoch",
                  "lr_mode",
                  "warmup_lr",
                  "warmup_epochs",
                  "num_workers",
                  "resume",
                  "start_epoch",
                  "momentum",
                  "wd",
                  "save_interval",
                  "log_interval",
              ],
              "validation": [
                  "flip_test",
                  "nms_thresh",
                  "nms_topk",
                  "post_nms",
                  "num_workers",
                  "batch_size",
                  "interval",
              ],
          }
      elif config["meta_arch"] == "img_cls":
          config_mapping = {
              "img_cls": [
                  "model",
                  "use_pretrained",
                  "use_gn",
                  "batch_norm",
                  "use_se",
                  "last_gamma",
              ],
              "train": [
                  "gpus",
                  "num_workers",
                  "batch_size",
                  "epochs",
                  "start_epoch",
                  "lr",
                  "lr_mode",
                  "lr_decay",
                  "lr_decay_period",
                  "lr_decay_epoch",
                  "warmup_lr",
                  "warmup_epochs",
                  "momentum",
                  "wd",
                  "log_interval",
                  "seed",
                  "num_samples",
                  "no_wd",
                  "mixup",
                  "no_mixup_epochs",
                  "label_smooth",
              ],
              "validation": [],
          }
      else:
          raise NotImplementedError(
              "%s is not implemented." % config["meta_arch"]
          )
  
      nested_config = {}
  
      for k, v in config.items():
          if k in config_mapping[config["meta_arch"]]:
              if config["meta_arch"] not in nested_config:
                  nested_config[config["meta_arch"]] = {}
              nested_config[config["meta_arch"]].update({k: v})
          elif k in config_mapping["train"]:
              if "train" not in nested_config:
                  nested_config["train"] = {}
              nested_config["train"].update({k: v})
          elif k in config_mapping["validation"]:
              if "validation" not in nested_config:
                  nested_config["validation"] = {}
              nested_config["validation"].update({k: v})
          else:
              nested_config.update({k: v})
  
      return nested_config
  
imports: import copy
  import warnings
  import numpy
  import autogluon.core
  from ..estimators.base_estimator import BaseEstimator
  from ..estimators import SSDEstimator, FasterRCNNEstimator, YOLOv3Estimator, CenterNetEstimator
  from ..estimators import ImageClassificationEstimator
  from ..data.dataset import ObjectDetectionDataset
label_desc: Use image node_id 4 for calling a global function with example usage: config_to_nested_v0(config) and returns: nested_config