class_docstr: The class for implementing DBNet loss.
  
  This is partially adapted from https://github.com/MhLiao/DB.
  
  Args:
      loss_prob (dict): The loss config for probability map. Defaults to
          dict(type='MaskedBalancedBCEWithLogitsLoss').
      loss_thr (dict): The loss config for threshold map. Defaults to
          dict(type='MaskedSmoothL1Loss', beta=0).
      loss_db (dict): The loss config for binary map. Defaults to
          dict(type='MaskedDiceLoss').
      weight_prob (float): The weight of probability map loss.
          Denoted as :math:`\alpha` in paper. Defaults to 5.
      weight_thr (float): The weight of threshold map loss.
          Denoted as :math:`\beta` in paper. Defaults to 10.
      shrink_ratio (float): The ratio of shrunk text region. Defaults to 0.4.
      thr_min (float): The minimum threshold map value. Defaults to 0.3.
      thr_max (float): The maximum threshold map value. Defaults to 0.7.
      min_sidelength (int or float): The minimum sidelength of the
          minimum rotated rectangle around any text region. Defaults to 8.
code: def __init__(
      self,
      loss_prob: Dict = dict(type="MaskedBalancedBCEWithLogitsLoss"),
      loss_thr: Dict = dict(type="MaskedSmoothL1Loss", beta=0),
      loss_db: Dict = dict(type="MaskedDiceLoss"),
      weight_prob: float = 5.0,
      weight_thr: float = 10.0,
      shrink_ratio: float = 0.4,
      thr_min: float = 0.3,
      thr_max: float = 0.7,
      min_sidelength: Union[int, float] = 8,
  ) -> None:
      super().__init__()
      self.loss_prob = MODELS.build(loss_prob)
      self.loss_thr = MODELS.build(loss_thr)
      self.loss_db = MODELS.build(loss_db)
      self.weight_prob = weight_prob
      self.weight_thr = weight_thr
      self.shrink_ratio = shrink_ratio
      self.thr_min = thr_min
      self.thr_max = thr_max
      self.min_sidelength = min_sidelength
  
imports: from typing import Dict, List, Sequence, Tuple, Union
  import cv2
  import numpy
  import torch
  from mmdet.models.utils import multi_apply
  from shapely.geometry import Polygon
  from torch import Tensor
  from mmocr.registry import MODELS
  from mmocr.structures import TextDetDataSample
  from mmocr.utils import offset_polygon
  from mmocr.utils.typing_utils import ArrayLike
  from .seg_based_module_loss import SegBasedModuleLoss
label_desc: Use image node_id 1 to create a new DBModuleLoss object from inherited base classes: SegBasedModuleLoss with example: obj = DBModuleLoss(loss_prob, loss_thr, loss_db, weight_prob, weight_thr, shrink_ratio, thr_min, thr_max, min_sidelength)