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: Check if the input polygon is invalid or not. It is invalid if its
  area is smaller than 1 or the shorter side of its minimum bounding box
  is smaller than min_sidelength.
  
  Args:
      poly (ndarray): The polygon.
  
  Returns:
      bool: Whether the polygon is invalid.
docstr_tok: ["Check","if","the","input","polygon","is","invalid","or","not",".","It","is","invalid","if","its","area","is","smaller","than","1","or","the","shorter","side","of","its","minimum","bounding","box","is","smaller","than","min_sidelength",".","Args",":","poly","(","ndarray",")",":","The","polygon",".","Returns",":","bool",":","Whether","the","polygon","is","invalid","."]
code: def _is_poly_invalid(self, poly: np.ndarray) -> bool:
      """Check if the input polygon is invalid or not. It is invalid if its
      area is smaller than 1 or the shorter side of its minimum bounding box
      is smaller than min_sidelength.
  
      Args:
          poly (ndarray): The polygon.
  
      Returns:
          bool: Whether the polygon is invalid.
      """
      poly = poly.reshape(-1, 2)
      area = Polygon(poly).area
      if abs(area) < 1:
          return True
      rect_size = cv2.minAreaRect(poly)[1]
      len_shortest_side = min(rect_size)
      if len_shortest_side < self.min_sidelength:
          return True
  
      return False
  
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 3 for calling the DBModuleLoss obj's underlying member method code with example usage: obj._is_poly_invalid(poly) and returns: False, True, True