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: Generate loss target from a data sample.
  
  Args:
      data_sample (TextDetDataSample): The data sample.
  
  Returns:
      tuple: A tuple of four tensors as the targets of one prediction.
docstr_tok: ["Generate","loss","target","from","a","data","sample",".","Args",":","data_sample","(","TextDetDataSample",")",":","The","data","sample",".","Returns",":","tuple",":","A","tuple","of","four","tensors","as","the","targets","of","one","prediction","."]
code: def _get_target_single(self, data_sample: TextDetDataSample) -> Tuple:
      """Generate loss target from a data sample.
  
      Args:
          data_sample (TextDetDataSample): The data sample.
  
      Returns:
          tuple: A tuple of four tensors as the targets of one prediction.
      """
  
      gt_instances = data_sample.gt_instances
      ignore_flags = gt_instances.ignored
      for idx, polygon in enumerate(gt_instances.polygons):
          if self._is_poly_invalid(polygon):
              ignore_flags[idx] = True
      gt_shrink, ignore_flags = self._generate_kernels(
          data_sample.img_shape,
          gt_instances.polygons,
          self.shrink_ratio,
          ignore_flags=ignore_flags,
      )
  
      # Get boolean mask where Trues indicate text instance pixels
      gt_shrink = gt_shrink > 0
  
      gt_shrink_mask = self._generate_effective_mask(
          data_sample.img_shape, gt_instances[ignore_flags].polygons
      )
      gt_thr, gt_thr_mask = self._generate_thr_map(
          data_sample.img_shape, gt_instances[~ignore_flags].polygons
      )
  
      # to_tensor
      gt_shrink = torch.from_numpy(gt_shrink).unsqueeze(0).float()
      gt_shrink_mask = (
          torch.from_numpy(gt_shrink_mask).unsqueeze(0).float()
      )
      gt_thr = torch.from_numpy(gt_thr).unsqueeze(0).float()
      gt_thr_mask = torch.from_numpy(gt_thr_mask).unsqueeze(0).float()
      return gt_shrink, gt_shrink_mask, gt_thr, gt_thr_mask
  
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 7 for calling the DBModuleLoss obj's underlying member method code with example usage: obj._get_target_single(data_sample) and returns: gt_shrink,  gt_shrink_mask,  gt_thr,  gt_thr_mask