class_docstr: The implementation of the paper: Spatial Dual-Modality Graph Reasoning
  for Key Information Extraction. https://arxiv.org/abs/2103.14470.
  
  Args:
      backbone (dict, optional): Config of backbone. If None, None will be
          passed to kie_head during training and testing. Defaults to None.
      roi_extractor (dict, optional): Config of roi extractor. Only
          applicable when backbone is not None. Defaults to None.
      neck (dict, optional): Config of neck. Defaults to None.
      kie_head (dict): Config of KIE head. Defaults to None.
      dictionary (dict, optional): Config of dictionary. Defaults to None.
      data_preprocessor (dict or ConfigDict, optional): The pre-process
          config of :class:`BaseDataPreprocessor`.  it usually includes,
          ``pad_size_divisor``, ``pad_value``, ``mean`` and ``std``. It has
          to be None when working in non-visual mode. Defaults to None.
      init_cfg (dict or list[dict], optional): Initialization configs.
          Defaults to None.
code: def __init__(
      self,
      backbone: Optional[Dict] = None,
      roi_extractor: Optional[Dict] = None,
      neck: Optional[Dict] = None,
      kie_head: Dict = None,
      dictionary: Optional[Dict] = None,
      data_preprocessor: Optional[Dict] = None,
      init_cfg: Optional[Dict] = None,
  ) -> None:
      super().__init__(
          data_preprocessor=data_preprocessor, init_cfg=init_cfg
      )
      if dictionary is not None:
          self.dictionary = TASK_UTILS.build(dictionary)
          if kie_head.get("dictionary", None) is None:
              kie_head.update(dictionary=self.dictionary)
          else:
              warnings.warn(
                  f"Using dictionary {kie_head['dictionary']} "
                  "in kie_head's config."
              )
      if backbone is not None:
          self.backbone = MODELS.build(backbone)
          self.extractor = MODELS.build(
              {
                  **roi_extractor,
                  "out_channels": self.backbone.base_channels,
              }
          )
          self.maxpool = nn.MaxPool2d(
              roi_extractor["roi_layer"]["output_size"]
          )
      if neck is not None:
          self.neck = MODELS.build(neck)
      self.kie_head = MODELS.build(kie_head)
  
file_path: mmocr/mmocr/models/kie/extractors/sdmgr.py
imports: import warnings
  from typing import Dict, List, Optional, Sequence, Tuple
  import torch
  from mmdet.structures.bbox import bbox2roi
  from mmengine.model import BaseModel
  from torch import nn
  from mmocr.registry import MODELS, TASK_UTILS
  from mmocr.structures import KIEDataSample
label_desc: Use image node_id 1 to create a new SDMGR object from inherited base classes: BaseModel with example: obj = SDMGR(backbone, roi_extractor, neck, kie_head, dictionary, data_preprocessor, init_cfg)