class_docstr: Base module of Semantic Head.
  
  Args:
      num_classes (int): the number of classes.
      seg_rescale_factor (float): the rescale factor for ``gt_sem_seg``,
          which equals to ``1 / output_strides``. The output_strides is
          for ``seg_preds``. Defaults to  1 / 4.
      init_cfg (Optional[Union[:obj:`ConfigDict`, dict]]): the initialization
          config.
      loss_seg (Union[:obj:`ConfigDict`, dict]): the loss of the semantic
          head.
code: def __init__(
      self,
      num_classes: int,
      seg_rescale_factor: float = 1 / 4.0,
      loss_seg: ConfigType = dict(
          type="CrossEntropyLoss", ignore_index=255, loss_weight=1.0
      ),
      init_cfg: OptMultiConfig = None,
  ) -> None:
      super().__init__(init_cfg=init_cfg)
      self.loss_seg = MODELS.build(loss_seg)
      self.num_classes = num_classes
      self.seg_rescale_factor = seg_rescale_factor
  
file_path: mmdetection/mmdet/models/seg_heads/base_semantic_head.py
imports: from abc import ABCMeta, abstractmethod
  from typing import Dict, List, Tuple, Union
  import torch.nn.functional
  from mmengine.model import BaseModule
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.utils import ConfigType, OptMultiConfig
label_desc: Use image node_id 1 to create a new BaseSemanticHead object from inherited base classes: BaseModule with example: obj = BaseSemanticHead(num_classes, seg_rescale_factor, loss_seg, init_cfg)