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.
docstr: Compute DBNet loss.
  
  Args:
      preds (tuple(tensor)): Raw predictions from model, containing
          ``prob_logits``, ``thr_map`` and ``binary_map``.
          Each is a tensor of shape :math:`(N, H, W)`.
      data_samples (list[TextDetDataSample]): The data samples.
  
  Returns:
      results(dict): The dict for dbnet losses with loss_prob,                 loss_db and loss_thr.
docstr_tok: ["Compute","DBNet","loss",".","Args",":","preds","(","tuple","(","tensor",")",")",":","Raw","predictions","from","model",",","containing","``","prob_logits","``",",","``","thr_map","``","and","``","binary_map","``",".","Each","is","a","tensor","of","shape",":","math",":","`","(","N",",","H",",","W",")","`",".","data_samples","(","list","[","TextDetDataSample","]",")",":","The","data","samples",".","Returns",":","results","(","dict",")",":","The","dict","for","dbnet","losses","with","loss_prob",",","loss_db","and","loss_thr","."]
code: def forward(
      self,
      preds: Tuple[Tensor, Tensor, Tensor],
      data_samples: Sequence[TextDetDataSample],
  ) -> Dict:
      """Compute DBNet loss.
  
          Args:
              preds (tuple(tensor)): Raw predictions from model, containing
                  ``prob_logits``, ``thr_map`` and ``binary_map``.
                  Each is a tensor of shape :math:`(N, H, W)`.
              data_samples (list[TextDetDataSample]): The data samples.
  
          Returns:
              results(dict): The dict for dbnet losses with loss_prob, \
                  loss_db and loss_thr.
          """
      prob_logits, thr_map, binary_map = preds
      (
          gt_shrinks,
          gt_shrink_masks,
          gt_thrs,
          gt_thr_masks,
      ) = self.get_targets(data_samples)
      gt_shrinks = gt_shrinks.to(prob_logits.device)
      gt_shrink_masks = gt_shrink_masks.to(prob_logits.device)
      gt_thrs = gt_thrs.to(thr_map.device)
      gt_thr_masks = gt_thr_masks.to(thr_map.device)
      loss_prob = self.loss_prob(
          prob_logits, gt_shrinks, gt_shrink_masks
      )
  
      loss_thr = self.loss_thr(thr_map, gt_thrs, gt_thr_masks)
      loss_db = self.loss_db(binary_map, gt_shrinks, gt_shrink_masks)
  
      results = dict(
          loss_prob=self.weight_prob * loss_prob,
          loss_thr=self.weight_thr * loss_thr,
          loss_db=loss_db,
      )
  
      return results
  
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 2 for calling the DBModuleLoss obj's underlying member method code with example usage: obj.forward(preds, data_samples) and returns: results